Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONLabTest into OnosCHO
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/lincoedriver.py b/TestON/drivers/common/cli/emulator/lincoedriver.py
index a82cfa4..82179a5 100644
--- a/TestON/drivers/common/cli/emulator/lincoedriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoedriver.py
@@ -329,7 +329,11 @@
cmd = "sudo kill -9 `pgrep -f linc`"
self.handle.sendline( cmd )
self.handle.expect( "\$" )
-
+ # Close the ssh connection
+ self.handle.sendline( "" )
+ self.handle.expect( "\$" )
+ self.handle.sendline( "exit" )
+ self.handle.expect( "closed" )
except pexpect.EOF:
main.log.error( self.name + ": EOF exception" )
main.log.error( self.name + ": " + self.handle.before )
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index acef039..4dd6d28 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(
@@ -442,11 +443,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 )"
@@ -478,16 +484,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
@@ -1244,30 +1256,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 = self.handle.before
else:
main.log.error( "Connection failed to the host" )
- response = main.FALSE
-
return response
def stopNet( self ):
"""
- 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:
@@ -1275,7 +1289,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
except pexpect.EOF:
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index e15e53c..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,18 +373,15 @@
"""
Called at the end of the test to disconnect the handle.
"""
- response = ''
- # print "Disconnecting Mininet"
if self.handle:
+ # Close the ssh connection
+ self.handle.sendline( "" )
+ self.handle.expect( "\$" )
self.handle.sendline( "exit" )
- self.handle.expect( "exit" )
- self.handle.expect( "(.*)" )
- response = self.handle.before
-
+ self.handle.expect( "closed" )
else:
main.log.error( "Connection failed to the host" )
- response = main.FALSE
- return response
+ 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 a660caa..cb9549b 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -76,7 +76,7 @@
"""
Called when Test is complete to disconnect the ONOS handle.
"""
- response = ''
+ response = main.TRUE
try:
self.handle.sendline( "" )
i = self.handle.expect( [ "onos>", "\$" ] )
@@ -92,7 +92,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 )
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 0661073..8fd8089 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.py
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.py
@@ -23,33 +23,24 @@
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' ]
main.case( "Setting up test environment" )
+ main.step( "Starting mininet topology" )
+ main.Mininet1.startNet()
+
main.step( "Creating cell file" )
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 )
@@ -80,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
@@ -557,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/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
index d3ed757..52519d8 100644
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -55,7 +55,7 @@
main.step( "Git checkout, pull and get version" )
#main.ONOSbench.gitCheckout( "master" )
gitPullResult = main.ONOSbench.gitPull()
- print "git_pull_result = ", gitPullResult
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
versionResult = main.ONOSbench.getVersion( report=True )
if gitPullResult == 1:
@@ -106,6 +106,12 @@
print startcli2
print startcli3
+ # Starting the mininet using the old way
+ main.step( "Starting Mininet ..." )
+ netIsUp = main.Mininet1.startNet()
+ if netIsUp:
+ main.log.info("Mininet CLI is up")
+
case1Result = ( packageResult and
cellResult and verifyResult and onosInstallResult and
onosIsup and startResult )
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index d3ed757..52519d8 100644
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -55,7 +55,7 @@
main.step( "Git checkout, pull and get version" )
#main.ONOSbench.gitCheckout( "master" )
gitPullResult = main.ONOSbench.gitPull()
- print "git_pull_result = ", gitPullResult
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
versionResult = main.ONOSbench.getVersion( report=True )
if gitPullResult == 1:
@@ -106,6 +106,12 @@
print startcli2
print startcli3
+ # Starting the mininet using the old way
+ main.step( "Starting Mininet ..." )
+ netIsUp = main.Mininet1.startNet()
+ if netIsUp:
+ main.log.info("Mininet CLI is up")
+
case1Result = ( packageResult and
cellResult and verifyResult and onosInstallResult and
onosIsup and startResult )
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index 5e31df3..645ae22 100755
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -17,6 +17,7 @@
self.default = ''
def CASE1( self, main ):
+ import time
"""
Startup sequence:
cell <name>
@@ -46,7 +47,7 @@
main.step( "Git checkout and get version" )
#main.ONOSbench.gitCheckout( "master" )
gitPullResult = main.ONOSbench.gitPull()
- main.log.info( "git_pull_result = " + gitPullResult )
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
main.ONOSbench.getVersion( report=True )
if gitPullResult == 1:
@@ -78,7 +79,14 @@
startResult = main.ONOSbench.onosStart( ONOS1Ip )
main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-
+ main.step( "Starting Mininet CLI..." )
+
+ # Starting the mininet using the old way
+ main.step( "Starting Mininet ..." )
+ netIsUp = main.Mininet1.startNet()
+ if netIsUp:
+ main.log.info("Mininet CLI is up")
+
case1Result = ( packageResult and
cellResult and verifyResult
and onosInstallResult and
@@ -184,6 +192,7 @@
main.case( "Disconnecting mininet and restarting ONOS" )
main.step( "Disconnecting mininet and restarting ONOS" )
mininetDisconnect = main.Mininet1.disconnect()
+ print "mininetDisconnect = ", mininetDisconnect
main.step( "Removing raft logs before a clen installation of ONOS" )
main.ONOSbench.onosRemoveRaftLogs()
@@ -271,7 +280,7 @@
print "devices_result = ", devicesResult
devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1:-1 ]
+ devicesLinewise = devicesLinewise[ 1: ]
roadmCount = 0
packetLayerSWCount = 0
for line in devicesLinewise:
@@ -631,11 +640,10 @@
main.step( "Pingall" )
pingResult = main.FALSE
- while pingResult == main.FALSE:
- time1 = time.time()
- pingResult = main.Mininet1.pingall()
- time2 = time.time()
- print "Time for pingall: %2f seconds" % ( time2 - time1 )
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ print "Time for pingall: %2f seconds" % ( time2 - time1 )
# Start onos cli again because u might have dropped out of
# onos prompt to the shell prompt
@@ -734,6 +742,8 @@
host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
main.ONOS2.addHostIntent( host1Id, host2Id )
+ hIntents = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intents:" + hIntents )
time.sleep( 10 )
hIntents = main.ONOS2.intents( jsonFormat=False )
@@ -1055,17 +1065,17 @@
def CASE8( self ):
"""
- Host intents removal
+ Intent removal
"""
+ import time
main.log.report( "This testcase removes any previously added intents" +
- " before adding the same intents or point intents" )
+ " before adding any new set of intents" )
main.log.report( "__________________________________" )
- main.log.info( "Host intents removal" )
- main.case( "Removing host intents" )
+ main.log.info( "intent removal" )
+ main.case( "Removing installed intents" )
main.step( "Obtain the intent id's" )
intentResult = main.ONOS2.intents( jsonFormat=False )
main.log.info( "intent_result = " + intentResult )
-
intentLinewise = intentResult.split( "\n" )
intentList = []
for line in intentLinewise:
@@ -1113,11 +1123,11 @@
# Note: If the ping result failed, that means the intents have been
# withdrawn correctly.
if PingResult == main.TRUE:
- main.log.report( "Host intents have not been withdrawn correctly" )
+ main.log.report( "Installed intents have not been withdrawn correctly" )
# main.cleanup()
# main.exit()
if PingResult == main.FALSE:
- main.log.report( "Host intents have been withdrawn correctly" )
+ main.log.report( "Installed intents have been withdrawn correctly" )
case8Result = case8Result and PingResult
@@ -1332,8 +1342,7 @@
"___________________________________________________________" )
flowHandle = main.ONOS2.flows()
- # print "flowHandle = ", flowHandle
- main.log.info( "flows :" + flowHandle )
+ #main.log.info( "flows :" + flowHandle )
count = 1
i = 8
diff --git a/TestON/tests/ProdFunc/ProdFunc.topo b/TestON/tests/ProdFunc/ProdFunc.topo
index 7dff686..c3fe280 100755
--- a/TestON/tests/ProdFunc/ProdFunc.topo
+++ b/TestON/tests/ProdFunc/ProdFunc.topo
@@ -91,13 +91,5 @@
</COMPONENTS>
</LincOE2>
- <LincOE3>
- <host>10.128.20.30</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>LincOEDriver</type>
- <connect_order>9</connect_order>
- </LincOE3>
-
</COMPONENT>
</TOPOLOGY>
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index b1246c2..13dc26d 100644
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -17,6 +17,7 @@
self.default = ''
def CASE1( self, main ):
+ import time
"""
Startup sequence:
cell <name>
@@ -43,10 +44,10 @@
main.step( "Removing raft logs before a clen installation of ONOS" )
main.ONOSbench.onosRemoveRaftLogs()
- main.step( "Git checkout, pull and get version" )
+ main.step( "Git checkout and get version" )
#main.ONOSbench.gitCheckout( "master" )
gitPullResult = main.ONOSbench.gitPull()
- main.log.info( "git_pull_result = " + gitPullResult )
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
main.ONOSbench.getVersion( report=True )
if gitPullResult == 1:
@@ -78,7 +79,14 @@
startResult = main.ONOSbench.onosStart( ONOS1Ip )
main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-
+ main.step( "Starting Mininet CLI..." )
+
+ # Starting the mininet using the old way
+ main.step( "Starting Mininet ..." )
+ netIsUp = main.Mininet1.startNet()
+ if netIsUp:
+ main.log.info("Mininet CLI is up")
+
case1Result = ( packageResult and
cellResult and verifyResult
and onosInstallResult and
@@ -184,6 +192,7 @@
main.case( "Disconnecting mininet and restarting ONOS" )
main.step( "Disconnecting mininet and restarting ONOS" )
mininetDisconnect = main.Mininet1.disconnect()
+ print "mininetDisconnect = ", mininetDisconnect
main.step( "Removing raft logs before a clen installation of ONOS" )
main.ONOSbench.onosRemoveRaftLogs()
@@ -271,7 +280,7 @@
print "devices_result = ", devicesResult
devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1:-1 ]
+ devicesLinewise = devicesLinewise[ 1: ]
roadmCount = 0
packetLayerSWCount = 0
for line in devicesLinewise:
@@ -631,11 +640,10 @@
main.step( "Pingall" )
pingResult = main.FALSE
- while pingResult == main.FALSE:
- time1 = time.time()
- pingResult = main.Mininet1.pingall()
- time2 = time.time()
- print "Time for pingall: %2f seconds" % ( time2 - time1 )
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ print "Time for pingall: %2f seconds" % ( time2 - time1 )
# Start onos cli again because u might have dropped out of
# onos prompt to the shell prompt
@@ -734,6 +742,8 @@
host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
main.ONOS2.addHostIntent( host1Id, host2Id )
+ hIntents = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intents:" + hIntents )
time.sleep( 10 )
hIntents = main.ONOS2.intents( jsonFormat=False )
@@ -1055,17 +1065,17 @@
def CASE8( self ):
"""
- Host intents removal
+ Intent removal
"""
+ import time
main.log.report( "This testcase removes any previously added intents" +
- " before adding the same intents or point intents" )
+ " before adding any new set of intents" )
main.log.report( "__________________________________" )
- main.log.info( "Host intents removal" )
- main.case( "Removing host intents" )
+ main.log.info( "intent removal" )
+ main.case( "Removing installed intents" )
main.step( "Obtain the intent id's" )
intentResult = main.ONOS2.intents( jsonFormat=False )
main.log.info( "intent_result = " + intentResult )
-
intentLinewise = intentResult.split( "\n" )
intentList = []
for line in intentLinewise:
@@ -1113,11 +1123,11 @@
# Note: If the ping result failed, that means the intents have been
# withdrawn correctly.
if PingResult == main.TRUE:
- main.log.report( "Host intents have not been withdrawn correctly" )
+ main.log.report( "Installed intents have not been withdrawn correctly" )
# main.cleanup()
# main.exit()
if PingResult == main.FALSE:
- main.log.report( "Host intents have been withdrawn correctly" )
+ main.log.report( "Installed intents have been withdrawn correctly" )
case8Result = case8Result and PingResult
@@ -1136,9 +1146,9 @@
main.log.report( "__________________________________" )
main.log.info( "Adding point intents" )
main.case(
- '''Adding bidirectional point for mn hosts
- ( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22,
- h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )''' )
+ "Adding bidirectional point for mn hosts" +
+ "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
+ "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
main.step( "Add point intents for mn hosts h8 and h18 or" +
"ONOS hosts h8 and h12" )
@@ -1332,8 +1342,7 @@
"___________________________________________________________" )
flowHandle = main.ONOS2.flows()
- # print "flowHandle = ", flowHandle
- main.log.info( "flows :" + flowHandle )
+ #main.log.info( "flows :" + flowHandle )
count = 1
i = 8
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.topo b/TestON/tests/ProdFunc13/ProdFunc13.topo
index c592e18..11a2e6c 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.topo
+++ b/TestON/tests/ProdFunc13/ProdFunc13.topo
@@ -91,13 +91,5 @@
</COMPONENTS>
</LincOE2>
- <LincOE3>
- <host>10.128.20.30</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>LincOEDriver</type>
- <connect_order>9</connect_order>
- </LincOE3>
-
</COMPONENT>
</TOPOLOGY>
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 d0b66c9..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' ]
@@ -63,6 +67,9 @@
main.log.report( "Setting up test environment" )
+ main.step( "Starting mininet topology " )
+ main.Mininet1.startNet()
+
main.step( "Cleaning previously installed ONOS if any" )
main.ONOSbench.onosUninstall( nodeIp=ONOS2Ip )
main.ONOSbench.onosUninstall( nodeIp=ONOS3Ip )
@@ -309,7 +316,7 @@
main.log.info( "Object read in from OFP capture: " +
str( lineOfp ) )
- if len( lineOfp ) > 1:
+ if len( obj ) > 1:
t0Ofp = float( obj[ 1 ] ) * 1000.0
else:
main.log.error( "Tshark output file for OFP" +
@@ -608,6 +615,7 @@
import json
import numpy
global clusterCount
+ global runNum
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
@@ -627,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( "/", "" )
@@ -1128,6 +1139,8 @@
portDownDevAvg = 0
portDownGraphAvg = 0
+ dbCmdList = []
+
for node in range( 0, clusterCount ):
# NOTE:
@@ -1147,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" )