Added checkIntentState and checkFlowsState in onosclidriver
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index d59adbe..90267af 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1829,9 +1829,7 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
- return main.TRUE
-
def flows( self, jsonFormat=True ):
"""
Optional:
@@ -1865,6 +1863,41 @@
main.cleanup()
main.exit()
+ def checkFlowsState( self ):
+ """
+ Description:
+ Check the if all the current flows are in ADDED state or
+ PENDING_ADD state
+ Return:
+ returnValue - Returns main.TRUE only if all flows are in
+ ADDED state or PENDING_ADD, return main.FALSE
+ otherwise.
+ """
+ try:
+ tempFlows = json.loads( self.flows() )
+ returnValue = main.TRUE
+ for device in tempFlows:
+ for flow in device.get( 'flows' ):
+ if flow.get( 'state' ) != 'ADDED' and flow.get( 'state' ) != \
+ 'PENDING_ADD':
+ main.log.info( self.name + ": flow Id: " +
+ flow.get( 'flowId' ) +
+ " | state:" + flow.get( 'state' ) )
+ returnValue = main.FALSE
+ return returnValue
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
def pushTestIntents( self, dpidSrc, dpidDst, numIntents,
numMult="", appId="", report=True ):
"""
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 547cb0a..d5b9400 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -565,7 +565,7 @@
main.step( "Verify Pingall" )
ping_result = main.FALSE
time1 = time.time()
- ping_result = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -645,7 +645,7 @@
main.step( "Verify Pingall" )
ping_result = main.FALSE
time1 = time.time()
- ping_result = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -725,7 +725,7 @@
main.step( "Verify Pingall" )
ping_result = main.FALSE
time1 = time.time()
- ping_result = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1927,14 +1927,19 @@
print intentIdTemp
print len(intentIdList)
print intentIdList
+ checkIntentStateResult = main.TRUE
print "Checking intents state"
- checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList )
- #checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList )
- #checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList )
- #checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList )
- #checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList )
+ checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+ checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+ checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+ checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+ checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+
if checkIntentStateResult:
main.log.info( "All intents are installed correctly " )
+
+ print "Checking flows state "
+ checkFlowsState = main.ONOScli1.checkFlowsState()
time.sleep(50)
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
@@ -1946,7 +1951,7 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
-
+ checkFlowsState = main.ONOScli1.checkFlowsState()
case93Result = pingResult
utilities.assert_equals(
expect=main.TRUE,