Merge " Added IPv6 to existing IPv4 VLAN hosts making them dual stack VLAN hosts. Adding IPv6 only VLAN hosts would have required too many changes to FUNCintent."
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 12ad24a..bc23be0 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -292,15 +292,26 @@
self.log.wiki( "<p>" + self.caseExplanation + "</p>" )
self.log.summary( self.caseExplanation )
self.log.wiki( "<ul>" )
+ subcaseMessage = False
for line in self.stepCache.splitlines():
- if re.search( " - PASS$", line ):
- self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"tick\" /></li>\n" )
- elif re.search( " - FAIL$", line ):
- self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"cross\" /></li>\n" )
- elif re.search( " - No Result$", line ):
- self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"warning\" /></li>\n" )
- else: # Should only be on fail message
- self.log.wiki( "<ul><li>" + line + "</li></ul>\n" )
+ if re.search( "[0-9]\.[0-9]", line ): # Step
+ if subcaseMessage: # End of Failure Message Printout
+ self.log.wiki( "</ul>\n" )
+ subcaseMessage = False
+ if re.search( " - PASS$", line ):
+ self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"tick\" /></li>\n" )
+ elif re.search( " - FAIL$", line ):
+ self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"cross\" /></li>\n" )
+ elif re.search( " - No Result$", line ):
+ self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"warning\" /></li>\n" )
+ else: # Substep
+ if not subcaseMessage: # Open Failure Message Printout
+ self.log.wiki( "<ul><li>" + line + "</li>\n" )
+ subcaseMessage = True
+ else: # Add to Failure Message Printout
+ self.log.wiki( "<li>" + line + "</li>\n" )
+ if subcaseMessage: # End of Failure Message Printout for last item
+ self.log.wiki( "</ul>\n" )
self.log.wiki( "</ul>" )
self.log.summary( self.stepCache )
self.stepCache = ""
@@ -342,12 +353,23 @@
self.stepCache += "\t\t" + self.onFailMsg + "\n"
self.stepCount = self.stepCount + 1
return self.FALSE
- except StandardError:
- stepNo = self.stepResults[0][ self.stepNumber - 1]
- stepName = self.stepResults[1][ self.stepNumber - 1 ]
- self.log.exception( "\nException in the following section of" +
- " code: " + str( testCaseNumber ) + "." +
- str( stepNo ) + ": " + stepName )
+ except StandardError as e:
+ try:
+ stepNo = self.stepResults[0][ self.stepNumber - 1 ]
+ except IndexError:
+ stepNo = "<IndexError>"
+ main.log.warn( "Error trying to get step number. " +
+ "It is likely between step " +
+ str( self.stepNumber ) + " and step" +
+ str( self.stepNumber + 1 ) )
+ try:
+ stepName = self.stepResults[1][ self.stepNumber - 1 ]
+ except IndexError:
+ stepName = "<IndexError>"
+ self.log.error( "\nException in the following section of" +
+ " code: " + str( testCaseNumber ) + "." +
+ str( stepNo ) + ": " + stepName )
+ self.log.error( e )
self.stepCount = self.stepCount + 1
self.logger.updateCaseResults( self )
# WIKI results
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 66cd8b4..3ff43c7 100644
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -20,6 +20,7 @@
import os
import requests
import types
+import sys
from drivers.common.api.controllerdriver import Controller
@@ -32,6 +33,7 @@
super( Controller, self ).__init__()
self.ip_address = "localhost"
self.port = "8080"
+ self.wrapped = sys.modules[ __name__ ]
def connect( self, **connectargs ):
try:
@@ -55,6 +57,24 @@
self.handle = super( OnosRestDriver, self ).connect()
return self.handle
+ def pprint( self, jsonObject ):
+ """
+ Pretty Prints a json object
+
+ arguments:
+ jsonObject - a parsed json object
+ returns:
+ A formatted string for printing or None on error
+ """
+ try:
+ if isinstance( jsonObject, str ):
+ jsonObject = json.loads( jsonObject )
+ return json.dumps( jsonObject, sort_keys=True,
+ indent=4, separators=(',', ': '))
+ except ( TypeError, ValueError ):
+ main.log.exception( "Error parsing jsonObject" )
+ return None
+
def send( self, ip, port, url, base="/onos/v1", method="GET",
query=None, data=None, debug=False ):
"""
@@ -93,10 +113,10 @@
except requests.exceptions:
main.log.exception( "Error sending request." )
return None
- except Exception as e:
- main.log.exception( e )
- return None
- # FIXME: add other exceptions
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def intents( self, ip="DEFAULT", port="DEFAULT" ):
"""
@@ -121,15 +141,20 @@
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
a = json.loads( output ).get( 'intents' )
+ assert a is not None, "Error parsing json object"
b = json.dumps( a )
return b
else:
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, AssertionError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def intent( self, intentId, appId="org.onosproject.cli",
ip="DEFAULT", port="DEFAULT" ):
@@ -169,9 +194,13 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def getIntentsId( self, ip="DEFAULT", port="DEFAULT" ):
"""
@@ -187,18 +216,19 @@
intentsDict = json.loads( self.intents( ip=ip, port=port ) )
for intent in intentsDict:
intentsIdList.append( intent.get( 'id' ) )
-
if not intentsIdList:
main.log.debug( "Cannot find any intents" )
return main.FALSE
else:
main.log.info( "Found intents: " + str( intentsIdList ) )
return main.TRUE
-
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
-
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def apps( self, ip="DEFAULT", port="DEFAULT" ):
"""
@@ -222,15 +252,20 @@
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
a = json.loads( output ).get( 'applications' )
+ assert a is not None, "Error parsing json object"
b = json.dumps( a )
return b
else:
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, AssertionError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def activateApp( self, appName, ip="DEFAULT", port="DEFAULT", check=True ):
"""
@@ -280,9 +315,13 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def deactivateApp( self, appName, ip="DEFAULT", port="DEFAULT",
check=True ):
@@ -332,9 +371,13 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def getApp( self, appName, project="org.onosproject.", ip="DEFAULT",
port="DEFAULT" ):
@@ -367,9 +410,13 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def addHostIntent( self, hostIdOne, hostIdTwo, appId='org.onosproject.cli',
ip="DEFAULT", port="DEFAULT" ):
@@ -419,9 +466,13 @@
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def addPointIntent( self,
ingressDevice,
@@ -567,10 +618,13 @@
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
-
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def removeIntent( self, intentId, appId='org.onosproject.cli',
ip="DEFAULT", port="DEFAULT" ):
@@ -600,9 +654,13 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def getIntentsId( self, ip="DEFAULT", port="DEFAULT" ):
"""
@@ -611,14 +669,16 @@
try:
intentIdList = []
intentsJson = json.loads( self.intents() )
- print intentsJson
for intent in intentsJson:
intentIdList.append( intent.get( 'id' ) )
- print intentIdList
return intentIdList
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def removeAllIntents( self, intentIdList ='ALL',appId='org.onosproject.cli',
ip="DEFAULT", port="DEFAULT", delay=5 ):
@@ -660,10 +720,13 @@
return main.FALSE
else:
main.log.debug( self.name + ": There is no intents ID list" )
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
-
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def hosts( self, ip="DEFAULT", port="DEFAULT" ):
"""
@@ -688,15 +751,20 @@
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
a = json.loads( output ).get( 'hosts' )
+ assert a is not None, "Error parsing json object"
b = json.dumps( a )
return b
else:
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, AssertionError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def getHost( self, mac, vlan="-1", ip="DEFAULT", port="DEFAULT" ):
"""
@@ -738,9 +806,13 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def topology( self, ip="DEFAULT", port="DEFAULT" ):
"""
@@ -770,9 +842,51 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
+ def devices( self, ip="DEFAULT", port="DEFAULT" ):
+ """
+ Description:
+ Get the devices discovered by ONOS is json string format
+ Returns:
+ a json string of the devices currently discovered by ONOS OR
+ main.FALSE if there is an error in the request OR
+ Returns None for exception
+ """
+ try:
+ output = None
+ if ip == "DEFAULT":
+ main.log.warn( "No ip given, reverting to ip from topo file" )
+ ip = self.ip_address
+ if port == "DEFAULT":
+ main.log.warn( "No port given, reverting to port " +
+ "from topo file" )
+ port = self.port
+ response = self.send( ip, port, url="/devices" )
+ if response:
+ if 200 <= response[ 0 ] <= 299:
+ output = response[ 1 ]
+ a = json.loads( output ).get( 'devices' )
+ assert a is not None, "Error parsing json object"
+ b = json.dumps( a )
+ return b
+ else:
+ main.log.error( "Error with REST request, response was: " +
+ str( response ) )
+ return main.FALSE
+ except ( AttributeError, AssertionError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def getIntentState( self, intentsId, intentsJson=None,
ip="DEFAULT", port="DEFAULT" ):
@@ -823,12 +937,13 @@
main.log.info( "Invalid intents ID entry" )
return None
- except TypeError:
- main.log.exception( self.name + ": Object Type not as expected" )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
- except Exception as e:
- main.log.exception( e )
- return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def checkIntentState( self, intentsId="ALL", expectedState='INSTALLED',
ip="DEFAULT", port="DEFAULT"):
@@ -889,12 +1004,13 @@
" intents are in " + str( expectedState ) +
" state" )
return returnValue
- except TypeError:
+ except ( AttributeError, TypeError ):
main.log.exception( self.name + ": Object not as expected" )
- return main.FALSE
- except Exception as e:
- main.log.exception( e )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def flows( self, ip="DEFAULT", port="DEFAULT" ):
"""
@@ -902,7 +1018,9 @@
Get flows currently added to the system
NOTE:
The flows -j cli command has completely different format than
- the REST output; Returns None for exception
+ the REST output
+
+ Returns None for exception
"""
try:
output = None
@@ -918,23 +1036,28 @@
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
a = json.loads( output ).get( 'flows' )
+ assert a is not None, "Error parsing json object"
b = json.dumps( a )
return b
else:
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, AssertionError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
- def getFlows( self, device, flowId=0, ip="DEFAULT", port="DEFAULT" ):
+ def getFlows( self, deviceId, flowId=None, ip="DEFAULT", port="DEFAULT" ):
"""
Description:
Gets all the flows of the device or get a specific flow in the
device by giving its flow ID
Required:
- str device - device/switch Id
+ str deviceId - device/switch Id
Optional:
int/hex flowId - ID of the flow
"""
@@ -947,7 +1070,7 @@
main.log.warn( "No port given, reverting to port " +
"from topo file" )
port = self.port
- url = "/flows/" + device
+ url = "/flows/" + deviceId
if flowId:
url += "/" + str( int( flowId ) )
print url
@@ -956,16 +1079,20 @@
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
a = json.loads( output ).get( 'flows' )
+ assert a is not None, "Error parsing json object"
b = json.dumps( a )
return b
else:
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, AssertionError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
-
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def addFlow( self,
deviceId,
@@ -1009,17 +1136,14 @@
of the ONOS node
"""
try:
-
flowJson = { "priority":100,
"isPermanent":"true",
"timeout":0,
"deviceId":deviceId,
"treatment":{"instructions":[]},
"selector": {"criteria":[]}}
-
if appId:
flowJson[ "appId" ] = appId
-
if egressPort:
flowJson[ 'treatment' ][ 'instructions' ].append(
{ "type":"OUTPUT",
@@ -1064,11 +1188,10 @@
flowJson[ 'selector' ][ 'criteria' ].append(
{ "type":"IP_PROTO",
"protocol": ipProto } )
-
- # TODO: Bandwidth and Lambda will be implemented if needed
-
- main.log.debug( flowJson )
-
+ if bandwidth or lambdaAlloc:
+ # TODO: Bandwidth and Lambda will be implemented if needed
+ raise NotImplementedError
+ main.log.debug( "Adding flow: " + self.pprint( flowJson ) )
output = None
if ip == "DEFAULT":
main.log.warn( "No ip given, reverting to ip from topo file" )
@@ -1092,10 +1215,15 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
-
- except Exception as e:
- main.log.exception( e )
+ except NotImplementedError as e:
+ raise e # Inform the caller
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def removeFlow( self, deviceId, flowId,
ip="DEFAULT", port="DEFAULT" ):
@@ -1131,9 +1259,13 @@
main.log.error( "Error with REST request, response was: " +
str( response ) )
return main.FALSE
- except Exception as e:
- main.log.exception( e )
+ except ( AttributeError, TypeError ):
+ main.log.exception( self.name + ": Object not as expected" )
return None
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
def checkFlowsState( self , ip="DEFAULT", port="DEFAULT" ):
"""
@@ -1155,11 +1287,8 @@
str( flow.get( 'state' ) ) )
returnValue = main.FALSE
return returnValue
- except TypeError:
+ except ( AttributeError, TypeError ):
main.log.exception( self.name + ": Object not as expected" )
- return main.FALSE
- except Exception as e:
- main.log.exception( e )
return None
except Exception:
main.log.exception( self.name + ": Uncaught exception!" )
diff --git a/TestON/tests/CHOtest/CHOtest.py b/TestON/tests/CHOtest/CHOtest.py
index 2a0ac6b..e93769d 100644
--- a/TestON/tests/CHOtest/CHOtest.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -3394,10 +3394,28 @@
onpass="INTENTS INSTALLED",
onfail="SOME INTENTS NOT INSTALLED" )
- main.log.info( "Checking flows state" )
- checkFlowsState = main.ONOScli1.checkFlowsState()
- # Giving onos time to return the state of the flows
- time.sleep(50)
+ main.step("Verify flows are all added")
+
+ for i in range( main.flowCheck ):
+ if i != 0:
+ main.log.warn( "verification failed. Retrying..." )
+ main.log.info( "Waiting for onos to add flows..." )
+ time.sleep( main.checkFlowsDelay )
+
+ flowState = main.TRUE
+ for cli in main.CLIs:
+ flowState = cli.checkFlowState()
+ if not flowState:
+ main.log.warn( "Not all flows added" )
+ if flowState:
+ break
+ else:
+ #Dumping summary
+ main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
+
+ utilities.assert_equals( expect=main.TRUE, actual=flowState,
+ onpass="FLOWS INSTALLED",
+ onfail="SOME FLOWS NOT ADDED" )
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
@@ -3422,6 +3440,17 @@
onpass="Install 25 multi to single point Intents and Ping All test PASS",
onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
+ if not intentState:
+ main.log.debug( "Intents failed to install completely" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not checkFlowsState:
+ main.log.debug( "Flows failed to add completely" )
+
+ if not caseResult and main.failSwitch:
+ main.log.report("Stopping test")
+ main.stop( email=main.emailOnStop )
+
def CASE94( self ):
"""
Install multi-single point intents and verify Ping all works
@@ -3435,7 +3464,7 @@
deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
intentIdList = []
- print "MACsDict", main.MACsDict
+ main.log.info( "MACsDict" + str(main.MACsDict) )
time1 = time.time()
for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
pool = []
@@ -3481,19 +3510,42 @@
#Dumping intent summary
main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
-
utilities.assert_equals( expect=main.TRUE, actual=intentState,
onpass="INTENTS INSTALLED",
onfail="SOME INTENTS NOT INSTALLED" )
+ main.step("Verify flows are all added")
+
+ for i in range( main.flowCheck ):
+ if i != 0:
+ main.log.warn( "verification failed. Retrying..." )
+ main.log.info( "Waiting for onos to add flows..." )
+ time.sleep( main.checkFlowsDelay )
+
+ flowState = main.TRUE
+ for cli in main.CLIs:
+ flowState = cli.checkFlowState()
+ if not flowState:
+ main.log.warn( "Not all flows added" )
+ if flowState:
+ break
+ else:
+ #Dumping summary
+ main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
+
+ utilities.assert_equals( expect=main.TRUE, actual=flowState,
+ onpass="FLOWS INSTALLED",
+ onfail="SOME FLOWS NOT ADDED" )
+
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
if not pingResult:
- main.log.info( "First pingall failed. Retrying..." )
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+ main.log.warn("First pingall failed. Retrying")
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -3501,15 +3553,143 @@
str( timeDiff ) +
" seconds" )
-
- caseResult = ( pingResult and intentState )
+ caseResult = ( checkFlowsState and pingResult and intentState )
utilities.assert_equals(
expect=main.TRUE,
actual=caseResult,
onpass="Install 25 multi to single point Intents and Ping All test PASS",
onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
- #def CASE95 multi-single point intent for Spine
+ if not intentState:
+ main.log.debug( "Intents failed to install completely" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not checkFlowsState:
+ main.log.debug( "Flows failed to add completely" )
+
+ if not caseResult and main.failSwitch:
+ main.log.report("Stopping test")
+ main.stop( email=main.emailOnStop )
+
+ def CASE95( self ):
+ """
+ Install multi-single point intents and verify Ping all works
+ for Spine topology
+ """
+ import copy
+ import time
+ main.log.report( "Install multi-single point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install multi-single point intents and Ping all" )
+ deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
+ portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
+ intentIdList = []
+ main.log.info( "MACsDict" + str(main.MACsDict) )
+ time1 = time.time()
+ for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
+ pool = []
+ for cli in main.CLIs:
+ egressDevice = deviceDPIDsCopy[i]
+ ingressDeviceList = copy.copy(deviceDPIDsCopy)
+ ingressDeviceList.remove(egressDevice)
+ if i >= len( deviceDPIDsCopy ):
+ break
+ t = main.Thread( target=cli.addMultipointToSinglepointIntent,
+ threadID=main.threadID,
+ name="addMultipointToSinglepointIntent",
+ args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
+ pool.append(t)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+
+ main.step("Verify intents are installed")
+
+ # Giving onos multiple chances to install intents
+ for i in range( main.intentCheck ):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Waiting for onos to install intents...")
+ time.sleep( main.checkIntentsDelay )
+
+ intentState = main.TRUE
+ for e in range(int(main.numCtrls)):
+ main.log.info( "Checking intents on CLI %s" % (e+1) )
+ intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
+
+ utilities.assert_equals( expect=main.TRUE, actual=intentState,
+ onpass="INTENTS INSTALLED",
+ onfail="SOME INTENTS NOT INSTALLED" )
+
+ main.step("Verify flows are all added")
+
+ for i in range( main.flowCheck ):
+ if i != 0:
+ main.log.warn( "verification failed. Retrying..." )
+ main.log.info( "Waiting for onos to add flows..." )
+ time.sleep( main.checkFlowsDelay )
+
+ flowState = main.TRUE
+ for cli in main.CLIs:
+ flowState = cli.checkFlowState()
+ if not flowState:
+ main.log.warn( "Not all flows added" )
+ if flowState:
+ break
+ else:
+ #Dumping summary
+ main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
+
+ utilities.assert_equals( expect=main.TRUE, actual=flowState,
+ onpass="FLOWS INSTALLED",
+ onfail="SOME FLOWS NOT ADDED" )
+
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+ if not pingResult:
+ time1 = time.time()
+ main.log.warn("First pingall failed. Retrying")
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ caseResult = ( checkFlowsState and pingResult and intentState )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=caseResult,
+ onpass="Install 25 multi to single point Intents and Ping All test PASS",
+ onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
+
+ if not intentState:
+ main.log.debug( "Intents failed to install completely" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not checkFlowsState:
+ main.log.debug( "Flows failed to add completely" )
+
+ if not caseResult and main.failSwitch:
+ main.log.report("Stopping test")
+ main.stop( email=main.emailOnStop )
def CASE96( self ):
"""
@@ -3523,7 +3703,7 @@
deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
intentIdList = []
- print "MACsDict", main.MACsDict
+ main.log.info( "MACsDict" + str(main.MACsDict) )
time1 = time.time()
for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
pool = []
@@ -3569,19 +3749,42 @@
#Dumping intent summary
main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
-
utilities.assert_equals( expect=main.TRUE, actual=intentState,
onpass="INTENTS INSTALLED",
onfail="SOME INTENTS NOT INSTALLED" )
+ main.step("Verify flows are all added")
+
+ for i in range( main.flowCheck ):
+ if i != 0:
+ main.log.warn( "verification failed. Retrying..." )
+ main.log.info( "Waiting for onos to add flows..." )
+ time.sleep( main.checkFlowsDelay )
+
+ flowState = main.TRUE
+ for cli in main.CLIs:
+ flowState = cli.checkFlowState()
+ if not flowState:
+ main.log.warn( "Not all flows added" )
+ if flowState:
+ break
+ else:
+ #Dumping summary
+ main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
+
+ utilities.assert_equals( expect=main.TRUE, actual=flowState,
+ onpass="FLOWS INSTALLED",
+ onfail="SOME FLOWS NOT ADDED" )
+
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
if not pingResult:
- main.log.info( "First pingall failed. Retrying..." )
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+ main.log.warn("First pingall failed. Retrying")
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -3589,13 +3792,24 @@
str( timeDiff ) +
" seconds" )
- caseResult = ( pingResult and intentState )
+ caseResult = ( pingResult and intentState and flowState)
utilities.assert_equals(
expect=main.TRUE,
actual=caseResult,
onpass="Install 25 single to multi point Intents and Ping All test PASS",
onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
+ if not intentState:
+ main.log.debug( "Intents failed to install completely" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not checkFlowsState:
+ main.log.debug( "Flows failed to add completely" )
+
+ if not caseResult and main.failSwitch:
+ main.log.report("Stopping test")
+ main.stop( email=main.emailOnStop )
+
def CASE97( self ):
"""
Install single-multi point intents and verify Ping all works
@@ -3608,7 +3822,7 @@
deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
intentIdList = []
- print "MACsDict", main.MACsDict
+ main.log.info( "MACsDict" + str(main.MACsDict) )
time1 = time.time()
for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
pool = []
@@ -3654,19 +3868,42 @@
#Dumping intent summary
main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
-
utilities.assert_equals( expect=main.TRUE, actual=intentState,
onpass="INTENTS INSTALLED",
onfail="SOME INTENTS NOT INSTALLED" )
+ main.step("Verify flows are all added")
+
+ for i in range( main.flowCheck ):
+ if i != 0:
+ main.log.warn( "verification failed. Retrying..." )
+ main.log.info( "Waiting for onos to add flows..." )
+ time.sleep( main.checkFlowsDelay )
+
+ flowState = main.TRUE
+ for cli in main.CLIs:
+ flowState = cli.checkFlowState()
+ if not flowState:
+ main.log.warn( "Not all flows added" )
+ if flowState:
+ break
+ else:
+ #Dumping summary
+ main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
+
+ utilities.assert_equals( expect=main.TRUE, actual=flowState,
+ onpass="FLOWS INSTALLED",
+ onfail="SOME FLOWS NOT ADDED" )
+
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
if not pingResult:
- main.log.info( "First pingall failed. Retrying..." )
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+ main.log.warn("First pingall failed. Retrying")
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -3674,13 +3911,24 @@
str( timeDiff ) +
" seconds" )
- caseResult = ( pingResult and intentState )
+ caseResult = ( pingResult and intentState and flowState)
utilities.assert_equals(
expect=main.TRUE,
actual=caseResult,
onpass="Install 25 single to multi point Intents and Ping All test PASS",
onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
+ if not intentState:
+ main.log.debug( "Intents failed to install completely" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not checkFlowsState:
+ main.log.debug( "Flows failed to add completely" )
+
+ if not caseResult and main.failSwitch:
+ main.log.report("Stopping test")
+ main.stop( email=main.emailOnStop )
+
def CASE98( self ):
"""
Install single-multi point intents and verify Ping all works
@@ -3698,9 +3946,8 @@
for i in range( len( deviceDPIDsCopy ) ):
MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
- print "deviceDPIDsCopy", deviceDPIDsCopy
- print ""
- print "MACsDictCopy", MACsDictCopy
+ main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
+ main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
time1 = time.time()
for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
pool = []
@@ -3746,19 +3993,42 @@
#Dumping intent summary
main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
-
utilities.assert_equals( expect=main.TRUE, actual=intentState,
onpass="INTENTS INSTALLED",
onfail="SOME INTENTS NOT INSTALLED" )
+ main.step("Verify flows are all added")
+
+ for i in range( main.flowCheck ):
+ if i != 0:
+ main.log.warn( "verification failed. Retrying..." )
+ main.log.info( "Waiting for onos to add flows..." )
+ time.sleep( main.checkFlowsDelay )
+
+ flowState = main.TRUE
+ for cli in main.CLIs:
+ flowState = cli.checkFlowState()
+ if not flowState:
+ main.log.warn( "Not all flows added" )
+ if flowState:
+ break
+ else:
+ #Dumping summary
+ main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
+
+ utilities.assert_equals( expect=main.TRUE, actual=flowState,
+ onpass="FLOWS INSTALLED",
+ onfail="SOME FLOWS NOT ADDED" )
+
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
if not pingResult:
- main.log.info( "First pingall failed. Retrying..." )
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+ main.log.warn("First pingall failed. Retrying")
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -3766,13 +4036,24 @@
str( timeDiff ) +
" seconds" )
- caseResult = ( pingResult and intentState )
+ caseResult = ( pingResult and intentState and flowState)
utilities.assert_equals(
expect=main.TRUE,
actual=caseResult,
onpass="Install 25 single to multi point Intents and Ping All test PASS",
onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
+ if not intentState:
+ main.log.debug( "Intents failed to install completely" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not checkFlowsState:
+ main.log.debug( "Flows failed to add completely" )
+
+ if not caseResult and main.failSwitch:
+ main.log.report("Stopping test")
+ main.stop( email=main.emailOnStop )
+
def CASE190( self ):
"""
Verify IPv6 ping across 600 Point intents (Att Topology)
diff --git a/TestON/tests/FUNCflow/Dependency/startUp.py b/TestON/tests/FUNCflow/Dependency/startUp.py
new file mode 100644
index 0000000..bf2a2b6
--- /dev/null
+++ b/TestON/tests/FUNCflow/Dependency/startUp.py
@@ -0,0 +1,38 @@
+"""
+ This wrapper function is use for starting up onos instance
+"""
+
+import time
+import os
+import json
+
+def onosBuild( main, gitBranch ):
+ """
+ This includes pulling ONOS and building it using maven install
+ """
+
+ buildResult = main.FALSE
+
+ # Git checkout a branch of ONOS
+ checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
+ # Does the git pull on the branch that was checked out
+ if not checkOutResult:
+ main.log.warn( "Failed to checked out " + gitBranch +
+ " branch")
+ else:
+ main.log.info( "Successfully checked out " + gitBranch +
+ " branch")
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == main.ERROR:
+ main.log.error( "Error pulling git branch" )
+ else:
+ main.log.info( "Successfully pulled " + gitBranch + " branch" )
+
+ # Maven clean install
+ buildResult = main.ONOSbench.cleanInstall()
+
+ return buildResult
+
+
+
+
diff --git a/TestON/tests/FUNCflow/FUNCflow.params b/TestON/tests/FUNCflow/FUNCflow.params
new file mode 100755
index 0000000..d6312b3
--- /dev/null
+++ b/TestON/tests/FUNCflow/FUNCflow.params
@@ -0,0 +1,52 @@
+
+<PARAMS>
+ # CASE - Descritpion
+ # 1 - Variable initialization and optional pull and build ONOS package
+ # 2 - install ONOS
+ # 8 - Compare topology
+ # 9 - Report logs
+ # 10 - Start mininet and assign switches to controller
+ # 1000 - Add flows
+ # 2000 - Delete flows
+ # 3000 - Modify flow rule selectors
+ # 4000 - Modify flow rule treatments
+ # 5000 - flow rule controller
+ # 100 - Compare switch flow table with ONOS
+ <testcases>1,2,10,8</testcases>
+
+ <SCALE>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <path>/tests/FUNCflow/Dependency/</path>
+ <wrapper1>startUp</wrapper1>
+ <wrapper2>topo</wrapper2>
+ <topology>flow-2sw.py</topology>
+ </DEPENDENCY>
+
+ <TOPO>
+ <numSwitches>2</numSwitches>
+ <numHosts>4</numHosts>
+ <numLinks>2</numLinks>
+ </TOPO>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,openflow,proxyarp,mobility,fwd</cellApps>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <SLEEP>
+ <startup>15</startup>
+ </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/FUNCflow/FUNCflow.py b/TestON/tests/FUNCflow/FUNCflow.py
new file mode 100644
index 0000000..74c3464
--- /dev/null
+++ b/TestON/tests/FUNCflow/FUNCflow.py
@@ -0,0 +1,362 @@
+class FUNCflow:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import time
+ import os
+ import imp
+
+ """
+ - Construct tests variables
+ - GIT ( optional )
+ - Checkout ONOS master branch
+ - Pull latest ONOS code
+ - Building ONOS ( optional )
+ - Install ONOS package
+ - Build ONOS package
+ """
+
+ main.case( "Constructing test variables and building ONOS package" )
+ main.step( "Constructing test variables" )
+ stepResult = main.FALSE
+
+ # Test variables
+ main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+ main.cellName = main.params[ 'ENV' ][ 'cellName' ]
+ main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+ gitBranch = main.params[ 'GIT' ][ 'branch' ]
+ main.dependencyPath = main.testOnDirectory + \
+ main.params[ 'DEPENDENCY' ][ 'path' ]
+ main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+ main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
+ main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+ main.numSwitches = int( main.params[ 'TOPO' ][ 'numSwitches' ] )
+ main.numHosts = int( main.params[ 'TOPO' ][ 'numHosts' ] )
+ main.numLinks = int( main.params[ 'TOPO' ][ 'numLinks' ] )
+ wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+ wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
+ main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
+ main.cellData = {} # for creating cell file
+ main.CLIs = []
+ main.ONOSip = []
+
+ main.ONOSip = main.ONOSbench.getOnosIps()
+ print main.ONOSip
+
+ # Assigning ONOS cli handles to a list
+ for i in range( 1, main.maxNodes + 1 ):
+ main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+
+ # -- INIT SECTION, ONLY RUNS ONCE -- #
+ main.startUp = imp.load_source( wrapperFile1,
+ main.dependencyPath +
+ wrapperFile1 +
+ ".py" )
+
+ main.topo = imp.load_source( wrapperFile2,
+ main.dependencyPath +
+ wrapperFile2 +
+ ".py" )
+
+ copyResult = main.ONOSbench.scp( main.Mininet1,
+ main.dependencyPath+main.topology,
+ main.Mininet1.home+'/custom/',
+ direction="to" )
+
+ if main.CLIs:
+ stepResult = main.TRUE
+ else:
+ main.log.error( "Did not properly created list of ONOS CLI handle" )
+ stepResult = main.FALSE
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully construct " +
+ "test variables ",
+ onfail="Failed to construct test variables" )
+
+ if gitPull == 'True':
+ main.step( "Building ONOS in " + gitBranch + " branch" )
+ onosBuildResult = main.startUp.onosBuild( main, gitBranch )
+ stepResult = onosBuildResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully compiled " +
+ "latest ONOS",
+ onfail="Failed to compile " +
+ "latest ONOS" )
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
+
+ def CASE2( self, main ):
+ """
+ - Set up cell
+ - Create cell file
+ - Set cell file
+ - Verify cell file
+ - Kill ONOS process
+ - Uninstall ONOS cluster
+ - Verify ONOS start up
+ - Install ONOS cluster
+ - Connect to cli
+ """
+
+ main.numCtrls = int( main.maxNodes )
+
+ main.case( "Starting up " + str( main.numCtrls ) +
+ " node(s) ONOS cluster" )
+
+ #kill off all onos processes
+ main.log.info( "Safety check, killing all ONOS processes" +
+ " before initiating enviornment setup" )
+
+ for i in range( main.maxNodes ):
+ main.ONOSbench.onosDie( main.ONOSip[ i ] )
+
+ print "NODE COUNT = ", main.numCtrls
+
+ tempOnosIp = []
+ for i in range( main.numCtrls ):
+ tempOnosIp.append( main.ONOSip[i] )
+
+ main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "temp", main.Mininet1.ip_address, main.apps, tempOnosIp )
+
+ main.step( "Apply cell to environment" )
+ cellResult = main.ONOSbench.setCell( "temp" )
+ verifyResult = main.ONOSbench.verifyCell()
+ stepResult = cellResult and verifyResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully applied cell to " + \
+ "environment",
+ onfail="Failed to apply cell to environment " )
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+ stepResult = packageResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully created ONOS package",
+ onfail="Failed to create ONOS package" )
+
+ time.sleep( main.startUpSleep )
+ main.step( "Uninstalling ONOS package" )
+ onosUninstallResult = main.TRUE
+ for i in range( main.numCtrls ):
+ onosUninstallResult = onosUninstallResult and \
+ main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
+ stepResult = onosUninstallResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully uninstalled ONOS package",
+ onfail="Failed to uninstall ONOS package" )
+
+ time.sleep( main.startUpSleep )
+ main.step( "Installing ONOS package" )
+ onosInstallResult = main.TRUE
+ for i in range( main.numCtrls ):
+ onosInstallResult = onosInstallResult and \
+ main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
+ stepResult = onosInstallResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully installed ONOS package",
+ onfail="Failed to install ONOS package" )
+
+ time.sleep( main.startUpSleep )
+ main.step( "Starting ONOS service" )
+ stopResult = main.TRUE
+ startResult = main.TRUE
+ onosIsUp = main.TRUE
+
+ for i in range( main.numCtrls ):
+ onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+ if onosIsUp == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up, stop and " +
+ "start ONOS again " )
+ for i in range( main.numCtrls ):
+ stopResult = stopResult and \
+ main.ONOSbench.onosStop( main.ONOSip[ i ] )
+ for i in range( main.numCtrls ):
+ startResult = startResult and \
+ main.ONOSbench.onosStart( main.ONOSip[ i ] )
+ stepResult = onosIsUp and stopResult and startResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="ONOS service is ready",
+ onfail="ONOS service did not start properly" )
+
+ main.step( "Start ONOS cli" )
+ cliResult = main.TRUE
+ for i in range( main.numCtrls ):
+ cliResult = cliResult and \
+ main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
+ stepResult = cliResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully start ONOS cli",
+ onfail="Failed to start ONOS cli" )
+
+ def CASE8( self, main ):
+ '''
+ Compare topology
+ '''
+ import json
+
+ main.case( "Compare ONOS Topology view to Mininet topology" )
+ main.caseExplanation = "Compare topology elements between Mininet" +\
+ " and ONOS"
+
+ main.step( "Gathering topology information" )
+ # TODO: add a paramaterized sleep here
+ devicesResults = main.TRUE
+ linksResults = main.TRUE
+ hostsResults = main.TRUE
+ devices = main.topo.getAllDevices( main )
+ hosts = main.topo.getAllHosts( main )
+ ports = main.topo.getAllPorts( main )
+ links = main.topo.getAllLinks( main )
+ clusters = main.topo.getAllClusters( main )
+
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
+
+ main.step( "Conmparing MN topology to ONOS topology" )
+ for controller in range( main.numCtrls ):
+ controllerStr = str( controller + 1 )
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
+ currentDevicesResult = main.Mininet1.compareSwitches(
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
+ else:
+ currentDevicesResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentDevicesResult,
+ onpass="ONOS" + controllerStr +
+ " Switches view is correct",
+ onfail="ONOS" + controllerStr +
+ " Switches view is incorrect" )
+ if links[ controller ] and "Error" not in links[ controller ]:
+ currentLinksResult = main.Mininet1.compareLinks(
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
+ else:
+ currentLinksResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentLinksResult,
+ onpass="ONOS" + controllerStr +
+ " links view is correct",
+ onfail="ONOS" + controllerStr +
+ " links view is incorrect" )
+
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ currentHostsResult = main.Mininet1.compareHosts(
+ mnHosts,
+ json.loads( hosts[ controller ] ) )
+ else:
+ currentHostsResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentHostsResult,
+ onpass="ONOS" + controllerStr +
+ " hosts exist in Mininet",
+ onfail="ONOS" + controllerStr +
+ " hosts don't match Mininet" )
+
+ def CASE9( self, main ):
+ '''
+ Report errors/warnings/exceptions
+ '''
+ main.log.info("Error report: \n" )
+ main.ONOSbench.logReport( main.ONOSip[ 0 ],
+ [ "INFO",
+ "FOLLOWER",
+ "WARN",
+ "flow",
+ "ERROR",
+ "Except" ],
+ "s" )
+
+ def CASE10( self, main ):
+ '''
+ Start Mininet with
+ '''
+ main.case( "Setup mininet and assign switches to controllers" )
+ main.step( "Setup Mininet Topology" )
+ topology = main.Mininet1.home + '/custom/' + main.topology
+ stepResult1 = main.Mininet1.startNet( topoFile=topology )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult1,
+ onpass="Successfully loaded topology",
+ onfail="Failed to load topology" )
+
+ main.step( "Assign switches to controllers" )
+ for i in range( main.numSwitches ):
+ stepResult2 = main.Mininet1.assignSwController(
+ sw="s" + str( i+1 ),
+ ip=main.ONOSip )
+ if not stepResult2:
+ break
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult2,
+ onpass="Controller assignment successfull",
+ onfail="Controller assignment failed" )
+
+ time.sleep(5)
+
+ main.step( "Pingall hosts for discovery" )
+ stepResult3 = main.Mininet1.pingall()
+ if not stepResult3:
+ stepResult3 = main.Mininet1.pingall()
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult3,
+ onpass="Pingall successfull",
+ onfail="Pingall unsuccessfull" )
+
+ caseResult = stepResult1 and stepResult2 and stepResult3
+ if not caseResult:
+ main.cleanup()
+ main.exit()
+
+ def CASE1000( self, main ):
+ '''
+ Add flows
+ '''
+
+ def CASE2000( self, main ):
+ '''
+ Delete flows
+ '''
+
+ def CASE3000( self, main ):
+ '''
+ Modify flow rule selectors
+ '''
+
+ def CASE4000( self, main ):
+ '''
+ Modify flow rule treatment
+ '''
+
+ def CASE5000( self, main ):
+ '''
+ Modify flow rule controller
+ '''
+
+ def CASE100( self, main ):
+ '''
+ Compare switch flow table with ONOS
+ '''
+
diff --git a/TestON/tests/FUNCflow/FUNCflow.topo b/TestON/tests/FUNCflow/FUNCflow.topo
new file mode 100755
index 0000000..cfb3fb8
--- /dev/null
+++ b/TestON/tests/FUNCflow/FUNCflow.topo
@@ -0,0 +1,65 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli1>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOScli1>
+
+ <ONOScli2>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOScli2>
+
+ <ONOScli3>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOScli3>
+
+ <Mininet1>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </Mininet1>
+
+ <ONOSrest>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/FUNCflow/__init__.py b/TestON/tests/FUNCflow/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/FUNCflow/__init__.py
diff --git a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
index d1b3b22..377fd20 100644
--- a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
@@ -153,8 +153,9 @@
" something wrong with ONOS performance" )
# Ping hosts again...
- pingResult = pingallHosts( main, hostNames )
- if pingResult:
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
main.assertReturnString += 'Initial Pingall Passed\n'
else:
main.assertReturnString += 'Initial Pingall Failed\n'
@@ -182,17 +183,18 @@
main.assertReturnString += 'Link Down Topology State Failed\n'
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
- if pingResult:
+ if pingTemp:
main.assertReturnString += 'Link Down Pingall Passed\n'
else:
main.assertReturnString += 'Link Down Pingall Failed\n'
# Check intent states
- intentResult = checkIntentState( main, intentsId )
-
- if intentResult:
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
main.assertReturnString += 'Link Down Intent State Passed\n'
else:
main.assertReturnString += 'Link Down Intent State Failed\n'
@@ -226,16 +228,17 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
- if pingResult:
+ if pingTemp:
main.assertReturnString += 'Link Up Pingall Passed\n'
else:
main.assertReturnString += 'Link Up Pingall Failed\n'
- intentResult = checkIntentState( main, intentsId )
-
- if intentResult:
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
main.assertReturnString += 'Link Up Intent State Passed\n'
else:
main.assertReturnString += 'Link Up Intent State Failed\n'
@@ -402,13 +405,22 @@
checkFlowsState( main )
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Initial Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Initial Pingall Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
# link down
linkDownResult = link( main, sw1, sw2, "down" )
- intentResult = intentResult and checkIntentState( main, intentsId )
+
+ if linkDownResult:
+ main.assertReturnString += 'Link Down Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Failed\n'
# Check flows count in each node
checkFlowsCount( main )
@@ -417,11 +429,26 @@
# Check OnosTopology
topoResult = checkTopology( main, expectedLink )
+ if topoResult:
+ main.assertReturnString += 'Link Down Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Topology State Failed\n'
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Link Down Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Pingall Failed\n'
- intentResult = checkIntentState( main, intentsId )
+ # Check intent state
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Intent State Failed\n'
# Checks ONOS state in link down
if linkDownResult and topoResult and pingResult and intentResult:
@@ -431,6 +458,11 @@
# link up
linkUpResult = link( main, sw1, sw2, "up" )
+ if linkUpResult:
+ main.assertReturnString += 'Link Up Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Failed\n'
+
time.sleep( main.rerouteSleep )
# Check flows count in each node
@@ -440,11 +472,26 @@
# Check OnosTopology
topoResult = checkTopology( main, main.numLinks )
+ if topoResult:
+ main.assertReturnString += 'Link Up Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Topology State Failed\n'
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
- intentResult = checkIntentState( main, intentsId )
+ if pingTemp:
+ main.assertReturnString += 'Link Up Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Pingall Failed\n'
+
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Up Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Intent State Failed\n'
# Checks ONOS state in link up
if linkUpResult and topoResult and pingResult and intentResult:
@@ -454,6 +501,10 @@
# Remove all intents
removeIntentResult = removeAllIntents( main, intentsId )
+ if removeIntentResult:
+ main.assertReturnString += 'Remove Intents Passed'
+ else:
+ main.assertReturnString += 'Remove Intents Failed'
stepResult = pingResult and linkDownResult and linkUpResult \
and intentResult and removeIntentResult
@@ -636,14 +687,22 @@
checkFlowsState( main )
# Run iperf to both host
- iperfResult = iperfResult and main.Mininet1.iperftcp( host1,
- host2, 10 )
+ iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
+ iperfResult = iperfResult and iperfTemp
+ if iperfTemp:
+ main.assertReturnString += 'Initial Iperf Passed\n'
+ else:
+ main.assertReturnString += 'Initial Iperf Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
# link down
linkDownResult = link( main, sw1, sw2, "down" )
- intentResult = intentResult and checkIntentState( main, intentsId )
+
+ if linkDownResult:
+ main.assertReturnString += 'Link Down Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Failed\n'
# Check flows count in each node
checkFlowsCount( main )
@@ -652,12 +711,26 @@
# Check OnosTopology
topoResult = checkTopology( main, expectedLink )
+ if topoResult:
+ main.assertReturnString += 'Link Down Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Topology State Failed\n'
# Run iperf to both host
- iperfResult = iperfResult and main.Mininet1.iperftcp( host1,
- host2, 10 )
+ iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
+ iperfResult = iperfResult and iperfTemp
+ if iperfTemp:
+ main.assertReturnString += 'Link Down Iperf Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Iperf Failed\n'
- intentResult = checkIntentState( main, intentsId )
+ # Check intent state
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Intent State Failed\n'
# Checks ONOS state in link down
if linkDownResult and topoResult and iperfResult and intentResult:
@@ -667,6 +740,11 @@
# link up
linkUpResult = link( main, sw1, sw2, "up" )
+ if linkUpTemp:
+ main.assertReturnString += 'Link Up Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Failed\n'
+
time.sleep( main.rerouteSleep )
# Check flows count in each node
@@ -677,11 +755,26 @@
# Check OnosTopology
topoResult = checkTopology( main, main.numLinks )
- # Run iperf to both host
- iperfResult = iperfResult and main.Mininet1.iperftcp( host1,
- host2, 10 )
+ if topoResult:
+ main.assertReturnString += 'Link Up Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Topology State Failed\n'
- intentResult = checkIntentState( main, intentsId )
+ # Run iperf to both host
+ iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
+ iperfResult = iperfResult and iperfTemp
+ if iperfTemp:
+ main.assertReturnString += 'Link Up Iperf Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Iperf Failed\n'
+
+ # Check intent state
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Intent State Failed\n'
# Checks ONOS state in link up
if linkUpResult and topoResult and iperfResult and intentResult:
@@ -691,6 +784,10 @@
# Remove all intents
removeIntentResult = removeAllIntents( main, intentsId )
+ if removeIntentResult:
+ main.assertReturnString += 'Remove Intents Passed'
+ else:
+ main.assertReturnString += 'Remove Intents Failed'
stepResult = iperfResult and linkDownResult and linkUpResult \
and intentResult and removeIntentResult
@@ -867,7 +964,7 @@
tcpDst="" ) )
# Wait some time for the flow to go through when using multi instance
- pingResult = pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
# Check intents state
time.sleep( main.checkIntentSleep )
@@ -882,13 +979,22 @@
# Verify flows
checkFlowsState( main )
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Initial Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Initial Pingall Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
# link down
linkDownResult = link( main, sw1, sw2, "down" )
- intentResult = intentResult and checkIntentState( main, intentsId )
+
+ if linkDownResult:
+ main.assertReturnString += 'Link Down Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Failed\n'
# Check flows count in each node
checkFlowsCount( main )
@@ -897,11 +1003,26 @@
# Check OnosTopology
topoResult = checkTopology( main, expectedLink )
+ if topoResult:
+ main.assertReturnString += 'Link Down Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Topology State Failed\n'
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Link Down Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Pingall Failed\n'
- intentResult = checkIntentState( main, intentsId )
+ # Check intent state
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Intent State Failed\n'
# Checks ONOS state in link down
if linkDownResult and topoResult and pingResult and intentResult:
@@ -911,6 +1032,11 @@
# link up
linkUpResult = link( main, sw1, sw2, "up" )
+ if linkUpResult:
+ main.assertReturnString += 'Link Up Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Failed\n'
+
time.sleep( main.rerouteSleep )
# Check flows count in each node
@@ -920,11 +1046,26 @@
# Check OnosTopology
topoResult = checkTopology( main, main.numLinks )
+ if topoResult:
+ main.assertReturnString += 'Link Up Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Topology State Failed\n'
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Link Up Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Pingall Failed\n'
- intentResult = checkIntentState( main, intentsId )
+ # Check Intents
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Up Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Intent State Failed\n'
# Checks ONOS state in link up
if linkUpResult and topoResult and pingResult and intentResult:
@@ -934,6 +1075,10 @@
# Remove all intents
removeIntentResult = removeAllIntents( main, intentsId )
+ if removeIntentResult:
+ main.assertReturnString += 'Remove Intents Passed'
+ else:
+ main.assertReturnString += 'Remove Intents Failed'
stepResult = pingResult and linkDownResult and linkUpResult \
and intentResult and removeIntentResult
@@ -1107,7 +1252,7 @@
tcpSrc="",
tcpDst="" ) )
- pingResult = pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
# Check intents state
time.sleep( main.checkIntentSleep )
@@ -1123,15 +1268,25 @@
checkFlowsState( main )
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+
# Ping hosts again...
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Initial Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Initial Pingall Failed\n'
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
# link down
linkDownResult = link( main, sw1, sw2, "down" )
- intentResult = intentResult and checkIntentState( main, intentsId )
+
+ if linkDownResult:
+ main.assertReturnString += 'Link Down Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Failed\n'
# Check flows count in each node
checkFlowsCount( main )
@@ -1140,11 +1295,26 @@
# Check OnosTopology
topoResult = checkTopology( main, expectedLink )
+ if topoResult:
+ main.assertReturnString += 'Link Down Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Topology State Failed\n'
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Link Down Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Pingall Failed\n'
- intentResult = checkIntentState( main, intentsId )
+ # Check intent state
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Intent State Failed\n'
# Checks ONOS state in link down
if linkDownResult and topoResult and pingResult and intentResult:
@@ -1154,6 +1324,11 @@
# link up
linkUpResult = link( main, sw1, sw2, "up" )
+ if linkUpResult:
+ main.assertReturnString += 'Link Up Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Failed\n'
+
time.sleep( main.rerouteSleep )
# Check flows count in each node
@@ -1163,11 +1338,26 @@
# Check OnosTopology
topoResult = checkTopology( main, main.numLinks )
+ if topoResult:
+ main.assertReturnString += 'Link Up Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Topology State Failed\n'
# Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
+ pingTemp = pingallHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Link Up Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Pingall Failed\n'
- intentResult = checkIntentState( main, intentsId )
+ # Check Intents
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Up Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Intent State Failed\n'
# Checks ONOS state in link up
if linkUpResult and topoResult and pingResult and intentResult:
@@ -1177,6 +1367,10 @@
# Remove all intents
removeIntentResult = removeAllIntents( main, intentsId )
+ if removeIntentResult:
+ main.assertReturnString += 'Remove Intents Passed'
+ else:
+ main.assertReturnString += 'Remove Intents Failed'
stepResult = pingResult and linkDownResult and linkUpResult \
and intentResult and removeIntentResult