Skip to content

Commit

Permalink
Enhance test_35 (subscription and notification mechanism test) to all…
Browse files Browse the repository at this point in the history
…ow interference notifications while running test
  • Loading branch information
lo-simon committed Nov 6, 2023
1 parent b081bb0 commit f5ef015
Showing 1 changed file with 36 additions and 28 deletions.
64 changes: 36 additions & 28 deletions nmostesting/suites/IS1201Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,7 @@ def test_35(self, test):

error = False
error_message = ""
received_oids = dict.fromkeys(oids, 0)

for oid in oids:
new_user_label = "NMOS Testing Tool " + str(oid)
Expand All @@ -1391,37 +1392,44 @@ def test_35(self, test):
self.is12_utils.set_property(test, oid, NcObjectProperties.USER_LABEL.value, label)
self.is12_utils.stop_logging_notifications()

if len(self.is12_utils.get_notifications()) == 0:
notifications = self.is12_utils.get_notifications()

if len(notifications) == 0:
error = True
error_message = context + "No notification recieved"

for notification in self.is12_utils.get_notifications():
if notification['oid'] != oid:
error = True
error_message += context + "Unexpected Oid " + str(notification['oid']) + ", "

if notification['eventId'] != NcObjectEvents.PROPERTY_CHANGED.value:
error = True
error_message += context + "Unexpected event type: " + str(notification['eventId']) + ", "

if notification["eventData"]["propertyId"] != NcObjectProperties.USER_LABEL.value:
error = True
error_message += context + "Unexpected property id: " \
+ str(NcObjectProperties(notification["eventData"]["propertyId"]).name) + ", "

if notification["eventData"]["changeType"] != NcPropertyChangeType.ValueChanged.value:
error = True
error_message += context + "Unexpected change type: " \
+ str(NcPropertyChangeType(notification["eventData"]["changeType"]).name) + ", "

if notification["eventData"]["value"] != label:
error = True
error_message += context + "Unexpected value: " + str(notification["eventData"]["value"]) + ", "

if notification["eventData"]["sequenceItemIndex"] is not None:
error = True
error_message += context + "Unexpected sequence item index: " \
+ str(notification["eventData"]["sequenceItemIndex"]) + ", "
for notification in notifications:
if notification['oid'] == oid:

if notification['eventId'] != NcObjectEvents.PROPERTY_CHANGED.value:
error = True
error_message += context + "Unexpected event type: " + str(notification['eventId']) + ", "

if notification["eventData"]["propertyId"] != NcObjectProperties.USER_LABEL.value:
continue

if notification["eventData"]["changeType"] != NcPropertyChangeType.ValueChanged.value:
error = True
error_message += context + "Unexpected change type: " \
+ str(NcPropertyChangeType(notification["eventData"]["changeType"]).name) + ", "

if notification["eventData"]["value"] != label:
error = True
error_message += context + "Unexpected value: " + str(notification["eventData"]["value"]) + ", "

if notification["eventData"]["sequenceItemIndex"] is not None:
error = True
error_message += context + "Unexpected sequence item index: " \
+ str(notification["eventData"]["sequenceItemIndex"]) + ", "

received_oids[oid] += 1

if not all(received_oids.values()):
error = True
error_message += "No expected notifications received"
elif not any(received_oids.values()):
error = True
error_message += "Not all the expected Oid notifications received"

if error:
return test.FAIL(error_message)
Expand Down

0 comments on commit f5ef015

Please sign in to comment.