Merge "More useful assert statements for FUNCintent. Only CASE1000 so far, do not merge yet."
diff --git a/TestON/bin/cleanup.sh b/TestON/bin/cleanup.sh
index abeb2e9..d104d3a 100755
--- a/TestON/bin/cleanup.sh
+++ b/TestON/bin/cleanup.sh
@@ -5,3 +5,6 @@
sudo kill -9 `ps -ef | grep "ssh -X" | grep -v grep | awk '{print $2}'`
sudo mn -c
sudo pkill -f mn.pid
+sudo pkill bgpd
+sudo pkill zebra
+sudo kill -9 `ps -ef | grep "bird" | grep -v grep | awk '{print $2}'`
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 17893a1..bd65010 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -33,16 +33,16 @@
import xmldict
import importlib
import threading
-module = new.module("test")
+module = new.module( "test" )
import openspeak
import subprocess
-global path, drivers_path, core_path, tests_path,logs_path
+global path, drivers_path, core_path, tests_path, logs_path
location = os.path.abspath( os.path.dirname( __file__ ) )
path = re.sub( "(core|bin)$", "", location )
-drivers_path = path+"drivers"
-core_path = path+"core"
-tests_path = path+"tests"
-logs_path = path+"logs/"
+drivers_path = path + "drivers"
+core_path = path + "core"
+tests_path = path + "tests"
+logs_path = path + "logs/"
config_path = path + "config/"
sys.path.append( path )
sys.path.append( drivers_path )
@@ -56,13 +56,14 @@
class TestON:
'''
TestON will initiate the specified test.
- The main tasks are :
+ The main tasks are:
* Initiate the required Component handles for the test.
* Create Log file Handles.
'''
- def __init__(self,options):
+ def __init__( self, options ):
'''
- Initialise the component handles specified in the topology file of the specified test.
+ Initialise the component handles specified in the topology file of
+ the specified test.
'''
# Initialization of the variables.
__builtin__.main = self
@@ -76,7 +77,6 @@
self.PASS = True
self.CASERESULT = self.ERROR
self.STEPRESULT = self.NORESULT
- self.stepResults = []
self.init_result = self.TRUE
self.testResult = "Summary"
self.stepName = ""
@@ -98,101 +98,111 @@
self.initiated = False
self.configparser()
- verifyOptions(options)
+ verifyOptions( options )
load_logger()
self.componentDictionary = {}
- self.componentDictionary = self.topology ['COMPONENT']
- self.driversList=[]
- if type(self.componentDictionary) == str :
- self.componentDictionary = dict(self.componentDictionary)
+ self.componentDictionary = self.topology['COMPONENT']
+ self.driversList = []
+ if isinstance( self.componentDictionary, str):
+ self.componentDictionary = dict( self.componentDictionary )
- for component in self.componentDictionary :
- self.driversList.append(self.componentDictionary[component]['type'])
+ for component in self.componentDictionary:
+ self.driversList.append( self.componentDictionary[component]['type'] )
- self.driversList = list(set(self.driversList)) # Removing duplicates.
+ self.driversList = list( set( self.driversList ) ) # Removing duplicates.
# Checking the test_target option set for the component or not
- if type(self.componentDictionary) == dict:
+ if isinstance( self.componentDictionary, dict ):
for component in self.componentDictionary.keys():
if 'test_target' in self.componentDictionary[component].keys():
self.test_target = component
# Checking for the openspeak file and test script
- self.logger.initlog(self)
+ self.logger.initlog( self )
# Creating Drivers Handles
- initString = "\n"+"*" * 30+"\n CASE INIT \n"+"*" * 30+"\n"
- self.log.exact(initString)
+ initString = "\n" + "*" * 30 + "\n CASE INIT \n" + "*" * 30 + "\n"
+ self.log.exact( initString )
self.driverObject = {}
- self.random_order = 111 # Random order id to connect the components
+ self.random_order = 111 # Random order id to connect the components
components_connect_order = {}
- #component_list.append()
- if type(self.componentDictionary) == dict:
+ if isinstance( self.componentDictionary, dict ):
for component in self.componentDictionary.keys():
- self.componentDictionary[component]['connect_order'] = self.componentDictionary[component]['connect_order'] if ('connect_order' in self.componentDictionary[component].keys()) else str(self.get_random())
- components_connect_order[component] = eval(self.componentDictionary[component]['connect_order'])
- #Ordering components based on the connect order.
- ordered_component_list =sorted(components_connect_order, key=lambda key: components_connect_order[key])
+ if 'connect_order' not in self.componentDictionary[component].keys():
+ self.componentDictionary[component]['connect_order'] = str( self.get_random() )
+ components_connect_order[component] = eval( self.componentDictionary[component]['connect_order'] )
+ # Ordering components based on the connect order.
+ ordered_component_list = sorted( components_connect_order,
+ key=lambda key: components_connect_order[key] )
print ordered_component_list
for component in ordered_component_list:
- self.componentInit(component)
+ self.componentInit( component )
- def configparser(self):
+ def configparser( self ):
'''
It will parse the config file (teston.cfg) and return as dictionary
'''
- matchFileName = re.match(r'(.*)\.cfg', self.configFile, re.M | re.I)
+ matchFileName = re.match( r'(.*)\.cfg', self.configFile, re.M | re.I )
if matchFileName:
- xml = open(self.configFile).read()
- try :
- self.configDict = xmldict.xml_to_dict(xml)
+ xml = open( self.configFile ).read()
+ try:
+ self.configDict = xmldict.xml_to_dict( xml )
return self.configDict
except IOError:
print "There is no such file to parse " + self.configFile
else:
print "There is no such file to parse " + self.configFile
- def componentInit(self,component):
+ def componentInit( self, component ):
'''
This method will initialize specified component
'''
global driver_options
self.initiated = False
- self.log.info("Creating component Handle: "+component)
+ self.log.info( "Creating component Handle: " + component )
driver_options = {}
if 'COMPONENTS' in self.componentDictionary[component].keys():
- driver_options =dict(self.componentDictionary[component]['COMPONENTS'])
+ driver_options = dict( self.componentDictionary[component]['COMPONENTS'] )
- driver_options['name']=component
+ driver_options['name'] = component
driverName = self.componentDictionary[component]['type']
- driver_options ['type'] = driverName
+ driver_options['type'] = driverName
- classPath = self.getDriverPath(driverName.lower())
- driverModule = importlib.import_module(classPath)
- driverClass = getattr(driverModule, driverName)
+ classPath = self.getDriverPath( driverName.lower() )
+ driverModule = importlib.import_module( classPath )
+ driverClass = getattr( driverModule, driverName )
driverObject = driverClass()
- if ( "OCN" in self.componentDictionary[component]['host'] and main.onoscell ):
+ if "OCN" in self.componentDictionary[component]['host'] and\
+ main.onoscell:
self.componentDictionary[component]['host'] = main.mnIP
- connect_result = driverObject.connect(user_name = self.componentDictionary[component]['user'] if ('user' in self.componentDictionary[component].keys()) else getpass.getuser(),
- ip_address= self.componentDictionary[component]['host'] if ('host' in self.componentDictionary[component].keys()) else 'localhost',
- pwd = self.componentDictionary[component]['password'] if ('password' in self.componentDictionary[component].keys()) else 'changeme',
- port = self.componentDictionary[component]['port'] if ('port' in self.componentDictionary[component].keys()) else None,
- options = driver_options)
+ user_name = self.componentDictionary[component].get( 'user',
+ getpass.getuser() )
+ ip_address = self.componentDictionary[component].get( 'host',
+ 'localhost' )
+ pwd = self.componentDictionary[component].get( 'password',
+ 'changeme' )
+ port = self.componentDictionary[component].get( 'port' )
+ connect_result = driverObject.connect( user_name=user_name,
+ ip_address=ip_address,
+ pwd=pwd,
+ port=port,
+ options=driver_options)
if not connect_result:
- self.log.error("Exiting from the test execution because the connecting to the "+component+" component failed.")
+ self.log.error( "Exiting from the test execution because connecting to the " +
+ component + " component failed." )
self.exit()
- vars(self)[component] = driverObject
+ vars( self )[component] = driverObject
self.initiated = True
- def run(self):
+ def run( self ):
'''
- The Execution of the test script's cases listed in the Test params file will be done here.
- And Update each test case result.
- This method will return TRUE if it executed all the test cases successfully,
- else will retun FALSE
+ The Execution of the test script's cases listed in the Test params
+ file will be done here then update each test case result.
+ This method will return main.TRUE if it executed all the test cases
+ successfully, else will retun main.FALSE
'''
self.testCaseResult = {}
self.TOTAL_TC = 0
@@ -202,66 +212,83 @@
self.TOTAL_TC_FAIL = 0
self.TOTAL_TC_PASS = 0
self.TEST_ITERATION = 0
+
+ # NOTE: number of main.step statements in the
+ # outer most level of the test case. used to
+ # execute code in smaller steps
self.stepCount = 0
self.CASERESULT = self.NORESULT
import testparser
- testFile = self.tests_path + "/"+self.TEST + "/"+self.TEST + ".py"
- test = testparser.TestParser(testFile)
+ testFile = self.tests_path + "/" + self.TEST + "/" + self.TEST + ".py"
+ test = testparser.TestParser( testFile )
self.testscript = test.testscript
self.code = test.getStepCode()
- repeat= int(self.params['repeat']) if ('repeat' in self.params) else 1
- self.TOTAL_TC_PLANNED = len(self.testcases_list)*repeat
+ repeat = int( self.params.get( 'repeat', 1 ) )
+ self.TOTAL_TC_PLANNED = len( self.testcases_list ) * repeat
result = self.TRUE
- while(repeat):
+ while repeat:
for self.CurrentTestCaseNumber in self.testcases_list:
- result = self.runCase(self.CurrentTestCaseNumber)
- repeat-=1
+ result = self.runCase( self.CurrentTestCaseNumber )
+ repeat -= 1
return result
def runCase( self, testCaseNumber ):
self.CurrentTestCaseNumber = testCaseNumber
self.CurrentTestCase = ""
- self.stepResults = []
+
+ # List of step results in a case. ANDed together to get the result
+ self.stepResultsList = []
self.stepName = ""
self.caseExplanation = ""
result = self.TRUE
+
+ # NOTE: number of main.step statements in the
+ # outer most level of the test case. used to
+ # execute code in smaller steps
self.stepCount = 0
+
+ # NOTE: This is the current number of main.step()'s executed
+ # in a case. Used for logging.
+ self.stepNumber = 0
self.EXPERIMENTAL_MODE = self.FALSE
self.addCaseHeader()
self.testCaseNumber = str( testCaseNumber )
self.CASERESULT = self.NORESULT
stopped = False
- try :
- self.stepList = self.code[self.testCaseNumber].keys()
+ try:
+ self.code[self.testCaseNumber]
except KeyError:
self.log.error( "There is no Test-Case " + self.testCaseNumber )
return self.FALSE
self.stepCount = 0
- while self.stepCount < len(self.code[self.testCaseNumber].keys()):
- result = self.runStep(self.stepList,self.code,self.testCaseNumber)
+ while self.stepCount < len( self.code[self.testCaseNumber].keys() ):
+ result = self.runStep( self.code, self.testCaseNumber )
if result == self.FALSE:
break
elif result == self.TRUE:
continue
+ # stepResults format: ( stepNo[], stepName[], stepResult[], onFail[] )
+ stepResults = self.stepResultsList
if not stopped:
if self.CASERESULT == self.TRUE or self.CASERESULT == self.FALSE:
- # Result was already explitily set somewhere else like skipCase()
+ # Result was already explitily set somewhere else like
+ # in skipCase()
pass
- elif all( self.TRUE == i for i in self.stepResults ):
+ elif all( self.TRUE == i for i in stepResults ):
# ALL PASSED
self.CASERESULT = self.TRUE
- elif self.FALSE in self.stepResults:
+ elif self.FALSE in stepResults:
# AT LEAST ONE FAILED
self.CASERESULT = self.FALSE
- elif self.TRUE in self.stepResults:
+ elif self.TRUE in stepResults:
# AT LEAST ONE PASSED
self.CASERESULT = self.TRUE
else:
self.CASERESULT = self.NORESULT
- self.testCaseResult[str(self.CurrentTestCaseNumber)] = self.CASERESULT
- self.logger.updateCaseResults(self)
+ self.testCaseResult[str( self.CurrentTestCaseNumber )] = self.CASERESULT
+ self.logger.updateCaseResults( self )
self.log.wiki( "<p>" + self.caseExplanation + "</p>" )
self.log.summary( self.caseExplanation )
self.log.wiki( "<ul>" )
@@ -279,40 +306,51 @@
self.stepCache = ""
return result
- def runStep(self,stepList,code,testCaseNumber):
+ def runStep( self, code, testCaseNumber ):
if not cli.pause:
- try :
- step = stepList[self.stepCount]
- self.STEPRESULT = self.NORESULT
- self.onFailMsg = "No on fail message given"
+ try:
+ step = self.stepCount
+ # stepResults format: ( stepNo, stepName, stepResult, onFail )
+ # NOTE: This is needed to catch results of main.step()'s
+ # called inside functions or loops
+ self.stepResults = ( [], [], [], [] )
exec code[testCaseNumber][step] in module.__dict__
self.stepCount = self.stepCount + 1
- if step > 0:
- self.stepCache += "\t"+str(testCaseNumber)+"."+str(step)+" "+self.stepName+" - "
- if self.STEPRESULT == self.TRUE:
+
+ # Iterate through each of the steps and print them
+ for index in range( len( self.stepResults[0] ) ):
+ # stepResults = ( stepNo, stepName, stepResult, onFail )
+ stepNo = self.stepResults[0][ index ]
+ stepName = self.stepResults[1][ index ]
+ stepResult = self.stepResults[2][ index ]
+ onFail = self.stepResults[3][ index ]
+ self.stepCache += "\t" + str( testCaseNumber ) + "."
+ self.stepCache += str( stepNo ) + " "
+ self.stepCache += stepName + " - "
+ if stepResult == self.TRUE:
self.stepCache += "PASS\n"
- elif self.STEPRESULT == self.FALSE:
+ elif stepResult == self.FALSE:
self.stepCache += "FAIL\n"
- # TODO: Print the on-fail statement here
- self.stepCache += "\t\t" + self.onFailMsg + "\n"
+ self.stepCache += "\t\t" + onFail + "\n"
else:
self.stepCache += "No Result\n"
- self.stepResults.append(self.STEPRESULT)
+ self.stepResultsList.append( stepResult )
except StopIteration: # Raised in self.skipCase()
self.log.warn( "Skipping the rest of CASE" +
str( testCaseNumber ) )
- self.stepResults.append(self.STEPRESULT)
+ self.stepResultsList.append( self.STEPRESULT )
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( step ) + ": " + self.stepName )
- #print code[testCaseNumber][step]
+ str( stepNo ) + ": " + stepName )
self.stepCount = self.stepCount + 1
- self.logger.updateCaseResults(self)
- #WIKI results
+ self.logger.updateCaseResults( self )
+ # WIKI results
self.log.wiki( "<ul>" )
for line in self.stepCache.splitlines():
if re.search( " - PASS$", line ):
@@ -324,7 +362,7 @@
else: # Should only be on fail message
self.log.wiki( "<ul><li>" + line + "</li></ul>\n" )
self.log.wiki( "</ul>" )
- #summary results
+ # summary results
self.log.summary( self.stepCache )
self.stepCache = ""
self.cleanup()
@@ -332,10 +370,9 @@
return self.TRUE
if cli.stop:
cli.stop = False
- stopped = True
self.TOTAL_TC_NORESULT = self.TOTAL_TC_NORESULT + 1
- self.testCaseResult[str(self.CurrentTestCaseNumber)] = "Stopped"
- self.logger.updateCaseResults(self)
+ self.testCaseResult[str( self.CurrentTestCaseNumber )] = "Stopped"
+ self.logger.updateCaseResults( self )
result = self.cleanup()
return self.FALSE
@@ -360,24 +397,30 @@
self.onFailMsg += str( msg )
raise StopIteration
- def addCaseHeader(self):
- caseHeader = "\n"+"*" * 30+"\n Result summary for Testcase"+str(self.CurrentTestCaseNumber)+"\n"+"*" * 30+"\n"
- self.log.exact(caseHeader)
- caseHeader = "\n"+"*" * 40 +"\nStart of Test Case"+str(self.CurrentTestCaseNumber)+" : "
+ def addCaseHeader( self ):
+ caseHeader = "\n" + "*" * 30 + "\n Result summary for Testcase" +\
+ str( self.CurrentTestCaseNumber ) + "\n" + "*" * 30 + "\n"
+ self.log.exact( caseHeader )
+ caseHeader = "\n" + "*" * 40 + "\nStart of Test Case" +\
+ str( self.CurrentTestCaseNumber ) + " : "
for driver in self.componentDictionary.keys():
- vars(self)[driver+'log'].info(caseHeader)
+ vars( self )[driver + 'log'].info( caseHeader )
- def addCaseFooter(self):
- if self.stepCount-1 > 0 :
- previousStep = " "+str(self.CurrentTestCaseNumber)+"."+str(self.stepCount-1)+": "+ str(self.stepName) + ""
- stepHeader = "\n"+"*" * 40+"\nEnd of Step "+previousStep+"\n"+"*" * 40+"\n"
+ def addCaseFooter( self ):
+ stepNo = self.stepResults[0][-2]
+ if stepNo > 0:
+ previousStep = " " + str( self.CurrentTestCaseNumber ) + "." +\
+ str( stepNo ) + ": " + str( self.stepName )
+ stepHeader = "\n" + "*" * 40 + "\nEnd of Step " + previousStep +\
+ "\n" + "*" * 40 + "\n"
- caseFooter = "\n"+"*" * 40+"\nEnd of Test case "+str(self.CurrentTestCaseNumber)+"\n"+"*" * 40+"\n"
+ caseFooter = "\n" + "*" * 40 + "\nEnd of Test case " +\
+ str( self.CurrentTestCaseNumber ) + "\n" + "*" * 40 + "\n"
for driver in self.driversList:
- vars(self)[driver].write(stepHeader+"\n"+caseFooter)
+ vars( self )[driver].write( stepHeader + "\n" + caseFooter )
- def cleanup(self):
+ def cleanup( self ):
'''
Print a summary of the current test's results then attempt to release
all the component handles and the close opened file handles.
@@ -395,12 +438,12 @@
if self.cleanupFlag is False: # First thread to run this
self.cleanupFlag = True
if self.initiated:
- self.logger.testSummary(self)
+ self.logger.testSummary( self )
for component in self.componentDictionary.keys():
- try :
- tempObject = vars(self)[component]
- print "Disconnecting from " + str(tempObject.name) + ": " + \
- str(tempObject)
+ try:
+ tempObject = vars( self )[component]
+ print "Disconnecting from " + str( tempObject.name ) +\
+ ": " + str( tempObject.__class__)
tempObject.disconnect()
except KeyboardInterrupt:
pass
@@ -415,7 +458,7 @@
# Closing all the driver's session files
for driver in self.componentDictionary.keys():
try:
- vars(self)[driver].close_log_handles()
+ vars( self )[driver].close_log_handles()
except KeyboardInterrupt:
pass
except KeyError:
@@ -440,210 +483,226 @@
lock.release()
return result
- def pause(self):
+ def pause( self ):
'''
- This function will pause the test's execution, and will continue after user provide 'resume' command.
+ This function will pause the test's execution, and will continue after
+ user provide 'resume' command.
'''
__builtin__.testthread.pause()
- def onfail(self,*components):
+ def onfail( self, *components ):
'''
When test step failed, calling all the components onfail.
'''
if not components:
- try :
+ try:
for component in self.componentDictionary.keys():
- tempObject = vars(self)[component]
+ tempObject = vars( self )[component]
result = tempObject.onfail()
except StandardError as e:
- print str(e)
+ print str( e )
result = self.FALSE
else:
- try :
+ try:
for component in components:
- tempObject = vars(self)[component]
+ tempObject = vars( self )[component]
result = tempObject.onfail()
except StandardError as e:
- print str(e)
+ print str( e )
result = self.FALSE
- def getDriverPath(self,driverName):
+ def getDriverPath( self, driverName ):
'''
- Based on the component 'type' specified in the params , this method will find the absolute path ,
- by recursively searching the name of the component.
+ Based on the component 'type' specified in the params , this method
+ will find the absolute path, by recursively searching the name of
+ the component.
+
+ NOTE: This function requires the linux 'find' command.
'''
import commands
- cmd = "find "+drivers_path+" -name "+driverName+".py"
- result = commands.getoutput(cmd)
+ cmd = "find " + drivers_path + " -name " + driverName + ".py"
+ result = commands.getoutput( cmd )
- result_array = str(result).split('\n')
+ result_array = str( result ).split( '\n' )
result_count = 0
for drivers_list in result_array:
- result_count = result_count+1
- if result_count > 1 :
- print "found "+driverName+" "+ str(result_count) + " times"+str(result_array)
+ result_count = result_count + 1
+ if result_count > 1:
+ print "Found " + driverName + " " + str( result_count ) + " times:"
+ print str( result_array )
self.exit()
- result = re.sub("(.*)drivers","",result)
- result = re.sub("\/\/","/",result)
- result = re.sub("\.py","",result)
- result = re.sub("\.pyc","",result)
- result = re.sub("\/",".",result)
- result = "drivers"+result
+ result = re.sub( "(.*)drivers", "", result )
+ result = re.sub( "\/\/", "/", result )
+ result = re.sub( "\.py", "", result )
+ result = re.sub( "\.pyc", "", result )
+ result = re.sub( "\/", ".", result )
+ result = "drivers" + result
return result
- def step(self,stepDesc):
+ def step( self, stepDesc ):
'''
The step information of the test-case will append to the logs.
'''
- previousStep = " "+str(self.CurrentTestCaseNumber)+"."+str(self.stepCount-1)+": "+ str(self.stepName) + ""
+ previousStep = " " + str( self.CurrentTestCaseNumber ) + "." +\
+ str( self.stepNumber ) + ": " + str( self.stepName )
self.stepName = stepDesc
+ self.stepNumber += 1
+ self.stepResults[0].append( self.stepNumber )
+ self.stepResults[1].append( stepDesc )
+ self.stepResults[2].append( self.NORESULT )
+ self.stepResults[3].append( "No on fail message given" )
- stepName = " "+str(self.CurrentTestCaseNumber)+"."+str(self.stepCount)+": "+ str(stepDesc) + ""
- try :
- if self.stepCount == 0:
- stepName = " INIT : Initializing the test case :"+self.CurrentTestCase
- except AttributeError:
- stepName = " INIT : Initializing the test case :"+str(self.CurrentTestCaseNumber)
-
+ stepName = " " + str( self.CurrentTestCaseNumber ) + "." +\
+ str( self.stepNumber ) + ": " + str( stepDesc )
self.log.step(stepName)
stepHeader = ""
- if self.stepCount > 1 :
- stepHeader = "\n"+"-"*45+"\nEnd of Step "+previousStep+"\n"+"-"*45+"\n"
-
- stepHeader += "\n"+"-"*45+"\nStart of Step"+stepName+"\n"+"-"*45+"\n"
+ line = "\n" + "-" * 45 + "\n"
+ if self.stepNumber > 1:
+ stepHeader = line + "End of Step " + previousStep + line
+ stepHeader += line + "Start of Step" + stepName + line
for driver in self.componentDictionary.keys():
- vars(self)[driver+'log'].info(stepHeader)
+ vars( self )[driver + 'log'].info( stepHeader )
- def case(self,testCaseName):
+ def case( self, testCaseName ):
'''
Test's each test-case information will append to the logs.
'''
self.CurrentTestCase = testCaseName
- testCaseName = " " + str(testCaseName) + ""
- self.log.case(testCaseName)
- caseHeader = testCaseName+"\n"+"*" * 40+"\n"
+ testCaseName = " " + str( testCaseName )
+ self.log.case( testCaseName )
+ caseHeader = testCaseName + "\n" + "*" * 40 + "\n"
for driver in self.componentDictionary.keys():
- vars(self)[driver+'log'].info(caseHeader)
+ vars( self )[driver + 'log'].info( caseHeader )
- def testDesc(self,description):
+ def testDesc( self, description ):
'''
Test description will append to the logs.
'''
- description = "Test Description : " + str (description) + ""
- self.log.info(description)
+ description = "Test Description : " + str( description )
+ self.log.info( description )
- def _getTest(self):
+ def _getTest( self ):
'''
- This method will parse the test script to find required test information.
+ This method will parse the test script to find required test
+ information.
'''
- testFile = self.tests_path + "/"+self.TEST + "/"+self.TEST + ".py"
- testFileHandler = open(testFile, 'r')
+ testFile = self.tests_path + "/" + self.TEST + "/" + self.TEST + ".py"
+ testFileHandler = open( testFile, 'r' )
testFileList = testFileHandler.readlines()
testFileHandler.close()
- #self.TOTAL_TC_PLANNED = 0
counter = 0
- for index in range(len(testFileList)):
- lineMatch = re.match('\s+def CASE(\d+)(.*):',testFileList[index],0)
+ for index in range( len( testFileList ) ):
+ lineMatch = re.match( '\s+def CASE(\d+)(.*):',
+ testFileList[index],
+ 0 )
if lineMatch:
- counter = counter + 1
- self.TC_PLANNED = len(self.testcases_list)
+ counter = counter + 1
+ self.TC_PLANNED = len( self.testcases_list )
- def response_parser(self,response, return_format):
+ def response_parser( self, response, return_format ):
''' It will load the default response parser '''
response_dict = {}
- response_dict = self.response_to_dict(response, return_format)
- return_format_string = self.dict_to_return_format(response,return_format,response_dict)
+ response_dict = self.response_to_dict( response, return_format )
+ return_format_string = self.dict_to_return_format( response,
+ return_format,
+ response_dict )
return return_format_string
- def response_to_dict(self,response,return_format):
+ def response_to_dict( self, response, return_format ):
response_dict = {}
- json_match = re.search('^\s*{', response)
- xml_match = re.search('^\s*\<', response)
- ini_match = re.search('^\s*\[', response)
- if json_match :
- self.log.info(" Response is in 'JSON' format and Converting to '"+return_format+"' format")
+ json_match = re.search( '^\s*{', response )
+ xml_match = re.search( '^\s*\<', response )
+ ini_match = re.search( '^\s*\[', response )
+ if json_match:
+ self.log.info( "Response is in 'JSON' format, converting to '" +
+ return_format + "' format" )
# Formatting the json string
- response = re.sub(r"{\s*'?(\w)", r'{"\1', response)
- response = re.sub(r",\s*'?(\w)", r',"\1', response)
- response = re.sub(r"(\w)'?\s*:", r'\1":', response)
- response = re.sub(r":\s*'(\w)'\s*([,}])", r':"\1"\2', response)
- try :
+ response = re.sub( r"{\s*'?(\w)", r'{"\1', response )
+ response = re.sub( r",\s*'?(\w)", r',"\1', response )
+ response = re.sub( r"(\w)'?\s*:", r'\1":', response )
+ response = re.sub( r":\s*'(\w)'\s*([,}])", r':"\1"\2', response )
+ try:
import json
- response_dict = json.loads(response)
+ response_dict = json.loads( response )
except StandardError:
self.log.exception( "Json Parser is unable to parse the string" )
return response_dict
- elif ini_match :
- self.log.info(" Response is in 'INI' format and Converting to '"+return_format+"' format")
+ elif ini_match:
+ self.log.info( "Response is in 'INI' format, converting to '" +
+ return_format + "' format" )
from configobj import ConfigObj
- response_file = open("respnse_file.temp",'w')
- response_file.write(response)
+ response_file = open( "respnse_file.temp", 'w' )
+ response_file.write( response )
response_file.close()
- response_dict = ConfigObj("respnse_file.temp")
+ response_dict = ConfigObj( "respnse_file.temp" )
return response_dict
- elif xml_match :
- self.log.info(" Response is in 'XML' format and Converting to '"+return_format+"' format")
- try :
- response_dict = xmldict.xml_to_dict("<response> "+str(response)+" </response>")
+ elif xml_match:
+ self.log.info( "Response is in 'XML' format, converting to '" +
+ return_format + "' format" )
+ try:
+ response_dict = xmldict.xml_to_dict( "<response> " +
+ str( response ) +
+ " </response>" )
except StandardError:
self.log.exception()
return response_dict
- def dict_to_return_format(self,response,return_format,response_dict):
- if return_format =='table' :
+ def dict_to_return_format( self, response, return_format, response_dict ):
+ if return_format == 'table':
''' Will return in table format'''
to_do = "Call the table output formatter"
global response_table
response_table = '\n'
- response_table = response_table +'\t'.join(response_dict)+"\n"
+ response_table = response_table + '\t'.join( response_dict ) + "\n"
- def get_table(value_to_convert):
- ''' This will parse the dictionary recusrsively and print as table format'''
+ def get_table( value_to_convert ):
+ ''' This will parse the dictionary recusrsively and print as
+ table format'''
table_data = ""
- if type(value_to_convert) == dict :
- table_data = table_data +'\t'.join(value_to_convert)+"\n"
- for temp_val in value_to_convert.values() :
- table_data = table_data + get_table(temp_val)
- else :
- table_data = table_data + str(value_to_convert) +"\t"
+ if isinstance( value_to_convert, dict ):
+ table_data = table_data + '\t'.join( value_to_convert ) +\
+ "\n"
+ for temp_val in value_to_convert.values():
+ table_data = table_data + get_table( temp_val )
+ else:
+ table_data = table_data + str( value_to_convert ) + "\t"
return table_data
- for value in response_dict.values() :
- response_table = response_table + get_table(value)
- # response_table = response_table + '\t'.join(response_dict.values())
+ for value in response_dict.values():
+ response_table = response_table + get_table( value )
return response_table
- elif return_format =='config':
+ elif return_format == 'config':
''' Will return in config format'''
to_do = 'Call dict to config coverter'
- response_string = str(response_dict)
+ response_string = str( response_dict )
print response_string
- response_config = re.sub(",", "\n\t", response_string)
- response_config = re.sub("u\'", "\'", response_config)
- response_config = re.sub("{", "", response_config)
- response_config = re.sub("}", "\n", response_config)
- response_config = re.sub(":", " =", response_config)
- return "[response]\n\t "+response_config
+ response_config = re.sub( ",", "\n\t", response_string )
+ response_config = re.sub( "u\'", "\'", response_config )
+ response_config = re.sub( "{", "", response_config )
+ response_config = re.sub( "}", "\n", response_config )
+ response_config = re.sub( ":", " =", response_config )
+ return "[response]\n\t " + response_config
elif return_format == 'xml':
''' Will return in xml format'''
- response_xml = xmldict.dict_to_xml(response_dict)
- response_xml = re.sub(">\s*<", ">\n<", response_xml)
- return "\n"+response_xml
+ response_xml = xmldict.dict_to_xml( response_dict )
+ response_xml = re.sub( ">\s*<", ">\n<", response_xml )
+ return "\n" + response_xml
elif return_format == 'json':
''' Will return in json format'''
to_do = 'Call dict to xml coverter'
import json
- response_json = json.dumps(response_dict)
+ response_json = json.dumps( response_dict )
return response_json
- def get_random(self):
+ def get_random( self ):
self.random_order = self.random_order + 1
return self.random_order
- def exit(self):
+ def exit( self ):
__builtin__.testthread = None
for thread in threading.enumerate():
if thread.isAlive():
@@ -653,248 +712,281 @@
# NOTE: We should catch any exceptions while trying to
# close the thread so that we can try to close the other
# threads as well
- print( str( thread.getName() ) + ' could not be terminated' )
+ print str( thread.getName() ) +\
+ ' could not be terminated'
sys.exit()
-def verifyOptions(options):
+def verifyOptions( options ):
'''
- This will verify the command line options and set to default values, if any option not given in command line.
+ This will verify the command line options and set to default values,
+ if any option not given in command line.
'''
- import pprint
- pp = pprint.PrettyPrinter(indent=4)
-
- # pp.pprint(options)
- verifyTest(options)
- verifyExample(options)
- verifyTestScript(options)
+ verifyTest( options )
+ verifyExample( options )
+ verifyTestScript( options )
verifyParams()
- verifyLogdir(options)
- verifyMail(options)
- verifyTestCases(options)
- verifyOnosCell(options)
+ verifyLogdir( options )
+ verifyMail( options )
+ verifyTestCases( options )
+ verifyOnosCell( options )
-def verifyTest(options):
+def verifyTest( options ):
try:
if options.testname:
main.TEST = options.testname
- main.classPath = "tests."+main.TEST+"."+main.TEST
+ main.classPath = "tests." + main.TEST + "." + main.TEST
main.tests_path = tests_path
elif options.example:
main.TEST = options.example
- main.tests_path = path+"/examples/"
- main.classPath = "examples."+main.TEST+"."+main.TEST
+ main.tests_path = path + "/examples/"
+ main.classPath = "examples." + main.TEST + "." + main.TEST
except AttributeError:
print "Test or Example not specified please specify the --test <test name > or --example <example name>"
main.exit()
-def verifyExample(options):
+def verifyExample( options ):
if options.example:
- main.testDir = path+'/examples/'
- main.tests_path = path+"/examples/"
- main.classPath = "examples."+main.TEST+"."+main.TEST
+ main.testDir = path + '/examples/'
+ main.tests_path = path + "/examples/"
+ main.classPath = "examples." + main.TEST + "." + main.TEST
-def verifyLogdir(options):
+def verifyLogdir( options ):
# Verifying Log directory option
if options.logdir:
main.logdir = options.logdir
- else :
+ else:
main.logdir = main.FALSE
-def verifyMail(options):
+def verifyMail( options ):
# Checking the mailing list
if options.mail:
main.mail = options.mail
- elif main.params.has_key('mail'):
- main.mail = main.params['mail']
- else :
- main.mail = 'paxweb@paxterrasolutions.com'
+ else:
+ main.mail = main.params.get( 'mail', 'paxweb@paxterrasolutions.com' )
-def verifyTestCases(options):
+def verifyTestCases( options ):
# Getting Test cases list
if options.testcases:
testcases_list = options.testcases
# sys.exit()
- testcases_list = re.sub("(\[|\])", "", options.testcases)
- main.testcases_list = eval(testcases_list+",")
- else :
+ testcases_list = re.sub( "(\[|\])", "", options.testcases )
+ main.testcases_list = eval( testcases_list + "," )
+ else:
if 'testcases' in main.params.keys():
- temp = eval(main.params['testcases']+",")
- list1=[]
- if type(temp[0])==list:
+ temp = eval( main.params['testcases'] + "," )
+ list1 = []
+ if isinstance( temp[0], list ):
for test in temp:
for testcase in test:
- if type(testcase)==int:
- testcase=[testcase]
- list1.extend(testcase)
- else :
- temp=list(temp)
+ if isinstance( testcase, int ):
+ testcase = [testcase]
+ list1.extend( testcase )
+ else:
+ temp = list( temp )
for testcase in temp:
- if type(testcase)==int:
- testcase=[testcase]
- list1.extend(testcase)
- main.testcases_list=list1
- else :
- print "testcases not specifed in params, please provide in params file or 'testcases' commandline argument"
+ if isinstance( testcase, int ):
+ testcase = [testcase]
+ list1.extend( testcase )
+ main.testcases_list = list1
+ else:
+ print "Testcases not specifed in params, please provide in " +\
+ "params file or 'testcases' commandline argument"
sys.exit()
-def verifyOnosCell(options):
+def verifyOnosCell( options ):
# Verifying onoscell option
if options.onoscell:
main.onoscell = options.onoscell
main.onosIPs = []
main.mnIP = ""
- cellCMD = ". ~/.profile; cell "+main.onoscell
- output=subprocess.check_output( ["bash", '-c', cellCMD] )
+ cellCMD = ". ~/.profile; cell " + main.onoscell
+ output = subprocess.check_output( ["bash", '-c', cellCMD] )
splitOutput = output.splitlines()
- for i in range( len(splitOutput) ):
- if( re.match( "OCN", splitOutput[i] ) ):
- mnNode=splitOutput[i].split("=")
+ for i in range( len( splitOutput ) ):
+ if re.match( "OCN", splitOutput[i] ):
+ mnNode = splitOutput[i].split( "=" )
main.mnIP = mnNode[1]
- # cell already sorts OC variables in bash, so no need to sort in TestON
- if( re.match( "OC[1-9]", splitOutput[i] ) ):
- onosNodes = splitOutput[i].split("=")
+ # cell already sorts OC variables in bash, so no need to
+ # sort in TestON
+ if re.match( "OC[1-9]", splitOutput[i] ):
+ onosNodes = splitOutput[i].split( "=" )
main.onosIPs.append( onosNodes[1] )
- else :
+ else:
main.onoscell = main.FALSE
-def verifyTestScript(options):
+def verifyTestScript( options ):
'''
Verifyies test script.
'''
main.openspeak = openspeak.OpenSpeak()
- openspeakfile = main.testDir+"/" + main.TEST + "/" + main.TEST + ".ospk"
- testfile = main.testDir+"/" + main.TEST + "/" + main.TEST + ".py"
- if os.path.exists(openspeakfile):
+ openspeakfile = main.testDir + "/" + main.TEST + "/" + main.TEST + ".ospk"
+ testfile = main.testDir + "/" + main.TEST + "/" + main.TEST + ".py"
+ if os.path.exists( openspeakfile ):
# Openspeak file found, compiling to python
- main.openspeak.compiler(openspeakfile=openspeakfile,writetofile=1)
- elif os.path.exists(testfile):
+ main.openspeak.compiler( openspeakfile=openspeakfile, writetofile=1 )
+ elif os.path.exists( testfile ):
# No openspeak found, using python file instead
pass
else:
- print "\nThere is no \""+main.TEST+"\" test script.\nPlease provide a " +\
+ print "\nThere is no \"" + main.TEST + "\" test script.\nPlease provide a " +\
"Python or OpenSpeak test script in the tests folder: " +\
- main.testDir+"/" + main.TEST + "/"
+ main.testDir + "/" + main.TEST + "/"
__builtin__.testthread = None
main.exit()
- try :
- testModule = __import__(main.classPath, globals(), locals(), [main.TEST], -1)
+ try:
+ testModule = __import__( main.classPath,
+ globals(),
+ locals(),
+ [main.TEST],
+ -1 )
except ImportError:
- print "There was an import error, it might mean that there is no test named "+main.TEST
+ print "There was an import error, it might mean that there is " +\
+ "no test named " + main.TEST
main.exit()
- testClass = getattr(testModule, main.TEST)
+ testClass = getattr( testModule, main.TEST )
main.testObject = testClass()
load_parser()
- main.params = main.parser.parseParams(main.classPath)
- main.topology = main.parser.parseTopology(main.classPath)
+ main.params = main.parser.parseParams( main.classPath )
+ main.topology = main.parser.parseTopology( main.classPath )
def verifyParams():
- try :
+ try:
main.params = main.params['PARAMS']
except KeyError:
- print "Error with the params file: Either the file not specified or the format is not correct"
+ print "Error with the params file: Either the file not specified " +\
+ "or the format is not correct"
main.exit()
- try :
+ try:
main.topology = main.topology['TOPOLOGY']
except KeyError:
- print "Error with the Topology file: Either the file not specified or the format is not correct"
+ print "Error with the Topology file: Either the file not specified " +\
+ "or the format is not correct"
main.exit()
-def load_parser() :
+def load_parser():
'''
It facilitates the loading customised parser for topology and params file.
It loads parser mentioned in tab named parser of teston.cfg file.
- It also loads default xmlparser if no parser have specified in teston.cfg file.
+ It also loads default xmlparser if no parser have specified in teston.cfg
+ file.
'''
confighash = main.configDict
- if 'file' in confighash['config']['parser'] and 'class' in confighash['config']['parser']:
+ if 'file' in confighash['config']['parser'] and\
+ 'class' in confighash['config']['parser']:
path = confighash['config']['parser']['file']
- if path != None or confighash['config']['parser']['class']!= None:
+ if path is not None or\
+ confighash['config']['parser']['class'] is not None:
try:
module = re.sub( r".py\s*$", "", path )
moduleList = module.split("/")
- newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
+ newModule = ".".join( moduleList[-2:] )
parsingClass = confighash['config']['parser']['class']
- parsingModule = __import__(newModule, globals(), locals(), [parsingClass], -1)
- parsingClass = getattr(parsingModule, parsingClass)
+ parsingModule = __import__( newModule,
+ globals(),
+ locals(),
+ [parsingClass],
+ -1 )
+ parsingClass = getattr( parsingModule, parsingClass )
main.parser = parsingClass()
- #hashobj = main.parser.parseParams(main.classPath)
- if hasattr(main.parser,"parseParams") and hasattr(main.parser,"parseTopology") and hasattr(main.parser,"parse"):
+ if hasattr( main.parser, "parseParams" ) and\
+ hasattr( main.parser, "parseTopology" ) and\
+ hasattr( main.parser, "parse" ):
pass
else:
print "Invalid parser format"
main.exit()
except ImportError:
- print "Could not find the file " + path + " using default parser."
+ print "Could not find the file " + path +\
+ " using default parser."
load_defaultParser()
- elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None:
+ elif confighash['config']['parser']['file'] is None or\
+ confighash['config']['parser']['class'] is None:
load_defaultParser()
else:
load_defaultParser()
def load_defaultParser():
'''
- It will load the default parser which is xml parser to parse the params and topology file.
+ It will load the default parser which is xml parser to parse the params and
+ topology file.
'''
moduleList = main.parserPath.split("/")
- newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
- try :
+ newModule = ".".join( moduleList[-2:] )
+ try:
parsingClass = main.parsingClass
- parsingModule = __import__(newModule, globals(), locals(), [parsingClass], -1)
- parsingClass = getattr(parsingModule, parsingClass)
+ parsingModule = __import__( newModule,
+ globals(),
+ locals(),
+ [parsingClass],
+ -1 )
+ parsingClass = getattr( parsingModule, parsingClass )
main.parser = parsingClass()
- if hasattr(main.parser,"parseParams") and hasattr(main.parser,"parseTopology") and hasattr(main.parser,"parse") :
+ if hasattr( main.parser, "parseParams" ) and\
+ hasattr( main.parser, "parseTopology" ) and\
+ hasattr( main.parser, "parse" ):
pass
else:
main.exit()
-
except ImportError:
print sys.exc_info()[1]
-def load_logger() :
+def load_logger():
'''
It facilitates the loading customised parser for topology and params file.
It loads parser mentioned in tab named parser of teston.cfg file.
- It also loads default xmlparser if no parser have specified in teston.cfg file.
-
+ It also loads default xmlparser if no parser have specified in teston.cfg
+ file.
'''
confighash = main.configDict
- if 'file' in confighash['config']['logger'] and 'class' in confighash['config']['logger']:
+ if 'file' in confighash['config']['logger'] and\
+ 'class' in confighash['config']['logger']:
path = confighash['config']['logger']['file']
- if path != None or confighash['config']['logger']['class']!= None :
+ if path is not None or\
+ confighash['config']['logger']['class'] is not None:
try:
module = re.sub( r".py\s*$", "", path )
- moduleList = module.split("/")
- newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
+ moduleList = module.split( "/" )
+ newModule = ".".join( moduleList[-2:] )
loggerClass = confighash['config']['logger']['class']
- loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
- loggerClass = getattr(loggerModule, loggerClass)
+ loggerModule = __import__( newModule,
+ globals(),
+ locals(),
+ [loggerClass],
+ -1 )
+ loggerClass = getattr( loggerModule, loggerClass )
main.logger = loggerClass()
- #hashobj = main.parser.parseParams(main.classPath)
except ImportError:
- print "Could not find the file " + path + " using default logger."
+ print "Could not find the file " + path +\
+ " using default logger."
load_defaultlogger()
- elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
+ elif confighash['config']['parser']['file'] is None or\
+ confighash['config']['parser']['class'] is None:
load_defaultlogger()
else:
load_defaultlogger()
def load_defaultlogger():
'''
- It will load the default parser which is xml parser to parse the params and topology file.
+ It will load the default parser which is xml parser to parse the params and
+ topology file.
'''
moduleList = main.loggerPath.split("/")
- newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
- try :
+ newModule = ".".join( moduleList[-2:] )
+ try:
loggerClass = main.loggerClass
- loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
- loggerClass = getattr(loggerModule, loggerClass)
+ loggerModule = __import__( newModule,
+ globals(),
+ locals(),
+ [loggerClass],
+ -1 )
+ loggerClass = getattr( loggerModule, loggerClass )
main.logger = loggerClass()
except ImportError:
print sys.exc_info()[1]
main.exit()
-def _echo(self):
+def _echo( self ):
print "THIS IS ECHO"
diff --git a/TestON/core/utilities.py b/TestON/core/utilities.py
index 8cd81e5..d5a5c0f 100644
--- a/TestON/core/utilities.py
+++ b/TestON/core/utilities.py
@@ -185,6 +185,14 @@
print e
main.last_result = result
+ if main.stepResults[2]:
+ main.stepResults[2][-1] = result
+ try:
+ main.stepResults[3][-1] = arguments[ 'ONFAIL' ]
+ except AttributeError:
+ pass
+ else:
+ main.log.warn( "Assertion called before a test step" )
return result
def parse_args(self,args, **kwargs):
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 0996652..d726f2e 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -424,9 +424,8 @@
main.log.info( "Testing reachability between specified hosts" )
isReachable = main.TRUE
- pingResponse = ""
- main.info.log("IPv4 ping across specified hosts")
-
+ pingResponse = "IPv4 ping across specified hosts\n"
+ failedPings = 0
for host in hostList:
listIndex = hostList.index( host )
# List of hosts to ping other than itself
@@ -442,14 +441,14 @@
self.handle.expect( "mininet>" )
response = self.handle.before
if re.search( ',\s0\%\spacket\sloss', response ):
- main.log.info( str( host ) + " -> " + str( temp ) )
pingResponse += str(" h" + str( temp[1:] ))
else:
pingResponse += " X"
# One of the host to host pair is unreachable
isReachable = main.FALSE
+ failedPings += 1
pingResponse += "\n"
- main.log.info(pingResponse)
+ main.log.info( pingResponse + "Failed pings: " + str(failedPings) )
return isReachable
except pexpect.TIMEOUT:
main.log.exception( self.name + ": TIMEOUT exception" )
@@ -477,8 +476,8 @@
main.log.info( "Testing reachability between specified IPv6 hosts" )
isReachable = main.TRUE
cmd = " ping6 -c 1 -i 1 -W 8 "
- pingResponse = ""
- main.log.info("IPv6 Pingall output:")
+ pingResponse = "IPv6 Pingall output:\n"
+ failedPings = 0
for host in hostList:
listIndex = hostList.index( host )
# List of hosts to ping other than itself
@@ -499,8 +498,9 @@
pingResponse += " X"
# One of the host to host pair is unreachable
isReachable = main.FALSE
+ failedPings += 1
pingResponse += "\n"
- main.log.info(pingResponse)
+ main.log.info( pingResponse + "Failed pings: " + str(failedPings) )
return isReachable
except pexpect.TIMEOUT:
@@ -1267,6 +1267,35 @@
main.exit()
return main.TRUE
+ def node( self, nodeName, commandStr ):
+ """
+ Carry out a command line on a given node
+ @parm:
+ nodeName: the node name in Mininet testbed
+ commandStr: the command line will be carried out on the node
+ Example: main.Mininet.node( nodeName="h1", commandStr="ls" )
+ """
+ command = str( nodeName ) + " " + str( commandStr )
+ main.log.info( command )
+
+ try:
+ response = self.execute( cmd = command, prompt = "mininet>" )
+ if re.search( "Unknown command", response ):
+ main.log.warn( response )
+ return main.FALSE
+ except pexpect.TIMEOUT:
+ main.log.error( self.name + ": pexpect.TIMEOUT found" )
+ main.cleanup()
+ main.exit()
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ main.log.info( " response is :" )
+ main.log.info( response )
+ return response
+
def yank( self, **yankargs ):
"""
yank a mininet switch interface to a host"""
diff --git a/TestON/tests/CHOtest/CHOtest.params b/TestON/tests/CHOtest/CHOtest.params
index d4199ad..1efb9bd 100644
--- a/TestON/tests/CHOtest/CHOtest.params
+++ b/TestON/tests/CHOtest/CHOtest.params
@@ -90,7 +90,7 @@
<LinkDiscovery>15</LinkDiscovery>
<SwitchDiscovery>10</SwitchDiscovery>
<IntentPurgeDelay>15</IntentPurgeDelay>
- <CheckIntentDelay>40</CheckIntentDelay>
+ <CheckIntentDelay>5</CheckIntentDelay>
</timers>
</PARAMS>
diff --git a/TestON/tests/CHOtest/CHOtest.py b/TestON/tests/CHOtest/CHOtest.py
index fbe51cd..ffc67eb 100644
--- a/TestON/tests/CHOtest/CHOtest.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -989,27 +989,31 @@
time2 = time.time()
main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+ # Saving intent ids to check intents in later cases
+ main.intentIds = list(intentIdList)
+
main.step("Verify intents are installed")
# Giving onos 3 chances to install intents
for i in range(3):
- intentsJson = main.ONOScli1.intents()
- getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
- intentsJson = intentsJson)
- main.log.info("Waiting for onos to get intents...")
+ 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
- failedIntents = 0
- for intent in getIntentStateResult:
- state = intent.items()[0][1]
- if state != 'INSTALLED':
- main.log.info("Intent State: " + state)
- failedIntents += 1
- intentState = main.FALSE
+ 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
- main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
utilities.assert_equals( expect=main.TRUE, actual=intentState,
onpass="INTENTS INSTALLED",
@@ -1040,6 +1044,11 @@
onpass="Install 300 Host Intents and Ping All test PASS",
onfail="Install 300 Host 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" )
+
def CASE61( self ):
"""
Install 600 host intents and verify ping all for Chordal Topology
@@ -1075,28 +1084,30 @@
time2 = time.time()
main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+ # Saving intent ids to check intents in later cases
+ main.intentIds = list(intentIdList)
+
main.step("Verify intents are installed")
# Giving onos 3 chances to install intents
for i in range(3):
- intentsJson = main.ONOScli1.intents()
- getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
- intentsJson = intentsJson)
- main.log.info("Waiting for onos to get intents...")
+ 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
- failedIntents = 0
- for intent in getIntentStateResult:
- state = intent.items()[0][1]
- if state != 'INSTALLED':
- main.log.info("Intent State: " + state)
- failedIntents += 1
- intentState = main.FALSE
+ 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
- main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
-
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
utilities.assert_equals( expect=main.TRUE, actual=intentState,
onpass="INTENTS INSTALLED",
@@ -1128,6 +1139,11 @@
onpass="Install 300 Host Intents and Ping All test PASS",
onfail="Install 300 Host 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" )
+
def CASE62( self ):
"""
Install 2278 host intents and verify ping all for Spine Topology
@@ -1162,27 +1178,30 @@
time2 = time.time()
main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+ # Saving intent ids to check intents in later cases
+ main.intentIds = list(intentIdList)
+
main.step("Verify intents are installed")
- # Giving onos 5 chances to install intents
- for i in range(5):
- intentsJson = main.ONOScli1.intents()
- getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
- intentsJson = intentsJson)
- main.log.info("Waiting for onos to get intents...")
+ # Giving onos 3 chances to install intents
+ for i in range(3):
+ 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
- failedIntents = 0
- for intent in getIntentStateResult:
- state = intent.items()[0][1]
- if state != 'INSTALLED':
- main.log.info("Intent State: " + state)
- failedIntents += 1
- intentState = main.FALSE
+ 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
- main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
utilities.assert_equals( expect=main.TRUE, actual=intentState,
onpass="INTENTS INSTALLED",
@@ -1214,6 +1233,11 @@
onpass="Install 2278 Host Intents and Ping All test PASS",
onfail="Install 2278 Host 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" )
+
def CASE160( self ):
"""
Verify IPv6 ping across 300 host intents (Att Topology)
@@ -1383,14 +1407,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkDown = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
- if not pingResultLinkDown:
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1398,15 +1448,23 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult70 = linkDown and pingResultLinkDown
+ caseResult70 = linkDown and pingResult and intentState
utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
onpass="Random Link cut Test PASS",
onfail="Random Link cut Test FAIL" )
+ # Printing what exactly failed
+ if not linkDown:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
+
def CASE80( self, main ):
"""
Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
@@ -1455,14 +1513,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkUp = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall( timeout=main.pingTimeout )
- if not pingResultLinkUp:
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout )
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1470,14 +1554,21 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult80 = linkUp and pingResultLinkUp
+ caseResult80 = linkUp and pingResult
utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL" )
+ # Printing what exactly failed
+ if not linkUp:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
def CASE71( self, main ):
"""
@@ -1541,14 +1632,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkDown = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
- if not pingResultLinkDown:
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1556,15 +1673,24 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult71 = linkDown and pingResultLinkDown
- utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
+ caseResult70 = linkDown and pingResult and intentState
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
onpass="Random Link cut Test PASS",
onfail="Random Link cut Test FAIL" )
+ # Printing what exactly failed
+ if not linkDown:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
+
+
def CASE81( self, main ):
"""
Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
@@ -1613,14 +1739,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkUp = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout = main.pingTimeout )
- if not pingResultLinkUp:
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout )
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1628,14 +1780,21 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult81 = linkUp and pingResultLinkUp
- utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
+ caseResult80 = linkUp and pingResult
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL" )
+ # Printing what exactly failed
+ if not linkUp:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
def CASE72( self, main ):
"""
@@ -1676,15 +1835,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkDown = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
- if not pingResultLinkDown:
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1692,15 +1876,23 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult71 = pingResultLinkDown
- utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
+ caseResult70 = linkDown and pingResult and intentState
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
onpass="Random Link cut Test PASS",
onfail="Random Link cut Test FAIL" )
+ # Printing what exactly failed
+ if not linkDown:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
+
def CASE82( self, main ):
"""
Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
@@ -1736,15 +1928,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkUp = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
- if not pingResultLinkUp:
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1752,14 +1969,21 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult82 = linkUp and pingResultLinkUp
- utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
+ caseResult80 = linkUp and pingResult
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL" )
+ # Printing what exactly failed
+ if not linkUp:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
def CASE73( self, main ):
"""
@@ -1800,14 +2024,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkDown = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
- if not pingResultLinkDown:
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1815,15 +2065,23 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult73 = pingResultLinkDown
- utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
+ caseResult70 = linkDown and pingResult and intentState
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
onpass="Random Link cut Test PASS",
onfail="Random Link cut Test FAIL" )
+ # Printing what exactly failed
+ if not linkDown:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
+
def CASE83( self, main ):
"""
Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
@@ -1859,14 +2117,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkUp = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
- if not pingResultLinkUp:
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1874,14 +2158,21 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult83 = linkUp and pingResultLinkUp
- utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
+ caseResult80 = linkUp and pingResult
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL" )
+ # Printing what exactly failed
+ if not linkUp:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
def CASE74( self, main ):
"""
@@ -1933,14 +2224,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkDown = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
- if not pingResultLinkDown:
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -1948,15 +2265,23 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult74 = linkDown and pingResultLinkDown
- utilities.assert_equals( expect=main.TRUE, actual=caseResult74,
+ caseResult70 = linkDown and pingResult and intentState
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
onpass="Random Link cut Test PASS",
onfail="Random Link cut Test FAIL" )
+ # Printing what exactly failed
+ if not linkDown:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
+
def CASE84( self, main ):
"""
Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
@@ -1993,14 +2318,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkUp = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
- if not pingResultLinkUp:
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -2008,14 +2359,21 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult84 = linkUp and pingResultLinkUp
- utilities.assert_equals( expect=main.TRUE, actual=caseResult84,
+ caseResult80 = linkUp and pingResult
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL" )
+ # Printing what exactly failed
+ if not linkUp:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
def CASE75( self, main ):
"""
@@ -2067,14 +2425,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkDown = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
- if not pingResultLinkDown:
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -2082,15 +2466,23 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult75 = linkDown and pingResultLinkDown
- utilities.assert_equals( expect=main.TRUE, actual=caseResult75,
+ caseResult70 = linkDown and pingResult and intentState
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
onpass="Random Link cut Test PASS",
onfail="Random Link cut Test FAIL" )
+ # Printing what exactly failed
+ if not linkDown:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
+
def CASE85( self, main ):
"""
Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
@@ -2127,14 +2519,40 @@
str( link_sleep ) +
" seconds" )
+ main.step("Verify intents are installed")
+ # Checking a maximum of 3
+ for i in range(3):
+ if i != 0:
+ main.log.warn( "Verification failed. Retrying..." )
+ main.log.info("Giving onos some time...")
+ 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 = main.intentIds ) and\
+ intentState
+ if not intentState:
+ main.log.warn( "Not all intents installed" )
+ if intentState:
+ break
+ else:
+ #Dumping intent summary
+ main.log.info( "**** Intent Summary ****\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 Ping across all hosts" )
- pingResultLinkUp = main.FALSE
+ pingResult = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
- if not pingResultLinkUp:
+ pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+ if not pingResult:
main.log.warn("First pingall failed. Retrying...")
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
@@ -2142,14 +2560,21 @@
"Time taken for Ping All: " +
str( timeDiff ) +
" seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult85 = linkUp and pingResultLinkUp
- utilities.assert_equals( expect=main.TRUE, actual=caseResult85,
+ caseResult80 = linkUp and pingResult
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL" )
+ # Printing what exactly failed
+ if not linkUp:
+ main.log.debug( "Link down was not discovered correctly" )
+ if not pingResult:
+ main.log.debug( "Pingall failed" )
+ if not intentState:
+ main.log.debug( "Intents are not all installed" )
def CASE170( self ):
"""
@@ -2614,33 +3039,36 @@
intentIdList.append(thread.result)
time2 = time.time()
main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
- intentResult = main.TRUE
- intentsJson = main.ONOScli1.intents()
- getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
- intentsJson = intentsJson)
- # Takes awhile for all the onos to get the intents
- time.sleep(60)
+
+ # Saving intent ids to check intents in later case
+ main.intentIds = list(intentIdList)
main.step("Verify intents are installed")
+
+ # Giving onos 3 chances to install intents
for i in range(3):
+ 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
- failedIntents = 0
- for intent in getIntentStateResult:
- state = intent.items()[0][1]
- if state != 'INSTALLED':
- main.log.info("Intent State: " + state)
- failedIntents += 1
- intentState = main.FALSE
+ 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
- main.log.error("Total: " + str(failedIntents))
- time.sleep(5)
+ 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 Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
@@ -2655,7 +3083,7 @@
onpass="PING tALL PASS",
onfail="PING ALL FAIL" )
- case90Result = ( intentResult and pingResult )
+ case90Result = ( intentState and pingResult )
utilities.assert_equals(
expect=main.TRUE,
@@ -2697,33 +3125,36 @@
intentIdList.append(thread.result)
time2 = time.time()
main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
- intentResult = main.TRUE
- intentsJson = main.ONOScli1.intents()
- getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
- intentsJson = intentsJson)
- # Takes awhile for all the onos to get the intents
- time.sleep(30)
+
+ # Saving intent ids to check intents in later case
+ main.intentIds = list(intentIdList)
main.step("Verify intents are installed")
+
+ # Giving onos 3 chances to install intents
for i in range(3):
+ 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
- failedIntents = 0
- for intent in getIntentStateResult:
- state = intent.items()[0][1]
- if state != 'INSTALLED':
- main.log.info("Intent State: " + state)
- failedIntents += 1
- intentState = main.FALSE
+ 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
- main.log.error("Total: " + str(failedIntents))
- time.sleep(5)
+ 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 Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
@@ -2738,7 +3169,7 @@
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- case91Result = ( intentResult and pingResult )
+ case91Result = ( intentState and pingResult )
utilities.assert_equals(
expect=main.TRUE,
@@ -2783,34 +3214,36 @@
intentIdList.append(thread.result)
time2 = time.time()
main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
- intentResult = main.TRUE
- intentsJson = main.ONOScli1.intents()
- getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
- intentsJson = intentsJson)
- #print getIntentStateResult
- # Takes awhile for all the onos to get the intents
- time.sleep(60)
+
+ # Saving intent ids to check intents in later case
+ main.intentIds = list(intentIdList)
main.step("Verify intents are installed")
+
+ # Giving onos 3 chances to install intents
for i in range(3):
+ 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
- failedIntents = 0
- for intent in getIntentStateResult:
- state = intent.items()[0][1]
- if state != 'INSTALLED':
- main.log.info("Intent State: " + state)
- failedIntents += 1
- intentState = main.FALSE
+ 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
- main.log.error("Total: " + str(failedIntents))
- time.sleep(5)
+ 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 Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
@@ -2825,7 +3258,7 @@
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- case92Result = ( intentResult and pingResult )
+ case92Result = ( intentState and pingResult )
utilities.assert_equals(
expect=main.TRUE,
@@ -2840,13 +3273,14 @@
"""
import copy
import time
+ from collections import Counter
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 = []
- 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 = []
@@ -2861,7 +3295,6 @@
name="addMultipointToSinglepointIntent",
args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
pool.append(t)
- #time.sleep(1)
t.start()
i = i + 1
main.threadID = main.threadID + 1
@@ -2870,38 +3303,55 @@
intentIdList.append(thread.result)
time2 = time.time()
main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
- time.sleep(30)
- print "getting all intents ID"
- intentIdTemp = main.ONOScli1.getAllIntentsId()
- print intentIdTemp
- print len(intentIdList)
- print intentIdList
- checkIntentStateResult = main.TRUE
- print "Checking intents state"
- 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 " )
+ main.step("Verify intents are installed")
- print "Checking flows state "
+ # Giving onos 3 chances to install intents
+ for i in range(3):
+ 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.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 Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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" )
- checkFlowsState = main.ONOScli1.checkFlowsState()
- case93Result = pingResult
+
+ case93Result = ( checkFlowsState and pingResult and intentState )
utilities.assert_equals(
expect=main.TRUE,
actual=case93Result,
@@ -2936,7 +3386,6 @@
name="addMultipointToSinglepointIntent",
args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
pool.append(t)
- #time.sleep(1)
t.start()
i = i + 1
main.threadID = main.threadID + 1
@@ -2945,11 +3394,42 @@
intentIdList.append(thread.result)
time2 = time.time()
main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
- time.sleep(5)
+
+ main.step("Verify intents are installed")
+
+ # Giving onos 3 chances to install intents
+ for i in range(3):
+ 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 Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -2957,7 +3437,8 @@
str( timeDiff ) +
" seconds" )
- case94Result = pingResult
+
+ case94Result = ( pingResult and intentState )
utilities.assert_equals(
expect=main.TRUE,
actual=case94Result,
@@ -2993,7 +3474,6 @@
name="addSinglepointToMultipointIntent",
args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
pool.append(t)
- #time.sleep(1)
t.start()
i = i + 1
main.threadID = main.threadID + 1
@@ -3002,11 +3482,42 @@
intentIdList.append(thread.result)
time2 = time.time()
main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
- time.sleep(5)
+
+ main.step("Verify intents are installed")
+
+ # Giving onos 3 chances to install intents
+ for i in range(3):
+ 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 Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -3014,7 +3525,7 @@
str( timeDiff ) +
" seconds" )
- case96Result = pingResult
+ case96Result = ( pingResult and intentState )
utilities.assert_equals(
expect=main.TRUE,
actual=case96Result,
@@ -3048,7 +3559,6 @@
name="addSinglepointToMultipointIntent",
args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
pool.append(t)
- #time.sleep(1)
t.start()
i = i + 1
main.threadID = main.threadID + 1
@@ -3057,11 +3567,42 @@
intentIdList.append(thread.result)
time2 = time.time()
main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
- time.sleep(5)
+
+ main.step("Verify intents are installed")
+
+ # Giving onos 3 chances to install intents
+ for i in range(3):
+ 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 Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -3069,7 +3610,7 @@
str( timeDiff ) +
" seconds" )
- case97Result = pingResult
+ case97Result = ( pingResult and intentState )
utilities.assert_equals(
expect=main.TRUE,
actual=case97Result,
@@ -3110,7 +3651,6 @@
name="addSinglepointToMultipointIntent",
args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
pool.append(t)
- #time.sleep(1)
t.start()
i = i + 1
main.threadID = main.threadID + 1
@@ -3119,11 +3659,42 @@
intentIdList.append(thread.result)
time2 = time.time()
main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
- time.sleep(5)
+
+ main.step("Verify intents are installed")
+
+ # Giving onos 3 chances to install intents
+ for i in range(3):
+ 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 Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -3131,7 +3702,7 @@
str( timeDiff ) +
" seconds" )
- case98Result = pingResult
+ case98Result = ( pingResult and intentState )
utilities.assert_equals(
expect=main.TRUE,
actual=case98Result,
diff --git a/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py b/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
index 7577d49..4bbc0bb 100644
--- a/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
+++ b/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
@@ -404,12 +404,12 @@
Getstatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/',
'GET', None, None )
utilities.assert_equals(
- expect='The tenantNetwork does not exists',
+ expect='Network is not found',
actual=result,
onpass="Get Success",
onfail="Get Failed " + str( Getstatus ) + str( result ) )
- if result != 'The tenantNetwork does not exists':
+ if result != 'Network is not found':
main.log.error( "Delete Network failed" )
def CASE5( self, main ):
@@ -675,12 +675,12 @@
Getstatus, result = main.ONOSrest.send( ctrlip, port, subnet.id, path + 'subnets/',
'GET', None, None )
utilities.assert_equals(
- expect='The subnet does not exists',
+ expect='Subnet is not found',
actual=result,
onpass="Get Subnet Success",
onfail="Get Subnet Failed " + str( Getstatus ) + str( result ) )
- if result != 'The subnet does not exists':
+ if result != 'Subnet is not found':
main.log.error( "Delete Subnet failed" )
def CASE8( self, main ):
@@ -998,12 +998,12 @@
Getstatus, result = main.ONOSrest.send( ctrlip, httpport, port.id, path + 'ports/',
'GET', None, None )
utilities.assert_equals(
- expect='The virtualPort does not exists',
+ expect='VirtualPort is not found',
actual=result,
onpass="Get Port Success",
onfail="Get Port Failed " + str( Getstatus ) + "," + str( result ) )
- if result != 'The virtualPort does not exists':
+ if result != 'VirtualPort is not found':
main.log.error( "Delete Port failed" )
main.step( "Clean Data via HTTP" )
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HAclusterRestart/HAclusterRestart.py
index 3026c1e..d77450a 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.py
@@ -2947,7 +2947,7 @@
for candidates in newAllCandidates:
if set( candidates ) != set( newCandidates ):
newLeaderResult = main.FALSE
- main.error.log( "Discrepancy in candidate lists detected" )
+ main.log.error( "Discrepancy in candidate lists detected" )
# Check that the new leader is not the older leader, which was withdrawn
if newLeader == oldLeader:
@@ -3032,7 +3032,7 @@
for candidates in newAllCandidates:
if set( candidates ) != set( newCandidates ):
newLeaderResult = main.FALSE
- main.error.log( "Discrepancy in candidate lists detected" )
+ main.log.error( "Discrepancy in candidate lists detected" )
# Check that the re-elected node is last on the candidate List
if oldLeader != newCandidates[ -1 ]:
diff --git a/TestON/tests/HAminorityRestart/HAminorityRestart.py b/TestON/tests/HAminorityRestart/HAminorityRestart.py
index 69c0645..d175fd7 100644
--- a/TestON/tests/HAminorityRestart/HAminorityRestart.py
+++ b/TestON/tests/HAminorityRestart/HAminorityRestart.py
@@ -2894,7 +2894,7 @@
for candidates in newAllCandidates:
if set( candidates ) != set( newCandidates ):
newLeaderResult = main.FALSE
- main.error.log( "Discrepancy in candidate lists detected" )
+ main.log.error( "Discrepancy in candidate lists detected" )
# Check that the new leader is not the older leader, which was withdrawn
if newLeader == oldLeader:
@@ -2979,7 +2979,7 @@
for candidates in newAllCandidates:
if set( candidates ) != set( newCandidates ):
newLeaderResult = main.FALSE
- main.error.log( "Discrepancy in candidate lists detected" )
+ main.log.error( "Discrepancy in candidate lists detected" )
# Check that the re-elected node is last on the candidate List
if oldLeader != newCandidates[ -1 ]:
diff --git a/TestON/tests/HAsanity/HAsanity.py b/TestON/tests/HAsanity/HAsanity.py
index e136d5e..4f8fadc 100644
--- a/TestON/tests/HAsanity/HAsanity.py
+++ b/TestON/tests/HAsanity/HAsanity.py
@@ -2846,7 +2846,7 @@
for candidates in newAllCandidates:
if set( candidates ) != set( newCandidates ):
newLeaderResult = main.FALSE
- main.error.log( "Discrepancy in candidate lists detected" )
+ main.log.error( "Discrepancy in candidate lists detected" )
# Check that the new leader is not the older leader, which was withdrawn
if newLeader == oldLeader:
@@ -2931,7 +2931,7 @@
for candidates in newAllCandidates:
if set( candidates ) != set( newCandidates ):
newLeaderResult = main.FALSE
- main.error.log( "Discrepancy in candidate lists detected" )
+ main.log.error( "Discrepancy in candidate lists detected" )
# Check that the re-elected node is last on the candidate List
if oldLeader != newCandidates[ -1 ]:
diff --git a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index a2602d1..19cc462 100644
--- a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -2020,7 +2020,7 @@
for candidates in newAllCandidates:
if set( candidates ) != set( newCandidates ):
newLeaderResult = main.FALSE
- main.error.log( "Discrepancy in candidate lists detected" )
+ main.log.error( "Discrepancy in candidate lists detected" )
# Check that the new leader is not the older leader, which was withdrawn
if newLeader == oldLeader:
@@ -2105,7 +2105,7 @@
for candidates in newAllCandidates:
if set( candidates ) != set( newCandidates ):
newLeaderResult = main.FALSE
- main.error.log( "Discrepancy in candidate lists detected" )
+ main.log.error( "Discrepancy in candidate lists detected" )
# Check that the re-elected node is last on the candidate List
if oldLeader != newCandidates[ -1 ]:
diff --git a/TestON/tests/SCPFswitchLat/SCPFswitchLat.params b/TestON/tests/SCPFswitchLat/SCPFswitchLat.params
index 701c034..4306fa0 100644
--- a/TestON/tests/SCPFswitchLat/SCPFswitchLat.params
+++ b/TestON/tests/SCPFswitchLat/SCPFswitchLat.params
@@ -39,7 +39,7 @@
<ofpRoleReply>OF 1.3 90 of_role_reply</ofpRoleReply>
<featureReply>OF 1.3 98 of_features_reply</featureReply>
<roleRequest>OF 1.3 90 of_role_request</roleRequest>
- <tcpSynAck>TCP 74 6653</tcpSynAck>
+ <tcpSynAck>TCP 74 openflow</tcpSynAck>
<finAckSequence>FIN</finAckSequence>
</TSHARK>
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py b/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
similarity index 86%
rename from TestON/tests/USECASE_SdnipI2/Dependency/Functions.py
rename to TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
index 1b93f49..ddd8c1e 100644
--- a/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py
+++ b/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
@@ -9,8 +9,8 @@
main.log.info( routeNumActual )
utilities.assertEquals( \
expect = routeNumExpected, actual = routeNumActual,
- onpass = "***Route number is correct!***",
- onfail = "***Route number is wrong!***" )
+ onpass = "Route number is correct!",
+ onfail = "Route number is wrong!" )
def checkM2SintentNum( main, intentNumExpected ):
main.step( "Check M2S intents installed" )
@@ -23,8 +23,8 @@
main.log.info( intentNumActual )
utilities.assertEquals( \
expect = intentNumExpected, actual = intentNumActual,
- onpass = "***M2S intent number is correct!***",
- onfail = "***M2S intent number is wrong!***" )
+ onpass = "M2S intent number is correct!",
+ onfail = "M2S intent number is wrong!" )
def checkP2PintentNum( main, intentNumExpected ):
main.step( "Check P2P intents installed" )
@@ -37,8 +37,8 @@
main.log.info( intentNumActual )
utilities.assertEquals( \
expect = intentNumExpected, actual = intentNumActual,
- onpass = "***P2P intent number is correct!***",
- onfail = "***P2P intent number is wrong!***" )
+ onpass = "P2P intent number is correct!",
+ onfail = "P2P intent number is wrong!" )
def checkFlowNum( main, switch, flowNumExpected ):
main.step( "Check flow entry number in " + switch )
@@ -49,8 +49,8 @@
main.log.info( flowNumActual )
utilities.assertEquals( \
expect = flowNumExpected, actual = flowNumActual,
- onpass = "***Flow number in " + switch + " is correct!***",
- onfail = "***Flow number in " + switch + " is wrong!***" )
+ onpass = "Flow number in " + switch + " is correct!",
+ onfail = "Flow number in " + switch + " is wrong!" )
def pingSpeakerToPeer( main, speakers = ["speaker1"],
@@ -66,19 +66,17 @@
"""
if len( speakers ) == 0:
main.log.error( "Parameter speakers can not be empty." )
- main.clearUp()
+ main.cleanup()
main.exit()
if len( peers ) == 0:
main.log.error( "Parameter speakers can not be empty." )
- main.clearUp()
+ main.cleanup()
main.exit()
if expectAllSuccess:
- main.step( "Check ping between BGP peers and speakers, expect all tests\
- will SUCCEED" )
+ main.step( "BGP speakers ping peers, expect all tests to succeed" )
else:
- main.step( "Check ping between BGP peers and speakers, expect all tests\
- will FAIL" )
+ main.step( "BGP speakers ping peers, expect all tests to fail" )
result = True
if expectAllSuccess:
@@ -98,7 +96,7 @@
onfail = "Ping test results are Not expected" )
if result == False:
- main.clearUp()
+ main.cleanup()
main.exit()
@@ -114,7 +112,7 @@
main.step( "Check ping between each host pair" )
if len( hosts ) == 0:
main.log.error( "Parameter hosts can not be empty." )
- main.clearUp()
+ main.cleanup()
main.exit()
result = True
@@ -137,7 +135,9 @@
onpass = "Ping test results are expected",
onfail = "Ping test results are Not expected" )
+ '''
if result == False:
main.cleanup()
main.exit()
+ '''
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py b/TestON/tests/USECASE_SdnipFunction/Dependency/USECASE_SdnipI2MN.py
similarity index 99%
rename from TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py
rename to TestON/tests/USECASE_SdnipFunction/Dependency/USECASE_SdnipI2MN.py
index 30b7b25..17544d1 100755
--- a/TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py
+++ b/TestON/tests/USECASE_SdnipFunction/Dependency/USECASE_SdnipI2MN.py
@@ -25,8 +25,8 @@
QUAGGA_DIR = '/usr/lib/quagga'
QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
-QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipI2/Dependency/'
-onos1IP = '10.128.4.52'
+QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipFunction/Dependency/'
+# onos1IP = '10.254.1.201'
numSw = 39
@@ -338,10 +338,11 @@
swCtl100.cmd( 'ovs-vsctl set-fail-mode swCtl100 standalone' )
# connect all switches to controller
+ '''
for i in range ( 1, numSw + 1 ):
swX = net.get( 'sw%s' % ( i ) )
swX.cmd( 'ovs-vsctl set-controller sw%s tcp:%s:6653' % ( i, onos1IP ) )
-
+ '''
# Start Quagga on border routers
'''
for i in range ( 64514, 64516 + 1 ):
@@ -367,12 +368,12 @@
hosts = [ peer64514, peer64515, peer64516, host64514];
startsshds( hosts )
#
-
+ '''
forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', onos1IP )
root.cmd( 'ssh -nNT -o "PasswordAuthentication no" \
-o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, onos1IP ) )
-
+ '''
# time.sleep( 3000000000 )
CLI( net )
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/quagga-sdn.conf b/TestON/tests/USECASE_SdnipFunction/Dependency/quagga-sdn.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipI2/Dependency/quagga-sdn.conf
rename to TestON/tests/USECASE_SdnipFunction/Dependency/quagga-sdn.conf
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/quagga64514.conf b/TestON/tests/USECASE_SdnipFunction/Dependency/quagga64514.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipI2/Dependency/quagga64514.conf
rename to TestON/tests/USECASE_SdnipFunction/Dependency/quagga64514.conf
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/quagga64515.conf b/TestON/tests/USECASE_SdnipFunction/Dependency/quagga64515.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipI2/Dependency/quagga64515.conf
rename to TestON/tests/USECASE_SdnipFunction/Dependency/quagga64515.conf
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/quagga64516.conf b/TestON/tests/USECASE_SdnipFunction/Dependency/quagga64516.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipI2/Dependency/quagga64516.conf
rename to TestON/tests/USECASE_SdnipFunction/Dependency/quagga64516.conf
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/zebra.conf b/TestON/tests/USECASE_SdnipFunction/Dependency/zebra.conf
similarity index 100%
rename from TestON/tests/USECASE_SdnipI2/Dependency/zebra.conf
rename to TestON/tests/USECASE_SdnipFunction/Dependency/zebra.conf
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.params
similarity index 85%
rename from TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
rename to TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.params
index 1575799..6e00c17 100644
--- a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
+++ b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.params
@@ -9,7 +9,7 @@
<CTRL>
<numCtrl>1</numCtrl>
- <ip1>10.128.4.52</ip1>
+ <ip1>OC1</ip1>
<port1>6653</port1>
</CTRL>
@@ -25,17 +25,19 @@
</JSON>
<DEPENDENCY>
- <path>/USECASE_SdnipI2/Dependency/</path>
+ <path>/USECASE_SdnipFunction/Dependency/</path>
<topology>USECASE_SdnipI2MN.py</topology>
<wrapper1>Functions</wrapper1>
</DEPENDENCY>
<config>
<peerNum> 3 </peerNum>
+ <switchNum> 39 </switchNum>
</config>
<timers>
<SdnIpSetup>10</SdnIpSetup>
+ <TopoDiscovery>60</TopoDiscovery>
<PingTestWithRoutes>20</PingTestWithRoutes>
<PingTestWithoutRoutes>100</PingTestWithoutRoutes>
<RouteDelivery>60</RouteDelivery>
diff --git a/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py
new file mode 100644
index 0000000..9e160d3
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py
@@ -0,0 +1,665 @@
+# Testing the functionality of SDN-IP with single ONOS instance
+class USECASE_SdnipFunction:
+
+ def __init__( self ):
+ self.default = ''
+ global branchName
+
+ # This case is to setup Mininet testbed
+ def CASE100( self, main ):
+ """
+ Start mininet
+ """
+ import os
+ import imp
+ main.log.case( "Setup the Mininet testbed" )
+ main.dependencyPath = main.testDir + \
+ main.params[ 'DEPENDENCY' ][ 'path' ]
+ main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+
+ main.step( "Starting Mininet Topology" )
+ topology = main.dependencyPath + main.topology
+ topoResult = main.Mininet.startNet( topoFile = topology )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = topoResult,
+ onpass = "Successfully loaded topology",
+ onfail = "Failed to load topology" )
+ # Exit if topology did not load properly
+ if not topoResult:
+ main.cleanup()
+ main.exit()
+ main.step( "Connect switches to controller" )
+
+ global ONOS1Ip
+ ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
+ # connect all switches to controller
+ swResult = main.TRUE
+ for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
+ sw = "sw%s" % ( i )
+ swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip )
+ # swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip, port = "6633" )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = swResult,
+ onpass = "Successfully connect all switches to ONOS",
+ onfail = "Failed to connect all switches to ONOS" )
+ if not swResult:
+ main.cleanup()
+ main.exit()
+
+ main.step( "Set up tunnel from Mininet node to onos node" )
+ forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', ONOS1Ip )
+ command = 'ssh -nNT -o "PasswordAuthentication no" \
+ -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, ONOS1Ip )
+
+ tunnelResult = main.TRUE
+ tunnelResult = main.Mininet.node( "root", command )
+ utilities.assert_equals( expect = True,
+ actual = ( "PasswordAuthentication" in tunnelResult ),
+ onpass = "Created tunnel succeeded",
+ onfail = "Create tunnel failed" )
+ if ("PasswordAuthentication" not in tunnelResult) :
+ main.cleanup()
+ main.exit()
+
+
+ # This case is to setup ONOS
+ def CASE101( self, main ):
+ """
+ Compile ONOS and install it
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ import json
+ import time
+ from operator import eq
+
+ main.case( "Setting up test environment" )
+
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = cellResult,
+ onpass = "Set cell succeeded",
+ onfail = "Set cell failed" )
+
+ verifyResult = main.ONOSbench.verifyCell()
+ utilities.assert_equals( expect = main.TRUE,
+ actual = verifyResult,
+ onpass = "Verify cell succeeded",
+ onfail = "Verify cell failed" )
+
+ branchName = main.ONOSbench.getBranchName()
+ main.log.report( "ONOS is on branch: " + branchName )
+
+ main.log.step( "Uninstalling ONOS" )
+ uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = uninstallResult,
+ onpass = "Uninstall ONOS succeeded",
+ onfail = "Uninstall ONOS failed" )
+
+ main.step( "Git pull" )
+ gitPullResult = main.ONOSbench.gitPull()
+ main.log.info( "gitPullResult" )
+ main.log.info( gitPullResult )
+ gitPullResult2 = ( gitPullResult == main.TRUE ) or ( gitPullResult == 3 )
+ utilities.assert_equals( expect = True,
+ actual = gitPullResult2,
+ onpass = "Git pull ONOS succeeded",
+ onfail = "Git pull ONOS failed" )
+
+ main.step( "Using mvn clean install" )
+ if gitPullResult == main.TRUE:
+ mciResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = mciResult,
+ onpass = "Maven clean install ONOS succeeded",
+ onfail = "Maven clean install ONOS failed" )
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
+ mciResult = main.TRUE
+
+ main.ONOSbench.getVersion( report = True )
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = packageResult,
+ onpass = "Package ONOS succeeded",
+ onfail = "Package ONOS failed" )
+
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
+ node = ONOS1Ip )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = onos1InstallResult,
+ onpass = "Install ONOS succeeded",
+ onfail = "Install ONOS failed" )
+
+ main.step( "Checking if ONOS is up yet" )
+ onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = onos1UpResult,
+ onpass = "ONOS is up",
+ onfail = "ONOS is NOT up" )
+
+ main.step( "Checking if ONOS CLI is ready" )
+ cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
+ commandlineTimeout = 100, onosStartTimeout = 600 )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = cliResult,
+ onpass = "ONOS CLI is ready",
+ onfail = "ONOS CLI is NOT ready" )
+
+ caseResult = ( cellResult and verifyResult and
+ gitPullResult2 and mciResult and packageResult and
+ onos1InstallResult and onos1UpResult and cliResult )
+
+ utilities.assert_equals( expect = main.TRUE, actual = caseResult,
+ onpass = "ONOS startup successful",
+ onfail = "ONOS startup NOT successful" )
+
+ if caseResult == main.FALSE:
+ main.log.info( "ONOS startup failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.log.info( "Get links in the network" )
+ time.sleep( int ( main.params['timers']['TopoDiscovery'] ) )
+ summaryResult = main.ONOScli.summary()
+ linkNum = json.loads( summaryResult )[ "links" ]
+ if linkNum < 100:
+ main.log.info( "Link number is wrong!" )
+ listResult = main.ONOScli.links( jsonFormat = False )
+ main.log.info( listResult )
+ main.cleanup()
+ main.exit()
+
+ listResult = main.ONOScli.links( jsonFormat = False )
+ main.log.info( listResult )
+
+ main.step( "Activate sdn-ip application" )
+ activeSDNIPresult = main.ONOScli.activateApp( "org.onosproject.sdnip" )
+ utilities.assert_equals( expect = main.TRUE,
+ actual = activeSDNIPresult,
+ onpass = "Activate SDN-IP succeeded",
+ onfail = "Activate SDN-IP failed" )
+ if not activeSDNIPresult:
+ main.log.info( "Activate SDN-IP failed!" )
+ main.cleanup()
+ main.exit()
+
+
+ main.log.info( "Wait SDN-IP to finish installing connectivity intents \
+ and the BGP paths in data plane are ready..." )
+ time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
+ main.log.info( "Wait Quagga to finish delivery all routes to each \
+ other and to sdn-ip, plus finish installing all intents..." )
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
+
+
+ def CASE102( self, main ):
+ '''
+ This test case is to load the methods from other Python files.
+ '''
+ main.case( "Loading methods from other Python file" )
+ # load the methods from other file
+ wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+ main.Functions = imp.load_source( wrapperFile,
+ main.dependencyPath +
+ wrapperFile +
+ ".py" )
+
+
+ def CASE1( self, main ):
+ '''
+ ping test from 3 bgp peers to BGP speaker
+ '''
+
+ main.case( "Ping tests between BGP peers and speakers" )
+ main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+ peers = ["peer64514", "peer64515", "peer64516"],
+ expectAllSuccess = True )
+
+
+ def CASE2( self, main ):
+ '''
+ point-to-point intents test for each BGP peer and BGP speaker pair
+ '''
+ main.case( "Check point-to-point intents" )
+ main.log.info( "There are %s BGP peers in total "
+ % main.params[ 'config' ][ 'peerNum' ] )
+ main.step( "Check P2P intents number from ONOS CLI" )
+
+ getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+ bgpIntentsActualNum = \
+ main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
+ bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
+ main.log.info( "bgpIntentsExpected num is:" )
+ main.log.info( bgpIntentsExpectedNum )
+ main.log.info( "bgpIntentsActual num is:" )
+ main.log.info( bgpIntentsActualNum )
+ utilities.assertEquals( \
+ expect = True,
+ actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
+ onpass = "PointToPointIntent Intent Num is correct!",
+ onfail = "PointToPointIntent Intent Num is wrong!" )
+
+
+ def CASE3( self, main ):
+ '''
+ routes and intents check to all BGP peers
+ '''
+ main.case( "Check routes and M2S intents to all BGP peers" )
+
+ allRoutesExpected = []
+ allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
+ allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
+ allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
+
+ getRoutesResult = main.ONOScli.routes( jsonFormat = True )
+ allRoutesActual = \
+ main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
+ allRoutesStrExpected = str( sorted( allRoutesExpected ) )
+ allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
+
+ main.step( "Check routes installed" )
+ main.log.info( "Routes expected:" )
+ main.log.info( allRoutesStrExpected )
+ main.log.info( "Routes get from ONOS CLI:" )
+ main.log.info( allRoutesStrActual )
+ utilities.assertEquals( \
+ expect = allRoutesStrExpected, actual = allRoutesStrActual,
+ onpass = "Routes are correct!",
+ onfail = "Routes are wrong!" )
+
+ main.step( "Check M2S intents installed" )
+ getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+ routeIntentsActualNum = \
+ main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
+ routeIntentsExpectedNum = 3
+
+ main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
+ main.log.info( routeIntentsExpectedNum )
+ main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
+ main.log.info( routeIntentsActualNum )
+ utilities.assertEquals( \
+ expect = True,
+ actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
+ onpass = "MultiPointToSinglePoint Intent Num is correct!",
+ onfail = "MultiPointToSinglePoint Intent Num is wrong!" )
+
+ main.step( "Check whether all flow status are ADDED" )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+ onpass = "Flow status is correct!",
+ onfail = "Flow status is wrong!" )
+
+
+ def CASE4( self, main ):
+ '''
+ Ping test in data plane for each route
+ '''
+ main.case( "Ping test for each route, all hosts behind BGP peers" )
+ main.Functions.pingHostToHost( main,
+ hosts = ["host64514", "host64515", "host64516"],
+ expectAllSuccess = True )
+
+
+ def CASE5( self, main ):
+ '''
+ Cut links to peers one by one, check routes/intents
+ '''
+ import time
+ main.case( "Bring down links and check routes/intents" )
+ main.step( "Bring down the link between sw32 and peer64514" )
+ linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
+ OPTION = "down" )
+ utilities.assertEquals( expect = main.TRUE,
+ actual = linkResult1,
+ onpass = "Bring down link succeeded!",
+ onfail = "Bring down link failed!" )
+
+ if linkResult1 == main.TRUE:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 2 )
+ main.Functions.checkM2SintentNum( main, 2 )
+ else:
+ main.log.info( "Bring down link failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Bring down the link between sw8 and peer64515" )
+ linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
+ OPTION = "down" )
+ utilities.assertEquals( expect = main.TRUE,
+ actual = linkResult2,
+ onpass = "Bring down link succeeded!",
+ onfail = "Bring down link failed!" )
+ if linkResult2 == main.TRUE:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 1 )
+ main.Functions.checkM2SintentNum( main, 1 )
+ else:
+ main.log.info( "Bring down link failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Bring down the link between sw28 and peer64516" )
+ linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
+ OPTION = "down" )
+ utilities.assertEquals( expect = main.TRUE,
+ actual = linkResult3,
+ onpass = "Bring down link succeeded!",
+ onfail = "Bring down link failed!" )
+ if linkResult3 == main.TRUE:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 0 )
+ main.Functions.checkM2SintentNum( main, 0 )
+ else:
+ main.log.info( "Bring down link failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Check whether all flow status are ADDED" )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+ onpass = "Flow status is correct!",
+ onfail = "Flow status is wrong!" )
+
+ # Ping test
+ main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+ peers = ["peer64514", "peer64515", "peer64516"],
+ expectAllSuccess = False )
+ main.Functions.pingHostToHost( main,
+ hosts = ["host64514", "host64515", "host64516"],
+ expectAllSuccess = False )
+
+
+ def CASE6( self, main ):
+ '''
+ Recover links to peers one by one, check routes/intents
+ '''
+ import time
+ main.case( "Bring up links and check routes/intents" )
+ main.step( "Bring up the link between sw32 and peer64514" )
+ linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
+ OPTION = "up" )
+ utilities.assertEquals( expect = main.TRUE,
+ actual = linkResult1,
+ onpass = "Bring up link succeeded!",
+ onfail = "Bring up link failed!" )
+ if linkResult1 == main.TRUE:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 1 )
+ main.Functions.checkM2SintentNum( main, 1 )
+ else:
+ main.log.info( "Bring up link failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Bring up the link between sw8 and peer64515" )
+ linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
+ OPTION = "up" )
+ utilities.assertEquals( expect = main.TRUE,
+ actual = linkResult2,
+ onpass = "Bring up link succeeded!",
+ onfail = "Bring up link failed!" )
+ if linkResult2 == main.TRUE:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 2 )
+ main.Functions.checkM2SintentNum( main, 2 )
+ else:
+ main.log.info( "Bring up link failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Bring up the link between sw28 and peer64516" )
+ linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
+ OPTION = "up" )
+ utilities.assertEquals( expect = main.TRUE,
+ actual = linkResult3,
+ onpass = "Bring up link succeeded!",
+ onfail = "Bring up link failed!" )
+ if linkResult3 == main.TRUE:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 3 )
+ main.Functions.checkM2SintentNum( main, 3 )
+ else:
+ main.log.info( "Bring up link failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Check whether all flow status are ADDED" )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+ onpass = "Flow status is correct!",
+ onfail = "Flow status is wrong!" )
+
+ # Ping test
+ main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+ peers = ["peer64514", "peer64515", "peer64516"],
+ expectAllSuccess = True )
+ main.Functions.pingHostToHost( main,
+ hosts = ["host64514", "host64515", "host64516"],
+ expectAllSuccess = True )
+
+
+ def CASE7( self, main ):
+ '''
+ Shut down a edge switch, check P-2-P and M-2-S intents, ping test
+ '''
+ import time
+ main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
+ main.step( "Stop sw32" )
+ result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
+ utilities.assertEquals( expect = main.TRUE, actual = result,
+ onpass = "Stopping switch succeeded!",
+ onfail = "Stopping switch failed!" )
+
+ if result == main.TRUE:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 2 )
+ main.Functions.checkM2SintentNum( main, 2 )
+ main.Functions.checkP2PintentNum( main, 12 )
+ else:
+ main.log.info( "Stopping switch failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Check ping between hosts behind BGP peers" )
+ result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" )
+ result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" )
+ result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" )
+
+ pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
+ and ( result3 == main.FALSE )
+ utilities.assert_equals( expect = True, actual = pingResult1,
+ onpass = "Ping test result is correct",
+ onfail = "Ping test result is wrong" )
+
+ if pingResult1 == False:
+ main.cleanup()
+ main.exit()
+
+ main.step( "Check ping between BGP peers and speakers" )
+ result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
+ result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
+ result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
+
+ pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
+ and ( result6 == main.TRUE )
+ utilities.assert_equals( expect = True, actual = pingResult2,
+ onpass = "Speaker1 ping peers successful",
+ onfail = "Speaker1 ping peers NOT successful" )
+
+ if pingResult2 == False:
+ main.cleanup()
+ main.exit()
+
+ main.step( "Check whether all flow status are ADDED" )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+ onpass = "Flow status is correct!",
+ onfail = "Flow status is wrong!" )
+
+
+ def CASE8( self, main ):
+ '''
+ Bring up the edge switch (sw32) which was shut down in CASE7,
+ check P-2-P and M-2-S intents, ping test
+ '''
+ import time
+ main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
+ main.step( "Start sw32" )
+ result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = result1,
+ onpass = "Starting switch succeeded!",
+ onfail = "Starting switch failed!" )
+
+ result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = result2,
+ onpass = "Connect switch to ONOS succeeded!",
+ onfail = "Connect switch to ONOS failed!" )
+
+ if result1 and result2:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 3 )
+ main.Functions.checkM2SintentNum( main, 3 )
+ main.Functions.checkP2PintentNum( main, 18 )
+ else:
+ main.log.info( "Starting switch failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Check whether all flow status are ADDED" )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+ onpass = "Flow status is correct!",
+ onfail = "Flow status is wrong!" )
+
+ # Ping test
+ main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+ peers = ["peer64514", "peer64515", "peer64516"],
+ expectAllSuccess = True )
+ main.Functions.pingHostToHost( main,
+ hosts = ["host64514", "host64515", "host64516"],
+ expectAllSuccess = True )
+
+
+ def CASE9( self, main ):
+ '''
+ Bring down a switch in best path, check:
+ route number, P2P intent number, M2S intent number, ping test
+ '''
+ main.case( "Stop sw11 located in best path, \
+ check route number, P2P intent number, M2S intent number, ping test" )
+
+ main.log.info( "Check the flow number correctness before stopping sw11" )
+ main.Functions.checkFlowNum( main, "sw11", 13 )
+ main.Functions.checkFlowNum( main, "sw1", 3 )
+ main.Functions.checkFlowNum( main, "sw7", 3 )
+ main.log.info( main.Mininet.checkFlows( "sw11" ) )
+ main.log.info( main.Mininet.checkFlows( "sw1" ) )
+ main.log.info( main.Mininet.checkFlows( "sw7" ) )
+
+ main.step( "Stop sw11" )
+ result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
+ utilities.assertEquals( expect = main.TRUE, actual = result,
+ onpass = "Stopping switch succeeded!",
+ onfail = "Stopping switch failed!" )
+ if result:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 3 )
+ main.Functions.checkM2SintentNum( main, 3 )
+ main.Functions.checkP2PintentNum( main, 18 )
+ else:
+ main.log.info( "Stopping switch failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Check whether all flow status are ADDED" )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+ onpass = "Flow status is correct!",
+ onfail = "Flow status is wrong!" )
+ # Ping test
+ main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+ peers = ["peer64514", "peer64515", "peer64516"],
+ expectAllSuccess = True )
+ main.Functions.pingHostToHost( main,
+ hosts = ["host64514", "host64515", "host64516"],
+ expectAllSuccess = True )
+
+
+ def CASE10( self, main ):
+ '''
+ Bring up the switch which was stopped in CASE9, check:
+ route number, P2P intent number, M2S intent number, ping test
+ '''
+ main.case( "Start sw11 which was stopped in CASE9, \
+ check route number, P2P intent number, M2S intent number, ping test" )
+
+ main.log.info( "Check the flow status before starting sw11" )
+ main.Functions.checkFlowNum( main, "sw1", 11 )
+ main.Functions.checkFlowNum( main, "sw7", 5 )
+ main.log.info( main.Mininet.checkFlows( "sw1" ) )
+ main.log.info( main.Mininet.checkFlows( "sw7" ) )
+
+ main.step( "Start sw11" )
+ result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" )
+ utilities.assertEquals( expect = main.TRUE, actual = result1,
+ onpass = "Starting switch succeeded!",
+ onfail = "Starting switch failed!" )
+ result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip )
+ utilities.assertEquals( expect = main.TRUE, actual = result2,
+ onpass = "Connect switch to ONOS succeeded!",
+ onfail = "Connect switch to ONOS failed!" )
+ if result1 and result2:
+ time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+ main.Functions.checkRouteNum( main, 3 )
+ main.Functions.checkM2SintentNum( main, 3 )
+ main.Functions.checkP2PintentNum( main, 18 )
+
+ main.log.debug( main.Mininet.checkFlows( "sw11" ) )
+ main.log.debug( main.Mininet.checkFlows( "sw1" ) )
+ main.log.debug( main.Mininet.checkFlows( "sw7" ) )
+ else:
+ main.log.info( "Starting switch failed!" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Check whether all flow status are ADDED" )
+ utilities.assertEquals( \
+ expect = main.TRUE,
+ actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+ onpass = "Flow status is correct!",
+ onfail = "Flow status is wrong!" )
+ # Ping test
+ main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+ peers = ["peer64514", "peer64515", "peer64516"],
+ expectAllSuccess = True )
+ main.Functions.pingHostToHost( main,
+ hosts = ["host64514", "host64515", "host64516"],
+ expectAllSuccess = True )
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.topo b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.topo
similarity index 96%
rename from TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.topo
rename to TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.topo
index 7259cb1..07109ba 100644
--- a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.topo
+++ b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.topo
@@ -20,7 +20,7 @@
</ONOScli>
<ONOS1>
- <host>10.128.4.52</host>
+ <host>OC1</host>
<user>sdn</user>
<password></password>
<type>OnosDriver</type>
diff --git a/TestON/tests/USECASE_SdnipI2/__init__.py b/TestON/tests/USECASE_SdnipFunction/__init__.py
similarity index 100%
rename from TestON/tests/USECASE_SdnipI2/__init__.py
rename to TestON/tests/USECASE_SdnipFunction/__init__.py
diff --git a/TestON/tests/USECASE_SdnipI2/network-cfg.json b/TestON/tests/USECASE_SdnipFunction/network-cfg.json
similarity index 100%
rename from TestON/tests/USECASE_SdnipI2/network-cfg.json
rename to TestON/tests/USECASE_SdnipFunction/network-cfg.json
diff --git a/TestON/tests/USECASE_SdnipFunction/sdnip_single_instance b/TestON/tests/USECASE_SdnipFunction/sdnip_single_instance
new file mode 100644
index 0000000..c2c51c6
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunction/sdnip_single_instance
@@ -0,0 +1,13 @@
+export ONOS_CELL="sdnip_single_instance"
+
+export ONOS_INSTALL_DIR="/opt/onos"
+export ONOS_NIC=10.254.1.*
+export OC1="10.254.1.201"
+export OCN="127.0.0.1"
+export OCI="${OC1}"
+export ONOS_USER="sdn" # ONOS user on remote system
+export ONOS_PWD="rocks"
+
+#export ONOS_APPS="drivers,openflow,config,proxyarp"
+export ONOS_APPS="drivers,openflow,proxyarp"
+
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
deleted file mode 100644
index ebc4545..0000000
--- a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
+++ /dev/null
@@ -1,552 +0,0 @@
-# Testing the functionality of SDN-IP with single ONOS instance
-class USECASE_SdnipI2:
-
- def __init__( self ):
- self.default = ''
- global branchName
-
- # This case is to setup Mininet testbed
- def CASE100( self, main ):
- """
- Start mininet
- """
- import os
- import imp
- main.log.case( "Start Mininet topology" )
- main.dependencyPath = main.testDir + \
- main.params[ 'DEPENDENCY' ][ 'path' ]
- main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
-
- main.step( "Starting Mininet Topology" )
- topology = main.dependencyPath + main.topology
- topoResult = main.Mininet.startNet( topoFile = topology )
- stepResult = topoResult
- utilities.assert_equals( expect = main.TRUE,
- actual = stepResult,
- onpass = "Successfully loaded topology",
- onfail = "Failed to load topology" )
- # Exit if topology did not load properly
- if not topoResult:
- main.cleanup()
- main.exit()
-
- # This case is to setup ONOS
- def CASE101( self, main ):
- """
- CASE100 is to compile ONOS and install it
- Startup sequence:
- cell <name>
- onos-verify-cell
- git pull
- mvn clean install
- onos-package
- onos-install -f
- onos-wait-for-start
- """
- import json
- import time
- from operator import eq
-
- main.case( "Setting up test environment" )
-
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- global ONOS1Ip
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.step( "Applying cell variable to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
-
- branchName = main.ONOSbench.getBranchName()
- main.log.info( "ONOS is on branch: " + branchName )
-
- main.log.report( "Uninstalling ONOS" )
- main.ONOSbench.onosUninstall( ONOS1Ip )
-
- # cleanInstallResult = main.TRUE
- # gitPullResult = main.TRUE
-
- main.step( "Git pull" )
- gitPullResult = main.ONOSbench.gitPull()
-
- main.step( "Using mvn clean install" )
- if gitPullResult == main.TRUE:
- cleanInstallResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 )
- else:
- main.log.warn( "Did not pull new code so skipping mvn " +
- "clean install" )
- cleanInstallResult = main.TRUE
-
- main.ONOSbench.getVersion( report = True )
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
-
- main.step( "Installing ONOS package" )
- onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
- node = ONOS1Ip )
-
- main.step( "Checking if ONOS is up yet" )
- for i in range( 2 ):
- onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
- if onos1Isup:
- break
- if not onos1Isup:
- main.log.report( "ONOS1 didn't start!" )
-
- cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
- commandlineTimeout = 100, onosStartTimeout = 600 )
-
- caseResult = ( cleanInstallResult and packageResult and
- cellResult and verifyResult and
- onos1InstallResult and
- onos1Isup and cliResult )
-
- utilities.assert_equals( expect = main.TRUE, actual = caseResult,
- onpass = "ONOS startup successful",
- onfail = "ONOS startup NOT successful" )
-
- if caseResult == main.FALSE:
- main.cleanup()
- main.exit()
-
- main.step( "Get links in the network" )
- listResult = main.ONOScli.links( jsonFormat = False )
- main.log.info( listResult )
- main.log.info( "Activate sdn-ip application" )
- main.ONOScli.activateApp( "org.onosproject.sdnip" )
-
- main.log.info( "Wait sdn-ip to finish installing connectivity intents, \
- and the BGP paths in data plane are ready..." )
- time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
- main.log.info( "Wait Quagga to finish delivery all routes to each \
- other and to sdn-ip, plus finish installing all intents..." )
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
-
-
- def CASE102( self, main ):
- '''
- This test case is to load the methods from other Python files.
- '''
- main.case( "Loading the methods from other Python file" )
- # load the methods from other file
- wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
- main.Functions = imp.load_source( wrapperFile,
- main.dependencyPath +
- wrapperFile +
- ".py" )
-
-
- def CASE1( self, main ):
- '''
- ping test from 3 bgp peers to BGP speaker
- '''
-
- main.case( "This case is to check ping between BGP peers and speakers" )
- main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
- peers = ["peer64514", "peer64515", "peer64516"],
- expectAllSuccess = True )
-
-
- def CASE2( self, main ):
- '''
- point-to-point intents test for each BGP peer and BGP speaker pair
- '''
- main.case( "This case is to check point-to-point intents" )
- main.log.info( "There are %s BGP peers in total "
- % main.params[ 'config' ][ 'peerNum' ] )
- main.step( "Get point-to-point intents from ONOS CLI" )
-
- getIntentsResult = main.ONOScli.intents( jsonFormat = True )
- bgpIntentsActualNum = \
- main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
- bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
- main.log.info( "bgpIntentsExpected num is:" )
- main.log.info( bgpIntentsExpectedNum )
- main.log.info( "bgpIntentsActual num is:" )
- main.log.info( bgpIntentsActualNum )
- utilities.assertEquals( \
- expect = True,
- actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
- onpass = "***PointToPointIntent Intent Num in SDN-IP are correct!***",
- onfail = "***PointToPointIntent Intent Num in SDN-IP are wrong!***" )
-
-
- def CASE3( self, main ):
- '''
- routes and intents check to all BGP peers
- '''
- main.case( "This case is to check routes and intents to all BGP peers" )
-
- allRoutesExpected = []
- allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
- allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
- allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
-
- getRoutesResult = main.ONOScli.routes( jsonFormat = True )
- allRoutesActual = \
- main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
- allRoutesStrExpected = str( sorted( allRoutesExpected ) )
- allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
-
- main.step( "Check routes installed" )
- main.log.info( "Routes expected:" )
- main.log.info( allRoutesStrExpected )
- main.log.info( "Routes get from ONOS CLI:" )
- main.log.info( allRoutesStrActual )
- utilities.assertEquals( \
- expect = allRoutesStrExpected, actual = allRoutesStrActual,
- onpass = "***Routes in SDN-IP are correct!***",
- onfail = "***Routes in SDN-IP are wrong!***" )
-
- main.step( "Check MultiPointToSinglePointIntent intents installed" )
- getIntentsResult = main.ONOScli.intents( jsonFormat = True )
- routeIntentsActualNum = \
- main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
- routeIntentsExpectedNum = 3
-
- main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
- main.log.info( routeIntentsExpectedNum )
- main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
- main.log.info( routeIntentsActualNum )
- utilities.assertEquals( \
- expect = True,
- actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
- onpass = "***MultiPointToSinglePoint Intent Num in SDN-IP is \
- correct!***",
- onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is \
- wrong!***" )
-
- main.step( "Check whether all flow status are ADDED" )
- utilities.assertEquals( \
- expect = main.TRUE,
- actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
- onpass = "***Flow status is correct!***",
- onfail = "***Flow status is wrong!***" )
-
-
- def CASE4( self, main ):
- '''
- Ping test in data plane for each route
- '''
- main.case( "This case is to check ping for each route, \
- all hosts behind BGP peers" )
- main.Functions.pingHostToHost( main,
- hosts = ["host64514", "host64515", "host64516"],
- expectAllSuccess = True )
-
-
- def CASE5( self, main ):
- '''
- Cut links to peers one by one, check routes/intents
- '''
- import time
- main.case( "This case is to bring down links and check routes/intents" )
- main.step( "Bring down the link between sw32 and peer64514" )
- result = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
- OPTION = "down" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 2 )
- main.Functions.checkM2SintentNum( main, 2 )
- else:
- main.log.info( "Bring down link failed!!!" )
- main.exit();
-
- main.step( "Bring down the link between sw8 and peer64515" )
- result = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
- OPTION = "down" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 1 )
- main.Functions.checkM2SintentNum( main, 1 )
- else:
- main.log.info( "Bring down link failed!!!" )
- main.exit();
-
- main.step( "Bring down the link between sw28 and peer64516" )
- result = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
- OPTION = "down" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 0 )
- main.Functions.checkM2SintentNum( main, 0 )
- else:
- main.log.info( "Bring down link failed!!!" )
- main.exit();
-
- main.step( "Check whether all flow status are ADDED" )
- utilities.assertEquals( \
- expect = main.TRUE,
- actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
- onpass = "***Flow status is correct!***",
- onfail = "***Flow status is wrong!***" )
-
- # Ping test
- main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
- peers = ["peer64514", "peer64515", "peer64516"],
- expectAllSuccess = False )
- main.Functions.pingHostToHost( main,
- hosts = ["host64514", "host64515", "host64516"],
- expectAllSuccess = False )
-
-
- def CASE6( self, main ):
- '''
- Recover links to peers one by one, check routes/intents
- '''
- import time
- main.case( "This case is to bring up links and check routes/intents" )
- main.step( "Bring up the link between sw32 and peer64514" )
- result = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
- OPTION = "up" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 1 )
- main.Functions.checkM2SintentNum( main, 1 )
- else:
- main.log.info( "Bring up link failed!!!" )
- main.exit();
-
- main.step( "Bring up the link between sw8 and peer64515" )
- result = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
- OPTION = "up" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 2 )
- main.Functions.checkM2SintentNum( main, 2 )
- else:
- main.log.info( "Bring up link failed!!!" )
- main.exit();
-
- main.step( "Bring up the link between sw28 and peer64516" )
- result = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
- OPTION = "up" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 3 )
- main.Functions.checkM2SintentNum( main, 3 )
- else:
- main.log.info( "Bring up link failed!!!" )
- main.exit();
-
- main.step( "Check whether all flow status are ADDED" )
- utilities.assertEquals( \
- expect = main.TRUE,
- actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
- onpass = "***Flow status is correct!***",
- onfail = "***Flow status is wrong!***" )
-
- # Ping test
- main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
- peers = ["peer64514", "peer64515", "peer64516"],
- expectAllSuccess = True )
- main.Functions.pingHostToHost( main,
- hosts = ["host64514", "host64515", "host64516"],
- expectAllSuccess = True )
-
-
- def CASE7( self, main ):
- '''
- Shut down a edge switch, check P-2-P and M-2-S intents, ping test
- '''
- import time
- main.case( "This case is to stop 1 edge switch,\
- check P-2-P and M-2-S intents, ping test" )
- main.step( "Stop sw32" )
- result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 2 )
- main.Functions.checkM2SintentNum( main, 2 )
- main.Functions.checkP2PintentNum( main, 12 )
- else:
- main.log.info( "Stop switch failed!!!" )
- main.exit();
-
- main.step( "Check ping between hosts behind BGP peers" )
- result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" )
- result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" )
- result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" )
-
- pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
- and ( result3 == main.FALSE )
- utilities.assert_equals( expect = True, actual = pingResult1,
- onpass = "Ping test result is correct",
- onfail = "Ping test result is wrong" )
-
- if pingResult1 == False:
- main.cleanup()
- main.exit()
-
- main.step( "Check ping between BGP peers and speakers" )
- result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
- result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
- result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
-
- pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
- and ( result6 == main.TRUE )
- utilities.assert_equals( expect = True, actual = pingResult2,
- onpass = "Speaker1 ping peers successful",
- onfail = "Speaker1 ping peers NOT successful" )
-
- if pingResult2 == False:
- main.cleanup()
- main.exit()
-
- main.step( "Check whether all flow status are ADDED" )
- utilities.assertEquals( \
- expect = main.TRUE,
- actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
- onpass = "***Flow status is correct!***",
- onfail = "***Flow status is wrong!***" )
-
- '''
- main.step( "Stop sw8" )
- result = main.Mininet.switch( SW = "sw8", OPTION = "stop" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 1 )
-
- # Note: there should be 0 M2S intent, not 1.
- main.Functions.checkM2SintentNum( main, 0 )
- main.Functions.checkP2PintentNum( main, 6 )
- else:
- main.log.info( "Stop switch failed!!!" )
- main.exit();
-
- main.step( "Stop sw28" )
- result = main.Mininet.switch( SW = "sw28", OPTION = "stop" )
- if result == main.TRUE:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 0 )
- main.Functions.checkM2SintentNum( main, 0 )
- main.Functions.checkP2PintentNum( main, 0 )
- else:
- main.log.info( "Stop switch failed!!!" )
- main.exit();
- '''
-
-
- def CASE8( self, main ):
- '''
- Bring up the edge switch which was shut down in CASE7,
- check P-2-P and M-2-S intents, ping test
- '''
- import time
- main.case( "This case is to start the switch which was shut down in CASE7,\
- check P-2-P and M-2-S intents, ping test" )
- main.step( "Start sw32" )
- result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
- result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
-
- if result1 and result2:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 3 )
- main.Functions.checkM2SintentNum( main, 3 )
- main.Functions.checkP2PintentNum( main, 18 )
- else:
- main.log.info( "Start switch failed!!!" )
- main.cleanup()
- main.exit();
-
- main.step( "Check whether all flow status are ADDED" )
- utilities.assertEquals( \
- expect = main.TRUE,
- actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
- onpass = "***Flow status is correct!***",
- onfail = "***Flow status is wrong!***" )
-
- # Ping test
- main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
- peers = ["peer64514", "peer64515", "peer64516"],
- expectAllSuccess = True )
- main.Functions.pingHostToHost( main,
- hosts = ["host64514", "host64515", "host64516"],
- expectAllSuccess = True )
-
-
- def CASE9( self, main ):
- '''
- Bring down a switch in best path, check:
- route number, P2P intent number, M2S intent number, ping test
- '''
- main.case( "This case is to stop switch in best path, \
- check route number, P2P intent number, M2S intent number, ping test" )
-
- main.step( "Check the flow status before stopping sw11" )
- main.Functions.checkFlowNum( main, "sw11", 13 )
- main.Functions.checkFlowNum( main, "sw1", 3 )
- main.Functions.checkFlowNum( main, "sw7", 3 )
- main.log.info( main.Mininet.checkFlows( "sw11" ) )
- main.log.info( main.Mininet.checkFlows( "sw1" ) )
- main.log.info( main.Mininet.checkFlows( "sw7" ) )
-
- main.step( "Stop sw11" )
- result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
- if result:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 3 )
- main.Functions.checkM2SintentNum( main, 3 )
- main.Functions.checkP2PintentNum( main, 18 )
- else:
- main.log.info( "Stop switch failed!!!" )
- main.cleanup()
- main.exit();
-
- main.step( "Check whether all flow status are ADDED" )
- utilities.assertEquals( \
- expect = main.TRUE,
- actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
- onpass = "***Flow status is correct!***",
- onfail = "***Flow status is wrong!***" )
- # Ping test
- main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
- peers = ["peer64514", "peer64515", "peer64516"],
- expectAllSuccess = True )
- main.Functions.pingHostToHost( main,
- hosts = ["host64514", "host64515", "host64516"],
- expectAllSuccess = True )
-
-
- def CASE10( self, main ):
- '''
- Bring up the switch which was stopped in CASE9, check:
- route number, P2P intent number, M2S intent number, ping test
- '''
- main.case( "This case is to start switch which was stopped in CASE9, \
- check route number, P2P intent number, M2S intent number, ping test" )
- main.step( "Start sw11" )
- result = main.Mininet.switch( SW = "sw11", OPTION = "start" )
- if result:
- time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
- main.Functions.checkRouteNum( main, 3 )
- main.Functions.checkM2SintentNum( main, 3 )
- main.Functions.checkP2PintentNum( main, 18 )
-
- main.step( "Check the flow status after stop and start sw11" )
- main.Functions.checkFlowNum( main, "sw11", 3 )
- main.Functions.checkFlowNum( main, "sw1", 11 )
- main.Functions.checkFlowNum( main, "sw7", 5 )
- main.log.info( main.Mininet.checkFlows( "sw11" ) )
- main.log.info( main.Mininet.checkFlows( "sw1" ) )
- main.log.info( main.Mininet.checkFlows( "sw7" ) )
- else:
- main.log.info( "Start switch failed!!!" )
- main.cleanup()
- main.exit();
-
- main.step( "Check whether all flow status are ADDED" )
- utilities.assertEquals( \
- expect = main.TRUE,
- actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
- onpass = "***Flow status is correct!***",
- onfail = "***Flow status is wrong!***" )
- # Ping test
- main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
- peers = ["peer64514", "peer64515", "peer64516"],
- expectAllSuccess = True )
- main.Functions.pingHostToHost( main,
- hosts = ["host64514", "host64515", "host64516"],
- expectAllSuccess = True )