Merge pull request #65 from opennetworkinglab/devl/newMNdriver
Devl/new m ndriver
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 8934e50..3f07691 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -47,9 +47,6 @@
from core.utilities import Utilities
-import logging
-import datetime
-from optparse import OptionParser
class TestON:
'''
@@ -79,11 +76,11 @@
self.init_result = self.TRUE
self.testResult = "Summary"
self.stepName =""
- self.EXPERIMENTAL_MODE = False
+ self.EXPERIMENTAL_MODE = False
self.test_target = None
self.lastcommand = None
- self.testDir = tests_path
- self.configFile = config_path + "teston.cfg"
+ self.testDir = tests_path
+ self.configFile = config_path + "teston.cfg"
self.parsingClass = "xmlparser"
self.parserPath = core_path + "/xmlparser"
self.loggerPath = core_path + "/logger"
@@ -111,7 +108,7 @@
if 'test_target' in self.componentDictionary[component].keys():
self.test_target = component
- # Checking for the openspeak file and test script
+ # Checking for the openspeak file and test script
self.logger.initlog(self)
# Creating Drivers Handles
@@ -151,7 +148,7 @@
'''
global driver_options
self.log.info("Creating component Handle: "+component)
- driver_options = {}
+ driver_options = {}
if 'COMPONENTS' in self.componentDictionary[component].keys():
driver_options =dict(self.componentDictionary[component]['COMPONENTS'])
@@ -171,7 +168,7 @@
options = driver_options)
if not connect_result:
self.log.error("Exiting form the test execution because the connecting to the "+component+" component failed.")
- self.exit()
+ self.exit()
vars(self)[component] = driverObject
@@ -186,7 +183,7 @@
self.testCaseResult = {}
self.TOTAL_TC = 0
self.TOTAL_TC_RUN = 0
- self.TOTAL_TC_PLANNED = 0
+ self.TOTAL_TC_PLANNED = 0
self.TOTAL_TC_NORESULT = 0
self.TOTAL_TC_FAIL = 0
self.TOTAL_TC_PASS = 0
@@ -194,7 +191,7 @@
self.stepCount = 0
self.CASERESULT = self.TRUE
- import testparser
+ import testparser
testFile = self.tests_path + "/"+self.TEST + "/"+self.TEST + ".py"
test = testparser.TestParser(testFile)
self.testscript = test.testscript
@@ -205,8 +202,8 @@
result = self.TRUE
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):
@@ -219,7 +216,7 @@
stopped = False
try :
self.stepList = self.code[self.testCaseNumber].keys()
- except KeyError,e:
+ except KeyError:
main.log.error("There is no Test-Case "+ self.testCaseNumber)
return main.FALSE
@@ -258,8 +255,8 @@
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)+" : "
+ 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)
@@ -282,28 +279,29 @@
'''
result = self.TRUE
self.logger.testSummary(self)
-
+
#self.reportFile.close()
-
+
#utilities.send_mail()
try :
for component in self.componentDictionary.keys():
- tempObject = vars(self)[component]
- print "Disconnecting "+str(tempObject)
-
+ tempObject = vars(self)[component]
+ print "Disconnecting " + str(tempObject)
tempObject.disconnect()
- #tempObject.execute(cmd="exit",prompt="(.*)",timeout=120)
+ #tempObject.execute(cmd="exit",prompt="(.*)",timeout=120)
except(Exception):
+ self.log.exception( "Exception while disconnecting from " +
+ str( component ) )
#print " There is an error with closing hanldes"
result = self.FALSE
# Closing all the driver's session files
for driver in self.componentDictionary.keys():
vars(self)[driver].close_log_handles()
-
+
return result
-
+
def pause(self):
'''
This function will pause the test's execution, and will continue after user provide 'resume' command.
@@ -380,7 +378,7 @@
if self.stepCount > 1 :
stepHeader = "\n"+"-"*45+"\nEnd of Step "+previousStep+"\n"+"-"*45+"\n"
- stepHeader += "\n"+"-"*45+"\nStart of Step"+stepName+"\n"+"-"*45+"\n"
+ stepHeader += "\n"+"-"*45+"\nStart of Step"+stepName+"\n"+"-"*45+"\n"
for driver in self.componentDictionary.keys():
vars(self)[driver+'log'].info(stepHeader)
@@ -388,10 +386,10 @@
'''
Test's each test-case information will append to the logs.
'''
- self.CurrentTestCase = testCaseName
+ self.CurrentTestCase = testCaseName
testCaseName = " " + str(testCaseName) + ""
self.log.case(testCaseName)
- caseHeader = testCaseName+"\n"+"*" * 40+"\n"
+ caseHeader = testCaseName+"\n"+"*" * 40+"\n"
for driver in self.componentDictionary.keys():
vars(self)[driver+'log'].info(caseHeader)
@@ -423,7 +421,7 @@
''' 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)
+ 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):
@@ -434,7 +432,7 @@
ini_match = re.search('^\s*\[', response)
if json_match :
main.log.info(" Response is in 'JSON' format and Converting to '"+return_format+"' format")
- # Formatting the json string
+ # Formatting the json string
response = re.sub(r"{\s*'?(\w)", r'{"\1', response)
response = re.sub(r",\s*'?(\w)", r',"\1', response)
@@ -454,14 +452,13 @@
from configobj import ConfigObj
response_file = open("respnse_file.temp",'w')
response_file.write(response)
- response_file.close()
+ response_file.close()
response_dict = ConfigObj("respnse_file.temp")
return response_dict
elif xml_match :
main.log.info(" Response is in 'XML' format and Converting to '"+return_format+"' format")
try :
- from core import dicttoobject
response_dict = xmldict.xml_to_dict("<response> "+str(response)+" </response>")
except Exception, e:
main.log.error(e)
@@ -485,7 +482,7 @@
table_data = table_data + get_table(temp_val)
else :
table_data = table_data + str(value_to_convert) +"\t"
- return table_data
+ return table_data
for value in response_dict.values() :
response_table = response_table + get_table(value)
@@ -510,7 +507,6 @@
elif return_format == 'xml':
''' Will return in xml format'''
- from core import dicttoobject
response_xml = xmldict.dict_to_xml(response_dict)
response_xml = re.sub(">\s*<", ">\n<", response_xml)
return "\n"+response_xml
@@ -566,14 +562,14 @@
main.classPath = "examples."+main.TEST+"."+main.TEST
def verifyLogdir(options):
- #Verifying Log directory option
+ #Verifying Log directory option
if options.logdir:
main.logdir = options.logdir
else :
- main.logdir = main.FALSE
+ main.logdir = main.FALSE
def verifyMail(options):
- # Checking the mailing list
+ # Checking the mailing list
if options.mail:
main.mail = options.mail
elif main.params.has_key('mail'):
@@ -582,10 +578,10 @@
main.mail = 'paxweb@paxterrasolutions.com'
def verifyTestCases(options):
- #Getting Test cases list
+ #Getting Test cases list
if options.testcases:
- testcases_list = options.testcases
- #sys.exit()
+ testcases_list = options.testcases
+ #sys.exit()
testcases_list = re.sub("(\[|\])", "", options.testcases)
main.testcases_list = eval(testcases_list+",")
else :
@@ -604,16 +600,16 @@
if type(testcase)==int:
testcase=[testcase]
list1.extend(testcase)
- main.testcases_list=list1
+ main.testcases_list=list1
else :
print "testcases not specifed in params, please provide in params file or 'testcases' commandline argument"
- sys.exit()
+ sys.exit()
def verifyTestScript(options):
'''
Verifyies test script.
'''
- main.openspeak = openspeak.OpenSpeak()
+ 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) :
@@ -629,20 +625,20 @@
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 like "+main.TEST
- main.exit()
+ main.exit()
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 :
main.params = main.params['PARAMS']
except(KeyError):
print "Error with the params file: Either the file not specified or the format is not correct"
- main.exit()
+ main.exit()
try :
main.topology = main.topology['TOPOLOGY']
@@ -681,9 +677,9 @@
main.exit()
else :
print "No Such File Exists !!"+ confighash['config']['parser']['file'] +"using default parser"
- load_defaultParser()
- elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
- load_defaultParser()
+ load_defaultParser()
+ elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
+ load_defaultParser()
else:
load_defaultParser()
@@ -694,7 +690,7 @@
moduleList = main.parserPath.split("/")
newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
try :
- parsingClass = main.parsingClass
+ parsingClass = main.parsingClass
parsingModule = __import__(newModule, globals(), locals(), [parsingClass], -1)
parsingClass = getattr(parsingModule, parsingClass)
main.parser = parsingClass()
@@ -733,8 +729,8 @@
else :
print "No Such File Exists !!"+confighash['config']['logger']['file']+ "Using default logger"
load_defaultlogger()
- elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
- load_defaultlogger()
+ elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
+ load_defaultlogger()
else:
load_defaultlogger()
@@ -745,14 +741,14 @@
moduleList = main.loggerPath.split("/")
newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
try :
- loggerClass = main.loggerClass
+ loggerClass = main.loggerClass
loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
loggerClass = getattr(loggerModule, loggerClass)
main.logger = loggerClass()
except ImportError:
print sys.exc_info()[1]
- main.exit()
+ main.exit()
def load_defaultlogger():
'''
@@ -761,7 +757,7 @@
moduleList = main.loggerPath.split("/")
newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
try :
- loggerClass = main.loggerClass
+ loggerClass = main.loggerClass
loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
loggerClass = getattr(loggerModule, loggerClass)
main.logger = loggerClass()
diff --git a/TestON/dependencies/Jenkins_getresult_HA.py b/TestON/dependencies/Jenkins_getresult_HA.py
index 859612d..9cb3b8b 100755
--- a/TestON/dependencies/Jenkins_getresult_HA.py
+++ b/TestON/dependencies/Jenkins_getresult_HA.py
@@ -101,11 +101,12 @@
f.close()
#https://wiki.onosproject.org/display/OST/Test+Results+-+HA#Test+Results+-+HA
#Example anchor on new wiki: #TestResults-HA-TestHATestSanity
- page_name = "Master+-+HA"
+ page_name = "Master-HA"
if "ONOS-HA-Maint" in job:
- page_name = "1.0+-+HA"
+ #NOTE if page name starts with number it prepends 'id-' to anchor links
+ page_name = "id-1.0-HA"
- header += "<li><a href=\'#" + str(page_name) + str(test) + "\'> " + str(test) + " - Results: " + str(passes) + " Passed, " + str(fails) + " Failed</a></li>"
+ header += "<li><a href=\'#" + str(page_name) + "-Test" + str(test) + "\'> " + str(test) + " - Results: " + str(passes) + " Passed, " + str(fails) + " Failed</a></li>"
#*********************
#include any other phrase specific to case you would like to include in wiki here
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 9943ac7..fbd863e 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -102,7 +102,8 @@
"""
Starts Mininet accepts a topology(.py) file and/or an optional
arguement ,to start the mininet, as a parameter.
- Returns true if the mininet starts successfully
+ Returns main.TRUE if the mininet starts successfully and
+ main.FALSE otherwise
"""
if self.handle:
main.log.info(
@@ -451,11 +452,16 @@
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
- # Determine ipaddress of the host-oldSw interface
+ # Determine ip and mac address of the host-oldSw interface
cmd = "px ipaddr = hintf.IP()"
print "cmd3= ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
+
+ cmd = "px macaddr = hintf.MAC()"
+ print "cmd3= ", cmd
+ self.handle.sendline( cmd )
+ self.handle.expect( "mininet>" )
# Detach interface between oldSw-host
cmd = "px " + oldSw + ".detach( sintf )"
@@ -487,16 +493,22 @@
print "cmd7 = ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
+
+ # Set macaddress of the host-newSw interface
+ cmd = "px " + host + ".setMAC( mac = macaddr, intf = hintf)"
+ print "cmd8 = ", cmd
+ self.handle.sendline( cmd )
+ self.handle.expect( "mininet>" )
cmd = "net"
- print "cmd8 = ", cmd
+ print "cmd9 = ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
print "output = ", self.handle.before
# Determine ipaddress of the host-newSw interface
- cmd = "h1 ifconfig"
- print "cmd9= ", cmd
+ cmd = host + " ifconfig"
+ print "cmd10= ", cmd
self.handle.sendline( cmd )
self.handle.expect( "mininet>" )
print "ifconfig o/p = ", self.handle.before
@@ -1253,30 +1265,32 @@
disconnect the handle.
"""
self.handle.sendline('')
- i = 1
- i = self.handle.expect( ['mininet>',pexpect.EOF,pexpect.TIMEOUT ], timeout = 2)
+ i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
+ timeout = 2)
if i == 0:
self.stopNet()
- response = ''
+ elif i == 1:
+ return main.TRUE
+ response = main.TRUE
# print "Disconnecting Mininet"
if self.handle:
self.handle.sendline( "exit" )
self.handle.expect( "exit" )
self.handle.expect( "(.*)" )
- main.log.info( "Mininet CLI is successfully disconnected" )
- response = main.TRUE
else:
main.log.error( "Connection failed to the host" )
- response = main.FALSE
-
return response
def stopNet( self , timeout = 5):
"""
- Stops mininet. returns true if the mininet succesfully stops.
+ Stops mininet.
+ Returns main.TRUE if the mininet succesfully stops and
+ main.FALSE if the pexpect handle does not exist.
+
+ Will cleanup and exit the test if mininet fails to stop
"""
-
- main.log.info( self.name + ": Disconnecting mininet..." )
+
+ main.log.info( self.name + ": Stopping mininet..." )
response = ''
if self.handle:
try:
@@ -1293,7 +1307,7 @@
cmd="exit",
prompt="(.*)",
timeout=120 )
- main.log.info( self.name + ": Disconnected")
+ main.log.info( self.name + ": Stopped")
self.handle.sendline( "sudo mn -c" )
response = main.TRUE
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 3d91a20..389a077 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -336,7 +336,6 @@
try:
self.handle.sendline( "sudo pkill tcpdump" )
self.handle.sendline( "" )
- self.handle.sendline( "" )
self.handle.expect( "\$" )
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
@@ -374,12 +373,7 @@
"""
Called at the end of the test to disconnect the handle.
"""
- response = ''
- # print "Disconnecting Mininet"
if self.handle:
- self.handle.sendline( "exit" )
- self.handle.expect( "exit" )
- self.handle.expect( "(.*)" )
# Close the ssh connection
self.handle.sendline( "" )
self.handle.expect( "\$" )
@@ -387,6 +381,7 @@
self.handle.expect( "closed" )
else:
main.log.error( "Connection failed to the host" )
+ return main.TRUE
def getFlowTable( self, protoVersion, sw ):
"""
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index e79cf1b..4fb58df 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -78,7 +78,7 @@
"""
Called when Test is complete to disconnect the ONOS handle.
"""
- response = ''
+ response = main.TRUE
try:
self.handle.sendline( "" )
i = self.handle.expect( [ "onos>", "\$" ] )
@@ -94,7 +94,7 @@
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
- return None
+ response = main.FALSE
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
@@ -938,6 +938,7 @@
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
return None
+
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 50994ee..c2b3693 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -45,9 +45,9 @@
if key == "home":
self.home = self.options[ 'home' ]
break
- if self.home == None or self.home == "":
+ if self.home is None or self.home == "":
self.home = "~/ONOS"
-
+
self.name = self.options[ 'name' ]
self.handle = super( OnosDriver, self ).connect(
user_name=self.user_name,
@@ -79,7 +79,7 @@
"""
Called when Test is complete to disconnect the ONOS handle.
"""
- response = ''
+ response = main.TRUE
try:
self.handle.sendline( "" )
self.handle.expect( "\$" )
@@ -169,8 +169,8 @@
self.handle.expect( "mvn clean install" )
while True:
i = self.handle.expect( [
- 'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s\
- Runtime\sEnvironment\sto\scontinue',
+ 'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s' +
+ 'Runtime\sEnvironment\sto\scontinue',
'BUILD\sFAILURE',
'BUILD\sSUCCESS',
'ONOS\$',
@@ -205,8 +205,8 @@
main.cleanup()
main.exit()
else:
- main.log.error( self.name + ": unexpected response from \
- mvn clean install" )
+ main.log.error( self.name + ": unexpected response from " +
+ "mvn clean install" )
# return main.FALSE
main.cleanup()
main.exit()
@@ -254,10 +254,8 @@
'Already up-to-date',
'Aborting',
'You\sare\snot\scurrently\son\sa\sbranch',
- 'You\sasked\sme\sto\spull\swithout\stelling\sme\swhich\
- \sbranch\syou',
- 'Pull\sis\snot\spossible\sbecause\syou\shave\sunmerged\
- \sfiles',
+ 'You asked me to pull without telling me which branch you',
+ 'Pull is not possible because you have unmerged files',
pexpect.TIMEOUT ],
timeout=300 )
# debug
@@ -285,27 +283,26 @@
elif i == 4:
main.log.info(
self.name +
- ": Git Pull - Aborting...\
- Are there conflicting git files?" )
+ ": Git Pull - Aborting..." +
+ "Are there conflicting git files?" )
return main.ERROR
elif i == 5:
main.log.info(
self.name +
- ": Git Pull - You are not currently\
- on a branch so git pull failed!" )
+ ": Git Pull - You are not currently " +
+ "on a branch so git pull failed!" )
return main.ERROR
elif i == 6:
main.log.info(
self.name +
- ": Git Pull - You have not configured\
- an upstream branch to pull from\
- . Git pull failed!" )
+ ": Git Pull - You have not configured an upstream " +
+ "branch to pull from. Git pull failed!" )
return main.ERROR
elif i == 7:
main.log.info(
self.name +
- ": Git Pull - Pull is not possible\
- because you have unmerged files." )
+ ": Git Pull - Pull is not possible because " +
+ "you have unmerged files." )
return main.ERROR
elif i == 8:
main.log.error( self.name + ": Git Pull - TIMEOUT" )
@@ -348,27 +345,23 @@
try:
self.handle.sendline( "cd " + self.home )
self.handle.expect( self.home + "\$" )
- main.log.info(
- self.name +
- ": Checking out git branch: " +
- branch +
- "..." )
+ main.log.info( self.name +
+ ": Checking out git branch/ref: " + branch + "..." )
cmd = "git checkout " + branch
self.handle.sendline( cmd )
self.handle.expect( cmd )
i = self.handle.expect(
- [
- 'fatal',
- 'Username\sfor\s(.*):\s',
- 'Already\son\s\'',
- 'Switched\sto\sbranch\s\'' +
- str( branch ),
- pexpect.TIMEOUT,
- 'error: Your local changes to the following files\
- would be overwritten by checkout:',
- 'error: you need to resolve your current index first' ],
+ [ 'fatal',
+ 'Username\sfor\s(.*):\s',
+ 'Already\son\s\'',
+ 'Switched\sto\sbranch\s\'' + str( branch ),
+ pexpect.TIMEOUT,
+ 'error: Your local changes to the following files' +
+ 'would be overwritten by checkout:',
+ 'error: you need to resolve your current index first',
+ "You are in 'detached HEAD' state.",
+ "HEAD is now at " ],
timeout=60 )
-
if i == 0:
main.log.error(
self.name +
@@ -381,12 +374,12 @@
": Git checkout asking for username." +
" Please configure your local git repository to be able " +
"to access your remote repository passwordlessly" )
+ # TODO add support for authenticating
return main.ERROR
elif i == 2:
main.log.info(
self.name +
- ": Git Checkout %s : Already on this branch" %
- branch )
+ ": Git Checkout %s : Already on this branch" % branch )
self.handle.expect( self.home + "\$" )
# main.log.info( "DEBUG: after checkout cmd = "+
# self.handle.before )
@@ -394,8 +387,7 @@
elif i == 3:
main.log.info(
self.name +
- ": Git checkout %s - Switched to this branch" %
- branch )
+ ": Git checkout %s - Switched to this branch" % branch )
self.handle.expect( self.home + "\$" )
# main.log.info( "DEBUG: after checkout cmd = "+
# self.handle.before )
@@ -403,33 +395,45 @@
elif i == 4:
main.log.error( self.name + ": Git Checkout- TIMEOUT" )
main.log.error(
- self.name + " Response was: " + str(
- self.handle.before ) )
+ self.name + " Response was: " + str( self.handle.before ) )
return main.ERROR
elif i == 5:
self.handle.expect( "Aborting" )
main.log.error(
self.name +
": Git checkout error: \n" +
- "Your local changes to the following\
- files would be overwritten by checkout:" +
- str(
- self.handle.before ) )
+ "Your local changes to the following files would" +
+ " be overwritten by checkout:" +
+ str( self.handle.before ) )
self.handle.expect( self.home + "\$" )
return main.ERROR
elif i == 6:
- main.log.error( self.name +
- ": Git checkout error: \n" +
- "You need to resolve your\
- current index first:" +
- str( self.handle.before ) )
+ main.log.error(
+ self.name +
+ ": Git checkout error: \n" +
+ "You need to resolve your current index first:" +
+ str( self.handle.before ) )
self.handle.expect( self.home + "\$" )
return main.ERROR
+ elif i == 7:
+ main.log.info(
+ self.name +
+ ": Git checkout " + str( branch ) +
+ " - You are in 'detached HEAD' state. HEAD is now at " +
+ str( branch ) )
+ self.handle.expect( self.home + "\$" )
+ return main.TRUE
+ elif i == 8: # Already in detached HEAD on the specified commit
+ main.log.info(
+ self.name +
+ ": Git Checkout %s : Already on commit" % branch )
+ self.handle.expect( self.home + "\$" )
+ return main.TRUE
else:
main.log.error(
self.name +
- ": Git Checkout - Unexpected response,\
- check for pull errors" )
+ ": Git Checkout - Unexpected response, " +
+ "check for pull errors" )
main.log.error( self.name + ": " + self.handle.before )
return main.ERROR
@@ -447,7 +451,7 @@
def getVersion( self, report=False ):
"""
- Writes the COMMIT number to the report to be parsed\
+ Writes the COMMIT number to the report to be parsed
by Jenkins data collecter.
"""
try:
@@ -456,8 +460,8 @@
self.handle.sendline(
"cd " +
self.home +
- "; git log -1 --pretty=fuller --decorate=short | grep -A 6\
- \"commit\" --color=never" )
+ "; git log -1 --pretty=fuller --decorate=short | grep -A 6 " +
+ " \"commit\" --color=never" )
# NOTE: for some reason there are backspaces inserted in this
# phrase when run from Jenkins on some tests
self.handle.expect( "never" )
@@ -524,8 +528,7 @@
# That you may wish to use by default on startup.
# Note that you may not want certain features listed
# on here.
- coreFeatureString = "export ONOS_FEATURES=webconsole,onos-api," +\
- "onos-cli,onos-openflow," + extraFeatureString
+ coreFeatureString = "export ONOS_FEATURES=" + extraFeatureString
mnString = "export OCN="
onosString = "export OC"
tempCount = 1
@@ -594,7 +597,7 @@
# Expect the cellname in the ONOSCELL variable.
# Note that this variable name is subject to change
# and that this driver will have to change accordingly
- self.handle.expect( "ONOS_CELL=" + str( cellname ) )
+ self.handle.expect( "ONOS_CELL" )
handleBefore = self.handle.before
handleAfter = self.handle.after
# Get the rest of the handle
@@ -1220,13 +1223,13 @@
result = main.TRUE
else:
output = output + \
- "The number of links and switches does not match\
- what was expected"
+ "The number of links and switches does not match " + \
+ "what was expected"
result = main.FALSE
- output = output + "\n ONOS sees %i devices (%i expected)\
- and %i links (%i expected)" %\
- ( int( devices ), int( numoswitch ),
- int( links ), int( numolink ) )
+ output = output + "\n ONOS sees %i devices" % int ( devices )
+ output = output + " (%i expected) " % int( numoswitch )
+ output = output + "and %i links " % int( links )
+ output = output + "(%i expected)" % int( numolink )
if logLevel == "report":
main.log.report( output )
elif logLevel == "warn":
@@ -1488,3 +1491,102 @@
main.log.info( self.name + " ::::::" )
main.cleanup()
main.exit()
+
+ def setIpTables( self, ip, port='', action='add', packet_type='tcp',
+ direction='INPUT', rule='DROP' ):
+ '''
+ Description:
+ add or remove iptables rule to DROP (default) packets from
+ specific IP and PORT
+ Usage:
+ * specify action ('add' or 'remove')
+ when removing, pass in the same argument as you would add. It will
+ delete that specific rule.
+ * specify the ip to block
+ * specify the destination port to block (defaults to all ports)
+ * optional packet type to block (default tcp)
+ * optional iptables rule (default DROP)
+ * optional direction to block (default 'INPUT')
+ Returns:
+ main.TRUE on success or
+ main.FALSE if given invalid input or
+ main.ERROR if there is an error in response from iptables
+ WARNING:
+ * This function uses root privilege iptables command which may result
+ in unwanted network errors. USE WITH CAUTION
+ '''
+ import time
+
+ # NOTE*********
+ # The strict checking methods of this driver function is intentional
+ # to discourage any misuse or error of iptables, which can cause
+ # severe network errors
+ # *************
+
+ # NOTE: Sleep needed to give some time for rule to be added and
+ # registered to the instance. If you are calling this function
+ # multiple times this sleep will prevent any errors.
+ # DO NOT REMOVE
+ time.sleep( 5 )
+ try:
+ # input validation
+ action_type = action.lower()
+ rule = rule.upper()
+ direction = direction.upper()
+ if action_type != 'add' and action_type != 'remove':
+ main.log.error( "Invalid action type. Use 'add' or "
+ "'remove' table rule" )
+ if rule != 'DROP' and rule != 'ACCEPT' and rule != 'LOG':
+ # NOTE Currently only supports rules DROP, ACCEPT, and LOG
+ main.log.error( "Invalid rule. Valid rules are 'DROP' or "
+ "'ACCEPT' or 'LOG' only." )
+ if direction != 'INPUT' and direction != 'OUTPUT':
+ # NOTE currently only supports rules INPUT and OUPTUT
+ main.log.error( "Invalid rule. Valid directions are"
+ " 'OUTPUT' or 'INPUT'" )
+ return main.FALSE
+ return main.FALSE
+ return main.FALSE
+ if action_type == 'add':
+ # -A is the 'append' action of iptables
+ actionFlag = '-A'
+ elif action_type == 'remove':
+ # -D is the 'delete' rule of iptables
+ actionFlag = '-D'
+ self.handle.sendline( "" )
+ self.handle.expect( "\$" )
+ cmd = "sudo iptables " + actionFlag + " " +\
+ direction +\
+ " -p " + str( packet_type ) +\
+ " -s " + str( ip )
+ if port:
+ cmd += " --dport " + str( port )
+ cmd += " -j " + str( rule )
+
+ self.handle.sendline( cmd )
+ self.handle.expect( "\$" )
+ main.log.warn( self.handle.before )
+
+ info_string = "On " + str( self.name )
+ info_string += " " + str( action_type )
+ info_string += " iptable rule [ "
+ info_string += " IP: " + str( ip )
+ info_string += " Port: " + str( port )
+ info_string += " Rule: " + str( rule )
+ info_string += " Direction: " + str( direction ) + " ]"
+ main.log.info( info_string )
+ return main.TRUE
+ except pexpect.TIMEOUT:
+ main.log.exception( self.name + ": Timeout exception in "
+ "setIpTables function" )
+ return main.ERROR
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.exception( "Unknown error:")
+ main.cleanup()
+ main.exit()
+
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 1b8998b..6d7fb2a 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -81,7 +81,7 @@
while i == 5:
i = self.handle.expect( [
ssh_newkey,
- 'password:|\$',
+ 'password:',
pexpect.EOF,
pexpect.TIMEOUT,
refused,
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
index 6f2002d..123fd0f 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
@@ -1,7 +1,7 @@
<PARAMS>
<testcases>1,2,8,3,4,5,14,[6],8,3,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
- <cellName>HA</cellName>
+ <cellName>HA</cellName>
</ENV>
<Git>False</Git>
<branch> master </branch>
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index ff38cfe..e9beb0c 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -150,24 +150,38 @@
onos1Isup = main.ONOSbench.isup( ONOS1Ip )
if not onos1Isup:
main.log.report( "ONOS1 didn't start!" )
+ main.ONOSbench.onosStop( ONOS1Ip )
+ main.ONOSbench.onosStart( ONOS1Ip )
onos2Isup = main.ONOSbench.isup( ONOS2Ip )
if not onos2Isup:
main.log.report( "ONOS2 didn't start!" )
+ main.ONOSbench.onosStop( ONOS2Ip )
+ main.ONOSbench.onosStart( ONOS2Ip )
onos3Isup = main.ONOSbench.isup( ONOS3Ip )
if not onos3Isup:
main.log.report( "ONOS3 didn't start!" )
+ main.ONOSbench.onosStop( ONOS3Ip )
+ main.ONOSbench.onosStart( ONOS3Ip )
onos4Isup = main.ONOSbench.isup( ONOS4Ip )
if not onos4Isup:
main.log.report( "ONOS4 didn't start!" )
+ main.ONOSbench.onosStop( ONOS4Ip )
+ main.ONOSbench.onosStart( ONOS4Ip )
onos5Isup = main.ONOSbench.isup( ONOS5Ip )
if not onos5Isup:
main.log.report( "ONOS5 didn't start!" )
+ main.ONOSbench.onosStop( ONOS5Ip )
+ main.ONOSbench.onosStart( ONOS5Ip )
onos6Isup = main.ONOSbench.isup( ONOS6Ip )
if not onos6Isup:
main.log.report( "ONOS6 didn't start!" )
+ main.ONOSbench.onosStop( ONOS6Ip )
+ main.ONOSbench.onosStart( ONOS6Ip )
onos7Isup = main.ONOSbench.isup( ONOS7Ip )
if not onos7Isup:
main.log.report( "ONOS7 didn't start!" )
+ main.ONOSbench.onosStop( ONOS7Ip )
+ main.ONOSbench.onosStart( ONOS7Ip )
onosIsupResult = onos1Isup and onos2Isup and onos3Isup\
and onos4Isup and onos5Isup and onos6Isup and onos7Isup
if onosIsupResult == main.TRUE:
@@ -378,9 +392,9 @@
onfail="Switches were not successfully reassigned" )
mastershipCheck = mastershipCheck and roleCall and roleCheck
utilities.assert_equals( expect=main.TRUE, actual=mastershipCheck,
- onpass="Switch mastership correctly assigned",
- onfail="Error in ( re )assigning switch" +
- " mastership" )
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch" +
+ " mastership" )
def CASE3( self, main ):
"""
@@ -448,6 +462,7 @@
host1Id = host1Dict.get( 'id', None )
host2Id = host2Dict.get( 'id', None )
if host1Id and host2Id:
+
tmpResult = main.ONOScli1.addHostIntent(
host1Id,
host2Id )
@@ -493,7 +508,7 @@
" and h" + str( i + 10 ) )
elif ping == main.TRUE:
main.log.info( "Ping test passed!" )
- PingResult = main.TRUE
+ # Don't set PingResult or you'd override failures
if PingResult == main.FALSE:
main.log.report(
"Intents have not been installed correctly, pings failed." )
@@ -1498,6 +1513,7 @@
count = 0
main.step( "Collecting topology information from ONOS" )
startTime = time.time()
+ # Give time for Gossip to work
while topoResult == main.FALSE and elapsed < 60:
count = count + 1
if count > 1:
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo b/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo
index 4d4156c..9305025 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo
@@ -151,7 +151,7 @@
<arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
<arg2> --topo mytopo </arg2>
<arg3> </arg3>
- <controller> remote </controller>
+ <controller> none </controller>
</COMPONENTS>
</Mininet1>
@@ -162,11 +162,7 @@
<type>RemoteMininetDriver</type>
<connect_order>17</connect_order>
<COMPONENTS>
- # Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo --arp</arg2>
- <controller> remote </controller>
- </COMPONENTS>
+ </COMPONENTS>
</Mininet2>
</COMPONENT>
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
index 7d79860..595b78c 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
@@ -1,7 +1,7 @@
<PARAMS>
<testcases>1,2,8,3,4,5,14,[6],8,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
- <cellName>HA</cellName>
+ <cellName>HA</cellName>
</ENV>
<Git>False</Git>
<branch> master </branch>
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
index 3d9adc7..de26e67 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -150,24 +150,38 @@
onos1Isup = main.ONOSbench.isup( ONOS1Ip )
if not onos1Isup:
main.log.report( "ONOS1 didn't start!" )
+ main.ONOSbench.onosStop( ONOS1Ip )
+ main.ONOSbench.onosStart( ONOS1Ip )
onos2Isup = main.ONOSbench.isup( ONOS2Ip )
if not onos2Isup:
main.log.report( "ONOS2 didn't start!" )
+ main.ONOSbench.onosStop( ONOS2Ip )
+ main.ONOSbench.onosStart( ONOS2Ip )
onos3Isup = main.ONOSbench.isup( ONOS3Ip )
if not onos3Isup:
main.log.report( "ONOS3 didn't start!" )
+ main.ONOSbench.onosStop( ONOS3Ip )
+ main.ONOSbench.onosStart( ONOS3Ip )
onos4Isup = main.ONOSbench.isup( ONOS4Ip )
if not onos4Isup:
main.log.report( "ONOS4 didn't start!" )
+ main.ONOSbench.onosStop( ONOS4Ip )
+ main.ONOSbench.onosStart( ONOS4Ip )
onos5Isup = main.ONOSbench.isup( ONOS5Ip )
if not onos5Isup:
main.log.report( "ONOS5 didn't start!" )
+ main.ONOSbench.onosStop( ONOS5Ip )
+ main.ONOSbench.onosStart( ONOS5Ip )
onos6Isup = main.ONOSbench.isup( ONOS6Ip )
if not onos6Isup:
main.log.report( "ONOS6 didn't start!" )
+ main.ONOSbench.onosStop( ONOS6Ip )
+ main.ONOSbench.onosStart( ONOS6Ip )
onos7Isup = main.ONOSbench.isup( ONOS7Ip )
if not onos7Isup:
main.log.report( "ONOS7 didn't start!" )
+ main.ONOSbench.onosStop( ONOS7Ip )
+ main.ONOSbench.onosStart( ONOS7Ip )
onosIsupResult = onos1Isup and onos2Isup and onos3Isup\
and onos4Isup and onos5Isup and onos6Isup and onos7Isup
if onosIsupResult == main.TRUE:
@@ -378,9 +392,9 @@
onfail="Switches were not successfully reassigned" )
mastershipCheck = mastershipCheck and roleCall and roleCheck
utilities.assert_equals( expect=main.TRUE, actual=mastershipCheck,
- onpass="Switch mastership correctly assigned",
- onfail="Error in ( re )assigning switch" +
- " mastership" )
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch" +
+ " mastership" )
def CASE3( self, main ):
"""
@@ -484,15 +498,15 @@
main.case( description )
PingResult = main.TRUE
for i in range( 8, 18 ):
- ping = main.Mininet1.pingHost(
- src="h" + str( i ), target="h" + str( i + 10 ) )
+ ping = main.Mininet1.pingHost( src="h" + str( i ),
+ target="h" + str( i + 10 ) )
PingResult = PingResult and ping
if ping == main.FALSE:
main.log.warn( "Ping failed between h" + str( i ) +
" and h" + str( i + 10 ) )
elif ping == main.TRUE:
main.log.info( "Ping test passed!" )
- PingResult = main.TRUE
+ # Don't set PingResult or you'd override failures
if PingResult == main.FALSE:
main.log.report(
"Intents have not been installed correctly, pings failed." )
@@ -1109,8 +1123,9 @@
cliResult3 = main.ONOScli3.startOnosCli( ONOS3Ip )
cliResults = cliResult1 and cliResult2 and cliResult3
- main.log.info( "Install leadership election app on restarted node" )
-
+ # Grab the time of restart so we chan check how long the gossip
+ # protocol has had time to work
+ main.restartTime = time.time()
caseResults = main.TRUE and onosIsupResult and cliResults
utilities.assert_equals( expect=main.TRUE, actual=caseResults,
onpass="ONOS restart successful",
@@ -1149,8 +1164,6 @@
ONOS5Mastership = main.ONOScli5.roles()
ONOS6Mastership = main.ONOScli6.roles()
ONOS7Mastership = main.ONOScli7.roles()
- # print json.dumps( json.loads( ONOS1Mastership ), sort_keys=True,
- # indent=4, separators=( ',', ': ' ) )
if "Error" in ONOS1Mastership or not ONOS1Mastership\
or "Error" in ONOS2Mastership or not ONOS2Mastership\
or "Error" in ONOS3Mastership or not ONOS3Mastership\
@@ -1243,133 +1256,147 @@
# NOTE: we expect mastership to change on controller failure
mastershipCheck = consistentMastership
- main.step( "Get the intents and compare across all nodes" )
- ONOS1Intents = main.ONOScli1.intents( jsonFormat=True )
- ONOS2Intents = main.ONOScli2.intents( jsonFormat=True )
- ONOS3Intents = main.ONOScli3.intents( jsonFormat=True )
- ONOS4Intents = main.ONOScli4.intents( jsonFormat=True )
- ONOS5Intents = main.ONOScli5.intents( jsonFormat=True )
- ONOS6Intents = main.ONOScli6.intents( jsonFormat=True )
- ONOS7Intents = main.ONOScli7.intents( jsonFormat=True )
- intentCheck = main.FALSE
- if "Error" in ONOS1Intents or not ONOS1Intents\
- or "Error" in ONOS2Intents or not ONOS2Intents\
- or "Error" in ONOS3Intents or not ONOS3Intents\
- or "Error" in ONOS4Intents or not ONOS4Intents\
- or "Error" in ONOS5Intents or not ONOS5Intents\
- or "Error" in ONOS6Intents or not ONOS6Intents\
- or "Error" in ONOS7Intents or not ONOS7Intents:
- main.log.report( "Error in getting ONOS intents" )
- main.log.warn( "ONOS1 intents response: " + repr( ONOS1Intents ) )
- main.log.warn( "ONOS2 intents response: " + repr( ONOS2Intents ) )
- main.log.warn( "ONOS3 intents response: " + repr( ONOS3Intents ) )
- main.log.warn( "ONOS4 intents response: " + repr( ONOS4Intents ) )
- main.log.warn( "ONOS5 intents response: " + repr( ONOS5Intents ) )
- main.log.warn( "ONOS6 intents response: " + repr( ONOS6Intents ) )
- main.log.warn( "ONOS7 intents response: " + repr( ONOS7Intents ) )
- elif ONOS1Intents == ONOS2Intents\
- and ONOS1Intents == ONOS3Intents\
- and ONOS1Intents == ONOS4Intents\
- and ONOS1Intents == ONOS5Intents\
- and ONOS1Intents == ONOS6Intents\
- and ONOS1Intents == ONOS7Intents:
- intentCheck = main.TRUE
- main.log.report( "Intents are consistent across all ONOS nodes" )
- else:
- main.log.warn( "ONOS1 intents: " )
- print json.dumps( json.loads( ONOS1Intents ), sort_keys=True,
- indent=4, separators=( ',', ': ' ) )
- main.log.warn( "ONOS2 intents: " )
- print json.dumps( json.loads( ONOS2Intents ), sort_keys=True,
- indent=4, separators=( ',', ': ' ) )
- main.log.warn( "ONOS3 intents: " )
- print json.dumps( json.loads( ONOS3Intents ), sort_keys=True,
- indent=4, separators=( ',', ': ' ) )
- main.log.warn( "ONOS4 intents: " )
- print json.dumps( json.loads( ONOS4Intents ), sort_keys=True,
- indent=4, separators=( ',', ': ' ) )
- main.log.warn( "ONOS5 intents: " )
- print json.dumps( json.loads( ONOS5Intents ), sort_keys=True,
- indent=4, separators=( ',', ': ' ) )
- main.log.warn( "ONOS6 intents: " )
- print json.dumps( json.loads( ONOS6Intents ), sort_keys=True,
- indent=4, separators=( ',', ': ' ) )
- main.log.warn( "ONOS7 intents: " )
- print json.dumps( json.loads( ONOS7Intents ), sort_keys=True,
- indent=4, separators=( ',', ': ' ) )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=intentCheck,
- onpass="Intents are consistent across all ONOS nodes",
- onfail="ONOS nodes have different views of intents" )
- # Print the intent states
- intents = []
- intents.append( ONOS1Intents )
- intents.append( ONOS2Intents )
- intents.append( ONOS3Intents )
- intents.append( ONOS4Intents )
- intents.append( ONOS5Intents )
- intents.append( ONOS6Intents )
- intents.append( ONOS7Intents )
- intentStates = []
- for node in intents: # Iter through ONOS nodes
- nodeStates = []
- for intent in json.loads( node ): # Iter through intents of a node
- nodeStates.append( intent[ 'state' ] )
- intentStates.append( nodeStates )
- out = [ (i, nodeStates.count( i ) ) for i in set( nodeStates ) ]
- main.log.info( dict( out ) )
-
-
- # NOTE: Hazelcast has no durability, so intents are lost across system
- # restarts
- main.step( "Compare current intents with intents before the failure" )
- # NOTE: this requires case 5 to pass for intentState to be set.
- # maybe we should stop the test if that fails?
- sameIntents = main.TRUE
- if intentState and intentState == ONOS1Intents:
- sameIntents = main.TRUE
- main.log.report( "Intents are consistent with before failure" )
- # TODO: possibly the states have changed? we may need to figure out
- # what the aceptable states are
- else:
- try:
+ while True:
+ whileTime = time.time() - main.restartTime
+ # Gossip store
+ main.step( "Get the intents and compare across all nodes" )
+ ONOS1Intents = main.ONOScli1.intents( jsonFormat=True )
+ ONOS2Intents = main.ONOScli2.intents( jsonFormat=True )
+ ONOS3Intents = main.ONOScli3.intents( jsonFormat=True )
+ ONOS4Intents = main.ONOScli4.intents( jsonFormat=True )
+ ONOS5Intents = main.ONOScli5.intents( jsonFormat=True )
+ ONOS6Intents = main.ONOScli6.intents( jsonFormat=True )
+ ONOS7Intents = main.ONOScli7.intents( jsonFormat=True )
+ intentCheck = main.FALSE
+ if "Error" in ONOS1Intents or not ONOS1Intents\
+ or "Error" in ONOS2Intents or not ONOS2Intents\
+ or "Error" in ONOS3Intents or not ONOS3Intents\
+ or "Error" in ONOS4Intents or not ONOS4Intents\
+ or "Error" in ONOS5Intents or not ONOS5Intents\
+ or "Error" in ONOS6Intents or not ONOS6Intents\
+ or "Error" in ONOS7Intents or not ONOS7Intents:
+ main.log.report( "Error in getting ONOS intents" )
+ main.log.warn( "ONOS1 intents response: " +
+ repr( ONOS1Intents ) )
+ main.log.warn( "ONOS2 intents response: " +
+ repr( ONOS2Intents ) )
+ main.log.warn( "ONOS3 intents response: " +
+ repr( ONOS3Intents ) )
+ main.log.warn( "ONOS4 intents response: " +
+ repr( ONOS4Intents ) )
+ main.log.warn( "ONOS5 intents response: " +
+ repr( ONOS5Intents ) )
+ main.log.warn( "ONOS6 intents response: " +
+ repr( ONOS6Intents ) )
+ main.log.warn( "ONOS7 intents response: " +
+ repr( ONOS7Intents ) )
+ elif ONOS1Intents == ONOS2Intents\
+ and ONOS1Intents == ONOS3Intents\
+ and ONOS1Intents == ONOS4Intents\
+ and ONOS1Intents == ONOS5Intents\
+ and ONOS1Intents == ONOS6Intents\
+ and ONOS1Intents == ONOS7Intents:
+ intentCheck = main.TRUE
+ main.log.report( "Intents are consistent across all" +
+ " ONOS nodes" )
+ else:
main.log.warn( "ONOS1 intents: " )
- print json.dumps( json.loads( ONOS1Intents ),
- sort_keys=True, indent=4,
- separators=( ',', ': ' ) )
- except:
- pass
- sameIntents = main.FALSE
- utilities.assert_equals(
- expect=main.TRUE,
- actual=sameIntents,
- onpass="Intents are consistent with before failure",
- onfail="The Intents changed during failure" )
- intentCheck = intentCheck and sameIntents
+ print json.dumps( json.loads( ONOS1Intents ), sort_keys=True,
+ indent=4, separators=( ',', ': ' ) )
+ main.log.warn( "ONOS2 intents: " )
+ print json.dumps( json.loads( ONOS2Intents ), sort_keys=True,
+ indent=4, separators=( ',', ': ' ) )
+ main.log.warn( "ONOS3 intents: " )
+ print json.dumps( json.loads( ONOS3Intents ), sort_keys=True,
+ indent=4, separators=( ',', ': ' ) )
+ main.log.warn( "ONOS4 intents: " )
+ print json.dumps( json.loads( ONOS4Intents ), sort_keys=True,
+ indent=4, separators=( ',', ': ' ) )
+ main.log.warn( "ONOS5 intents: " )
+ print json.dumps( json.loads( ONOS5Intents ), sort_keys=True,
+ indent=4, separators=( ',', ': ' ) )
+ main.log.warn( "ONOS6 intents: " )
+ print json.dumps( json.loads( ONOS6Intents ), sort_keys=True,
+ indent=4, separators=( ',', ': ' ) )
+ main.log.warn( "ONOS7 intents: " )
+ print json.dumps( json.loads( ONOS7Intents ), sort_keys=True,
+ indent=4, separators=( ',', ': ' ) )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=intentCheck,
+ onpass="Intents are consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of intents" )
+ # Print the intent states
+ intents = []
+ intents.append( ONOS1Intents )
+ intents.append( ONOS2Intents )
+ intents.append( ONOS3Intents )
+ intents.append( ONOS4Intents )
+ intents.append( ONOS5Intents )
+ intents.append( ONOS6Intents )
+ intents.append( ONOS7Intents )
+ intentStates = []
+ for node in intents: # Iter through ONOS nodes
+ nodeStates = []
+ # Iter through intents of a node
+ for intent in json.loads( node ):
+ nodeStates.append( intent[ 'state' ] )
+ intentStates.append( nodeStates )
+ out = [ (i, nodeStates.count( i ) ) for i in set( nodeStates ) ]
+ main.log.info( dict( out ) )
- main.step( "Get the OF Table entries and compare to before " +
- "component failure" )
- FlowTables = main.TRUE
- flows2 = []
- for i in range( 28 ):
- main.log.info( "Checking flow table on s" + str( i + 1 ) )
- tmpFlows = main.Mininet2.getFlowTable( 1.3, "s" + str( i + 1 ) )
- flows2.append( tmpFlows )
- tempResult = main.Mininet2.flowComp(
- flow1=flows[ i ],
- flow2=tmpFlows )
- FlowTables = FlowTables and tempResult
- if FlowTables == main.FALSE:
- main.log.info( "Differences in flow table for switch: s" +
- str( i + 1 ) )
- if FlowTables == main.TRUE:
- main.log.report( "No changes were found in the flow tables" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=FlowTables,
- onpass="No changes were found in the flow tables",
- onfail="Changes were found in the flow tables" )
+
+ # NOTE: Store has no durability, so intents are lost across system
+ # restarts
+ main.step( "Compare current intents with intents before the failure" )
+ # NOTE: this requires case 5 to pass for intentState to be set.
+ # maybe we should stop the test if that fails?
+ sameIntents = main.TRUE
+ if intentState and intentState == ONOS1Intents:
+ sameIntents = main.TRUE
+ main.log.report( "Intents are consistent with before failure" )
+ # TODO: possibly the states have changed? we may need to figure out
+ # what the aceptable states are
+ else:
+ try:
+ main.log.warn( "ONOS1 intents: " )
+ print json.dumps( json.loads( ONOS1Intents ),
+ sort_keys=True, indent=4,
+ separators=( ',', ': ' ) )
+ except:
+ pass
+ sameIntents = main.FALSE
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=sameIntents,
+ onpass="Intents are consistent with before failure",
+ onfail="The Intents changed during failure" )
+ intentCheck = intentCheck and sameIntents
+
+ main.step( "Get the OF Table entries and compare to before " +
+ "component failure" )
+ FlowTables = main.TRUE
+ flows2 = []
+ for i in range( 28 ):
+ main.log.info( "Checking flow table on s" + str( i + 1 ) )
+ tmpFlows = main.Mininet2.getFlowTable( 1.3, "s" + str( i + 1 ) )
+ flows2.append( tmpFlows )
+ tempResult = main.Mininet2.flowComp(
+ flow1=flows[ i ],
+ flow2=tmpFlows )
+ FlowTables = FlowTables and tempResult
+ if FlowTables == main.FALSE:
+ main.log.info( "Differences in flow table for switch: s" +
+ str( i + 1 ) )
+ if FlowTables == main.TRUE:
+ main.log.report( "No changes were found in the flow tables" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=FlowTables,
+ onpass="No changes were found in the flow tables",
+ onfail="Changes were found in the flow tables" )
+ if topoResult == main.TRUE or ( whileTime > 10 ) :
+ break
main.step( "Check the continuous pings to ensure that no packets " +
"were dropped during component failure" )
@@ -1494,6 +1521,7 @@
count = 0
main.step( "Collecting topology information from ONOS" )
startTime = time.time()
+ # Give time for Gossip to work
while topoResult == main.FALSE and elapsed < 60:
count = count + 1
if count > 1:
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo
index 4d4156c..9305025 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo
@@ -151,7 +151,7 @@
<arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
<arg2> --topo mytopo </arg2>
<arg3> </arg3>
- <controller> remote </controller>
+ <controller> none </controller>
</COMPONENTS>
</Mininet1>
@@ -162,11 +162,7 @@
<type>RemoteMininetDriver</type>
<connect_order>17</connect_order>
<COMPONENTS>
- # Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo --arp</arg2>
- <controller> remote </controller>
- </COMPONENTS>
+ </COMPONENTS>
</Mininet2>
</COMPONENT>
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
index 58f9954..590ff56 100644
--- a/TestON/tests/HATestSanity/HATestSanity.py
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -150,24 +150,38 @@
onos1Isup = main.ONOSbench.isup( ONOS1Ip )
if not onos1Isup:
main.log.report( "ONOS1 didn't start!" )
+ main.ONOSbench.onosStop( ONOS1Ip )
+ main.ONOSbench.onosStart( ONOS1Ip )
onos2Isup = main.ONOSbench.isup( ONOS2Ip )
if not onos2Isup:
main.log.report( "ONOS2 didn't start!" )
+ main.ONOSbench.onosStop( ONOS2Ip )
+ main.ONOSbench.onosStart( ONOS2Ip )
onos3Isup = main.ONOSbench.isup( ONOS3Ip )
if not onos3Isup:
main.log.report( "ONOS3 didn't start!" )
+ main.ONOSbench.onosStop( ONOS3Ip )
+ main.ONOSbench.onosStart( ONOS3Ip )
onos4Isup = main.ONOSbench.isup( ONOS4Ip )
if not onos4Isup:
main.log.report( "ONOS4 didn't start!" )
+ main.ONOSbench.onosStop( ONOS4Ip )
+ main.ONOSbench.onosStart( ONOS4Ip )
onos5Isup = main.ONOSbench.isup( ONOS5Ip )
if not onos5Isup:
main.log.report( "ONOS5 didn't start!" )
+ main.ONOSbench.onosStop( ONOS5Ip )
+ main.ONOSbench.onosStart( ONOS5Ip )
onos6Isup = main.ONOSbench.isup( ONOS6Ip )
if not onos6Isup:
main.log.report( "ONOS6 didn't start!" )
+ main.ONOSbench.onosStop( ONOS6Ip )
+ main.ONOSbench.onosStart( ONOS6Ip )
onos7Isup = main.ONOSbench.isup( ONOS7Ip )
if not onos7Isup:
main.log.report( "ONOS7 didn't start!" )
+ main.ONOSbench.onosStop( ONOS7Ip )
+ main.ONOSbench.onosStart( ONOS7Ip )
onosIsupResult = onos1Isup and onos2Isup and onos3Isup\
and onos4Isup and onos5Isup and onos6Isup and onos7Isup
if onosIsupResult == main.TRUE:
@@ -446,6 +460,7 @@
host1Id = host1Dict.get( 'id', None )
host2Id = host2Dict.get( 'id', None )
if host1Id and host2Id:
+ # TODO: distribute the intents across onos nodes
tmpResult = main.ONOScli1.addHostIntent(
host1Id,
host2Id )
@@ -491,7 +506,7 @@
" and h" + str( i + 10 ) )
elif ping == main.TRUE:
main.log.info( "Ping test passed!" )
- PingResult = main.TRUE
+ # Don't set PingResult or you'd override failures
if PingResult == main.FALSE:
main.log.report(
"Intents have not been installed correctly, pings failed." )
@@ -553,8 +568,6 @@
ONOS5Mastership = main.ONOScli5.roles()
ONOS6Mastership = main.ONOScli6.roles()
ONOS7Mastership = main.ONOScli7.roles()
- # print json.dumps( json.loads( ONOS1Mastership ), sort_keys=True,
- # indent=4, separators=( ',', ': ' ) )
if "Error" in ONOS1Mastership or not ONOS1Mastership\
or "Error" in ONOS2Mastership or not ONOS2Mastership\
or "Error" in ONOS3Mastership or not ONOS3Mastership\
@@ -1126,8 +1139,6 @@
ONOS5Mastership = main.ONOScli5.roles()
ONOS6Mastership = main.ONOScli6.roles()
ONOS7Mastership = main.ONOScli7.roles()
- # print json.dumps( json.loads( ONOS1Mastership ), sort_keys=True,
- # indent=4, separators=( ',', ': ' ) )
if "Error" in ONOS1Mastership or not ONOS1Mastership\
or "Error" in ONOS2Mastership or not ONOS2Mastership\
or "Error" in ONOS3Mastership or not ONOS3Mastership\
@@ -1466,6 +1477,7 @@
count = 0
main.step( "Collecting topology information from ONOS" )
startTime = time.time()
+ # Give time for Gossip to work
while topoResult == main.FALSE and elapsed < 60:
count = count + 1
if count > 1:
@@ -1526,140 +1538,134 @@
cliTime = time.time() - cliStart
print "CLI time: " + str( cliTime )
- try:
- for controller in range( numControllers ):
- controllerStr = str( controller + 1 )
- if devices[ controller ] or "Error" not in devices[
- controller ]:
- currentDevicesResult = main.Mininet1.compareSwitches(
- MNTopo,
- json.loads(
- devices[ controller ] ) )
- else:
- currentDevicesResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentDevicesResult,
- onpass="ONOS" + controllerStr +
- " Switches view is correct",
- onfail="ONOS" + controllerStr +
- " Switches view is incorrect" )
+ for controller in range( numControllers ):
+ controllerStr = str( controller + 1 )
+ if devices[ controller ] or "Error" not in devices[
+ controller ]:
+ currentDevicesResult = main.Mininet1.compareSwitches(
+ MNTopo,
+ json.loads(
+ devices[ controller ] ) )
+ else:
+ currentDevicesResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentDevicesResult,
+ onpass="ONOS" + controllerStr +
+ " Switches view is correct",
+ onfail="ONOS" + controllerStr +
+ " Switches view is incorrect" )
- if ports[ controller ] or "Error" not in ports[ controller ]:
- currentPortsResult = main.Mininet1.comparePorts(
- MNTopo,
- json.loads(
- ports[ controller ] ) )
- else:
- currentPortsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentPortsResult,
- onpass="ONOS" + controllerStr +
- " ports view is correct",
- onfail="ONOS" + controllerStr +
- " ports view is incorrect" )
+ if ports[ controller ] or "Error" not in ports[ controller ]:
+ currentPortsResult = main.Mininet1.comparePorts(
+ MNTopo,
+ json.loads(
+ ports[ controller ] ) )
+ else:
+ currentPortsResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentPortsResult,
+ onpass="ONOS" + controllerStr +
+ " ports view is correct",
+ onfail="ONOS" + controllerStr +
+ " ports view is incorrect" )
- if links[ controller ] or "Error" not in links[ controller ]:
- currentLinksResult = main.Mininet1.compareLinks(
- MNTopo,
- json.loads(
- links[ controller ] ) )
- else:
- currentLinksResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentLinksResult,
- onpass="ONOS" + controllerStr +
- " links view is correct",
- onfail="ONOS" + controllerStr +
- " links view is incorrect" )
- devicesResults = devicesResults and currentDevicesResult
- portsResults = portsResults and currentPortsResult
- linksResults = linksResults and currentLinksResult
+ if links[ controller ] or "Error" not in links[ controller ]:
+ currentLinksResult = main.Mininet1.compareLinks(
+ MNTopo,
+ json.loads(
+ links[ controller ] ) )
+ else:
+ currentLinksResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentLinksResult,
+ onpass="ONOS" + controllerStr +
+ " links view is correct",
+ onfail="ONOS" + controllerStr +
+ " links view is incorrect" )
+ devicesResults = devicesResults and currentDevicesResult
+ portsResults = portsResults and currentPortsResult
+ linksResults = linksResults and currentLinksResult
- # Compare json objects for hosts and dataplane clusters
+ # Compare json objects for hosts and dataplane clusters
- # hosts
- consistentHostsResult = main.TRUE
- for controller in range( len( hosts ) ):
- controllerStr = str( controller + 1 )
- if "Error" not in hosts[ controller ]:
- if hosts[ controller ] == hosts[ 0 ]:
- continue
- else: # hosts not consistent
- main.log.report( "hosts from ONOS" + controllerStr +
- " is inconsistent with ONOS1" )
- main.log.warn( repr( hosts[ controller ] ) )
- consistentHostsResult = main.FALSE
-
- else:
- main.log.report( "Error in getting ONOS hosts from ONOS" +
- controllerStr )
+ # hosts
+ consistentHostsResult = main.TRUE
+ for controller in range( len( hosts ) ):
+ controllerStr = str( controller + 1 )
+ if "Error" not in hosts[ controller ]:
+ if hosts[ controller ] == hosts[ 0 ]:
+ continue
+ else: # hosts not consistent
+ main.log.report( "hosts from ONOS" + controllerStr +
+ " is inconsistent with ONOS1" )
+ main.log.warn( repr( hosts[ controller ] ) )
consistentHostsResult = main.FALSE
- main.log.warn( "ONOS" + controllerStr +
- " hosts response: " +
- repr( hosts[ controller ] ) )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=consistentHostsResult,
- onpass="Hosts view is consistent across all ONOS nodes",
- onfail="ONOS nodes have different views of hosts" )
- # Strongly connected clusters of devices
- consistentClustersResult = main.TRUE
- for controller in range( len( clusters ) ):
- controllerStr = str( controller + 1 )
- if "Error" not in clusters[ controller ]:
- if clusters[ controller ] == clusters[ 0 ]:
- continue
- else: # clusters not consistent
- main.log.report( "clusters from ONOS" +
- controllerStr +
- " is inconsistent with ONOS1" )
- consistentClustersResult = main.FALSE
+ else:
+ main.log.report( "Error in getting ONOS hosts from ONOS" +
+ controllerStr )
+ consistentHostsResult = main.FALSE
+ main.log.warn( "ONOS" + controllerStr +
+ " hosts response: " +
+ repr( hosts[ controller ] ) )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=consistentHostsResult,
+ onpass="Hosts view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of hosts" )
- else:
- main.log.report( "Error in getting dataplane clusters " +
- "from ONOS" + controllerStr )
+ # Strongly connected clusters of devices
+ consistentClustersResult = main.TRUE
+ for controller in range( len( clusters ) ):
+ controllerStr = str( controller + 1 )
+ if "Error" not in clusters[ controller ]:
+ if clusters[ controller ] == clusters[ 0 ]:
+ continue
+ else: # clusters not consistent
+ main.log.report( "clusters from ONOS" +
+ controllerStr +
+ " is inconsistent with ONOS1" )
consistentClustersResult = main.FALSE
- main.log.warn( "ONOS" + controllerStr +
- " clusters response: " +
- repr( clusters[ controller ] ) )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=consistentClustersResult,
- onpass="Clusters view is consistent across all ONOS nodes",
- onfail="ONOS nodes have different views of clusters" )
- # there should always only be one cluster
- numClusters = len( json.loads( clusters[ 0 ] ) )
- utilities.assert_equals(
- expect=1,
- actual=numClusters,
- onpass="ONOS shows 1 SCC",
- onfail="ONOS shows " +
- str( numClusters ) +
- " SCCs" )
- topoResult = ( devicesResults and portsResults and linksResults
- and consistentHostsResult
- and consistentClustersResult )
+ else:
+ main.log.report( "Error in getting dataplane clusters " +
+ "from ONOS" + controllerStr )
+ consistentClustersResult = main.FALSE
+ main.log.warn( "ONOS" + controllerStr +
+ " clusters response: " +
+ repr( clusters[ controller ] ) )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=consistentClustersResult,
+ onpass="Clusters view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of clusters" )
+ # there should always only be one cluster
+ numClusters = len( json.loads( clusters[ 0 ] ) )
+ utilities.assert_equals(
+ expect=1,
+ actual=numClusters,
+ onpass="ONOS shows 1 SCC",
+ onfail="ONOS shows " +
+ str( numClusters ) +
+ " SCCs" )
- topoResult = topoResult and int( count <= 2 )
- note = "note it takes about " + str( int( cliTime ) ) + \
- " seconds for the test to make all the cli calls to fetch " +\
- "the topology from each ONOS instance"
- main.log.info(
- "Very crass estimate for topology discovery/convergence( " +
- str( note ) + " ): " + str( elapsed ) + " seconds, " +
- str( count ) + " tries" )
- utilities.assert_equals( expect=main.TRUE, actual=topoResult,
- onpass="Topology Check Test successful",
- onfail="Topology Check Test NOT successful" )
- if topoResult == main.TRUE:
- main.log.report( "ONOS topology view matches Mininet topology" )
- except:
- main.log.info( self.name + " ::::::" )
- main.log.error( traceback.print_exc() )
- main.log.info( self.name + " ::::::" )
+ topoResult = ( devicesResults and portsResults and linksResults
+ and consistentHostsResult
+ and consistentClustersResult )
+ topoResult = topoResult and int( count <= 2 )
+ note = "note it takes about " + str( int( cliTime ) ) + \
+ " seconds for the test to make all the cli calls to fetch " +\
+ "the topology from each ONOS instance"
+ main.log.info(
+ "Very crass estimate for topology discovery/convergence( " +
+ str( note ) + " ): " + str( elapsed ) + " seconds, " +
+ str( count ) + " tries" )
+ utilities.assert_equals( expect=main.TRUE, actual=topoResult,
+ onpass="Topology Check Test successful",
+ onfail="Topology Check Test NOT successful" )
+ if topoResult == main.TRUE:
+ main.log.report( "ONOS topology view matches Mininet topology" )
def CASE9( self, main ):
"""
diff --git a/TestON/tests/HATestSanity/HATestSanity.topo b/TestON/tests/HATestSanity/HATestSanity.topo
index c24d546..9305025 100644
--- a/TestON/tests/HATestSanity/HATestSanity.topo
+++ b/TestON/tests/HATestSanity/HATestSanity.topo
@@ -151,7 +151,7 @@
<arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
<arg2> --topo mytopo </arg2>
<arg3> </arg3>
- <controller> remote </controller>
+ <controller> none </controller>
</COMPONENTS>
</Mininet1>
@@ -162,7 +162,7 @@
<type>RemoteMininetDriver</type>
<connect_order>17</connect_order>
<COMPONENTS>
- </COMPONENTS>
+ </COMPONENTS>
</Mininet2>
</COMPONENT>
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params
index 7f5cf4e..80de267 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params
@@ -1,7 +1,7 @@
<PARAMS>
<testcases>1,2,8,3,4,5,14,[6],8,3,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
- <cellName>HA</cellName>
+ <cellName>HA</cellName>
</ENV>
<Git>False</Git>
<branch> master </branch>
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
index 4b9b287..44ce741 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
@@ -293,7 +293,7 @@
" and h" + str( i + 10 ) )
elif ping == main.TRUE:
main.log.info( "Ping test passed!" )
- PingResult = main.TRUE
+ # Don't set PingResult or you'd override failures
if PingResult == main.FALSE:
main.log.report(
"Intents have not been installed correctly, pings failed." )
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo
index 4d4156c..9305025 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo
@@ -151,7 +151,7 @@
<arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
<arg2> --topo mytopo </arg2>
<arg3> </arg3>
- <controller> remote </controller>
+ <controller> none </controller>
</COMPONENTS>
</Mininet1>
@@ -162,11 +162,7 @@
<type>RemoteMininetDriver</type>
<connect_order>17</connect_order>
<COMPONENTS>
- # Specify the Option for mininet
- <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
- <arg2> --topo mytopo --arp</arg2>
- <controller> remote </controller>
- </COMPONENTS>
+ </COMPONENTS>
</Mininet2>
</COMPONENT>
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.py b/TestON/tests/IntentPerfNext/IntentPerfNext.py
index c965612..8fd8089 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.py
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.py
@@ -23,22 +23,10 @@
gitPull = main.params[ 'GIT' ][ 'autoPull' ]
checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
- ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
- ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
- ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
-
- main.ONOSbench.onosUninstall( nodeIp=ONOS1Ip )
- main.ONOSbench.onosUninstall( nodeIp=ONOS2Ip )
- main.ONOSbench.onosUninstall( nodeIp=ONOS3Ip )
- main.ONOSbench.onosUninstall( nodeIp=ONOS4Ip )
- main.ONOSbench.onosUninstall( nodeIp=ONOS5Ip )
- main.ONOSbench.onosUninstall( nodeIp=ONOS6Ip )
- #TODO: Investigate why node 7 uninstall fails
- #main.ONOSbench.onosUninstall( nodeIp=ONOS7Ip )
+ ONOSIp = []
+ for i in range(1, 8):
+ ONOSIp.append(main.params[ 'CTRL' ][ 'ip'+str(i) ])
+ main.ONOSbench.onosUninstall( nodeIp = ONOSIp[i-1] )
MN1Ip = main.params[ 'MN' ][ 'ip1' ]
BENCHIp = main.params[ 'BENCH' ][ 'ip' ]
@@ -52,7 +40,7 @@
cellFileResult = main.ONOSbench.createCellFile(
BENCHIp, cellName, MN1Ip,
"onos-core,onos-app-metrics,onos-gui",
- ONOS1Ip )
+ ONOSIp[0] )
main.step( "Applying cell file to environment" )
cellApplyResult = main.ONOSbench.setCell( cellName )
@@ -83,21 +71,15 @@
packageResult = main.ONOSbench.onosPackage()
main.step( "Installing ONOS package" )
- install1Result = main.ONOSbench.onosInstall( node=ONOS1Ip )
- #install2Result = main.ONOSbench.onosInstall( node=ONOS2Ip )
- #install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip )
+ install1Result = main.ONOSbench.onosInstall( node=ONOSIp[0] )
main.step( "Set cell for ONOScli env" )
main.ONOS1cli.setCell( cellName )
- # main.ONOS2cli.setCell( cellName )
- # main.ONOS3cli.setCell( cellName )
time.sleep( 5 )
main.step( "Start onos cli" )
- cli1 = main.ONOS1cli.startOnosCli( ONOS1Ip )
- #cli2 = main.ONOS2cli.startOnosCli( ONOS2Ip )
- #cli3 = main.ONOS3cli.startOnosCli( ONOS3Ip )
+ cli1 = main.ONOS1cli.startOnosCli( ONOSIp[0] )
utilities.assert_equals( expect=main.TRUE,
actual=cellFileResult and cellApplyResult and
@@ -560,6 +542,9 @@
def CASE4( self, main ):
"""
Batch intent install
+
+ Supports scale-out scenarios and increasing
+ number of intents within each iteration
"""
import time
import json
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.params b/TestON/tests/LinkEventTP/LinkEventTP.params
new file mode 100644
index 0000000..2beb9aa
--- /dev/null
+++ b/TestON/tests/LinkEventTP/LinkEventTP.params
@@ -0,0 +1,61 @@
+<PARAMS>
+
+ <testcases>1,3,2,3,2,3,2,3</testcases>
+
+ <ENV>
+ <cellName>network_tp_test</cellName>
+ <cellFeatures>"webconsole,onos-core,onos-api,onos-cli,onos-null,onos-rest,onos-app-metrics,onos-app-metrics-intent,onos-app-metrics-topology"</cellFeatures>
+ </ENV>
+
+ <SCALE>2</SCALE>
+ <availableNodes>7</availableNodes>
+
+ <GIT>
+ <autopull>off</autopull>
+ <checkout>master</checkout>
+ </GIT>
+
+ <CTRL>
+ <USER>admin</USER>
+ <ip1>10.254.1.201</ip1>
+ <port1>6633</port1>
+ <ip2>10.254.1.202</ip2>
+ <port2>6633</port2>
+ <ip3>10.254.1.203</ip3>
+ <port3>6633</port3>
+ <ip4>10.254.1.204</ip4>
+ <port4>6633</port4>
+ <ip5>10.254.1.205</ip5>
+ <port5>6633</port5>
+ <ip6>10.254.1.206</ip6>
+ <port6>6633</port6>
+ <ip7>10.254.1.207</ip7>
+ <port7>6633</port7>
+ </CTRL>
+
+ <BENCH>
+ <user>admin</user>
+ <ip1>localhost</ip1>
+ </BENCH>
+
+ <TEST> # duration = time the test loop runs
+ # log_interval = how often the data is reported
+ # wait = time between tests, used to let the averages run down
+
+ <metric1>topologyLinkEventRate</metric1>
+ <metric2>topologyGraphEventRate</metric2>
+ <flickerRate>2</flickerRate>
+ <duration>180</duration>
+ <log_interval>20</log_interval>
+ <wait>30</wait>
+ <configFile>/onos/tools/package/etc/org.onosproject.net.topology.impl.DefaultTopologyProvider.cfg</configFile>
+ <skipCleanInstall>yes</skipCleanInstall>
+ <MN>localhost</MN>
+ <logFile>link_event_tp_results_LOG</logFile>
+ </TEST>
+
+ <JSON>
+ <intents_rate>intentInstalledRate</intents_rate>
+ </JSON>
+
+</PARAMS>
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.py b/TestON/tests/LinkEventTP/LinkEventTP.py
new file mode 100644
index 0000000..1f5861e
--- /dev/null
+++ b/TestON/tests/LinkEventTP/LinkEventTP.py
@@ -0,0 +1,276 @@
+# ScaleOutTemplate --> LinkEventTP
+#
+# CASE1 starts number of nodes specified in param file
+#
+# cameron@onlab.us
+
+import sys
+import os
+
+
+class LinkEventTP:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ): #This is the initialization case
+ import os.path #this case will clean up all nodes
+ #but only node 1 isnodestarted in this case
+
+ global clusterCount #number of nodes running
+ global ONOSIp #list of ONOS IP addresses
+
+ clusterCount = 1
+ ONOSIp = [ 0 ]
+
+ #Load values from params file
+ checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
+ gitPull = main.params[ 'GIT' ][ 'autopull' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ Features= main.params[ 'ENV' ][ 'cellFeatures' ]
+ BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+ BENCHUser = main.params[ 'BENCH' ][ 'user' ]
+ maxNodes = int(main.params[ 'availableNodes' ])
+ Features = main.params[ 'ENV' ][ 'cellFeatures' ]
+ skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
+ flickerRate = main.params[ 'TEST' ][ 'flickerRate']
+ MNip = main.params[ 'TEST' ][ 'MN' ]
+
+ #Populate ONOSIp with ips from params
+ for i in range(1, maxNodes + 1):
+ ipString = 'ip' + str(i)
+ ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
+
+ #kill off all onos processes
+ main.log.step("Safety check, killing all ONOS processes")
+ main.log.step("before initiating enviornment setup")
+ for node in range(1, maxNodes + 1):
+ main.ONOSbench.onosDie(ONOSIp[node])
+
+ #construct the cell file
+ main.log.step("Creating cell file")
+ exec "a = main.ONOSbench.createCellFile"
+ cellIp = []
+ for node in range (1, maxNodes + 1):
+ cellIp.append(ONOSIp[node])
+ a(BENCHIp,cellName,MNip,str(Features), *cellIp) #'0' as third arg because we are not using mininet
+
+ main.step( "Set Cell" )
+ main.ONOSbench.setCell(cellName)
+
+ #Uninstall everywhere
+ main.log.step( "Cleaning Enviornment..." )
+ for i in range(1, maxNodes + 1):
+ main.log.info(" Uninstalling ONOS " + str(i) )
+ main.ONOSbench.onosUninstall( ONOSIp[i] )
+
+ #git step - skipable
+ main.step( "Git checkout and pull " + checkoutBranch )
+ if gitPull == 'on':
+ checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
+ pullResult = main.ONOSbench.gitPull()
+
+ else:
+ checkoutResult = main.TRUE
+ pullResult = main.TRUE
+ main.log.info( "Skipped git checkout and pull" )
+
+ #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
+ if skipMvn != "yes":
+ mvnResult = main.ONOSbench.cleanInstall()
+
+ #configuring file to enable flicker
+ main.log.step(" Configuring null provider to enable flicker. Flicker Rate = " + flickerRate )
+ homeDir = os.path.expanduser('~')
+ main.log.info(homeDir)
+ localPath = "/onos/tools/package/etc/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg"
+ filePath = homeDir + localPath
+ main.log.info(filePath)
+
+ neighborsString = ""
+ for node in range(1, maxNodes + 1):
+ neighborsString += ONOSIp[node]
+ if node < maxNodes:
+ neighborsString += ","
+
+ configFile = open(filePath, 'w+')
+ main.log.info("File opened")
+ configFile.write("# Sample configurations for the NullLinkProvider.\n")
+ configFile.write("# \n")
+ configFile.write("# If enabled, sets time between linkEvent generation\n")
+ configFile.write("# in milliseconds.\n")
+ configFile.write("#\n")
+ configFile.write("eventRate = " + flickerRate)
+ configFile.write("\n")
+ configFile.write("#Set order of islands to chain together, in a line.\n")
+ configFile.write("neighbors = " + neighborsString)
+ configFile.close()
+ main.log.info("Configuration completed")
+
+ ### configure event rate file ###
+ main.log.step("Writing Default Topology Provider config file")
+ localPath = main.params[ 'TEST' ][ 'configFile' ]
+ filePath = homeDir + localPath
+ main.log.info(filePath)
+ configFile = open(filePath, 'w+')
+ main.log.info("File Opened")
+ configFile.write("maxEvents = 1\n")
+ configFile.write("maxIdleMs = 0\n")
+ configFile.write("maxBatchMs = 0\n")
+ main.log.info("File written and closed")
+
+
+ devices_by_ip = ""
+ for node in range(1, maxNodes + 1):
+ devices_by_ip += (ONOSIp[node] + ":" + str(5))
+ if node < maxNodes:
+ devices_by_ip +=(",")
+
+ main.log.step("Configuring device provider")
+ localPath = "/onos/tools/package/etc/org.onosproject.provider.nil.device.impl.NullDeviceProvider.cfg"
+ filePath = homeDir + localPath
+ main.log.info(filePath)
+ configFile = open(filePath, 'w+')
+ main.log.info("Device config file opened")
+ configFile.write("devConfigs = " + devices_by_ip)
+ configFile.close()
+ main.log.info("File closed")
+
+ logFileName = main.params[ 'TEST' ][ 'logFile' ]
+ logFile = open(logFileName, 'w+')
+ main.log.info("Created log File")
+ logFile.close()
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "Installing ONOS package" )
+ install1Result = main.ONOSbench.onosInstall( node=ONOSIp[1] )
+
+ main.step( "Verify cells" )
+ verifyCellResult = main.ONOSbench.verifyCell()
+
+ main.step( "Enviornment setup and verification complete." )
+ main.ONOS1cli.startOnosCli( ONOSIp[1] )
+ main.step( "ONOS 1 is up and running." )
+
+
+ def CASE2( self, main ):
+ # This case increases the cluster size by whatever scale is
+ # Note: 'scale' is the size of the step
+ # if scaling is not a part of your test, simply run this case
+ # once after CASE1 to set up your enviornment for your desired
+ # cluster size. If scaling is a part of you test call this case each time
+ # you want to increase cluster size
+
+ ''
+ 'Increase number of nodes and initiate CLI'
+ ''
+ import time
+ global clusterCount
+
+ scale = int( main.params[ 'SCALE' ] )
+ clusterCount += scale
+
+ main.log.report( "Increasing cluster size to " + str( clusterCount ) )
+ for node in range((clusterCount - scale) + 1, clusterCount + 1):
+ main.ONOSbench.onosDie(ONOSIp[node])
+ time.sleep(10)
+ main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
+ main.ONOSbench.onosInstall( ONOSIp[node] )
+ exec "a = main.ONOS%scli.startOnosCli" %str(node)
+ a(ONOSIp[node])
+
+ def CASE3( self, main ):
+ import time
+ import json
+ import string
+ import csv
+ import os.path
+
+
+ linkResult = main.FALSE
+ scale = int( main.params[ 'SCALE' ] )
+
+ testDelay = main.params[ 'TEST' ][ 'wait']
+ time.sleep( float( testDelay ) )
+
+ metric1 = main.params[ 'TEST' ][ 'metric1' ]
+ metric2 = main.params[ 'TEST' ][ 'metric2' ]
+ testDuration = main.params[ 'TEST' ][ 'duration' ]
+ stop = time.time() + float( testDuration )
+
+ msg = ( "Starting test loop for " + str(testDuration) + " seconds on a " + str(clusterCount) + " node cluster" )
+ main.log.info( msg )
+ logInterval = main.params[ 'TEST' ][ 'log_interval' ]
+
+ linkResults = [0,0,0,0,0,0,0,0]
+ graphResults = [0,0,0,0,0,0,0,0]
+ JsonStr = [ 0,0,0,0,0,0,0,0 ]
+ JsonObj = [ 0,0,0,0,0,0,0,0 ]
+
+ while time.time() < stop:
+ time.sleep( float( logInterval ) )
+ for node in range(1, clusterCount+1):
+ exec "a = main.ONOS%scli.topologyEventsMetrics" %str(node)
+ JsonStr[node] = a()
+ JsonObj[node] = json.loads( JsonStr[node] )
+ msg = ( "Node " + str(node) + " Link Event TP: " + str( JsonObj[node][ metric1 ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+ msg = ( "Node " + str(node) + " Graph Event TP: " + str( JsonObj[node][ metric2 ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+
+ linkResults[node] = round(JsonObj[node][ metric2 ][ 'm1_rate' ],2)
+ graphResults[node] = round(JsonObj[node][ metric1 ][ 'm1_rate' ],2)
+
+ print("")
+ print("")
+
+ main.log.info("Final Link Event TP Results on " + str(clusterCount) + " node cluster")
+ main.log.info("_______________________________________________")
+ for node in range(1, clusterCount+1):
+ main.log.info("Node " + str(node) + ": " + str(linkResults[node]))
+
+ print("")
+ print("")
+
+ main.log.info("Final Graph Event TP Results on " + str(clusterCount) + " node cluster")
+ main.log.info("_______________________________________________")
+ for node in range(1, clusterCount+1):
+ main.log.info("Node " + str(node) + ": " + str(graphResults[node]))
+
+ #################################################################################
+ # Data Logging
+
+ logFileName = main.params[ 'TEST' ][ 'logFile' ]
+ logFile = open(logFileName, 'a')
+ main.log.info("Log file opened")
+ flickerRate = main.params[ 'TEST' ][ 'flickerRate']
+
+ for node in range (1, clusterCount + 1):
+ logFile.write( str(clusterCount) + "," )
+ logFile.write("'" + "baremetal" + str(node) + "'," )
+ logFile.write( testDuration + "," )
+ logFile.write( flickerRate + "," )
+ logFile.write( str(linkResults[node]) + "," )
+ logFile.write( str(graphResults[node]) + "\n" )
+
+ logFile.close()
+ main.log.info("Log file closed")
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.pyc b/TestON/tests/LinkEventTP/LinkEventTP.pyc
new file mode 100644
index 0000000..08393ed
--- /dev/null
+++ b/TestON/tests/LinkEventTP/LinkEventTP.pyc
Binary files differ
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.topo b/TestON/tests/LinkEventTP/LinkEventTP.topo
new file mode 100644
index 0000000..1c48a85
--- /dev/null
+++ b/TestON/tests/LinkEventTP/LinkEventTP.topo
@@ -0,0 +1,146 @@
+<TOPOLOGY>
+
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <home>~/onos</home>
+ </COMPONENTS>
+
+ </ONOSbench>
+
+ <ONOS1cli>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1cli>
+
+ <ONOS2cli>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2cli>
+
+ <ONOS3cli>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3cli>
+
+ <ONOS4cli>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS4cli>
+
+ <ONOS5cli>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS5cli>
+
+ <ONOS6cli>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS6cli>
+
+ <ONOS7cli>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS7cli>
+
+ <ONOS1>
+ <host>10.254.1.201</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>9</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1>
+
+ <ONOS2>
+ <host>10.254.1.202</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>10</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2>
+
+ <ONOS3>
+ <host>10.254.1.203</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>11</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3>
+
+ <ONOS4>
+ <host>10.254.1.204</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>12</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS4>
+
+
+ <ONOS5>
+ <host>10.254.1.205</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>13</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS5>
+
+ <ONOS6>
+ <host>10.254.1.206</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>14</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS6>
+
+ <ONOS7>
+ <host>10.254.1.207</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>15</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS7>
+
+ </COMPONENT>
+
+</TOPOLOGY>
diff --git a/TestON/tests/LinkEventTP/OLDLinkEventTP.py b/TestON/tests/LinkEventTP/OLDLinkEventTP.py
new file mode 100644
index 0000000..e12befa
--- /dev/null
+++ b/TestON/tests/LinkEventTP/OLDLinkEventTP.py
@@ -0,0 +1,348 @@
+# ScaleOutTemplate --> LinkEventTp
+#
+# CASE1 starts number of nodes specified in param file
+#
+# cameron@onlab.us
+
+import sys
+import os
+
+
+class LinkEventTP:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import os.path
+ global clusterCount
+ clusterCount = 1
+
+ checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
+ gitPull = main.params[ 'GIT' ][ 'autopull' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+ BENCHUser = main.params[ 'BENCH' ][ 'user' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ flickerRate = main.params[ 'TEST' ][ 'flickerRate']
+
+
+ main.log.step( "Cleaning Enviornment..." )
+ main.ONOSbench.onosUninstall( ONOS1Ip )
+ main.ONOSbench.onosUninstall( ONOS2Ip )
+ main.ONOSbench.onosUninstall( ONOS3Ip )
+
+ main.step( "Git checkout and pull " + checkoutBranch )
+ if gitPull == 'on':
+ checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
+ pullResult = main.ONOSbench.gitPull()
+
+ else:
+ checkoutResult = main.TRUE
+ pullResult = main.TRUE
+ main.log.info( "Skipped git checkout and pull" )
+
+ #mvnResult = main.ONOSbench.cleanInstall()
+
+ main.step( "Set cell for ONOS cli env" )
+ main.ONOS1cli.setCell( cellName )
+ main.ONOS2cli.setCell( cellName )
+ main.ONOS3cli.setCell( cellName )
+
+ ### configuring file to enable flicker ###
+ main.log.info(" Configuring null provider to enable flicker. Flicker Rate = " + flickerRate )
+ homeDir = os.path.expanduser('~')
+ main.log.info(homeDir)
+ localPath = "/ONOS/tools/package/etc/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg"
+ filePath = homeDir + localPath
+ main.log.info(filePath)
+
+ configFile = open(filePath, 'w+')
+ main.log.info("File opened")
+ configFile.write("# Sample configurations for the NullLinkProvider.\n")
+ configFile.write("# \n")
+ configFile.write("# If enabled, generates LinkDetected and LinkVanished events\n")
+ configFile.write("# to make the link appear to be flapping.\n")
+ configFile.write("#\n")
+ configFile.write("flicker = true\n")
+ configFile.write("#\n")
+ configFile.write("# If enabled, sets the time between LinkEvent generation,\n")
+ configFile.write("# in milliseconds.\n")
+ configFile.write("#\n")
+ configFile.write("eventRate = " + flickerRate)
+ configFile.close()
+ main.log.info("Configuration completed")
+
+ #############################
+ #config file default topo provider
+ ###########################
+
+ ### configure deafult topo provider event rate ###??????????????????
+ localPath = main.params[ 'TEST' ][ 'configFile' ]
+ filePath = homeDir + localPath
+ main.log.info(filePath)
+ configFile = open(filePath, 'w+')
+ main.log.info("File Opened")
+ configFile.write("maxEvents = 1\n")
+ configFile.write("maxIdleMs = 0\n")
+ configFile.write("maxBatchMs = 0\n")
+ main.log.info("File written and closed")
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage() # no file or directory
+
+ main.step( "Installing ONOS package" )
+ install1Result = main.ONOSbench.onosInstall( node=ONOS1Ip )
+
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ main.step( "Applying cell file to environment" )
+ cellApplyResult = main.ONOSbench.setCell( cellName )
+ main.step( "verify cells" )
+ verifyCellResult = main.ONOSbench.verifyCell()
+
+ main.step( "Set cell for ONOS cli env" )
+ main.ONOS1cli.setCell( cellName )
+
+ cli1 = main.ONOS1cli.startOnosCli( ONOS1Ip )
+
+ def CASE2( self, main ):
+ """
+ Increase number of nodes and initiate CLI
+ """
+ import time
+ global clusterCount
+
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ #ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
+ #ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
+ #ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
+ #ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ scale = int( main.params[ 'SCALE' ] )
+
+ # Cluster size increased everytime the case is defined
+ clusterCount += scale
+
+ main.log.report( "Increasing cluster size to " +
+ str( clusterCount ) )
+ installResult = main.FALSE
+
+ if scale == 2:
+ if clusterCount == 3:
+ main.log.info( "Installing nodes 2 and 3" )
+ install2Result = main.ONOSbench.onosInstall( node=ONOS2Ip )
+ install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip )
+ cli2 = main.ONOS2cli.startOnosCli( ONOS2Ip )
+ cli3 = main.ONOS3cli.startOnosCli( ONOS3Ip )
+ installResult = main.TRUE
+
+ if scale == 1:
+ if clusterCount == 2:
+ main.log.info( "Installing node 2" )
+ install2Result = main.ONOSbench.onosInstall( node=ONOS2Ip )
+ cli2 = main.ONOS2cli.startOnosCli( ONOS2Ip )
+ installResult = main.TRUE
+
+ if clusterCount == 3:
+ main.log.info( "Installing node 3" )
+ install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip )
+ cli3 = main.ONOS3cli.startOnosCli( ONOS3Ip )
+ installResult = main.TRUE
+
+
+ def CASE3( self, main ):
+ import time
+ import json
+ import string
+ import csv
+
+ linkResult = main.FALSE
+
+ testDelay = main.params[ 'TEST' ][ 'wait']
+ time.sleep( float( testDelay ) )
+
+ metric1 = main.params[ 'TEST' ][ 'metric1' ]
+ metric2 = main.params[ 'TEST' ][ 'metric2' ]
+ testDuration = main.params[ 'TEST' ][ 'duration' ]
+ stop = time.time() + float( testDuration )
+
+ main.ONOS1cli.featureInstall("onos-null")
+
+ msg = ( "Starting test loop for " + str(testDuration) + " seconds" )
+ main.log.info( msg )
+ logInterval = main.params[ 'TEST' ][ 'log_interval' ]
+
+ while time.time() < stop:
+ time.sleep( float( logInterval ) )
+
+ JsonStr1 = main.ONOS1cli.topologyEventsMetrics()
+ JsonObj1 = json.loads( JsonStr1 )
+ msg = ( "Node 1 Link Event TP: " + str( JsonObj1[ metric1 ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+ msg = ( "Node 1 Graph Event TP: " + str( JsonObj1[ metric2 ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+
+ lastGraphRate = round(JsonObj1[ metric2 ][ 'm1_rate' ],2)
+ lastLinkRate = round(JsonObj1[ metric1 ][ 'm1_rate' ],2)
+
+ msg = ( "Final Link Event TP: " + str( lastLinkRate ) )
+ main.log.report( msg )
+ msg = ( "Final Graph Event TP: " + str( lastGraphRate ) )
+ main.log.report( msg )
+
+ linkResult = main.TRUE
+ '''
+ jenkinsReport = open('LinkEventTP.csv', 'w')
+ jenkinsReport.write("T1 - Node 1, T2 - Node 1, T2 - Node 2, T3 - Node 1, T3 - Node 2, T3 - Node 3\n")
+ jenkinsReport.write(str(lastRate1))
+ jenkinsReport.write("\n")
+ jenkinsReport.close()
+
+ dbReportS1 = open('LinkEventTP-S1.csv','w') #must be the name of the test "-S" followed by the scale
+ dbReportS1.write(str(linkResult))
+ dbReportS1.write("\n")
+ dbReportS1.write(str(lastRate1))
+ dbReportS1.write("\n") #additional newline needed for bash script reading
+ dbReportS1.close()
+ '''
+
+
+ def CASE4( self, main ):
+ import time
+ import json
+ import string
+
+ linkResult = main.FALSE
+
+ testDelay = main.params[ 'TEST' ][ 'wait']
+ time.sleep( float( testDelay ) )
+
+ getMetric = main.params[ 'TEST' ][ 'metric1' ]
+ testDuration = main.params[ 'TEST' ][ 'duration' ]
+ stop = time.time() + float( testDuration )
+
+ main.ONOS2cli.featureInstall("onos-null")
+
+ msg = ( "Starting test loop for " + str(testDuration) + " seconds" )
+ main.log.info( msg )
+ logInterval = main.params[ 'TEST' ][ 'log_interval' ]
+
+ while time.time() < stop:
+ time.sleep( float( logInterval ) )
+
+ JsonStr1 = main.ONOS1cli.topologyEventsMetrics()
+ JsonObj1 = json.loads( JsonStr1 )
+ msg = ( "Node 1 TP: " + str( JsonObj1[ getMetric ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+ lastRate1 = round(JsonObj1[ getMetric ][ 'm1_rate' ],2)
+
+
+ JsonStr2 = main.ONOS2cli.topologyEventsMetrics()
+ JsonObj2 = json.loads( JsonStr2 )
+ msg = ( "Node 2 TP: " + str( JsonObj2[ getMetric ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+ lastRate2 = round(JsonObj2[ getMetric ][ 'm1_rate' ],2)
+
+
+ msg = ( "Final TP on node 1: " + str( lastRate1 ) )
+ main.log.report( msg )
+
+ msg = ( "Final TP on node 2: " + str( lastRate2 ) )
+ main.log.report( msg )
+
+ linkResult = main.TRUE
+
+ jenkinsReport = open('LinkEventTP.csv', 'a')
+ jenkinsReport.write(str(lastRate1))
+ jenkinsReport.write(", ")
+ jenkinsReport.write(str(lastRate2))
+ jenkinsReport.write(", ")
+ jenkinsReport.close()
+
+ dbReportS2 = open('LinkEventTP-S2.csv','w') #must be the name of the test "-S" followed by the scale
+ dbReportS2.write(str(linkResult))
+ dbReportS2.write("\n")
+ dbReportS2.write(str(lastRate1))
+ dbReportS2.write("\n")
+ dbReportS2.write(str(lastRate2))
+ dbReportS2.write("\n")
+ dbReportS2.close()
+
+
+
+ def CASE5( self, main ):
+ import time
+ import json
+ import string
+
+ linkResult = main.FALSE
+
+ testDelay = main.params[ 'TEST' ][ 'wait']
+ time.sleep( float( testDelay ) )
+
+ getMetric = main.params[ 'TEST' ][ 'metric1' ]
+ testDuration = main.params[ 'TEST' ][ 'duration' ]
+ stop = time.time() + float( testDuration )
+
+ main.ONOS3cli.featureInstall("onos-null")
+
+ msg = ( "Starting test loop for " + str(testDuration) + " seconds" )
+ main.log.info( msg )
+ logInterval = main.params[ 'TEST' ][ 'log_interval' ]
+
+ while time.time() < stop:
+ time.sleep( float( logInterval ) )
+
+ JsonStr1 = main.ONOS1cli.topologyEventsMetrics()
+ JsonObj1 = json.loads( JsonStr1 )
+ msg = ( "Node 1 TP: " + str( JsonObj1[ getMetric ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+ lastRate1 = round(JsonObj1[ getMetric ][ 'm1_rate' ],2)
+
+ JsonStr2 = main.ONOS2cli.topologyEventsMetrics()
+ JsonObj2 = json.loads( JsonStr2 )
+ msg = ( "Node 2 TP: " + str( JsonObj2[ getMetric ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+ lastRate2 = round(JsonObj2[ getMetric ][ 'm1_rate' ],2)
+
+ JsonStr3 = main.ONOS3cli.topologyEventsMetrics()
+ JsonObj3 = json.loads( JsonStr3 )
+ msg = ( "Node 3 TP: " + str( JsonObj3[ getMetric ][ 'm1_rate' ] ) )
+ main.log.info( msg )
+ lastRate3 = round(JsonObj3[ getMetric ][ 'm1_rate' ],2)
+
+ msg = ( "Final TP on node 1: " + str( lastRate1 ) )
+ main.log.report( msg )
+
+ msg = ( "Final TP on node 2: " + str( lastRate2 ) )
+ main.log.report( msg )
+
+ msg = ( "Final TP on node 3: " + str( lastRate3 ) )
+ main.log.report( msg )
+
+ linkResult = main.TRUE
+
+ jenkinsReport = open('LinkEventTP.csv', 'a')
+ jenkinsReport.write(str(lastRate1))
+ jenkinsReport.write(", ")
+ jenkinsReport.write(str(lastRate2))
+ jenkinsReport.write(", ")
+ jenkinsReport.write(str(lastRate3))
+ jenkinsReport.close()
+
+ dbReportS3 = open('LinkEventTP-S3.csv','w') #must be the name of the test "-S" followed by the scale
+ dbReportS3.write(str(linkResult))
+ dbReportS3.write("\n")
+ dbReportS3.write(str(lastRate1))
+ dbReportS3.write("\n")
+ dbReportS3.write(str(lastRate2))
+ dbReportS3.write("\n")
+ dbReportS3.write(str(lastRate3))
+ dbReportS3.write("\n")
+ dbReportS3.close()
+
+
diff --git a/TestON/tests/LinkEventTP/__init__.py b/TestON/tests/LinkEventTP/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/LinkEventTP/__init__.py
diff --git a/TestON/tests/LinkEventTP/__init__.pyc b/TestON/tests/LinkEventTP/__init__.pyc
new file mode 100644
index 0000000..5415a7b
--- /dev/null
+++ b/TestON/tests/LinkEventTP/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index c0325a9..af23c70 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -1,5 +1,5 @@
<PARAMS>
- #CHO sequence : 1,2,3,[4,5,6,5,7,8,5,10,5,9,5,7,8,5,10,5]*2
+ #CHO sequence : 1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100
# 1. ONOS brinup Test case
# 2. Assign and Balance all Mininet switches across controllers
# 3. Collect reference toplogy for topo compare
@@ -10,17 +10,38 @@
# 8. Bring core links Up that were down and verify pingall
# 9. Install 114 point intents and verify ping all
# 10. Remove all intents on ONOS
- # 1,2,3,[4,5,6,5,7,8,5,10,5,9,5,7,8,5,10,5]*2
+ # 1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100
- <testcases>1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100</testcases>
+ <testcases>1,2,3,4,5,12,3,4,5,13,3,4,5</testcases>
<ENV>
<cellName>choTest5</cellName>
</ENV>
<GIT>
#autoPull 'on' or 'off'
- <autoPull>on</autoPull>
+ <autoPull>off</autoPull>
<branch>master</branch>
</GIT>
+ <TOPO1>
+ <topo>~/mininet/custom/topoAtt.py</topo>
+ <numSwitches>25</numSwitches>
+ <numHosts>25</numHosts>
+ <numLinks>114</numLinks>
+ <numPaths>1</numPaths>
+ </TOPO1>
+ <TOPO2>
+ <topo>~/mininet/custom/topoChordal.py</topo>
+ <numSwitches>25</numSwitches>
+ <numHosts>25</numHosts>
+ <numLinks>600</numLinks>
+ <numPaths>1</numPaths>
+ </TOPO2>
+ <TOPO3>
+ <topo>~/mininet/custom/topoSpine.py</topo>
+ <numSwitches>78</numSwitches>
+ <numHosts>68</numHosts>
+ <numLinks>284</numLinks>
+ <numPaths>1</numPaths>
+ </TOPO3>
<CTRL>
<numCtrl>5</numCtrl>
<ip1>10.128.40.41</ip1>
@@ -38,13 +59,6 @@
<startMAC>00:00:00:00:00:01</startMAC>
<endMAC>00:00:00:00:00:19</endMAC>
</HOSTS>
- <ONOSTOPO>
- <numDevices>25</numDevices>
- <numLinks>114</numLinks>
- <numHosts>25</numHosts>
- <numIntents>300</numIntents>
- <numPaths>1360</numPaths>
- </ONOSTOPO>
<CORELINKS>
<toggleLinks>3</toggleLinks>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 3be5cbb..eb71518 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -11,13 +11,6 @@
def __init__( self ):
self.default = ''
- global deviceDPIDs
- global hostMACs
- global deviceLinks
- global deviceActiveLinksCount
- global devicePortsEnabledCount
- global installedIntents
- global randomLink1, randomLink2, randomLink3, numSwitches, numLinks
def CASE1( self, main ):
"""
@@ -31,9 +24,20 @@
onos-wait-for-start
"""
import time
+
+ main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+ main.ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+ main.ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+ main.ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+ main.ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
+ main.ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
+ main.ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
+ main.ONOS2_port = main.params[ 'CTRL' ][ 'port2' ]
+ main.ONOS3_port = main.params[ 'CTRL' ][ 'port3' ]
+ main.ONOS4_port = main.params[ 'CTRL' ][ 'port4' ]
+ main.ONOS5_port = main.params[ 'CTRL' ][ 'port5' ]
cell_name = main.params[ 'ENV' ][ 'cellName' ]
git_pull = main.params[ 'GIT' ][ 'autoPull' ]
- numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
git_branch = main.params[ 'GIT' ][ 'branch' ]
main.case( "Set up test environment" )
@@ -42,8 +46,8 @@
main.step( "Git checkout and pull " + git_branch )
if git_pull == 'on':
- checkout_result = main.ONOSbench.git_checkout( git_branch )
- pull_result = main.ONOSbench.git_pull()
+ checkout_result = main.ONOSbench.gitCheckout( git_branch )
+ pull_result = main.ONOSbench.gitPull()
cp_result = ( checkout_result and pull_result )
else:
checkout_result = main.TRUE
@@ -55,45 +59,49 @@
onfail="Test step FAIL" )
main.step( "mvn clean & install" )
- mvn_result = main.ONOSbench.clean_install()
- utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
+ if git_pull == 'on':
+ mvn_result = main.ONOSbench.cleanInstall()
+ utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
onpass="Test step PASS",
onfail="Test step FAIL" )
+ else:
+ mvn_result = main.TRUE
+ main.log.info("Skipped mvn clean install as git pull is disabled in params file")
- main.ONOSbench.get_version( report=True )
+ main.ONOSbench.getVersion( report=True )
main.step( "Apply Cell environment for ONOS" )
- cell_result = main.ONOSbench.set_cell( cell_name )
+ cell_result = main.ONOSbench.setCell( cell_name )
utilities.assert_equals( expect=main.TRUE, actual=cell_result,
onpass="Test step PASS",
onfail="Test step FAIL" )
main.step( "Create ONOS package" )
- packageResult = main.ONOSbench.onos_package()
+ packageResult = main.ONOSbench.onosPackage()
utilities.assert_equals( expect=main.TRUE, actual=packageResult,
onpass="Test step PASS",
onfail="Test step FAIL" )
main.step( "Uninstall ONOS package on all Nodes" )
uninstallResult = main.TRUE
- for i in range( 1, int( numCtrls ) + 1 ):
+ for i in range( 1, int( main.numCtrls ) + 1 ):
ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
main.log.info( "Unintsalling package on ONOS Node IP: " + ONOS_ip )
- u_result = main.ONOSbench.onos_uninstall( ONOS_ip )
+ u_result = main.ONOSbench.onosUninstall( ONOS_ip )
utilities.assert_equals( expect=main.TRUE, actual=u_result,
onpass="Test step PASS",
onfail="Test step FAIL" )
uninstallResult = ( uninstallResult and u_result )
main.step( "Removing copy-cat logs from ONOS nodes" )
- main.ONOSbench.onos_remove_raft_logs()
+ main.ONOSbench.onosRemoveRaftLogs()
main.step( "Install ONOS package on all Nodes" )
installResult = main.TRUE
- for i in range( 1, int( numCtrls ) + 1 ):
+ for i in range( 1, int( main.numCtrls ) + 1 ):
ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
main.log.info( "Intsalling package on ONOS Node IP: " + ONOS_ip )
- i_result = main.ONOSbench.onos_install( node=ONOS_ip )
+ i_result = main.ONOSbench.onosInstall( node=ONOS_ip )
utilities.assert_equals( expect=main.TRUE, actual=i_result,
onpass="Test step PASS",
onfail="Test step FAIL" )
@@ -101,10 +109,10 @@
main.step( "Verify ONOS nodes UP status" )
statusResult = main.TRUE
- for i in range( 1, int( numCtrls ) + 1 ):
+ for i in range( 1, int( main.numCtrls ) + 1 ):
ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
main.log.info( "ONOS Node " + ONOS_ip + " status:" )
- onos_status = main.ONOSbench.onos_status( node=ONOS_ip )
+ onos_status = main.ONOSbench.onosStatus( node=ONOS_ip )
utilities.assert_equals( expect=main.TRUE, actual=onos_status,
onpass="Test step PASS",
onfail="Test step FAIL" )
@@ -115,13 +123,13 @@
karafTimeout = "3600000"
# need to wait here for sometime. This will be removed once ONOS is
# stable enough
- time.sleep( 15 )
- for i in range( 1, int( numCtrls ) + 1 ):
+ time.sleep( 20 )
+ for i in range( 1, int( main.numCtrls ) + 1 ):
ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
ONOScli = 'ONOScli' + str( i )
main.log.info( "ONOS Node " + ONOS_ip + " cli start:" )
exec "startcli=main." + ONOScli + \
- ".start_onos_cli(ONOS_ip, karafTimeout=karafTimeout)"
+ ".startOnosCli(ONOS_ip, karafTimeout=karafTimeout)"
utilities.assert_equals( expect=main.TRUE, actual=startcli,
onpass="Test step PASS",
onfail="Test step FAIL" )
@@ -135,24 +143,15 @@
def CASE2( self, main ):
"""
- This test script still needs more refactoring
+ This test loads a Topology (ATT) on Mininet and balances all switches.
"""
import re
import time
import copy
- numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
- ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
- ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
- ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
- ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
- ONOS2_port = main.params[ 'CTRL' ][ 'port2' ]
- ONOS3_port = main.params[ 'CTRL' ][ 'port3' ]
- ONOS4_port = main.params[ 'CTRL' ][ 'port4' ]
- ONOS5_port = main.params[ 'CTRL' ][ 'port5' ]
+ main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
+ main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
+ main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
- numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
main.log.report(
"Assign and Balance all Mininet switches across controllers" )
main.log.report(
@@ -163,26 +162,27 @@
main.case(
"Assign and Balance all Mininet switches across controllers" )
main.step( "Assign switches to controllers" )
- for i in range( 1, 26 ): # 1 to ( num of switches +1 )
- main.Mininet1.assign_sw_controller(
+ netStatus = main.Mininet1.startNet()
+ for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
+ main.Mininet1.assignSwController(
sw=str( i ),
- count=int( numCtrls ),
- ip1=ONOS1_ip,
- port1=ONOS1_port,
- ip2=ONOS2_ip,
- port2=ONOS2_port,
- ip3=ONOS3_ip,
- port3=ONOS3_port,
- ip4=ONOS4_ip,
- port4=ONOS4_port,
- ip5=ONOS5_ip,
- port5=ONOS5_port )
+ count=int( main.numCtrls ),
+ ip1=main.ONOS1_ip,
+ port1=main.ONOS1_port,
+ ip2=main.ONOS2_ip,
+ port2=main.ONOS2_port,
+ ip3=main.ONOS3_ip,
+ port3=main.ONOS3_port,
+ ip4=main.ONOS4_ip,
+ port4=main.ONOS4_port,
+ ip5=main.ONOS5_ip,
+ port5=main.ONOS5_port )
switch_mastership = main.TRUE
- for i in range( 1, 26 ):
- response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+ for i in range( 1, ( main.numMNswitches + 1 ) ):
+ response = main.Mininet1.getSwController( "s" + str( i ) )
print( "Response is " + str( response ) )
- if re.search( "tcp:" + ONOS1_ip, response ):
+ if re.search( "tcp:" + main.ONOS1_ip, response ):
switch_mastership = switch_mastership and main.TRUE
else:
switch_mastership = main.FALSE
@@ -191,19 +191,19 @@
main.log.report( "Controller assignment successfull" )
else:
main.log.report( "Controller assignment failed" )
- time.sleep( 5 )
+ time.sleep( 15 )
- main.step( "Balance devices across controllers" )
- for i in range( int( numCtrls ) ):
- balanceResult = main.ONOScli1.balance_masters()
+ #main.step( "Balance devices across controllers" )
+ #for i in range( int( main.numCtrls ) ):
+ # balanceResult = main.ONOScli1.balanceMasters()
# giving some breathing time for ONOS to complete re-balance
- time.sleep( 3 )
+ # time.sleep( 3 )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=balanceResult,
- onpass="Assign and Balance devices test PASS",
- onfail="Assign and Balance devices test FAIL" )
+ #utilities.assert_equals(
+ # expect=main.TRUE,
+ # actual=balanceResult,
+ # onpass="Assign and Balance devices test PASS",
+ #onfail="Assign and Balance devices test FAIL" )
def CASE3( self, main ):
"""
@@ -212,11 +212,11 @@
"""
import re
import copy
- deviceDPIDs = []
- hostMACs = []
- deviceLinks = []
- deviceActiveLinksCount = []
- devicePortsEnabledCount = []
+ main.deviceDPIDs = []
+ main.hostMACs = []
+ main.deviceLinks = []
+ main.deviceActiveLinksCount = []
+ main.devicePortsEnabledCount = []
main.log.report(
"Collect and Store topology details from ONOS before running any Tests" )
@@ -226,63 +226,65 @@
main.step( "Collect and store current number of switches and links" )
topology_output = main.ONOScli1.topology()
- topology_result = main.ONOSbench.get_topology( topology_output )
- numSwitches = topology_result[ 'devices' ]
- numLinks = topology_result[ 'links' ]
- main.log.info(
- "Currently there are %s switches and %s links" %
- ( str( numSwitches ), str( numLinks ) ) )
+ topology_result = main.ONOSbench.getTopology( topology_output )
+ numOnosDevices = topology_result[ 'devices' ]
+ numOnosLinks = topology_result[ 'links' ]
- main.step( "Store Device DPIDs" )
- for i in range( 1, 26 ):
- deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
- print "Device DPIDs in Store: \n", str( deviceDPIDs )
+ if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
+ main.step( "Store Device DPIDs" )
+ for i in range( 1, (main.numMNswitches+1) ):
+ main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
+ print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
- main.step( "Store Host MACs" )
- for i in range( 1, 26 ):
- hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
- print "Host MACs in Store: \n", str( hostMACs )
+ main.step( "Store Host MACs" )
+ for i in range( 1, ( main.numMNhosts + 1 ) ):
+ main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
+ print "Host MACs in Store: \n", str( main.hostMACs )
- main.step( "Collect and store all Devices Links" )
- linksResult = main.ONOScli1.links( json_format=False )
- ansi_escape = re.compile( r'\x1b[^m]*m' )
- linksResult = ansi_escape.sub( '', linksResult )
- linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
- linksResult = linksResult.splitlines()
- linksResult = linksResult[ 1: ]
- deviceLinks = copy.copy( linksResult )
- print "Device Links Stored: \n", str( deviceLinks )
- # this will be asserted to check with the params provided count of
- # links
- print "Length of Links Store", len( deviceLinks )
+ main.step( "Collect and store all Devices Links" )
+ linksResult = main.ONOScli1.links( jsonFormat=False )
+ ansi_escape = re.compile( r'\x1b[^m]*m' )
+ linksResult = ansi_escape.sub( '', linksResult )
+ linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
+ linksResult = linksResult.splitlines()
+ linksResult = linksResult[ 1: ]
+ main.deviceLinks = copy.copy( linksResult )
+ print "Device Links Stored: \n", str( main.deviceLinks )
+ # this will be asserted to check with the params provided count of
+ # links
+ print "Length of Links Store", len( main.deviceLinks )
- main.step( "Collect and store each Device ports enabled Count" )
- for i in range( 1, 26 ):
- portResult = main.ONOScli1.getDevicePortsEnabledCount(
- "of:00000000000000" +
- format(
- i,
- '02x' ) )
- portTemp = re.split( r'\t+', portResult )
- portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
- devicePortsEnabledCount.append( portCount )
- print "Device Enabled Port Counts Stored: \n", str( devicePortsEnabledCount )
+ main.step( "Collect and store each Device ports enabled Count" )
+ for i in range( 1, ( main.numMNswitches + 1) ):
+ portResult = main.ONOScli1.getDevicePortsEnabledCount(
+ "of:00000000000000" + format( i,'02x' ) )
+ portTemp = re.split( r'\t+', portResult )
+ portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+ main.devicePortsEnabledCount.append( portCount )
+ print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
- main.step( "Collect and store each Device active links Count" )
- for i in range( 1, 26 ):
- linkCountResult = main.ONOScli1.getDeviceLinksActiveCount(
- "of:00000000000000" +
- format(
- i,
- '02x' ) )
- linkCountTemp = re.split( r'\t+', linkCountResult )
- linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
- deviceActiveLinksCount.append( linkCount )
- print "Device Active Links Count Stored: \n", str( deviceActiveLinksCount )
+ main.step( "Collect and store each Device active links Count" )
+ for i in range( 1, ( main.numMNswitches + 1) ):
+ linkCountResult = main.ONOScli1.getDeviceLinksActiveCount(
+ "of:00000000000000" + format( i,'02x' ) )
+ linkCountTemp = re.split( r'\t+', linkCountResult )
+ linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+ main.deviceActiveLinksCount.append( linkCount )
+ print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
+
+ else:
+ main.log.info("Devices (expected): %s, Links (expected): %s" %
+ ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
+ main.log.info("Devices (actual): %s, Links (actual): %s" %
+ ( numOnosDevices , numOnosLinks ) )
+ main.log.info("Topology does not match, exiting CHO test...")
+ time.sleep(300)
+ #main.cleanup()
+ #main.exit()
# just returning TRUE for now as this one just collects data
- caseResult = main.TRUE
- utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+ case3Result = main.TRUE
+ utilities.assert_equals( expect=main.TRUE, actual=case3Result,
onpass="Saving ONOS topology data test PASS",
onfail="Saving ONOS topology data test FAIL" )
@@ -293,18 +295,18 @@
import re
import copy
import time
- numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+
main.log.report( "Enable Reactive forwarding and Verify ping all" )
main.log.report( "______________________________________________" )
main.case( "Enable Reactive forwarding and Verify ping all" )
main.step( "Enable Reactive forwarding" )
installResult = main.TRUE
- for i in range( 1, int( numCtrls ) + 1 ):
+ for i in range( 1, int( main.numCtrls ) + 1 ):
onosFeature = 'onos-app-fwd'
ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
ONOScli = 'ONOScli' + str( i )
main.log.info( "Enabling Reactive mode on ONOS Node " + ONOS_ip )
- exec "inResult=main." + ONOScli + ".feature_install(onosFeature)"
+ exec "inResult=main." + ONOScli + ".featureInstall(onosFeature)"
time.sleep( 3 )
installResult = inResult and installResult
@@ -328,12 +330,12 @@
main.step( "Disable Reactive forwarding" )
uninstallResult = main.TRUE
- for i in range( 1, int( numCtrls ) + 1 ):
+ for i in range( 1, int( main.numCtrls ) + 1 ):
onosFeature = 'onos-app-fwd'
ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
ONOScli = 'ONOScli' + str( i )
main.log.info( "Disabling Reactive mode on ONOS Node " + ONOS_ip )
- exec "unResult=main." + ONOScli + ".feature_uninstall(onosFeature)"
+ exec "unResult=main." + ONOScli + ".featureUninstall(onosFeature)"
uninstallResult = unResult and uninstallResult
# Waiting for reative flows to be cleared.
@@ -349,11 +351,11 @@
Compare current ONOS topology with reference data
"""
import re
- devicesDPID_tmp = []
- hostMACs_tmp = []
- deviceLinks_tmp = []
- deviceActiveLinksCount_tmp = []
- devicePortsEnabledCount_tmp = []
+ devicesDPIDTemp = []
+ hostMACsTemp = []
+ deviceLinksTemp = []
+ deviceActiveLinksCountTemp = []
+ devicePortsEnabledCountTemp = []
main.log.report(
"Compare ONOS topology with reference data in Stores" )
@@ -369,16 +371,16 @@
'02x' ) )
portTemp = re.split( r'\t+', portResult )
portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
- devicePortsEnabledCount_tmp.append( portCount )
+ devicePortsEnabledCountTemp.append( portCount )
time.sleep( 2 )
- print (
- "Device Enabled ports EXPECTED: \n" +
- str( devicePortsEnabledCount ) )
- print (
- "Device Enabled ports ACTUAL: \n" +
- str( devicePortsEnabledCount_tmp ) )
- if ( cmp( devicePortsEnabledCount,
- devicePortsEnabledCount_tmp ) == 0 ):
+ main.log.info (
+ "Device Enabled ports EXPECTED: %s" %
+ str( main.devicePortsEnabledCount ) )
+ main.log.info (
+ "Device Enabled ports ACTUAL: %s" %
+ str( devicePortsEnabledCountTemp ) )
+ if ( cmp( main.devicePortsEnabledCount,
+ devicePortsEnabledCountTemp ) == 0 ):
stepResult1 = main.TRUE
else:
stepResult1 = main.FALSE
@@ -392,29 +394,26 @@
'02x' ) )
linkTemp = re.split( r'\t+', linkResult )
linkCount = linkTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
- deviceActiveLinksCount_tmp.append( linkCount )
+ deviceActiveLinksCountTemp.append( linkCount )
time.sleep( 3 )
- print (
- "Device Active links EXPECTED: \n" +
- str( deviceActiveLinksCount ) )
- print (
- "Device Active links ACTUAL: \n" +
- str( deviceActiveLinksCount_tmp ) )
- if ( cmp( deviceActiveLinksCount, deviceActiveLinksCount_tmp ) == 0 ):
+ main.log.info (
+ "Device Active links EXPECTED: %s" %
+ str( main.deviceActiveLinksCount ) )
+ main.log.info (
+ "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
+ if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
stepResult2 = main.TRUE
else:
stepResult2 = main.FALSE
"""
- place holder for comparing devices, hosts and paths if required.
+ place holder for comparing devices, hosts, paths and intents if required.
Links and ports data would be incorrect with out devices anyways.
"""
- caseResult = ( stepResult1 and stepResult2 )
- utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+ case5Result = ( stepResult1 and stepResult2 )
+ utilities.assert_equals( expect=main.TRUE, actual=case5Result,
onpass="Compare Topology test PASS",
onfail="Compare Topology test FAIL" )
- if caseResult == main.TRUE:
- main.log.report( "Compare Topology test Pass" )
def CASE6( self ):
"""
@@ -423,12 +422,13 @@
main.log.report( "Add 300 host intents and verify pingall" )
main.log.report( "_______________________________________" )
import itertools
+
main.case( "Install 300 host intents" )
main.step( "Add host Intents" )
intentResult = main.TRUE
- hostCombos = list( itertools.combinations( hostMACs, 2 ) )
+ hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
for i in range( len( hostCombos ) ):
- iResult = main.ONOScli1.add_host_intent(
+ iResult = main.ONOScli1.addHostIntent(
hostCombos[ i ][ 0 ],
hostCombos[ i ][ 1 ] )
intentResult = ( intentResult and iResult )
@@ -448,6 +448,7 @@
onfail="PING ALL FAIL" )
case4Result = ( intentResult and pingResult )
+ #case4Result = pingResult
utilities.assert_equals(
expect=main.TRUE,
actual=case4Result,
@@ -459,7 +460,9 @@
Randomly bring some core links down and verify ping all ( Host Intents Scenario )
"""
import random
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+ main.randomLink1 = []
+ main.randomLink2 = []
+ main.randomLink3 = []
link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' )
link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
@@ -469,47 +472,41 @@
switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
- main.log.report(
- "Host intents - Randomly bring some core links down and verify ping all" )
- main.log.report(
- "_________________________________________________________________" )
- main.case(
- "Host intents - Randomly bring some core links down and verify ping all" )
- main.step(
- "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
+ main.log.report( "Host intents - Randomly bring some core links down and verify ping all" )
+ main.log.report( "_________________________________________________________________" )
+ main.case( "Host intents - Randomly bring some core links down and verify ping all" )
+ main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
if ( int( switchLinksToToggle ) ==
0 or int( switchLinksToToggle ) > 5 ):
- main.log.info(
- "Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
+ main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
main.cleanup()
main.exit()
else:
- main.log.info(
- "User provided Core switch links range to toggle is correct, proceeding to run the test" )
+ main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
main.step( "Cut links on Core devices using user provided range" )
- randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
- randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
- randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
+ main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
+ main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
+ main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
for i in range( int( switchLinksToToggle ) ):
main.Mininet1.link(
END1=link1End1,
- END2=randomLink1[ i ],
+ END2=main.randomLink1[ i ],
OPTION="down" )
main.Mininet1.link(
END1=link2End1,
- END2=randomLink2[ i ],
+ END2=main.randomLink2[ i ],
OPTION="down" )
main.Mininet1.link(
END1=link3End1,
- END2=randomLink3[ i ],
+ END2=main.randomLink3[ i ],
OPTION="down" )
time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
- linkDown = main.ONOSbench.check_status(
- topology_output, numSwitches, str(
- int( numLinks ) - int( switchLinksToToggle ) * 6 ) )
+ linkDown = main.ONOSbench.checkStatus(
+ topology_output, main.numMNswitches, str(
+ int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
utilities.assert_equals(
expect=main.TRUE,
actual=linkDown,
@@ -532,8 +529,8 @@
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult7 = linkDown and pingResultLinkDown
- utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
+ caseResult70 = linkDown and pingResultLinkDown
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
onpass="Random Link cut Test PASS",
onfail="Random Link cut Test FAIL" )
@@ -542,7 +539,6 @@
Bring the core links up that are down and verify ping all ( Host Intents Scenario )
"""
import random
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
@@ -572,10 +568,10 @@
time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
- linkUp = main.ONOSbench.check_status(
+ linkUp = main.ONOSbench.checkStatus(
topology_output,
- numSwitches,
- str( numLinks ) )
+ main.numMNswitches,
+ str( main.numMNlinks ) )
utilities.assert_equals(
expect=main.TRUE,
actual=linkUp,
@@ -598,8 +594,8 @@
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult8 = linkUp and pingResultLinkUp
- utilities.assert_equals( expect=main.TRUE, actual=caseResult8,
+ caseResult80 = linkUp and pingResultLinkUp
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL" )
@@ -608,7 +604,9 @@
Randomly bring some core links down and verify ping all ( Point Intents Scenario )
"""
import random
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+ main.randomLink1 = []
+ main.randomLink2 = []
+ main.randomLink3 = []
link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' )
link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
@@ -618,14 +616,10 @@
switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
- main.log.report(
- "Point Intents - Randomly bring some core links down and verify ping all" )
- main.log.report(
- "__________________________________________________________________" )
- main.case(
- "Point Intents - Randomly bring some core links down and verify ping all" )
- main.step(
- "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
+ main.log.report( "Point Intents - Randomly bring some core links down and verify ping all" )
+ main.log.report( "__________________________________________________________________" )
+ main.case( "Point Intents - Randomly bring some core links down and verify ping all" )
+ main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
if ( int( switchLinksToToggle ) ==
0 or int( switchLinksToToggle ) > 5 ):
main.log.info(
@@ -643,22 +637,22 @@
for i in range( int( switchLinksToToggle ) ):
main.Mininet1.link(
END1=link1End1,
- END2=randomLink1[ i ],
+ END2=main.randomLink1[ i ],
OPTION="down" )
main.Mininet1.link(
END1=link2End1,
- END2=randomLink2[ i ],
+ END2=main.randomLink2[ i ],
OPTION="down" )
main.Mininet1.link(
END1=link3End1,
- END2=randomLink3[ i ],
+ END2=main.randomLink3[ i ],
OPTION="down" )
time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
- linkDown = main.ONOSbench.check_status(
- topology_output, numSwitches, str(
- int( numLinks ) - int( switchLinksToToggle ) * 6 ) )
+ linkDown = main.ONOSbench.checkStatus(
+ topology_output, main.numSwitches, str(
+ int( main.numLinks ) - int( switchLinksToToggle ) * 6 ) )
utilities.assert_equals(
expect=main.TRUE,
actual=linkDown,
@@ -691,7 +685,6 @@
Bring the core links up that are down and verify ping all ( Point Intents Scenario )
"""
import random
- ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
@@ -708,23 +701,23 @@
for i in range( int( switchLinksToToggle ) ):
main.Mininet1.link(
END1=link1End1,
- END2=randomLink1[ i ],
+ END2=main.randomLink1[ i ],
OPTION="up" )
main.Mininet1.link(
END1=link2End1,
- END2=randomLink2[ i ],
+ END2=main.randomLink2[ i ],
OPTION="up" )
main.Mininet1.link(
END1=link3End1,
- END2=randomLink3[ i ],
+ END2=main.randomLink3[ i ],
OPTION="up" )
time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
- linkUp = main.ONOSbench.check_status(
+ linkUp = main.ONOSbench.checkStatus(
topology_output,
- numSwitches,
- str( numLinks ) )
+ main.numMNswitches,
+ str( main.numMNlinks ) )
utilities.assert_equals(
expect=main.TRUE,
actual=linkUp,
@@ -747,8 +740,8 @@
onpass="PING ALL PASS",
onfail="PING ALL FAIL" )
- caseResult8 = linkUp and pingResultLinkUp
- utilities.assert_equals( expect=main.TRUE, actual=caseResult8,
+ caseResult81 = linkUp and pingResultLinkUp
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL" )
@@ -760,18 +753,18 @@
main.log.report( "Install 114 point intents and verify Ping all" )
main.log.report( "___________________________________________" )
main.case( "Install 114 point intents and Ping all" )
- deviceLinks_copy = copy.copy( deviceLinks )
+ deviceLinksCopy = copy.copy( main.deviceLinks )
main.step( "Install 114 point intents" )
- for i in range( len( deviceLinks_copy ) ):
+ for i in range( len( deviceLinksCopy ) ):
pointLink = str(
- deviceLinks_copy[ i ] ).replace(
+ deviceLinksCopy[ i ] ).replace(
"src=",
"" ).replace(
"dst=",
"" ).split( ',' )
point1 = pointLink[ 0 ].split( '/' )
point2 = pointLink[ 1 ].split( '/' )
- installResult = main.ONOScli1.add_point_intent(
+ installResult = main.ONOScli1.addPointIntent(
point1[ 0 ], point2[ 0 ], int(
point1[ 1 ] ), int(
point2[ 1 ] ) )
@@ -849,8 +842,8 @@
print "Intent IDs: ", intentIdList
for id in range( len( intentIdList ) ):
print "Removing intent id (round 1) :", intentIdList[ id ]
- main.ONOScli1.remove_intent( intent_id=intentIdList[ id ] )
- time.sleep( 1 )
+ main.ONOScli1.removeIntent( intentId=intentIdList[ id ] )
+ #time.sleep( 1 )
main.log.info(
"Verify all intents are removed and if any leftovers try remove one more time" )
@@ -875,9 +868,9 @@
print "Leftover Intent IDs: ", intentIdList1
for id in range( len( intentIdList1 ) ):
print "Removing intent id (round 2):", intentIdList1[ id ]
- main.ONOScli1.remove_intent(
- intent_id=intentIdList1[ id ] )
- time.sleep( 2 )
+ main.ONOScli1.removeIntent(
+ intentId=intentIdList1[ id ] )
+ #time.sleep( 2 )
else:
print "There are no more intents that need to be removed"
step1Result = main.TRUE
@@ -889,3 +882,281 @@
utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
onpass="Intent removal test successful",
onfail="Intent removal test failed" )
+
+ def CASE11( self, main ):
+ """
+ Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
+ """
+ import re
+ import copy
+ import time
+
+ main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
+ main.log.report( "_____________________________________________________" )
+ main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
+ main.step( "Enable intent based Reactive forwarding" )
+ installResult = main.TRUE
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ onosFeature = 'onos-app-ifwd'
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ ONOScli = 'ONOScli' + str( i )
+ main.log.info( "Enabling Intent based Reactive forwarding on ONOS Node " + ONOS_ip )
+ exec "inResult=main." + ONOScli + ".featureInstall(onosFeature)"
+ time.sleep( 3 )
+ installResult = inResult and installResult
+
+ time.sleep( 5 )
+
+ main.step( "Verify Pingall" )
+ ping_result = main.FALSE
+ time1 = time.time()
+ ping_result = main.Mininet1.pingall()
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ if ping_result == main.TRUE:
+ main.log.report( "Pingall Test in Reactive mode successful" )
+ else:
+ main.log.report( "Pingall Test in Reactive mode failed" )
+
+ main.step( "Disable Intent based Reactive forwarding" )
+ uninstallResult = main.TRUE
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ onosFeature = 'onos-app-ifwd'
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ ONOScli = 'ONOScli' + str( i )
+ main.log.info( "Disabling Intent based Reactive forwarding on ONOS Node " + ONOS_ip )
+ exec "unResult=main." + ONOScli + ".featureUninstall(onosFeature)"
+ uninstallResult = unResult and uninstallResult
+
+ # Waiting for reative flows to be cleared.
+ time.sleep( 10 )
+
+ case11Result = installResult and ping_result and uninstallResult
+ utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+ onpass="Intent based Reactive forwarding Pingall test PASS",
+ onfail="Intent based Reactive forwarding Pingall test FAIL" )
+
+ def CASE12( self, main ):
+ """
+ This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
+ """
+ import re
+ import time
+ import copy
+
+ newTopo = main.params['TOPO2']['topo']
+ main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
+ main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
+ main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
+
+ main.log.report(
+ "Load Chordal topology and Balance all Mininet switches across controllers" )
+ main.log.report(
+ "________________________________________________________________________" )
+ # need to wait here for sometime until ONOS bootup
+ time.sleep( 15 )
+ main.case(
+ "Assign and Balance all Mininet switches across controllers" )
+ main.step( "Stop any previous Mininet network topology" )
+ stopStatus = main.Mininet1.stopNet()
+
+ # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
+ main.step( "Stop ONOS on all Nodes" )
+ stopResult = main.TRUE
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
+ sresult = main.ONOSbench.onosStop( ONOS_ip )
+ utilities.assert_equals( expect=main.TRUE, actual=sresult,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ stopResult = ( stopResult and sresult )
+
+ main.step( "Start Mininet with Chordal topology" )
+ startStatus = main.Mininet1.startNet(topoFile = newTopo)
+
+ main.step( "Assign switches to controllers" )
+ for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ count=int( main.numCtrls ),
+ ip1=main.ONOS1_ip,
+ port1=main.ONOS1_port,
+ ip2=main.ONOS2_ip,
+ port2=main.ONOS2_port,
+ ip3=main.ONOS3_ip,
+ port3=main.ONOS3_port,
+ ip4=main.ONOS4_ip,
+ port4=main.ONOS4_port,
+ ip5=main.ONOS5_ip,
+ port5=main.ONOS5_port )
+
+ switch_mastership = main.TRUE
+ for i in range( 1, ( main.numMNswitches + 1 ) ):
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + main.ONOS1_ip, response ):
+ switch_mastership = switch_mastership and main.TRUE
+ else:
+ switch_mastership = main.FALSE
+
+ if switch_mastership == main.TRUE:
+ main.log.report( "Controller assignment successfull" )
+ else:
+ main.log.report( "Controller assignment failed" )
+ time.sleep( 5 )
+
+ main.step( "Start ONOS on all Nodes" )
+ startResult = main.TRUE
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
+ sresult = main.ONOSbench.onosStart( ONOS_ip )
+ utilities.assert_equals( expect=main.TRUE, actual=sresult,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ startResult = ( startResult and sresult )
+
+ main.step( "Start ONOS CLI on all nodes" )
+ cliResult = main.TRUE
+ #karafTimeout = "3600000" # This is not needed here as it is already set before.
+ # need to wait here sometime for ONOS to bootup.
+ time.sleep( 30 )
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ ONOScli = 'ONOScli' + str( i )
+ main.log.info( "ONOS Node " + ONOS_ip + " cli start:" )
+ exec "startcli=main." + ONOScli + \
+ ".startOnosCli(ONOS_ip)"
+ utilities.assert_equals( expect=main.TRUE, actual=startcli,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ cliResult = ( cliResult and startcli )
+
+ main.step( "Balance devices across controllers" )
+ for i in range( int( main.numCtrls ) ):
+ balanceResult = main.ONOScli1.balanceMasters()
+ # giving some breathing time for ONOS to complete re-balance
+ time.sleep( 3 )
+
+ case12Result = ( startResult and cliResult )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case12Result,
+ onpass="Starting new Chordal topology test PASS",
+ onfail="Starting new Chordal topology test FAIL" )
+
+ def CASE13( self, main ):
+ """
+ This test script Loads a new Topology (Spine) on CHO setup and balances all switches
+ """
+ import re
+ import time
+ import copy
+
+ newTopo = main.params['TOPO3']['topo']
+ main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
+ main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
+ main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
+
+ main.log.report(
+ "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
+ main.log.report(
+ "________________________________________________________________________" )
+ # need to wait here for sometime until ONOS bootup
+ time.sleep( 15 )
+ main.case(
+ "Assign and Balance all Mininet switches across controllers" )
+ main.step( "Stop any previous Mininet network topology" )
+ stopStatus = main.Mininet1.stopNet()
+
+ # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
+ main.step( "Stop ONOS on all Nodes" )
+ stopResult = main.TRUE
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
+ sresult = main.ONOSbench.onosStop( ONOS_ip )
+ utilities.assert_equals( expect=main.TRUE, actual=sresult,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ stopResult = ( stopResult and sresult )
+
+ main.step( "Start Mininet with Spine topology" )
+ startStatus = main.Mininet1.startNet(topoFile = newTopo)
+
+ main.step( "Assign switches to controllers" )
+ for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ count=int( main.numCtrls ),
+ ip1=main.ONOS1_ip,
+ port1=main.ONOS1_port,
+ ip2=main.ONOS2_ip,
+ port2=main.ONOS2_port,
+ ip3=main.ONOS3_ip,
+ port3=main.ONOS3_port,
+ ip4=main.ONOS4_ip,
+ port4=main.ONOS4_port,
+ ip5=main.ONOS5_ip,
+ port5=main.ONOS5_port )
+
+ switch_mastership = main.TRUE
+ for i in range( 1, ( main.numMNswitches + 1 ) ):
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + main.ONOS1_ip, response ):
+ switch_mastership = switch_mastership and main.TRUE
+ else:
+ switch_mastership = main.FALSE
+
+ if switch_mastership == main.TRUE:
+ main.log.report( "Controller assignment successfull" )
+ else:
+ main.log.report( "Controller assignment failed" )
+ time.sleep( 5 )
+
+ main.step( "Start ONOS on all Nodes" )
+ startResult = main.TRUE
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
+ sresult = main.ONOSbench.onosStart( ONOS_ip )
+ utilities.assert_equals( expect=main.TRUE, actual=sresult,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ startResult = ( startResult and sresult )
+
+ main.step( "Start ONOS CLI on all nodes" )
+ cliResult = main.TRUE
+ #karafTimeout = "3600000" # This is not needed here as it is already set before.
+ # need to wait here sometime for ONOS to bootup.
+ time.sleep( 30 )
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ ONOScli = 'ONOScli' + str( i )
+ main.log.info( "ONOS Node " + ONOS_ip + " cli start:" )
+ exec "startcli=main." + ONOScli + \
+ ".startOnosCli(ONOS_ip)"
+ utilities.assert_equals( expect=main.TRUE, actual=startcli,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ cliResult = ( cliResult and startcli )
+
+ main.step( "Balance devices across controllers" )
+ for i in range( int( main.numCtrls ) ):
+ balanceResult = main.ONOScli1.balanceMasters()
+ # giving some breathing time for ONOS to complete re-balance
+ time.sleep( 3 )
+
+ case13Result = ( startResult and cliResult )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case13Result,
+ onpass="Starting new Spine topology test PASS",
+ onfail="Starting new Spine topology test FAIL" )
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/OnosCHO/OnosCHO.topo
index 2a79611..b36c789 100644
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/OnosCHO/OnosCHO.topo
@@ -101,7 +101,7 @@
</ONOS5>
<Mininet1>
- <host>10.128.40.40</host>
+ <host>10.128.40.50</host>
<user>admin</user>
<password>onos_test</password>
<type>MininetCliDriver</type>
@@ -116,7 +116,7 @@
</Mininet1>
<Mininet2>
- <host>10.128.40.40</host>
+ <host>10.128.40.50</host>
<user>admin</user>
<password>onos_test</password>
<type>RemoteMininetDriver</type>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.params b/TestON/tests/TopoPerfNext/TopoPerfNext.params
index e17d6bd..c653090 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.params
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.params
@@ -67,6 +67,13 @@
<tabletFile>tablets_3node.json</tabletFile>
</TEST>
+ <DB>
+ <postToDB>on</postToDB>
+ <portEventResultPath>
+ /home/admin/ONLabTest/TestON/tests/TopoPerfNext/portEventResultDb.log
+ </portEventResultPath>
+ </DB>
+
<JSON>
<deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
<hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
index 24e3c9f..0d2a596 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.py
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -27,10 +27,14 @@
# Global cluster count for scale-out purposes
global clusterCount
+ #TODO: fix run number implementation
+ global runNum
# Set initial cluster count
clusterCount = 1
##
+ runNum = time.strftime("%d%H%M%S")
+
cellName = main.params[ 'ENV' ][ 'cellName' ]
gitPull = main.params[ 'GIT' ][ 'autoPull' ]
@@ -611,6 +615,7 @@
import json
import numpy
global clusterCount
+ global runNum
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
@@ -630,6 +635,9 @@
graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
debugMode = main.params[ 'TEST' ][ 'debugMode' ]
+ postToDB = main.params[ 'DB' ][ 'postToDB' ]
+ resultPath = main.params[ 'DB' ][ 'portEventResultPath' ]
+ timeToPost = time.strftime("%Y-%m-%d %H:%M:%S")
localTime = time.strftime( '%x %X' )
localTime = localTime.replace( "/", "" )
@@ -1131,6 +1139,8 @@
portDownDevAvg = 0
portDownGraphAvg = 0
+ dbCmdList = []
+
for node in range( 0, clusterCount ):
# NOTE:
@@ -1150,20 +1160,34 @@
if item > 0.0:
portDownGraphList.append(item)
- portUpDevAvg = numpy.mean(portUpDevList)
- portUpGraphAvg = numpy.mean(portUpGraphList)
- portDownDevAvg = numpy.mean(portDownDevList)
- portDownGraphAvg = numpy.mean(portDownGraphList)
+ portUpDevAvg = round(numpy.mean(portUpDevList), 2)
+ portUpGraphAvg = round(numpy.mean(portUpGraphList), 2)
+ portDownDevAvg = round(numpy.mean(portDownDevList), 2)
+ portDownGraphAvg = round(numpy.mean(portDownGraphList), 2)
main.log.report( " - Node "+str(node+1)+" Summary - " )
#main.log.report( " Port up ofp-to-device "+
# str(round(portUpDevAvg, 2))+" ms")
main.log.report( " Port up ofp-to-graph "+
- str(round(portUpGraphAvg, 2))+" ms")
+ str(portUpGraphAvg)+" ms")
#main.log.report( " Port down ofp-to-device "+
# str(round(portDownDevAvg, 2))+" ms")
main.log.report( " Port down ofp-to-graph "+
- str(round(portDownGraphAvg, 2))+" ms")
+ str(portDownGraphAvg)+" ms")
+
+ dbCmdList.append(
+ "INSERT INTO port_latency_tests VALUES("
+ "'"+timeToPost+"','port_latency_results',"
+ ""+runNum+","+str(clusterCount)+",'baremetal"+str(node+1)+"',"
+ ""+str(portUpGraphAvg)+",0,"+str(portDownGraphAvg)+",0);"
+ )
+
+ #Write to file for posting to DB
+ fResult = open(resultPath, 'a')
+ for line in dbCmdList:
+ if line:
+ fResult.write(line+"\n")
+ fResult.close()
# Remove switches from controller for next test
main.Mininet1.deleteSwController( "s1" )