[ONOS-7650] SRRouting: add case 602 fix case 620 and 622
Change-Id: Ie6cf28c5df71db16491519c305587ecb8aee715c
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 8cb4de1..03ea850 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -310,34 +310,33 @@
onfail="route-add command failed")
@staticmethod
- def checkGroupsForBuckets( main, deviceId, subnetDict, routingTable=30):
+ def checkGroupsForBuckets( main, deviceId, subnetDict, routingTable=30 ):
"""
Check number of groups for each subnet on device deviceId and matches
it with an expected value. subnetDict is a dictionarty containing values
of the type "10.0.1.0/24" : 5.
"""
- main.step("Checking if number of groups for subnets in device {0} is as expected.".format(deviceId))
- groups = main.Cluster.active( 0 ).CLI.getGroups(deviceId, group_type="select")
- flows = main.Cluster.active( 0 ).CLI.flows(jsonFormat=False, device=deviceId)
+ main.step( "Checking if number of groups for subnets in device {0} is as expected.".format( deviceId ) )
+ groups = main.Cluster.active( 0 ).CLI.getGroups( deviceId, groupType="select" )
+ flows = main.Cluster.active( 0 ).CLI.flows( jsonFormat=False, device=deviceId )
- for subnet, number_in_select in subnetDict.iteritems():
+ result = main.TRUE
+ for subnet, numberInSelect in subnetDict.iteritems():
for flow in flows.splitlines():
- if "tableId={0}".format(routingTable) in flow and subnet in flow:
-
+ if "tableId={0}".format( routingTable ) in flow and subnet in flow:
# this will match the group id that this flow entry points to, for example :
# 0x70000041 in flow entry which contains "deferred=[GROUP:0x70000041], transition=TABLE:60,"
- group_id = re.search(r".*GROUP:(0x.*)], transition.*", flow).groups()[0]
-
+ groupId = re.search( r".*GROUP:(0x.*)], transition.*", flow ).groups()[0]
count = 0
for group in groups.splitlines():
- if 'id={0}'.format(group_id) in group:
+ if 'id={0}'.format( groupId ) in group:
count += 1
-
- utilities.assert_equals( expect=True, actual=(count-1 == number_in_select),
- onpass="Number of buckets in select group is correct",
- onfail="Mismatch in number of buckets of select group, found {0}, expected {1} for subnet {2} on device {3}".format(count - 1, number_in_select, subnet, deviceId))
- else:
- continue
+ if count - 1 != numberInSelect:
+ result = main.FALSE
+ main.log.warn( "Mismatch in number of buckets of select group, found {0}, expected {1} for subnet {2} on device {3}".format( count - 1, numberInSelect, subnet, deviceId ) )
+ utilities.assert_equals( expect=main.TRUE, actual=result,
+ onpass="All bucket numbers are as expected",
+ onfail="Some bucket numbers are not as expected" )
@staticmethod
def checkFlows( main, minFlowCount, tag="", dumpflows=True, sleep=10 ):