Enable core flow number check in CHO Test
Change-Id: I537912145d5cc797c51dd5be8ef6c45f934776f0
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index ff3a56c..8ff6577 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2654,14 +2654,20 @@
main.cleanup()
main.exit()
- def FlowAddedCount( self, deviceId ):
+ def flowAddedCount( self, deviceId, core=False ):
"""
Determine the number of flow rules for the given device id that are
in the added state
+ Params:
+ core: if True, only return the number of core flows added
"""
try:
- cmdStr = "flows any " + str( deviceId ) + " | " +\
- "grep 'state=ADDED' | wc -l"
+ if core:
+ cmdStr = "flows any " + str( deviceId ) + " | " +\
+ "grep 'state=ADDED' | grep org.onosproject.core | wc -l"
+ else:
+ cmdStr = "flows any " + str( deviceId ) + " | " +\
+ "grep 'state=ADDED' | wc -l"
handle = self.sendline( cmdStr )
assert "Command not found:" not in handle, handle
return handle
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
index 6c9ef4b..85b2e0e 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
@@ -94,6 +94,8 @@
<CLIParamNum>0</CLIParamNum>
<rerunInterval>5</rerunInterval>
<maxRerunNum>5</maxRerunNum>
+ <coreFlowNum>4</coreFlowNum>
+ <coreFlowNum6>6</coreFlowNum6>
</FlowCheck>
<TrafficCheck>
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
index aad520c..6b0080f 100755
--- a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
@@ -46,9 +46,27 @@
def startCheckEvent( self, args=None ):
import json
checkResult = EventStates().PASS
+ if main.enableIPv6:
+ coreFlowNum = main.params[ 'EVENT' ][ 'FlowCheck' ][ 'coreFlowNum6' ]
+ else:
+ coreFlowNum = main.params[ 'EVENT' ][ 'FlowCheck' ][ 'coreFlowNum' ]
for controller in main.controllers:
if controller.isUp():
with controller.CLILock:
+ # Check core flow number
+ for device in main.devices:
+ if device.isRemoved():
+ continue
+ coreFlowNumOnos = controller.CLI.flowAddedCount( device.dpid, core=True )
+ if coreFlowNumOnos == None:
+ main.log.warn( "Flow Check - error when trying to get flow number of %s on ONOS%s" % ( device.dpid, controller.index ) )
+ checkResult = EventStates().FAIL
+ else:
+ coreFlowNumOnos = int( coreFlowNumOnos )
+ if coreFlowNumOnos != coreFlowNum:
+ main.log.warn( "Flow Check - core flow number of %s on ONOS%s is %s" % ( device.dpid, controller.index, coreFlowNumOnos ) )
+ checkResult = EventStates().FAIL
+ # Get flows for comparison
flows = controller.CLI.flows()
try:
flows = json.loads( flows )