Fixed conflict with ProdFunc
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index fc85c55..2661715 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -163,12 +163,20 @@
driverClass = getattr(driverModule, driverName)
driverObject = driverClass()
- try:
- self.componentDictionary[component]['host'] = os.environ[str( self.componentDictionary[component]['host'])]
- except KeyError:
- self.log.info("Missing OC environment variable! Using stored IPs")
- except Exception as inst:
- self.log.error("Uncaught exception: " + str(inst))
+ if "OC" in self.componentDictionary[component]['host']:
+ try:
+ self.componentDictionary[component]['host'] = os.environ[str( self.componentDictionary[component]['host'])]
+ except KeyError:
+ self.log.info("Missing OC environment variable! Using stored IPs")
+ f = open("myIps","r")
+ ips = f.readlines()
+ for line in ips:
+ if self.componentDictionary[component]['host'] in line:
+ line = line.split("=")
+ myIp = line[1]
+ self.componentDictionary[component]['host'] = myIp
+ except Exception as inst:
+ self.log.error("Uncaught exception: " + str(inst))
connect_result = driverObject.connect(user_name = self.componentDictionary[component]['user'] if ('user' in self.componentDictionary[component].keys()) else getpass.getuser(),
ip_address= self.componentDictionary[component]['host'] if ('host' in self.componentDictionary[component].keys()) else 'localhost',
@@ -264,6 +272,8 @@
self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"cross\" /></li>\n" )
elif re.search( " - No Result$", line ):
self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"warning\" /></li>\n" )
+ else: # Should only be on fail message
+ self.log.wiki( "<ul><li>" + line + "</li></ul>\n" )
self.log.wiki( "</ul>" )
self.log.summary( self.stepCache )
self.stepCache = ""
@@ -274,19 +284,19 @@
try :
step = stepList[self.stepCount]
self.STEPRESULT = self.NORESULT
+ self.onFailMsg = "\t\tNo on fail message given"
exec code[testCaseNumber][step] in module.__dict__
self.stepCount = self.stepCount + 1
if step > 0:
self.stepCache += "\t"+str(testCaseNumber)+"."+str(step)+" "+self.stepName+" - "
if self.STEPRESULT == self.TRUE:
self.stepCache += "PASS\n"
- #self.stepCache += "PASS <ac:emoticon ac:name=\"tick\" /></li>\n"
elif self.STEPRESULT == self.FALSE:
self.stepCache += "FAIL\n"
- #self.stepCache += "FAIL <ac:emoticon ac:name=\"cross\" /></li>\n"
+ # TODO: Print the on-fail statement here
+ self.stepCache += "\t\t" + self.onFailMsg + "\n"
else:
self.stepCache += "No Result\n"
- #self.stepCache += "No Result <ac:emoticon ac:name=\"warning\" /></li>\n"
self.stepResults.append(self.STEPRESULT)
except StandardError as e:
self.log.exception( "\nException in the following section of" +
@@ -304,6 +314,8 @@
self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"cross\" /></li>\n" )
elif re.search( " - No Result$", line ):
self.log.wiki( "<li>" + line + " <ac:emoticon ac:name=\"warning\" /></li>\n" )
+ else: # Should only be on fail message
+ self.log.wiki( "<ul><li>" + line + "</li></ul>\n" )
self.log.wiki( "</ul>" )
#summary results
self.log.summary( self.stepCache )
diff --git a/TestON/core/utilities.py b/TestON/core/utilities.py
index dda43bf..1ba403d 100644
--- a/TestON/core/utilities.py
+++ b/TestON/core/utilities.py
@@ -84,27 +84,27 @@
return result
return assertHandling
- def _assert (self,**assertParam):
+ def _assert (self,**assertParam):
'''
It will take the arguments :
- expect:'Expected output'
- actual:'Actual output'
+ expect:'Expected output'
+ actual:'Actual output'
onpass:'Action or string to be triggered or displayed respectively when the assert passed'
onfail:'Action or string to be triggered or displayed respectively when the assert failed'
not:'optional argument to specify the negation of the each assertion type'
operator:'assertion type will be defined by using operator. Like equal , greater, lesser, matches.'
-
+
It will return the assertion result.
-
+
'''
-
+
arguments = self.parse_args(["EXPECT","ACTUAL","ONPASS","ONFAIL","NOT","OPERATOR"],**assertParam)
-
+
result = 0
valuetype = ''
operation = "not "+ str(arguments["OPERATOR"]) if arguments['NOT'] and arguments['NOT'] == 1 else arguments["OPERATOR"]
operators = {'equals':{'STR':'==','NUM':'=='}, 'matches' : '=~', 'greater':'>' ,'lesser':'<'}
-
+
expectMatch = re.match('^\s*[+-]?0(e0)?\s*$', str(arguments["EXPECT"]), re.I+re.M)
if not ((not expectMatch) and (arguments["EXPECT"]==0)):
valuetype = 'NUM'
@@ -112,31 +112,30 @@
if arguments["OPERATOR"] == 'greater' or arguments["OPERATOR"] == 'lesser':
main.log.error("Numeric comparison on strings is not possibele")
return main.ERROR
-
+
valuetype = 'STR'
arguments["ACTUAL"] = str(arguments["ACTUAL"])
if arguments["OPERATOR"] != 'matches':
arguments["EXPECT"] = str(arguments["EXPECT"])
-
+
try :
opcode = operators[str(arguments["OPERATOR"])][valuetype] if arguments["OPERATOR"] == 'equals' else operators[str(arguments["OPERATOR"])]
-
+
except KeyError:
print "Key Error in assertion"
return main.FALSE
-
+
if opcode == '=~':
try:
assert re.search(str(arguments["EXPECT"]),str(arguments["ACTUAL"]))
result = main.TRUE
except AssertionError:
try :
- assert re.match(str(arguments["EXPECT"]),str(arguments["ACTUAL"]))
+ assert re.match(str(arguments["EXPECT"]),str(arguments["ACTUAL"]))
result = main.TRUE
except AssertionError:
main.log.error("Assertion Failed")
result = main.FALSE
-
else :
try:
if str(opcode)=="==":
@@ -145,27 +144,21 @@
result = main.TRUE
else :
result = main.FALSE
-
elif str(opcode) == ">":
main.log.info("Verifying the Expected is Greater than the actual or not using assert_greater")
if (ast.literal_eval(arguments["EXPECT"]) > ast.literal_eval(arguments["ACTUAL"])) :
result = main.TRUE
else :
result = main.FALSE
-
elif str(opcode) == "<":
main.log.info("Verifying the Expected is Lesser than the actual or not using assert_lesser")
if (ast.literal_eval(arguments["EXPECT"]) < ast.literal_eval(arguments["ACTUAL"])):
result = main.TRUE
else :
result = main.FALSE
-
-
except AssertionError:
main.log.error("Assertion Failed")
result = main.FALSE
-
-
result = result if result else 0
result = not result if arguments["NOT"] and arguments["NOT"] == 1 else result
resultString = ""
@@ -179,7 +172,8 @@
else :
main.log.error(arguments["ONFAIL"])
main.log.report(arguments["ONFAIL"])
-
+ main.onFailMsg = arguments[ 'ONFAIL' ]
+
msg = arguments["ON" + str(resultString)]
if not isinstance(msg,str):
@@ -190,8 +184,7 @@
main.last_result = result
return result
-
-
+
def parse_args(self,args, **kwargs):
'''
It will accept the (key,value) pair and will return the (key,value) pairs with keys in uppercase.
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 3b0b01b..c2c011a 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -410,7 +410,6 @@
cmd = "sudo -E python opticalTest.py " + controller
main.log.info( self.name + ": cmd = " + cmd )
self.handle.sendline( cmd )
- self.handle.expect( "Press ENTER to push Topology.json" )
time.sleep(30)
self.handle.sendline( "" )
self.handle.sendline( "" )
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index a0ed6e4..7256294 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -281,9 +281,12 @@
lvlStr = "--level=" + level
self.handle.sendline( "" )
- i = self.handle.expect( [ "onos>", pexpect.TIMEOUT ] )
- # TODO: look for bash prompt as well
+ i = self.handle.expect( [ "onos>","\$", pexpect.TIMEOUT ] )
if i == 1:
+ main.log.error( self.name + ": onos cli session closed." )
+ main.cleanup()
+ main.exit()
+ if i == 2:
self.handle.sendline( "" )
self.handle.expect( "onos>" )
self.handle.sendline( "log:log " + lvlStr + " " + cmdStr )
@@ -1621,6 +1624,31 @@
main.cleanup()
main.exit()
+ def purgeIntents( self ):
+ """
+ Purges all WITHDRAWN Intents
+ """
+ try:
+ cmdStr = "purge-intents"
+ handle = self.sendline( cmdStr )
+ if re.search( "Error", handle ):
+ main.log.error( "Error in purging intents" )
+ return main.FALSE
+ else:
+ return main.TRUE
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
def routes( self, jsonFormat=False ):
"""
NOTE: This method should be used after installing application:
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index bb30335..7abbcc6 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -174,11 +174,14 @@
main.cleanup()
main.exit()
- def cleanInstall( self, mciTimeout=600 ):
+ def cleanInstall( self, skipTest=False, mciTimeout=600 ):
"""
Runs mvn clean install in the root of the ONOS directory.
This will clean all ONOS artifacts then compile each module
-
+ Optional:
+ skipTest - Does "-DskipTests -Dcheckstyle.skip -U -T 1C" which
+ skip the test. This will make the building faster.
+ Disregarding the credibility of the build
Returns: main.TRUE on success
On Failure, exits the test
"""
@@ -191,8 +194,15 @@
self.handle.sendline( "" )
self.handle.expect( "\$" )
- self.handle.sendline( "mvn clean install" )
- self.handle.expect( "mvn clean install" )
+
+ if not skipTest:
+ self.handle.sendline( "mvn clean install" )
+ self.handle.expect( "mvn clean install" )
+ else:
+ self.handle.sendline( "mvn clean install -DskipTests" +
+ " -Dcheckstyle.skip -U -T 1C" )
+ self.handle.expect( "mvn clean install -DskipTests" +
+ " -Dcheckstyle.skip -U -T 1C" )
while True:
i = self.handle.expect( [
'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s' +
@@ -412,7 +422,7 @@
[ 'fatal',
'Username for (.*): ',
'Already on \'',
- 'Switched to branch \'' + str( branch ),
+ 'Switched to (a new )?branch \'' + str( branch ),
pexpect.TIMEOUT,
'error: Your local changes to the following files' +
'would be overwritten by checkout:',
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 44552ae..3b94ef7 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:|Password:',
pexpect.EOF,
pexpect.TIMEOUT,
refused,
diff --git a/TestON/tests/CbenchBM/CbenchBM.params b/TestON/tests/CbenchBM/CbenchBM.params
new file mode 100644
index 0000000..33dc069
--- /dev/null
+++ b/TestON/tests/CbenchBM/CbenchBM.params
@@ -0,0 +1,60 @@
+<PARAMS>
+
+ <testcases>1,2</testcases>
+
+ <SCALE>1</SCALE>
+ <availableNodes>7</availableNodes>
+
+ <ENV>
+ <cellName>CbenchBMcell</cellName>
+ </ENV>
+
+ <TEST>
+ <skipCleanInstall>yes</skipCleanInstall>
+ <mode>t</mode> #t throughput
+ </TEST>
+
+ <GIT>
+ <autopull>off</autopull>
+ <checkout>master</checkout>
+ </GIT>
+
+ <CTRL>
+ <USER>admin</USER>
+
+ <ip1>10.254.1.207</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.128.5.205</ip5>
+ <port5>6633</port5>
+
+ <ip6>10.128.5.206</ip6>
+ <port6>6633</port6>
+
+ <ip7>10.128.5.201</ip7>
+ <port7>6633</port7>
+
+ </CTRL>
+
+ <MN>
+ <ip1>10.254.1.200</ip1>
+ </MN>
+
+ <BENCH>
+ <user>admin</user>
+ <ip1>10.254.1.200</ip1>
+ </BENCH>
+
+ <JSON>
+ </JSON>
+
+</PARAMS>
diff --git a/TestON/tests/CbenchBM/CbenchBM.py b/TestON/tests/CbenchBM/CbenchBM.py
new file mode 100644
index 0000000..d042f45
--- /dev/null
+++ b/TestON/tests/CbenchBM/CbenchBM.py
@@ -0,0 +1,184 @@
+# ScaleOutTemplate --> CbenchBM
+#
+# CASE1 starts number of nodes specified in param file
+#
+# cameron@onlab.us
+
+import sys
+import os.path
+
+
+class CbenchBM:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+
+ import time
+ global init
+ try:
+ if type(init) is not bool:
+ init = False
+ except NameError:
+ init = False
+
+ #Load values from params file
+ checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
+ gitPull = main.params[ 'GIT' ][ 'autopull' ]
+ BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+ BENCHUser = main.params[ 'BENCH' ][ 'user' ]
+ MN1Ip = main.params[ 'MN' ][ 'ip1' ]
+ maxNodes = int(main.params[ 'availableNodes' ])
+ skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+
+ # -- INIT SECTION, ONLY RUNS ONCE -- #
+ if init == False:
+ init = True
+ global clusterCount #number of nodes running
+ global ONOSIp #list of ONOS IP addresses
+ global scale
+
+ clusterCount = 0
+ ONOSIp = [ 0 ]
+ scale = (main.params[ 'SCALE' ]).split(",")
+ clusterCount = int(scale[0])
+
+ #Populate ONOSIp with ips from params
+ for i in range(1, maxNodes + 1):
+ ipString = 'ip' + str(i)
+ ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
+
+ #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
+ if skipMvn != "yes":
+ mvnResult = main.ONOSbench.cleanInstall()
+
+ #git
+ 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" )
+
+ # -- END OF INIT SECTION --#
+
+ clusterCount = int(scale[0])
+ scale.remove(scale[0])
+
+ #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])
+
+ #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] )
+
+ main.step( "Set Cell" )
+ main.ONOSbench.setCell(cellName)
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "verify cells" )
+ verifyCellResult = main.ONOSbench.verifyCell()
+
+ main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
+ for node in range(1, clusterCount + 1):
+ main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
+ main.ONOSbench.onosInstall( ONOSIp[node])
+
+ for node in range(1, clusterCount + 1):
+ for i in range( 2 ):
+ isup = main.ONOSbench.isup( ONOSIp[node] )
+ if isup:
+ main.log.info("ONOS " + str(node) + " is up\n")
+ break
+ if not isup:
+ main.log.report( "ONOS " + str(node) + " didn't start!" )
+ main.log.info("Startup sequence complete")
+
+ for i in range(5):
+ main.ONOSbench.onosCfgSet(ONOSIp[1], "org.onosproject.fwd.ReactiveForwarding","packetOutOnly true")
+ time.sleep(5)
+ main.ONOSbench.handle.sendline("onos $OC1 cfg get|grep packetOutOnly")
+ main.ONOSbench.handle.expect(":~")
+ check = main.ONOSbench.handle.before
+ if "value=true" in check:
+ main.log.info("cfg set successful")
+ break
+ if i == 4:
+ main.log.info("Cfg set failed")
+ else:
+ time.sleep(5)
+
+
+
+
+
+ def CASE2( self, main ):
+
+ mode = main.params[ 'TEST' ][ 'mode' ]
+ if mode != "t":
+ mode = " "
+
+ runCbench = ( "ssh admin@" + ONOSIp[1] + " cbench -c localhost -p 6633 -m 1000 -l 25 -s 16 -M 100000 -w 15 -D 10000 -" + mode )
+ main.ONOSbench.handle.sendline(runCbench)
+ time.sleep(30)
+ main.ONOSbench.handle.expect(":~")
+ output = main.ONOSbench.handle.before
+ main.log.info(output)
+
+ output = output.splitlines()
+ for line in output:
+ if "RESULT: " in line:
+ print line
+ break
+
+ resultLine = line.split(" ")
+ for word in resultLine:
+ if word == "min/max/avg/stdev":
+ resultsIndex = resultLine.index(word)
+ print resultsIndex
+ break
+
+ finalDataString = resultLine[resultsIndex + 2]
+ print finalDataString
+ finalDataList = finalDataString.split("/")
+ avg = finalDataList[2]
+ stdev = finalDataList[3]
+
+ main.log.info("Average: \t\t\t" + avg)
+ main.log.info("Standard Deviation: \t" + stdev)
+
+ if mode == " ":
+ mode = "l"
+
+ commit = main.ONOSbench.getVersion()
+ commit = (commit.split(" "))[1]
+
+ dbfile = open("CbenchBMDB", "w+")
+ temp = "'" + commit + "',"
+ temp += "'" + mode + "',"
+ temp += "'" + avg + "',"
+ temp += "'" + stdev + "'\n"
+ dbfile.write(temp)
+ dbfile.close()
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
+
+
+
+
+
+
+
+
+
diff --git a/TestON/tests/CbenchBM/CbenchBM.topo b/TestON/tests/CbenchBM/CbenchBM.topo
new file mode 100644
index 0000000..7b39c4e
--- /dev/null
+++ b/TestON/tests/CbenchBM/CbenchBM.topo
@@ -0,0 +1,144 @@
+<TOPOLOGY>
+
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>10.254.1.200</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS><home>~/onos</home></COMPONENTS>
+ </ONOSbench>
+
+ <ONOS1cli>
+ <host>10.254.1.200</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1cli>
+
+ <ONOS2cli>
+ <host>10.254.1.200</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2cli>
+
+ <ONOS3cli>
+ <host>10.254.1.200</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3cli>
+
+ <ONOS4cli>
+ <host>10.254.1.200</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS4cli>
+
+ <ONOS5cli>
+ <host>10.254.1.200</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS5cli>
+
+ <ONOS6cli>
+ <host>10.254.1.200</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS6cli>
+
+ <ONOS7cli>
+ <host>10.254.1.200</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/CbenchBM/__init__.py b/TestON/tests/CbenchBM/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/CbenchBM/__init__.py
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
index 390facf..207e693 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,2,8,3,4,5,14,16,17,[6],8,3,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+ <testcases>1,2,8,3,8,4,5,14,16,17,[6],8,3,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
<cellName>HA</cellName>
</ENV>
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index 50bf06f..c1bd2f0 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -4,7 +4,8 @@
List of test cases:
CASE1: Compile ONOS and push it to the test machines
-CASE2: Assign mastership to controllers
+CASE2: Assign devices to controllers
+CASE21: Assign mastership to controllers
CASE3: Assign intents
CASE4: Ping across added host intents
CASE5: Reading state of ONOS
@@ -70,6 +71,11 @@
global ONOS6Port
global ONOS7Port
global numControllers
+ # These are for csv plotting in jenkins
+ global labels
+ global data
+ labels = []
+ data = []
numControllers = int( main.params[ 'num_controllers' ] )
# FIXME: just get controller port from params?
@@ -241,7 +247,7 @@
def CASE2( self, main ):
"""
- Assign mastership to controllers
+ Assign devices to controllers
"""
import re
import time
@@ -258,12 +264,10 @@
assert ONOS6Port, "ONOS6Port not defined"
assert ONOS7Port, "ONOS7Port not defined"
- main.case( "Assigning Controllers" )
+ main.case( "Assigning devices to controllers" )
main.caseExplaination = "Assign switches to ONOS using 'ovs-vsctl' " +\
"and check that an ONOS node becomes the " +\
- "master of the device. Then manually assign" +\
- " mastership to specific ONOS nodes using" +\
- " 'device-role'"
+ "master of the device."
main.step( "Assign switches to controllers" )
# TODO: rewrite this function to take lists of ips and ports?
@@ -301,6 +305,30 @@
onpass="Switch mastership assigned correctly",
onfail="Switches not assigned correctly to controllers" )
+ def CASE21( self, main ):
+ """
+ Assign mastership to controllers
+ """
+ import re
+ import time
+ assert numControllers, "numControllers not defined"
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ assert CLIs, "CLIs not defined"
+ assert nodes, "nodes not defined"
+ assert ONOS1Port, "ONOS1Port not defined"
+ assert ONOS2Port, "ONOS2Port not defined"
+ assert ONOS3Port, "ONOS3Port not defined"
+ assert ONOS4Port, "ONOS4Port not defined"
+ assert ONOS5Port, "ONOS5Port not defined"
+ assert ONOS6Port, "ONOS6Port not defined"
+ assert ONOS7Port, "ONOS7Port not defined"
+
+ main.case( "Assigning Controller roles for switches" )
+ main.caseExplaination = "Check that ONOS is connected to each " +\
+ "device. Then manually assign" +\
+ " mastership to specific ONOS nodes using" +\
+ " 'device-role'"
main.step( "Assign mastership of switches to specific controllers" )
# Manually assign mastership to the controller we want
roleCall = main.TRUE
@@ -345,6 +373,7 @@
else:
main.log.error( "You didn't write an else statement for " +
"switch s" + str( i ) )
+ roleCall = main.FALSE
# Assign switch
assert deviceId, "No device id for s" + str( i ) + " in ONOS"
# TODO: make this controller dynamic
@@ -385,11 +414,6 @@
onpass="Switches were successfully reassigned to designated " +
"controller",
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" )
def CASE3( self, main ):
"""
@@ -402,6 +426,16 @@
assert utilities.assert_equals, "utilities.assert_equals not defined"
assert CLIs, "CLIs not defined"
assert nodes, "nodes not defined"
+ try:
+ labels
+ except NameError:
+ main.log.error( "labels not defined, setting to []" )
+ labels = []
+ try:
+ data
+ except NameError:
+ main.log.error( "data not defined, setting to []" )
+ data = []
# NOTE: we must reinstall intents until we have a persistant intent
# datastore!
main.case( "Adding host Intents" )
@@ -572,6 +606,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -588,11 +623,19 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ # Check all nodes
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -639,13 +682,15 @@
main.log.debug( "Intents in " + cli.name + ": " +
str( sorted( onosIds ) ) )
if sorted( ids ) != sorted( intentIds ):
- # IF intents are missing
+ main.log.debug( "Set of intent IDs doesn't match" )
correct = False
break
else:
intents = json.loads( cli.intents() )
for intent in intents:
if intent[ 'state' ] != "INSTALLED":
+ main.log.warn( "Intent " + intent[ 'id' ] +
+ " is " + intent[ 'state' ] )
correct = False
break
if correct:
@@ -658,6 +703,17 @@
gossipTime = intentStop - intentStart
main.log.info( "It took about " + str( gossipTime ) +
" seconds for all intents to appear in each node" )
+ append = False
+ title = "Gossip Intents"
+ count = 1
+ while append is False:
+ curTitle = title + str( count )
+ if curTitle not in labels:
+ labels.append( curTitle )
+ data.append( str( gossipTime ) )
+ append = True
+ else:
+ count += 1
# FIXME: make this time configurable/calculate based off of number of
# nodes and gossip rounds
utilities.assert_greater_equals(
@@ -703,6 +759,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -722,11 +779,19 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ # Check all nodes
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -805,14 +870,13 @@
main.step( "Check Intent state" )
installedCheck = False
- count = 0
- while not installedCheck and count < 40:
+ loopCount = 0
+ while not installedCheck and loopCount < 40:
installedCheck = True
# Print the intent states
intents = main.ONOScli1.intents()
intentStates = []
main.log.info( "%-6s%-15s%-15s" % ( 'Count', 'ID', 'State' ) )
- count = 0
# Iter through intents of a node
try:
for intent in json.loads( intents ):
@@ -831,7 +895,7 @@
( str( count ), str( i ), str( s ) ) )
if not installedCheck:
time.sleep( 1 )
- count += 1
+ loopCount += 1
utilities.assert_equals( expect=True, actual=installedCheck,
onpass="Intents are all INSTALLED",
onfail="Intents are not all in " +
@@ -871,6 +935,13 @@
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
# TODO: Check for a leader of these topics
+ # Check all nodes
+ if topicCheck:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
utilities.assert_equals( expect=main.TRUE, actual=topicCheck,
onpass="intent Partitions is in leaders",
onfail="Some topics were lost " )
@@ -905,10 +976,11 @@
except ( ValueError, TypeError ):
main.log.exception( "Error parsing pending map" )
main.log.error( repr( pendingMap ) )
- main.log.info( "Waiting 60 seconds to see if the state of " +
- "intents change" )
- time.sleep( 60 )
+
if not installedCheck:
+ main.log.info( "Waiting 60 seconds to see if the state of " +
+ "intents change" )
+ time.sleep( 60 )
# Print the intent states
intents = main.ONOScli1.intents()
intentStates = []
@@ -931,6 +1003,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -950,11 +1023,18 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -1394,14 +1474,6 @@
for t in threads:
t.join()
ports.append( t.result )
- try:
- # FIXME: DEBUG
- main.log.debug( json.dumps( json.loads( t.result ),
- sort_keys=True,
- indent=4,
- separators=( ',', ': ' ) ) )
- except:
- main.log.debug( repr( t.result ) )
links = []
threads = []
for i in range( numControllers ):
@@ -1578,7 +1650,18 @@
assert utilities.assert_equals, "utilities.assert_equals not defined"
assert CLIs, "CLIs not defined"
assert nodes, "nodes not defined"
-
+ try:
+ labels
+ except NameError:
+ main.log.error( "labels not defined, setting to []" )
+ global labels
+ labels = []
+ try:
+ data
+ except NameError:
+ main.log.error( "data not defined, setting to []" )
+ global data
+ data = []
# Reset non-persistent variables
try:
iCounterValue = 0
@@ -1587,14 +1670,6 @@
iCounterValue = 0
main.case( "Restart entire ONOS cluster" )
- # FIXME: DEBUG
- main.step( "Start Packet Capture MN" )
- main.Mininet2.startTcpdump(
- str( main.params[ 'MNtcpdump' ][ 'folder' ] ) + str( main.TEST )
- + "-MN.pcap",
- intf=main.params[ 'MNtcpdump' ][ 'intf' ],
- port=main.params[ 'MNtcpdump' ][ 'port' ] )
- # FIXME: DEBUG
main.step( "Killing ONOS nodes" )
killResults = main.TRUE
@@ -1641,6 +1716,8 @@
# protocol has had time to work
main.restartTime = time.time() - killTime
main.log.debug( "Restart time: " + str( main.restartTime ) )
+ labels.append( "Restart" )
+ data.append( str( main.restartTime ) )
# FIXME: revisit test plan for election with madan
# Rerun for election on restarted nodes
@@ -1896,7 +1973,7 @@
for intent in before:
if intent not in after:
sameIntents = main.FALSE
- main.log.debug( "Intent is not currently in ONOS " +\
+ main.log.debug( "Intent is not currently in ONOS " +
"(at least in the same form):" )
main.log.debug( json.dumps( intent ) )
except ( ValueError, TypeError ):
@@ -2044,18 +2121,18 @@
portsResults = main.TRUE
linksResults = main.TRUE
hostsResults = main.TRUE
+ hostAttachmentResults = True
topoResult = main.FALSE
elapsed = 0
count = 0
main.step( "Collecting topology information from ONOS" )
startTime = time.time()
# Give time for Gossip to work
- while topoResult == main.FALSE and elapsed < 120:
+ while topoResult == main.FALSE and elapsed < 60:
count += 1
if count > 1:
# TODO: Deprecate STS usage
MNTopo = TestONTopology( main.Mininet1, ctrls )
- time.sleep( 1 )
cliStart = time.time()
devices = []
threads = []
@@ -2106,14 +2183,6 @@
for t in threads:
t.join()
ports.append( t.result )
- try:
- # FIXME: DEBUG
- main.log.debug( json.dumps( json.loads( t.result ),
- sort_keys=True,
- indent=4,
- separators=( ',', ': ' ) ) )
- except:
- main.log.debug( repr( t.result ) )
links = []
threads = []
for i in range( numControllers ):
@@ -2197,88 +2266,188 @@
" hosts exist in Mininet",
onfail="ONOS" + controllerStr +
" hosts don't match Mininet" )
+ # CHECKING HOST ATTACHMENT POINTS
+ hostAttachment = True
+ zeroHosts = False
+ # FIXME: topo-HA/obelisk specific mappings:
+ # key is mac and value is dpid
+ mappings = {}
+ for i in range( 1, 29 ): # hosts 1 through 28
+ # set up correct variables:
+ macId = "00:" * 5 + hex( i ).split( "0x" )[1].upper().zfill(2)
+ if i == 1:
+ deviceId = "1000".zfill(16)
+ elif i == 2:
+ deviceId = "2000".zfill(16)
+ elif i == 3:
+ deviceId = "3000".zfill(16)
+ elif i == 4:
+ deviceId = "3004".zfill(16)
+ elif i == 5:
+ deviceId = "5000".zfill(16)
+ elif i == 6:
+ deviceId = "6000".zfill(16)
+ elif i == 7:
+ deviceId = "6007".zfill(16)
+ elif i >= 8 and i <= 17:
+ dpid = '3' + str( i ).zfill( 3 )
+ deviceId = dpid.zfill(16)
+ elif i >= 18 and i <= 27:
+ dpid = '6' + str( i ).zfill( 3 )
+ deviceId = dpid.zfill(16)
+ elif i == 28:
+ deviceId = "2800".zfill(16)
+ mappings[ macId ] = deviceId
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ if hosts[ controller ] == []:
+ main.log.warn( "There are no hosts discovered" )
+ zeroHosts = True
+ else:
+ for host in hosts[ controller ]:
+ mac = None
+ location = None
+ device = None
+ port = None
+ try:
+ mac = host.get( 'mac' )
+ assert mac, "mac field could not be found for this host object"
+ location = host.get( 'location' )
+ assert location, "location field could not be found for this host object"
+
+ # Trim the protocol identifier off deviceId
+ device = str( location.get( 'elementId' ) ).split(':')[1]
+ assert device, "elementId field could not be found for this host location object"
+
+ port = location.get( 'port' )
+ assert port, "port field could not be found for this host location object"
+
+ # Now check if this matches where they should be
+ if mac and device and port:
+ if str( port ) != "1":
+ main.log.error( "The attachment port is incorrect for " +
+ "host " + str( mac ) +
+ ". Expected: 1 Actual: " + str( port) )
+ hostAttachment = False
+ if device != mappings[ str( mac ) ]:
+ main.log.error( "The attachment device is incorrect for " +
+ "host " + str( mac ) +
+ ". Expected: " + mappings[ str( mac ) ] +
+ " Actual: " + device )
+ hostAttachment = False
+ else:
+ hostAttachment = False
+ except AssertionError:
+ main.log.exception( "Json object not as expected" )
+ main.log.error( repr( host ) )
+ hostAttachment = False
+ else:
+ main.log.error( "No hosts json output or \"Error\"" +
+ " in output. hosts = " +
+ repr( hosts[ controller ] ) )
+ if zeroHosts:
+ # TODO: Find a way to know if there should be hosts in a
+ # given point of the test
+ hostAttachment = True
+
+ # END CHECKING HOST ATTACHMENT POINTS
devicesResults = devicesResults and currentDevicesResult
portsResults = portsResults and currentPortsResult
linksResults = linksResults and currentLinksResult
hostsResults = hostsResults and currentHostsResult
+ hostAttachmentResults = hostAttachmentResults and hostAttachment
- # Compare json objects for hosts and dataplane clusters
+ # Compare json objects for hosts and dataplane clusters
- # hosts
- main.step( "Hosts view is consistent across all ONOS nodes" )
- 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.error( "hosts from ONOS" + controllerStr +
- " is inconsistent with ONOS1" )
- main.log.warn( repr( hosts[ controller ] ) )
- consistentHostsResult = main.FALSE
-
- else:
- main.log.error( "Error in getting ONOS hosts from ONOS" +
- controllerStr )
+ # hosts
+ main.step( "Hosts view is consistent across all ONOS nodes" )
+ 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.error( "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
- main.step( "Clusters view is consistent across all ONOS nodes" )
- 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.error( "clusters from ONOS" +
- controllerStr +
- " is inconsistent with ONOS1" )
- consistentClustersResult = main.FALSE
+ else:
+ main.log.error( "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.error( "Error in getting dataplane clusters " +
- "from ONOS" + controllerStr )
+ main.step( "Hosts information is correct" )
+ hostsResults = hostsResults and ipResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=hostsResults,
+ onpass="Host information is correct",
+ onfail="Host information is incorrect" )
+
+ main.step( "Host attachment points to the network" )
+ utilities.assert_equals(
+ expect=True,
+ actual=hostAttachmentResults,
+ onpass="Hosts are correctly attached to the network",
+ onfail="ONOS did not correctly attach hosts to the network" )
+
+ # Strongly connected clusters of devices
+ main.step( "Clusters view is consistent across all ONOS nodes" )
+ 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.error( "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
- main.step( "Topology view is correct and consistent across all " +
- "ONOS nodes" )
- try:
- numClusters = len( json.loads( clusters[ 0 ] ) )
- except ( ValueError, TypeError ):
- main.log.exception( "Error parsing clusters[0]: " +
- repr( clusters[0] ) )
- clusterResults = main.FALSE
- if numClusters == 1:
- clusterResults = main.TRUE
- 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 hostsResults and consistentHostsResult
- and consistentClustersResult and clusterResults
- and ipResult )
+ else:
+ main.log.error( "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" )
+
+ main.step( "There is only one SCC" )
+ # there should always only be one cluster
+ try:
+ numClusters = len( json.loads( clusters[ 0 ] ) )
+ except ( ValueError, TypeError ):
+ main.log.exception( "Error parsing clusters[0]: " +
+ repr( clusters[0] ) )
+ clusterResults = main.FALSE
+ if numClusters == 1:
+ clusterResults = main.TRUE
+ 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 hostsResults and consistentHostsResult
+ and consistentClustersResult and clusterResults
+ and ipResult and hostAttachmentResults )
topoResult = topoResult and int( count <= 2 )
note = "note it takes about " + str( int( cliTime ) ) + \
@@ -2288,9 +2457,27 @@
"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" )
+
+ main.step( "Device information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=devicesResults,
+ onpass="Device information is correct",
+ onfail="Device information is incorrect" )
+
+ main.step( "Port information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=portsResults,
+ onpass="Port information is correct",
+ onfail="Port information is incorrect" )
+
+ main.step( "Links are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=linksResults,
+ onpass="Link are correct",
+ onfail="Links are incorrect" )
# FIXME: move this to an ONOS state case
main.step( "Checking ONOS nodes" )
@@ -2562,10 +2749,8 @@
try:
timerLog = open( main.logdir + "/Timers.csv", 'w')
- # Overwrite with empty line and close
- labels = "Gossip Intents, Restart"
- data = str( gossipTime ) + ", " + str( main.restartTime )
- timerLog.write( labels + "\n" + data )
+ main.log.error( ", ".join( labels ) + "\n" + ", ".join( data ) )
+ timerLog.write( ", ".join( labels ) + "\n" + ", ".join( data ) )
timerLog.close()
except NameError, e:
main.log.exception(e)
@@ -2800,6 +2985,7 @@
"""
Check for basic functionality with distributed primitives
"""
+ import json
# Make sure variables are defined/set
assert numControllers, "numControllers not defined"
assert main, "main not defined"
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
index af96bb5..08d81c2 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -4,7 +4,8 @@
List of test cases:
CASE1: Compile ONOS and push it to the test machines
-CASE2: Assign mastership to controllers
+CASE2: Assign devices to controllers
+CASE21: Assign mastership to controllers
CASE3: Assign intents
CASE4: Ping across added host intents
CASE5: Reading state of ONOS
@@ -241,7 +242,7 @@
def CASE2( self, main ):
"""
- Assign mastership to controllers
+ Assign devices to controllers
"""
import re
import time
@@ -258,12 +259,10 @@
assert ONOS6Port, "ONOS6Port not defined"
assert ONOS7Port, "ONOS7Port not defined"
- main.case( "Assigning Controllers" )
+ main.case( "Assigning devices to controllers" )
main.caseExplaination = "Assign switches to ONOS using 'ovs-vsctl' " +\
"and check that an ONOS node becomes the " +\
- "master of the device. Then manually assign" +\
- " mastership to specific ONOS nodes using" +\
- " 'device-role'"
+ "master of the device."
main.step( "Assign switches to controllers" )
# TODO: rewrite this function to take lists of ips and ports?
@@ -301,6 +300,30 @@
onpass="Switch mastership assigned correctly",
onfail="Switches not assigned correctly to controllers" )
+ def CASE21( self, main ):
+ """
+ Assign mastership to controllers
+ """
+ import re
+ import time
+ assert numControllers, "numControllers not defined"
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ assert CLIs, "CLIs not defined"
+ assert nodes, "nodes not defined"
+ assert ONOS1Port, "ONOS1Port not defined"
+ assert ONOS2Port, "ONOS2Port not defined"
+ assert ONOS3Port, "ONOS3Port not defined"
+ assert ONOS4Port, "ONOS4Port not defined"
+ assert ONOS5Port, "ONOS5Port not defined"
+ assert ONOS6Port, "ONOS6Port not defined"
+ assert ONOS7Port, "ONOS7Port not defined"
+
+ main.case( "Assigning Controller roles for switches" )
+ main.caseExplaination = "Check that ONOS is connected to each " +\
+ "device. Then manually assign" +\
+ " mastership to specific ONOS nodes using" +\
+ " 'device-role'"
main.step( "Assign mastership of switches to specific controllers" )
# Manually assign mastership to the controller we want
roleCall = main.TRUE
@@ -345,6 +368,7 @@
else:
main.log.error( "You didn't write an else statement for " +
"switch s" + str( i ) )
+ roleCall = main.FALSE
# Assign switch
assert deviceId, "No device id for s" + str( i ) + " in ONOS"
# TODO: make this controller dynamic
@@ -385,11 +409,6 @@
onpass="Switches were successfully reassigned to designated " +
"controller",
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" )
def CASE3( self, main ):
"""
@@ -537,7 +556,6 @@
pass # intent submitted is in onos
else:
intentAddResult = False
- # FIXME: DEBUG
if intentAddResult:
intentStop = time.time()
else:
@@ -571,6 +589,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -587,11 +606,19 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ # Check all nodes
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -638,12 +665,15 @@
main.log.debug( "Intents in " + cli.name + ": " +
str( sorted( onosIds ) ) )
if sorted( ids ) != sorted( intentIds ):
+ main.log.debug( "Set of intent IDs doesn't match" )
correct = False
break
else:
intents = json.loads( cli.intents() )
for intent in intents:
if intent[ 'state' ] != "INSTALLED":
+ main.log.warn( "Intent " + intent[ 'id' ] +
+ " is " + intent[ 'state' ] )
correct = False
break
if correct:
@@ -701,6 +731,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -720,11 +751,19 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ # Check all nodes
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -803,8 +842,8 @@
main.step( "Check Intent state" )
installedCheck = False
- count = 0
- while not installedCheck and count < 40:
+ loopCount = 0
+ while not installedCheck and loopCount < 40:
installedCheck = True
# Print the intent states
intents = main.ONOScli1.intents()
@@ -829,7 +868,7 @@
( str( count ), str( i ), str( s ) ) )
if not installedCheck:
time.sleep( 1 )
- count += 1
+ loopCount += 1
utilities.assert_equals( expect=True, actual=installedCheck,
onpass="Intents are all INSTALLED",
onfail="Intents are not all in " +
@@ -869,6 +908,13 @@
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
# TODO: Check for a leader of these topics
+ # Check all nodes
+ if topicCheck:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
utilities.assert_equals( expect=main.TRUE, actual=topicCheck,
onpass="intent Partitions is in leaders",
onfail="Some topics were lost " )
@@ -930,6 +976,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -949,11 +996,18 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -1861,7 +1915,7 @@
for intent in before:
if intent not in after:
sameIntents = main.FALSE
- main.log.debug( "Intent is not currently in ONOS " +\
+ main.log.debug( "Intent is not currently in ONOS " +
"(at least in the same form):" )
main.log.debug( json.dumps( intent ) )
except ( ValueError, TypeError ):
@@ -2015,6 +2069,7 @@
portsResults = main.TRUE
linksResults = main.TRUE
hostsResults = main.TRUE
+ hostAttachmentResults = True
topoResult = main.FALSE
elapsed = 0
count = 0
@@ -2103,6 +2158,7 @@
elapsed = time.time() - startTime
cliTime = time.time() - cliStart
+ print "Elapsed time: " + str( elapsed )
print "CLI time: " + str( cliTime )
for controller in range( numControllers ):
@@ -2158,88 +2214,186 @@
" hosts exist in Mininet",
onfail="ONOS" + controllerStr +
" hosts don't match Mininet" )
+ # CHECKING HOST ATTACHMENT POINTS
+ hostAttachment = True
+ noHosts = False
+ # FIXME: topo-HA/obelisk specific mappings:
+ # key is mac and value is dpid
+ mappings = {}
+ for i in range( 1, 29 ): # hosts 1 through 28
+ # set up correct variables:
+ macId = "00:" * 5 + hex( i ).split( "0x" )[1].upper().zfill(2)
+ if i == 1:
+ deviceId = "1000".zfill(16)
+ elif i == 2:
+ deviceId = "2000".zfill(16)
+ elif i == 3:
+ deviceId = "3000".zfill(16)
+ elif i == 4:
+ deviceId = "3004".zfill(16)
+ elif i == 5:
+ deviceId = "5000".zfill(16)
+ elif i == 6:
+ deviceId = "6000".zfill(16)
+ elif i == 7:
+ deviceId = "6007".zfill(16)
+ elif i >= 8 and i <= 17:
+ dpid = '3' + str( i ).zfill( 3 )
+ deviceId = dpid.zfill(16)
+ elif i >= 18 and i <= 27:
+ dpid = '6' + str( i ).zfill( 3 )
+ deviceId = dpid.zfill(16)
+ elif i == 28:
+ deviceId = "2800".zfill(16)
+ mappings[ macId ] = deviceId
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ if hosts[ controller ] == []:
+ main.log.warn( "There are no hosts discovered" )
+ noHosts = True
+ else:
+ for host in hosts[ controller ]:
+ mac = None
+ location = None
+ device = None
+ port = None
+ try:
+ mac = host.get( 'mac' )
+ assert mac, "mac field could not be found for this host object"
+ location = host.get( 'location' )
+ assert location, "location field could not be found for this host object"
+
+ # Trim the protocol identifier off deviceId
+ device = str( location.get( 'elementId' ) ).split(':')[1]
+ assert device, "elementId field could not be found for this host location object"
+
+ port = location.get( 'port' )
+ assert port, "port field could not be found for this host location object"
+
+ # Now check if this matches where they should be
+ if mac and device and port:
+ if str( port ) != "1":
+ main.log.error( "The attachment port is incorrect for " +
+ "host " + str( mac ) +
+ ". Expected: 1 Actual: " + str( port) )
+ hostAttachment = False
+ if device != mappings[ str( mac ) ]:
+ main.log.error( "The attachment device is incorrect for " +
+ "host " + str( mac ) +
+ ". Expected: " + mappings[ str( mac ) ] +
+ " Actual: " + device )
+ hostAttachment = False
+ else:
+ hostAttachment = False
+ except AssertionError:
+ main.log.exception( "Json object not as expected" )
+ main.log.error( repr( host ) )
+ hostAttachment = False
+ else:
+ main.log.error( "No hosts json output or \"Error\"" +
+ " in output. hosts = " +
+ repr( hosts[ controller ] ) )
+ if noHosts is False:
+ hostAttachment = True
+
+ # END CHECKING HOST ATTACHMENT POINTS
devicesResults = devicesResults and currentDevicesResult
portsResults = portsResults and currentPortsResult
linksResults = linksResults and currentLinksResult
hostsResults = hostsResults and currentHostsResult
+ hostAttachmentResults = hostAttachmentResults and hostAttachment
- # Compare json objects for hosts and dataplane clusters
+ # Compare json objects for hosts and dataplane clusters
- # hosts
- main.step( "Hosts view is consistent across all ONOS nodes" )
- 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.error( "hosts from ONOS" + controllerStr +
- " is inconsistent with ONOS1" )
- main.log.warn( repr( hosts[ controller ] ) )
- consistentHostsResult = main.FALSE
-
- else:
- main.log.error( "Error in getting ONOS hosts from ONOS" +
- controllerStr )
+ # hosts
+ main.step( "Hosts view is consistent across all ONOS nodes" )
+ 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.error( "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
- main.step( "Clusters view is consistent across all ONOS nodes" )
- 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.error( "clusters from ONOS" +
- controllerStr +
- " is inconsistent with ONOS1" )
- consistentClustersResult = main.FALSE
+ else:
+ main.log.error( "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.error( "Error in getting dataplane clusters " +
- "from ONOS" + controllerStr )
+ main.step( "Hosts information is correct" )
+ hostsResults = hostsResults and ipResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=hostsResults,
+ onpass="Host information is correct",
+ onfail="Host information is incorrect" )
+
+ main.step( "Host attachment points to the network" )
+ utilities.assert_equals(
+ expect=True,
+ actual=hostAttachmentResults,
+ onpass="Hosts are correctly attached to the network",
+ onfail="ONOS did not correctly attach hosts to the network" )
+
+ # Strongly connected clusters of devices
+ main.step( "Clusters view is consistent across all ONOS nodes" )
+ 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.error( "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
- main.step( "Topology view is correct and consistent across all " +
- "ONOS nodes" )
- try:
- numClusters = len( json.loads( clusters[ 0 ] ) )
- except ( ValueError, TypeError ):
- main.log.exception( "Error parsing clusters[0]: " +
- repr( clusters[0] ) )
- clusterResults = main.FALSE
- if numClusters == 1:
- clusterResults = main.TRUE
- 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 hostsResults and consistentHostsResult
- and consistentClustersResult and clusterResults
- and ipResult )
+ else:
+ main.log.error( "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" )
+
+ main.step( "There is only one SCC" )
+ # there should always only be one cluster
+ try:
+ numClusters = len( json.loads( clusters[ 0 ] ) )
+ except ( ValueError, TypeError ):
+ main.log.exception( "Error parsing clusters[0]: " +
+ repr( clusters[0] ) )
+ clusterResults = main.FALSE
+ if numClusters == 1:
+ clusterResults = main.TRUE
+ 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 hostsResults and consistentHostsResult
+ and consistentClustersResult and clusterResults
+ and ipResult and hostAttachmentResults )
topoResult = topoResult and int( count <= 2 )
note = "note it takes about " + str( int( cliTime ) ) + \
@@ -2249,9 +2403,27 @@
"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" )
+
+ main.step( "Device information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=devicesResults,
+ onpass="Device information is correct",
+ onfail="Device information is incorrect" )
+
+ main.step( "Port information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=portsResults,
+ onpass="Port information is correct",
+ onfail="Port information is incorrect" )
+
+ main.step( "Links are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=linksResults,
+ onpass="Link are correct",
+ onfail="Links are incorrect" )
# FIXME: move this to an ONOS state case
main.step( "Checking ONOS nodes" )
@@ -2746,6 +2918,7 @@
"""
Check for basic functionality with distributed primitives
"""
+ import json
# Make sure variables are defined/set
assert numControllers, "numControllers not defined"
assert main, "main not defined"
diff --git a/TestON/tests/HATestSanity/HATestSanity.params b/TestON/tests/HATestSanity/HATestSanity.params
index 9106d68..1e9d141 100644
--- a/TestON/tests/HATestSanity/HATestSanity.params
+++ b/TestON/tests/HATestSanity/HATestSanity.params
@@ -18,7 +18,7 @@
#CASE16: Install Distributed Primitives app
#CASE17: Check for basic functionality with distributed primitives
#1,2,8,3,4,5,14,16,17,[6],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13
- <testcases>1,2,8,3,4,5,14,16,17,[6],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+ <testcases>1,2,8,21,8,3,4,5,14,16,17,[6],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
<cellName>HA</cellName>
</ENV>
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
index 60c438e..306e547 100644
--- a/TestON/tests/HATestSanity/HATestSanity.py
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -5,7 +5,8 @@
List of test cases:
CASE1: Compile ONOS and push it to the test machines
-CASE2: Assign mastership to controllers
+CASE2: Assign devices to controllers
+CASE21: Assign mastership to controllers
CASE3: Assign intents
CASE4: Ping across added host intents
CASE5: Reading state of ONOS
@@ -241,7 +242,7 @@
def CASE2( self, main ):
"""
- Assign mastership to controllers
+ Assign devices to controllers
"""
import re
import time
@@ -258,12 +259,10 @@
assert ONOS6Port, "ONOS6Port not defined"
assert ONOS7Port, "ONOS7Port not defined"
- main.case( "Assigning Controllers" )
+ main.case( "Assigning devices to controllers" )
main.caseExplaination = "Assign switches to ONOS using 'ovs-vsctl' " +\
"and check that an ONOS node becomes the " +\
- "master of the device. Then manually assign" +\
- " mastership to specific ONOS nodes using" +\
- " 'device-role'"
+ "master of the device."
main.step( "Assign switches to controllers" )
# TODO: rewrite this function to take lists of ips and ports?
@@ -300,8 +299,31 @@
actual=mastershipCheck,
onpass="Switch mastership assigned correctly",
onfail="Switches not assigned correctly to controllers" )
- # FIXME: Check topo here
+ def CASE21( self, main ):
+ """
+ Assign mastership to controllers
+ """
+ import re
+ import time
+ assert numControllers, "numControllers not defined"
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ assert CLIs, "CLIs not defined"
+ assert nodes, "nodes not defined"
+ assert ONOS1Port, "ONOS1Port not defined"
+ assert ONOS2Port, "ONOS2Port not defined"
+ assert ONOS3Port, "ONOS3Port not defined"
+ assert ONOS4Port, "ONOS4Port not defined"
+ assert ONOS5Port, "ONOS5Port not defined"
+ assert ONOS6Port, "ONOS6Port not defined"
+ assert ONOS7Port, "ONOS7Port not defined"
+
+ main.case( "Assigning Controller roles for switches" )
+ main.caseExplaination = "Check that ONOS is connected to each " +\
+ "device. Then manually assign" +\
+ " mastership to specific ONOS nodes using" +\
+ " 'device-role'"
main.step( "Assign mastership of switches to specific controllers" )
# Manually assign mastership to the controller we want
roleCall = main.TRUE
@@ -346,6 +368,7 @@
else:
main.log.error( "You didn't write an else statement for " +
"switch s" + str( i ) )
+ roleCall = main.FALSE
# Assign switch
assert deviceId, "No device id for s" + str( i ) + " in ONOS"
# TODO: make this controller dynamic
@@ -386,11 +409,6 @@
onpass="Switches were successfully reassigned to designated " +
"controller",
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" )
def CASE3( self, main ):
"""
@@ -543,7 +561,6 @@
pass # intent submitted is in onos
else:
intentAddResult = False
- # FIXME: DEBUG
if intentAddResult:
intentStop = time.time()
else:
@@ -577,6 +594,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -593,11 +611,19 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ # Check all nodes
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -634,7 +660,7 @@
main.log.error( "Error in pushing host intents to ONOS" )
main.step( "Intent Anti-Entropy dispersion" )
- for i in range(80):
+ for i in range(100):
correct = True
main.log.info( "Submitted intents: " + str( sorted( intentIds ) ) )
for cli in CLIs:
@@ -657,6 +683,8 @@
break
if correct:
break
+ else:
+ time.sleep(1)
if not intentStop:
intentStop = time.time()
global gossipTime
@@ -708,6 +736,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -727,11 +756,19 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ # Check all nodes
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -810,14 +847,13 @@
main.step( "Check Intent state" )
installedCheck = False
- count = 0
- while not installedCheck and count < 40:
+ loopCount = 0
+ while not installedCheck and loopCount < 40:
installedCheck = True
# Print the intent states
intents = main.ONOScli1.intents()
intentStates = []
main.log.info( "%-6s%-15s%-15s" % ( 'Count', 'ID', 'State' ) )
- count = 0
# Iter through intents of a node
try:
for intent in json.loads( intents ):
@@ -836,7 +872,7 @@
( str( count ), str( i ), str( s ) ) )
if not installedCheck:
time.sleep( 1 )
- count += 1
+ loopCount += 1
utilities.assert_equals( expect=True, actual=installedCheck,
onpass="Intents are all INSTALLED",
onfail="Intents are not all in " +
@@ -876,6 +912,13 @@
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
# TODO: Check for a leader of these topics
+ # Check all nodes
+ if topicCheck:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
utilities.assert_equals( expect=main.TRUE, actual=topicCheck,
onpass="intent Partitions is in leaders",
onfail="Some topics were lost " )
@@ -937,6 +980,7 @@
( str( count ), str( i ), str( s ) ) )
leaders = main.ONOScli1.leaders()
try:
+ missing = False
if leaders:
parsedLeaders = json.loads( leaders )
main.log.warn( json.dumps( parsedLeaders,
@@ -956,11 +1000,18 @@
if topic not in ONOStopics:
main.log.error( "Error: " + topic +
" not in leaders" )
+ missing = True
else:
main.log.error( "leaders() returned None" )
except ( ValueError, TypeError ):
main.log.exception( "Error parsing leaders" )
main.log.error( repr( leaders ) )
+ if missing:
+ for node in CLIs:
+ response = node.leaders( jsonFormat=False)
+ main.log.warn( str( node.name ) + " leaders output: \n" +
+ str( response ) )
+
partitions = main.ONOScli1.partitions()
try:
if partitions :
@@ -1822,7 +1873,7 @@
for intent in before:
if intent not in after:
sameIntents = main.FALSE
- main.log.debug( "Intent is not currently in ONOS " +\
+ main.log.debug( "Intent is not currently in ONOS " +
"(at least in the same form):" )
main.log.debug( json.dumps( intent ) )
except ( ValueError, TypeError ):
@@ -1969,6 +2020,7 @@
portsResults = main.TRUE
linksResults = main.TRUE
hostsResults = main.TRUE
+ hostAttachmentResults = True
topoResult = main.FALSE
elapsed = 0
count = 0
@@ -2057,6 +2109,7 @@
elapsed = time.time() - startTime
cliTime = time.time() - cliStart
+ print "Elapsed time: " + str( elapsed )
print "CLI time: " + str( cliTime )
for controller in range( numControllers ):
@@ -2112,88 +2165,186 @@
" hosts exist in Mininet",
onfail="ONOS" + controllerStr +
" hosts don't match Mininet" )
+ # CHECKING HOST ATTACHMENT POINTS
+ hostAttachment = True
+ noHosts = False
+ # FIXME: topo-HA/obelisk specific mappings:
+ # key is mac and value is dpid
+ mappings = {}
+ for i in range( 1, 29 ): # hosts 1 through 28
+ # set up correct variables:
+ macId = "00:" * 5 + hex( i ).split( "0x" )[1].upper().zfill(2)
+ if i == 1:
+ deviceId = "1000".zfill(16)
+ elif i == 2:
+ deviceId = "2000".zfill(16)
+ elif i == 3:
+ deviceId = "3000".zfill(16)
+ elif i == 4:
+ deviceId = "3004".zfill(16)
+ elif i == 5:
+ deviceId = "5000".zfill(16)
+ elif i == 6:
+ deviceId = "6000".zfill(16)
+ elif i == 7:
+ deviceId = "6007".zfill(16)
+ elif i >= 8 and i <= 17:
+ dpid = '3' + str( i ).zfill( 3 )
+ deviceId = dpid.zfill(16)
+ elif i >= 18 and i <= 27:
+ dpid = '6' + str( i ).zfill( 3 )
+ deviceId = dpid.zfill(16)
+ elif i == 28:
+ deviceId = "2800".zfill(16)
+ mappings[ macId ] = deviceId
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ if hosts[ controller ] == []:
+ main.log.warn( "There are no hosts discovered" )
+ noHosts = True
+ else:
+ for host in hosts[ controller ]:
+ mac = None
+ location = None
+ device = None
+ port = None
+ try:
+ mac = host.get( 'mac' )
+ assert mac, "mac field could not be found for this host object"
+ location = host.get( 'location' )
+ assert location, "location field could not be found for this host object"
+
+ # Trim the protocol identifier off deviceId
+ device = str( location.get( 'elementId' ) ).split(':')[1]
+ assert device, "elementId field could not be found for this host location object"
+
+ port = location.get( 'port' )
+ assert port, "port field could not be found for this host location object"
+
+ # Now check if this matches where they should be
+ if mac and device and port:
+ if str( port ) != "1":
+ main.log.error( "The attachment port is incorrect for " +
+ "host " + str( mac ) +
+ ". Expected: 1 Actual: " + str( port) )
+ hostAttachment = False
+ if device != mappings[ str( mac ) ]:
+ main.log.error( "The attachment device is incorrect for " +
+ "host " + str( mac ) +
+ ". Expected: " + mappings[ str( mac ) ] +
+ " Actual: " + device )
+ hostAttachment = False
+ else:
+ hostAttachment = False
+ except AssertionError:
+ main.log.exception( "Json object not as expected" )
+ main.log.error( repr( host ) )
+ hostAttachment = False
+ else:
+ main.log.error( "No hosts json output or \"Error\"" +
+ " in output. hosts = " +
+ repr( hosts[ controller ] ) )
+ if noHosts is False:
+ hostAttachment = True
+
+ # END CHECKING HOST ATTACHMENT POINTS
devicesResults = devicesResults and currentDevicesResult
portsResults = portsResults and currentPortsResult
linksResults = linksResults and currentLinksResult
hostsResults = hostsResults and currentHostsResult
+ hostAttachmentResults = hostAttachmentResults and hostAttachment
- # Compare json objects for hosts and dataplane clusters
+ # Compare json objects for hosts and dataplane clusters
- # hosts
- main.step( "Hosts view is consistent across all ONOS nodes" )
- 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.error( "hosts from ONOS" + controllerStr +
- " is inconsistent with ONOS1" )
- main.log.warn( repr( hosts[ controller ] ) )
- consistentHostsResult = main.FALSE
-
- else:
- main.log.error( "Error in getting ONOS hosts from ONOS" +
- controllerStr )
+ # hosts
+ main.step( "Hosts view is consistent across all ONOS nodes" )
+ 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.error( "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
- main.step( "Clusters view is consistent across all ONOS nodes" )
- 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.error( "clusters from ONOS" +
- controllerStr +
- " is inconsistent with ONOS1" )
- consistentClustersResult = main.FALSE
+ else:
+ main.log.error( "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.error( "Error in getting dataplane clusters " +
- "from ONOS" + controllerStr )
+ main.step( "Hosts information is correct" )
+ hostsResults = hostsResults and ipResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=hostsResults,
+ onpass="Host information is correct",
+ onfail="Host information is incorrect" )
+
+ main.step( "Host attachment points to the network" )
+ utilities.assert_equals(
+ expect=True,
+ actual=hostAttachmentResults,
+ onpass="Hosts are correctly attached to the network",
+ onfail="ONOS did not correctly attach hosts to the network" )
+
+ # Strongly connected clusters of devices
+ main.step( "Clusters view is consistent across all ONOS nodes" )
+ 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.error( "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
- main.step( "Topology view is correct and consistent across all " +
- "ONOS nodes" )
- try:
- numClusters = len( json.loads( clusters[ 0 ] ) )
- except ( ValueError, TypeError ):
- main.log.exception( "Error parsing clusters[0]: " +
- repr( clusters[0] ) )
- clusterResults = main.FALSE
- if numClusters == 1:
- clusterResults = main.TRUE
- 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 hostsResults and consistentHostsResult
- and consistentClustersResult and clusterResults
- and ipResult )
+ else:
+ main.log.error( "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" )
+
+ main.step( "There is only one SCC" )
+ # there should always only be one cluster
+ try:
+ numClusters = len( json.loads( clusters[ 0 ] ) )
+ except ( ValueError, TypeError ):
+ main.log.exception( "Error parsing clusters[0]: " +
+ repr( clusters[0] ) )
+ clusterResults = main.FALSE
+ if numClusters == 1:
+ clusterResults = main.TRUE
+ 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 hostsResults and consistentHostsResult
+ and consistentClustersResult and clusterResults
+ and ipResult and hostAttachmentResults )
topoResult = topoResult and int( count <= 2 )
note = "note it takes about " + str( int( cliTime ) ) + \
@@ -2203,9 +2354,27 @@
"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" )
+
+ main.step( "Device information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=devicesResults,
+ onpass="Device information is correct",
+ onfail="Device information is incorrect" )
+
+ main.step( "Port information is correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=portsResults,
+ onpass="Port information is correct",
+ onfail="Port information is incorrect" )
+
+ main.step( "Links are correct" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=linksResults,
+ onpass="Link are correct",
+ onfail="Links are incorrect" )
# FIXME: move this to an ONOS state case
main.step( "Checking ONOS nodes" )
@@ -2700,6 +2869,7 @@
"""
Check for basic functionality with distributed primitives
"""
+ import json
# Make sure variables are defined/set
assert numControllers, "numControllers not defined"
assert main, "main not defined"
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
index 8f3c604..f77ca3d 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
@@ -4,11 +4,12 @@
List of test cases:
CASE1: Compile ONOS and push it to the test machines
-CASE2: Assign mastership to controllers
+CASE2: Assign devices to controllers
+CASE21: Assign mastership to controllers
CASE3: Assign intents
CASE4: Ping across added host intents
CASE5: Reading state of ONOS
-CASE6: The Failure case. Since this is the Sanity test, we do nothing.
+CASE6: The Failure case.
CASE7: Check state after control plane failure
CASE8: Compare topo
CASE9: Link s3-s28 down
@@ -211,9 +212,10 @@
def CASE2( self, main ):
"""
- Assign mastership to controllers
+ Assign devices to controllers
"""
import re
+ import time
assert numControllers, "numControllers not defined"
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
@@ -225,7 +227,7 @@
assert ONOS6Port, "ONOS6Port not defined"
assert ONOS7Port, "ONOS7Port not defined"
- main.case( "Assigning Controllers" )
+ main.case( "Assigning devices to controllers" )
main.caseExplaination = "Assign switches to ONOS using 'ovs-vsctl' " +\
"and check that an ONOS node becomes the " +\
"master of the device."
@@ -255,6 +257,30 @@
onpass="Switch mastership assigned correctly",
onfail="Switches not assigned correctly to controllers" )
+ def CASE21( self, main ):
+ """
+ Assign mastership to controllers
+ """
+ import re
+ import time
+ assert numControllers, "numControllers not defined"
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ assert CLIs, "CLIs not defined"
+ assert nodes, "nodes not defined"
+ assert ONOS1Port, "ONOS1Port not defined"
+ assert ONOS2Port, "ONOS2Port not defined"
+ assert ONOS3Port, "ONOS3Port not defined"
+ assert ONOS4Port, "ONOS4Port not defined"
+ assert ONOS5Port, "ONOS5Port not defined"
+ assert ONOS6Port, "ONOS6Port not defined"
+ assert ONOS7Port, "ONOS7Port not defined"
+
+ main.case( "Assigning Controller roles for switches" )
+ main.caseExplaination = "Check that ONOS is connected to each " +\
+ "device. Then manually assign" +\
+ " mastership to specific ONOS nodes using" +\
+ " 'device-role'"
main.step( "Assign mastership of switches to specific controllers" )
roleCall = main.TRUE
roleCheck = main.TRUE
@@ -318,11 +344,6 @@
onpass="Switches were successfully reassigned to designated " +
"controller",
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" )
def CASE3( self, main ):
"""
@@ -1268,7 +1289,7 @@
for intent in before:
if intent not in after:
sameIntents = main.FALSE
- main.log.debug( "Intent is not currently in ONOS " +\
+ main.log.debug( "Intent is not currently in ONOS " +
"(at least in the same form):" )
main.log.debug( json.dumps( intent ) )
except ( ValueError, TypeError ):
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.params b/TestON/tests/IntentEventTP/IntentEventTP.params
index ddda23e..0e6bbfb 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.params
+++ b/TestON/tests/IntentEventTP/IntentEventTP.params
@@ -14,40 +14,40 @@
<availableNodes>7</availableNodes>
<GIT>
- <autopull>on</autopull>
+ <autopull>off</autopull>
<checkout>master</checkout>
</GIT>
<CTRL>
<USER>admin</USER>
- <ip1>10.128.5.51</ip1>
+ <ip1>OC1</ip1>
<port1>6633</port1>
- <ip2>10.128.5.52</ip2>
+ <ip2>OC2</ip2>
<port2>6633</port2>
- <ip3>10.128.5.53</ip3>
+ <ip3>OC3</ip3>
<port3>6633</port3>
- <ip4>10.128.5.54</ip4>
+ <ip4>OC4</ip4>
<port4>6633</port4>
- <ip5>10.128.5.55</ip5>
+ <ip5>OC5</ip5>
<port5>6633</port5>
- <ip6>10.128.5.56</ip6>
+ <ip6>OC6</ip6>
<port6>6633</port6>
- <ip7>10.128.5.57</ip7>
+ <ip7>OC7</ip7>
<port7>6633</port7>
</CTRL>
- <MN><ip1>10.128.5.50</ip1></MN>
+ <MN><ip1>OCN</ip1></MN>
<BENCH>
<user>admin</user>
- <ip1>10.128.5.50</ip1>
+ <ip1>OCN</ip1>
</BENCH>
<TEST>
@@ -59,7 +59,7 @@
<numKeys>40000</numKeys>
<cyclePeriod>1000</cyclePeriod>
<neighbors>0,a</neighbors> #a == all nodes (-1)
- <flowRuleBUEnabled>false</flowRuleBUEnabled>
+ <flowRuleBUEnabled>true</flowRuleBUEnabled>
</TEST>
<METRICS>
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.py b/TestON/tests/IntentEventTP/IntentEventTP.py
index 99332f7..6134ed3 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.py
+++ b/TestON/tests/IntentEventTP/IntentEventTP.py
@@ -59,10 +59,11 @@
clusterCount = int(scale[0])
#Populate ONOSIp with ips from params
- for i in range(1, maxNodes + 1):
- ipString = 'ip' + str(i)
- ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
-
+ ONOSIp = [0]
+ ONOSIp.extend(main.ONOSbench.getOnosIps())
+ MN1Ip = ONOSIp[len(ONOSIp) -1]
+ BENCHIp = ONOSIp[len(ONOSIp) -2]
+
#mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
if skipMvn != "yes":
mvnResult = main.ONOSbench.cleanInstall()
@@ -159,7 +160,7 @@
time.sleep(20)
- while True:
+ for i in range(5):
main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount """ + str(clusterCount*10) + """ " """)
main.ONOSbench.handle.expect(":~")
main.ONOSbench.handle.sendline("""onos $OC1 "cfg get org.onosproject.provider.nil.NullProviders" """)
@@ -172,7 +173,7 @@
main.log.info("cfg set failure, retrying")
main.log.info("before" + main.ONOSbench.handle.before)
- while True:
+ for i in range(5):
main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """)
main.ONOSbench.handle.expect(":~")
main.ONOSbench.handle.sendline("""onos $OC1 "cfg get org.onosproject.provider.nil.NullProviders" """)
@@ -222,8 +223,7 @@
break
lastOutput = clusterCheck
time.sleep(5)
- main.ONOSbench.onosErrorLog(ONOSIp[1])
-
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
def CASE2( self, main ):
import time
import json
@@ -300,6 +300,7 @@
x = 0
while True:
main.ONOSbench.handle.sendline(cmd)
+ time.sleep(6)
main.ONOSbench.handle.expect(":~")
raw = main.ONOSbench.handle.before
if "OVERALL=" in raw:
@@ -353,6 +354,5 @@
resultsDB.close()
- main.ONOSbench.onosErrorLog(ONOSIp[1])
-
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.topo b/TestON/tests/IntentEventTP/IntentEventTP.topo
index 763a4d6..d82f3fd 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.topo
+++ b/TestON/tests/IntentEventTP/IntentEventTP.topo
@@ -3,7 +3,7 @@
<COMPONENT>
<ONOSbench>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
@@ -12,7 +12,7 @@
</ONOSbench>
<ONOS1cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -21,7 +21,7 @@
</ONOS1cli>
<ONOS2cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,7 +30,7 @@
</ONOS2cli>
<ONOS3cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -39,7 +39,7 @@
</ONOS3cli>
<ONOS4cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -48,7 +48,7 @@
</ONOS4cli>
<ONOS5cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -57,7 +57,7 @@
</ONOS5cli>
<ONOS6cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -66,7 +66,7 @@
</ONOS6cli>
<ONOS7cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -75,7 +75,7 @@
</ONOS7cli>
<ONOS1>
- <host>10.128.5.51</host>
+ <host>OC1</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -84,7 +84,7 @@
</ONOS1>
<ONOS2>
- <host>10.128.5.52</host>
+ <host>OC2</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -93,7 +93,7 @@
</ONOS2>
<ONOS3>
- <host>10.128.5.53</host>
+ <host>OC3</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -102,7 +102,7 @@
</ONOS3>
<ONOS4>
- <host>10.128.5.54</host>
+ <host>OC4</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -112,7 +112,7 @@
<ONOS5>
- <host>10.128.5.55</host>
+ <host>OC5</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -121,7 +121,7 @@
</ONOS5>
<ONOS6>
- <host>10.128.5.56</host>
+ <host>OC6</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -130,7 +130,7 @@
</ONOS6>
<ONOS7>
- <host>10.128.5.57</host>
+ <host>OC7</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
diff --git a/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.params b/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.params
index 2b76662..8aad63b 100644
--- a/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.params
+++ b/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.params
@@ -21,43 +21,43 @@
</TEST>
<GIT>
- <autopull>on</autopull>
+ <autopull>off</autopull>
<checkout>master</checkout>
</GIT>
<CTRL>
<USER>admin</USER>
- <ip1>10.254.1.201</ip1>
+ <ip1>OC1</ip1>
<port1>6633</port1>
- <ip2>10.254.1.202</ip2>
+ <ip2>OC2</ip2>
<port2>6633</port2>
- <ip3>10.254.1.203</ip3>
+ <ip3>OC3</ip3>
<port3>6633</port3>
- <ip4>10.254.1.204</ip4>
+ <ip4>OC4</ip4>
<port4>6633</port4>
- <ip5>10.254.1.205</ip5>
+ <ip5>OC5</ip5>
<port5>6633</port5>
- <ip6>10.254.1.206</ip6>
+ <ip6>OC6</ip6>
<port6>6633</port6>
- <ip7>10.254.1.207</ip7>
+ <ip7>OC7</ip7>
<port7>6633</port7>
</CTRL>
<MN>
- <ip1>10.254.1.200</ip1>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
<user>admin</user>
- <ip1>10.254.1.200</ip1>
+ <ip1>OCN</ip1>
</BENCH>
<JSON>
diff --git a/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.py b/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.py
index 83dac2a..a3833d4 100644
--- a/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.py
+++ b/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.py
@@ -50,10 +50,11 @@
clusterCount = int(scale[0])
#Populate ONOSIp with ips from params
- for i in range(1, maxNodes + 1):
- ipString = 'ip' + str(i)
- ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
-
+ ONOSIp = [0]
+ ONOSIp.extend(main.ONOSbench.getOnosIps())
+ MN1Ip = ONOSIps[len(ONOSIp)-1]
+ BENCHIp = ONOSIps[len(ONOSIp)-2]
+
#mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
if skipMvn != "yes":
mvnResult = main.ONOSbench.cleanInstall()
@@ -128,27 +129,40 @@
time.sleep(30)
- main.ONOSbench.handle.sendline("""onos $OC1 "cfg setorg.onosproject.provider.nil.NullProviders enabled true" """)
- main.ONOSbench.handle.expect(":~")
- print main.ONOSbench.handle.before
- main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount """ + str(switchCount) + """ " """)
- main.ONOSbench.handle.expect(":~")
- print main.ONOSbench.handle.before
- main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """)
- main.ONOSbench.handle.expect(":~")
- print main.ONOSbench.handle.before
- main.ONOSbench.handle.sendline("""onos $OC1 "null-simulation start" """)
- main.ONOSbench.handle.expect(":~")
- print main.ONOSbench.handle.before
- main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """)
- main.ONOSbench.handle.expect(":~")
- print main.ONOSbench.handle.before
+ for i in range(5):
+ main.ONOSbench.handle.sendline("""onos $OC1 "cfg setorg.onosproject.provider.nil.NullProviders enabled true" """)
+ main.ONOSbench.handle.expect(":~")
+ print main.ONOSbench.handle.before
+ main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount """ + str(switchCount) + """ " """)
+ main.ONOSbench.handle.expect(":~")
+ print main.ONOSbench.handle.before
+ main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """)
+ main.ONOSbench.handle.expect(":~")
+ print main.ONOSbench.handle.before
+ main.ONOSbench.handle.sendline("""onos $OC1 "null-simulation start" """)
+ main.ONOSbench.handle.expect(":~")
+ print main.ONOSbench.handle.before
+ main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """)
+ main.ONOSbench.handle.expect(":~")
+ print main.ONOSbench.handle.before
+
+ main.ONOSbench.handle.sendline("onos $OC1 summary")
+ main.ONOSbench.handle.expect(":~")
+ check = main.ONOSbench.handle.before
+ main.log.info(check)
+ if "SSC(s)=1," in check:
+ break
+
+
+
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
def CASE2( self, main ):
import time
import numpy
+ testStatus = "pass"
sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ])
warmUp = int(main.params[ 'TEST' ][ 'warmUp' ])
intentsList = (main.params[ 'TEST' ][ 'intents' ]).split(",")
@@ -157,10 +171,9 @@
for i in range(0,len(intentsList)):
intentsList[i] = int(intentsList[i])
- if debug == "True":
- debug = True
- else:
- debug = False
+ ######################
+ debug = True
+ ######################
linkCount = 0
for i in range(0,10):
@@ -173,13 +186,20 @@
time.sleep(2)
links = "--"
- while "=null:" not in links:
+ for i in range(8):
if debug: main.log.info("top of loop")
main.ONOSbench.handle.sendline("onos $OC1 links")
main.ONOSbench.handle.expect(":~")
links = main.ONOSbench.handle.before
+ if "=null:" in links:
+ break
if debug: main.log.info(str(links))
- time.sleep(1)
+ if i > 3:
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], "d")
+ if i == 7:
+ main.log.error("link data missing")
+ time.sleep(3)
+
links = links.splitlines()
templinks = links
@@ -233,9 +253,21 @@
if "withdraw" in line:
withdrawn.append(int(line.split(" ")[5]))
+ for line in myRawResult:
+ if "Failure:" in line:
+ main.log.error("INTENT TEST FAILURE, ABORTING TESTCASE")
+ testStatus = "fail"
+ if testStatus == "fail":
+ break
+
print("installed: " + str(installed))
print("withraw: " + str(withdrawn) + "\n")
+ if withdrawn[len(withdrawn) -1] > 1000 or installed[len(installed) -1] > 1000:
+ main.log.info("ABNORMAL VALUE, CHECKING LOG")
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
+ if testStatus == "fail":
+ break
main.log.report("----------------------------------------------------")
main.log.report("Scale: " + str(clusterCount) + "\tIntent batch size: " + str(intentSize))
main.log.report("Data samples: " + str(sampleSize) + "\tWarm up tests: " + str(warmUp))
@@ -255,3 +287,6 @@
resultsDB = open("IntentInstallWithdrawLatDB", "a")
resultsDB.write(resultString)
resultsDB.close()
+
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
+ time.sleep(20)
diff --git a/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.topo b/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.topo
index 0e45e0f..d82f3fd 100644
--- a/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.topo
+++ b/TestON/tests/IntentInstallWithdrawLat/IntentInstallWithdrawLat.topo
@@ -3,7 +3,7 @@
<COMPONENT>
<ONOSbench>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
@@ -12,7 +12,7 @@
</ONOSbench>
<ONOS1cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -21,7 +21,7 @@
</ONOS1cli>
<ONOS2cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,7 +30,7 @@
</ONOS2cli>
<ONOS3cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -39,7 +39,7 @@
</ONOS3cli>
<ONOS4cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -48,7 +48,7 @@
</ONOS4cli>
<ONOS5cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -57,7 +57,7 @@
</ONOS5cli>
<ONOS6cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -66,7 +66,7 @@
</ONOS6cli>
<ONOS7cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -75,7 +75,7 @@
</ONOS7cli>
<ONOS1>
- <host>10.254.1.201</host>
+ <host>OC1</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -84,7 +84,7 @@
</ONOS1>
<ONOS2>
- <host>10.254.1.202</host>
+ <host>OC2</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -93,7 +93,7 @@
</ONOS2>
<ONOS3>
- <host>10.254.1.203</host>
+ <host>OC3</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -102,7 +102,7 @@
</ONOS3>
<ONOS4>
- <host>10.254.1.204</host>
+ <host>OC4</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -112,7 +112,7 @@
<ONOS5>
- <host>10.254.1.205</host>
+ <host>OC5</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -121,7 +121,7 @@
</ONOS5>
<ONOS6>
- <host>10.254.1.206</host>
+ <host>OC6</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -130,7 +130,7 @@
</ONOS6>
<ONOS7>
- <host>10.254.1.207</host>
+ <host>OC7</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -141,6 +141,4 @@
</COMPONENT>
</TOPOLOGY>
-
-
-
+
diff --git a/TestON/tests/IntentRerouteLat/IntentRerouteLat.params b/TestON/tests/IntentRerouteLat/IntentRerouteLat.params
index 8e7a6a4..2e43679 100644
--- a/TestON/tests/IntentRerouteLat/IntentRerouteLat.params
+++ b/TestON/tests/IntentRerouteLat/IntentRerouteLat.params
@@ -13,7 +13,7 @@
<TEST>
<skipCleanInstall>yes</skipCleanInstall>
<warmUp>5</warmUp>
- <sampleSize>10</sampleSize>
+ <sampleSize>20</sampleSize>
<wait></wait>
<intents>1,100,1000</intents> #list format, will be split on ','
<debug>True</debug>
@@ -34,43 +34,43 @@
</METRICS>
<GIT>
- <autopull>on</autopull>
+ <autopull>off</autopull>
<checkout>master</checkout>
</GIT>
<CTRL>
<USER>admin</USER>
- <ip1>10.254.1.201</ip1>
+ <ip1>OC1</ip1>
<port1>6633</port1>
- <ip2>10.254.1.202</ip2>
+ <ip2>OC2</ip2>
<port2>6633</port2>
- <ip3>10.254.1.203</ip3>
+ <ip3>OC3</ip3>
<port3>6633</port3>
- <ip4>10.254.1.204</ip4>
+ <ip4>OC4</ip4>
<port4>6633</port4>
- <ip5>10.254.1.205</ip5>
+ <ip5>OC5</ip5>
<port5>6633</port5>
- <ip6>10.254.1.206</ip6>
+ <ip6>OC6</ip6>
<port6>6633</port6>
- <ip7>10.254.1.207</ip7>
+ <ip7>OC7</ip7>
<port7>6633</port7>
</CTRL>
<MN>
- <ip1>10.254.1.200</ip1>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
<user>admin</user>
- <ip1>10.254.1.200</ip1>
+ <ip1>OCN</ip1>
</BENCH>
<JSON>
diff --git a/TestON/tests/IntentRerouteLat/IntentRerouteLat.py b/TestON/tests/IntentRerouteLat/IntentRerouteLat.py
index f824a5c..97ac978 100644
--- a/TestON/tests/IntentRerouteLat/IntentRerouteLat.py
+++ b/TestON/tests/IntentRerouteLat/IntentRerouteLat.py
@@ -28,9 +28,7 @@
gitPull = main.params[ 'GIT' ][ 'autopull' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
Apps = main.params[ 'ENV' ][ 'cellApps' ]
- BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- MN1Ip = main.params[ 'MN' ][ 'ip1' ]
maxNodes = int(main.params[ 'availableNodes' ])
skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
@@ -49,10 +47,12 @@
clusterCount = int(scale[0])
#Populate ONOSIp with ips from params
- for i in range(1, maxNodes + 1):
- ipString = 'ip' + str(i)
- ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
-
+ ONOSIp = [0]
+ ONOSIp.extend(main.ONOSbench.getOnosIps())
+ MN1Ip = ONOSIp[len(ONOSIp)-1]
+ BENCHIp = ONOSIp[len(ONOSIp)-2]
+
+ print("-----------------" + str(ONOSIp))
#mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
if skipMvn != "yes":
mvnResult = main.ONOSbench.cleanInstall()
@@ -96,6 +96,12 @@
cellIp = []
for node in range (1, clusterCount + 1):
cellIp.append(ONOSIp[node])
+
+ print "Cell ip" + str(cellIp)
+ print cellName
+ print MN1Ip
+ print Apps
+
main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
@@ -176,6 +182,7 @@
break
index += 1
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
def CASE2( self, main ):
@@ -250,6 +257,7 @@
cmd = """onos $OC1 null-link "null:0000000000000004/1 null:0000000000000003/2 down" """
if debug: main.log.info("COMMAND: " + str(cmd))
main.ONOSbench.handle.sendline(cmd)
+ main.ONOSbench.handle.expect(":~")
cmd = "onos-ssh $OC1 cat /opt/onos/log/karaf.log | grep TopologyManager| tail -1"
for i in range(0,10):
@@ -344,11 +352,17 @@
if debug: main.log.info("last node: " + str(myResult[run-warmUp][1]))
cmd = """ onos $OC1 null-link "null:0000000000000004/1 null:0000000000000003/2 up" """
-
- #wait for intent withdraw
if debug: main.log.info(cmd)
main.ONOSbench.handle.sendline(cmd)
main.ONOSbench.handle.expect(":~")
+
+
+
+ #wait for intent withdraw
+ main.ONOSbench.handle.sendline(withdrawCmd)
+ main.log.info(withdrawCmd)
+ main.ONOSbench.handle.expect(":~")
+ if debug: main.log.info(main.ONOSbench.handle.before)
main.ONOSbench.handle.sendline("onos $OC1 intents|grep WITHDRAWN|wc -l")
main.ONOSbench.handle.expect(":~")
intentWithdrawCheck = main.ONOSbench.handle.before
@@ -408,3 +422,5 @@
resultsDB.write(str(stdDev) + "\n")
resultsDB.close()
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
+
diff --git a/TestON/tests/IntentRerouteLat/IntentRerouteLat.topo b/TestON/tests/IntentRerouteLat/IntentRerouteLat.topo
index 0e45e0f..d82f3fd 100644
--- a/TestON/tests/IntentRerouteLat/IntentRerouteLat.topo
+++ b/TestON/tests/IntentRerouteLat/IntentRerouteLat.topo
@@ -3,7 +3,7 @@
<COMPONENT>
<ONOSbench>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
@@ -12,7 +12,7 @@
</ONOSbench>
<ONOS1cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -21,7 +21,7 @@
</ONOS1cli>
<ONOS2cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,7 +30,7 @@
</ONOS2cli>
<ONOS3cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -39,7 +39,7 @@
</ONOS3cli>
<ONOS4cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -48,7 +48,7 @@
</ONOS4cli>
<ONOS5cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -57,7 +57,7 @@
</ONOS5cli>
<ONOS6cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -66,7 +66,7 @@
</ONOS6cli>
<ONOS7cli>
- <host>10.254.1.200</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -75,7 +75,7 @@
</ONOS7cli>
<ONOS1>
- <host>10.254.1.201</host>
+ <host>OC1</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -84,7 +84,7 @@
</ONOS1>
<ONOS2>
- <host>10.254.1.202</host>
+ <host>OC2</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -93,7 +93,7 @@
</ONOS2>
<ONOS3>
- <host>10.254.1.203</host>
+ <host>OC3</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -102,7 +102,7 @@
</ONOS3>
<ONOS4>
- <host>10.254.1.204</host>
+ <host>OC4</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -112,7 +112,7 @@
<ONOS5>
- <host>10.254.1.205</host>
+ <host>OC5</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -121,7 +121,7 @@
</ONOS5>
<ONOS6>
- <host>10.254.1.206</host>
+ <host>OC6</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -130,7 +130,7 @@
</ONOS6>
<ONOS7>
- <host>10.254.1.207</host>
+ <host>OC7</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -141,6 +141,4 @@
</COMPONENT>
</TOPOLOGY>
-
-
-
+
diff --git a/TestON/tests/IpOptical/IpOptical.params b/TestON/tests/IpOptical/IpOptical.params
new file mode 100755
index 0000000..62e44a8
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.params
@@ -0,0 +1,41 @@
+<PARAMS>
+ #20,21,22,25,10,23,24
+ <testcases>20,21,22,10,25,23,24</testcases>
+ #Environment variables
+ <ENV>
+ <cellName>driver_test</cellName>
+ </ENV>
+
+ <CTRL>
+ <ip1>10.128.20.11</ip1>
+ <port1>6633</port1>
+ </CTRL>
+
+ <PING>
+ <source1>h8</source1>
+ <source2>h9</source2>
+ <source3>h10</source3>
+ <source4>h11</source4>
+ <source5>h12</source5>
+ <source6>h13</source6>
+ <source7>h14</source7>
+ <source8>h15</source8>
+ <source9>h16</source9>
+ <source10>h17</source10>
+ <target1>10.0.0.18</target1>
+ <target2>10.0.0.19</target2>
+ <target3>10.0.0.20</target3>
+ <target4>10.0.0.21</target4>
+ <target5>10.0.0.22</target5>
+ <target6>10.0.0.23</target6>
+ <target7>10.0.0.24</target7>
+ <target8>10.0.0.25</target8>
+ <target9>10.0.0.26</target9>
+ <target10>10.0.0.27</target10>
+ </PING>
+
+ <timers>
+ <LinkDiscovery>5</LinkDiscovery>
+ <SwitchDiscovery>15</SwitchDiscovery>
+ </timers>
+</PARAMS>
diff --git a/TestON/tests/IpOptical/IpOptical.py b/TestON/tests/IpOptical/IpOptical.py
new file mode 100644
index 0000000..c4a4eb6
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.py
@@ -0,0 +1,630 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+# import sys
+# import os
+# import re
+import json
+
+time.sleep( 1 )
+
+class IpOptical:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import time
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-log
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.case( "Setting up test environment" )
+ main.log.report(
+ "This testcase is testing setting up test environment" )
+ main.log.report( "__________________________________" )
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ main.step( "Removing raft logs before a clen installation of ONOS" )
+ main.ONOSbench.onosRemoveRaftLogs()
+
+ main.step( "Git checkout and get version" )
+ #main.ONOSbench.gitCheckout( "master" )
+ gitPullResult = main.ONOSbench.gitPull()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ main.ONOSbench.getVersion( report=True )
+
+ if gitPullResult == 100:
+ main.step( "Using mvn clean & install" )
+ main.ONOSbench.cleanInstall()
+ elif gitPullResult == 0:
+ main.log.report(
+ "Git Pull Failed, look into logs for detailed reason" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "Uninstalling ONOS package" )
+ ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+ onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+ if onosUninstallResult:
+ main.log.report( "Uninstalling ONOS package successful" )
+ else:
+ main.log.report( "Uninstalled ONOS package unsucessful" )
+ time.sleep( 5 )
+ main.step( "Installing ONOS package" )
+ onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup()
+ if onos1Isup == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+ main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ main.step( "Starting Mininet CLI..." )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ import time
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Disconnecting mininet and restarting ONOS" )
+
+ main.step( "Disconnecting mininet and restarting ONOS" )
+ step1Result = main.TRUE
+ mininetDisconnect = main.Mininet1.disconnect()
+ print "mininetDisconnect = ", mininetDisconnect
+ step1Result = mininetDisconnect
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Mininet disconnect successfully",
+ onfail="Mininet failed to disconnect")
+ """
+ main.step( "Removing raft logs before a clean installation of ONOS" )
+ step2Result = main.TRUE
+ removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+ step2Result = removeRaftLogsResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Raft logs removed successfully",
+ onfail="Failed to remove raft logs")
+ """
+ main.step( "Applying cell variable to environment" )
+ step3Result = main.TRUE
+ setCellResult = main.ONOSbench.setCell( cellName )
+ verifyCellResult = main.ONOSbench.verifyCell()
+ step3Result = setCellResult and verifyCellResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Cell applied successfully",
+ onfail="Failed to apply cell")
+
+ main.step( "Uninstalling ONOS package" )
+ step4Result = main.TRUE
+ ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+ onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+ step4Result = onosUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully uninstalled ONOS",
+ onfail="Failed to uninstall ONOS")
+
+ time.sleep( 5 )
+ main.step( "Installing ONOS package" )
+ step5Result = main.TRUE
+ onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+ step5Result = onosInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step5Result,
+ onpass="Successfully installed ONOS",
+ onfail="Failed to install ONOS")
+
+ onos1Isup = main.ONOSbench.isup()
+ if onos1Isup == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up" )
+
+ main.step( "Starting ONOS service" )
+ step6Result = main.TRUE
+ startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ step6Result = startResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step6Result,
+ onpass="Successfully started ONOS",
+ onfail="Failed to start ONOS")
+
+ main.step( "Starting ONOS cli" )
+ step7Result = main.TRUE
+ cliResult = main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ step7Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step7Result,
+ onpass="Successfully started ONOS cli",
+ onfail="Failed to start ONOS cli")
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
+ which spawns packet optical topology and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ import time
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+
+ main.step( "Activate optical app" )
+ step1Result = main.TRUE
+ activateOpticalResult = main.ONOS2.activateApp( "org.onosproject.optical" )
+ step1Result = activateOpticalResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully activated optical app",
+ onfail="Failed to activate optical app")
+
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+
+ main.step( "Starting mininet and LINC-OE" )
+ step2Result = main.TRUE
+ time.sleep( 10 )
+ opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+ step2Result = opticalMnScript
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Started the topology successfully ",
+ onfail="Failed to start the topology")
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 10 optical switches(ROADM's) and
+ 6 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 10,
+ packetLayerSWCount variable = 6, hostCount=6 and
+ links=46.
+ All this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ import time
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+
+ main.step( "Starts new ONOS cli" )
+ step1Result = main.TRUE
+ cliResult = main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+ [ 'ip1' ] )
+ step1Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully starts a new cli",
+ onfail="Failed to start new cli" )
+
+ main.step( "Compare topology" )
+ step2Result = main.TRUE
+ devicesResult = main.ONOS3.devices( jsonFormat=False )
+ print "devices_result :\n", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 10:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+ if packetLayerSWCount == 6:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ # sleeps for sometime so the state of the switches will be active
+ time.sleep( 30 )
+ print "_________________________________"
+ linksResult = main.ONOS3.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+ linkActiveCount = linksResult.count("state=ACTIVE")
+ main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+ if linkActiveCount == 46:
+ linkActiveResult = main.TRUE
+ main.log.info(
+ "Number of links in ACTIVE state are correct")
+ else:
+ linkActiveResult = main.FALSE
+ main.log.info(
+ "Number of links in ACTIVE state are wrong")
+ step2Result = opticalSWResult and packetSWResult and \
+ linkActiveResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfully loaded packet optical topology",
+ onfail="Failed to load packet optical topology" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Install point intents between 2 packet layer device and " +
+ "ping the hosts" )
+
+ main.step( "Adding point intents" )
+ checkFlowResult = main.TRUE
+ step1Result = main.TRUE
+ main.pIntentsId = []
+ pIntent1 = main.ONOS3.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0005/1" )
+ time.sleep( 10 )
+ pIntent2 = main.ONOS3.addPointIntent(
+ "of:0000ffffffff0005/1",
+ "of:0000ffffffff0001/1" )
+ main.pIntentsId.append( pIntent1 )
+ main.pIntentsId.append( pIntent2 )
+ time.sleep( 10 )
+ main.log.info( "Checking intents state")
+ checkStateResult = main.ONOS3.checkIntentState(
+ intentsId = main.pIntentsId )
+ time.sleep( 10 )
+ main.log.info( "Checking flows state")
+ checkFlowResult = main.ONOS3.checkFlowsState()
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 10 )
+ main.log.info( "Checking intents state one more time")
+ checkStateResult = main.ONOS3.checkIntentState(
+ intentsId = main.pIntentsId )
+ step1Result = checkStateResult and checkFlowResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully added point intents",
+ onfail="Failed to add point intents")
+
+ print main.ONOS3.intents()
+
+ main.step( "Ping h1 and h5" )
+ step2Result = main.TRUE
+ main.log.info( "\n\nh1 is Pinging h5" )
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step2Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ LINC uses its own switch IDs. You can use the following
+ command on the LINC console to find the mapping between
+ DPIDs and LINC IDs.
+ rp(application:get_all_key(linc)).
+
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+ so that link
+ ( between switch1 port20 - switch5 port50 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+
+ main.step( "Attach to the Linc-OE session" )
+ step1Result = main.TRUE
+ attachConsole = main.LincOE1.attachLincOESession()
+ step1Result = attachConsole
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully attached Linc-OE session",
+ onfail="Failed to attached Linc-OE session")
+
+ main.step( "Bring a port down and verify the link state" )
+ step2Result = main.TRUE
+ main.LincOE1.portDown( swId="9", ptId="20" )
+ linksNonjson = main.ONOS3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 2:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+ links = main.ONOS3.links()
+ main.log.info( "links = " + links )
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "20":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+ 'dst' ][ 'port' ] == "50":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+ time.sleep( 10 )
+ #checkFlowsState = main.ONOS3.checkFlowsState()
+ step2Result = linksStateResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfuly brought down a link",
+ onfail="Failed to bring down a link")
+
+ main.step( "Verify Rerouting by a ping test" )
+ step3Result = main.TRUE
+ main.log.info( "\n\nh1 is Pinging h5" )
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step3Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
+
+ main.step( "Bring the downed port up and verify the link state" )
+ step4Result = main.TRUE
+ main.LincOE1.portUp( swId="9", ptId="20" )
+ linksNonjson = main.ONOS3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+ time.sleep( 30 )
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 0:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+ step4Result = main.FALSE
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully brought the port up",
+ onfail="Failed to bring the port up")
+ """
+ main.step( "Removing host intents" )
+ step5Result = main.TRUE
+ removeResult = main.TRUE
+ # Check remaining intents
+ intentsJson = json.loads( main.ONOS3.intents() )
+ main.ONOS3.removeIntent( intentId=intent1, purge=True )
+ main.ONOS3.removeIntent( intentId=intent2, purge=True )
+ for intents in intentsJson:
+ main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+ app='org.onosproject.optical',
+ purge=True )
+ print json.loads( main.ONOS3.intents() )
+ if len( json.loads( main.ONOS3.intents() ) ):
+ removeResult = main.FALSE
+ step5Result = removeResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step5Result,
+ onpass="Successfully removed host intents",
+ onfail="Failed to remove host intents" )
+ """
+ def CASE10( self ):
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ main.step( "Uninstalling reactive forwarding app" )
+ step1Result = main.TRUE
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ main.log.info( "deactivate reactive forwarding app" )
+ appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+ step1Result = appUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully deactivate reactive forwarding app",
+ onfail="Failed to deactivate reactive forwarding app")
+ # After reactive forwarding is disabled, the reactive flows on
+ # switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+ flows = main.ONOS2.flows()
+ main.log.info( flows )
+
+ def CASE25( self ):
+ """
+ Add host intents between 2 packet layer host
+ """
+ import time
+ import json
+ main.log.report( "Adding host intents between 2 optical layer host" )
+ main.case( "Test add host intents between optical layer host" )
+
+ main.step( "Discover host using arping" )
+ step1Result = main.TRUE
+ main.hostMACs = []
+ main.hostId = []
+ #Listing host MAC addresses
+ for i in range( 1 , 7 ):
+ main.hostMACs.append( "00:00:00:00:00:" +
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+ for macs in main.hostMACs:
+ main.hostId.append( macs + "/-1" )
+ host1 = main.hostId[ 0 ]
+ host2 = main.hostId[ 1 ]
+ # Use arping to discover the hosts
+ main.LincOE2.arping( host = "h1" )
+ main.LincOE2.arping( host = "h2" )
+ time.sleep( 5 )
+ hostsDict = main.ONOS3.hosts()
+ if not len( hostsDict ):
+ step1Result = main.FALSE
+ # Adding host intent
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Hosts discovered",
+ onfail="Failed to discover hosts")
+
+ main.step( "Adding host intents to h1 and h2" )
+ step2Result = main.TRUE
+ intentsId = []
+ intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
+ hostIdTwo = host2 )
+ intentsId.append( intent1 )
+ """
+ intent2 = main.ONOS3.addHostIntent( hostIdOne = host2,
+ hostIdTwo = host1 )
+ intentsId.append( intent2 )
+ """
+ # Checking intents state before pinging
+ main.log.info( "Checking intents state" )
+ time.sleep( 15 )
+ intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ #check intent state again if intents are not in installed state
+ print main.ONOS3.intents()
+ if not intentResult:
+ intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ step2Result = intentResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step2Result,
+ onpass="All intents are in INSTALLED state ",
+ onfail="Some of the intents are not in " +
+ "INSTALLED state " )
+
+ # pinging h1 to h2 and then ping h2 to h1
+ main.step( "Pinging h1 and h2" )
+ step3Result = main.TRUE
+ pingResult = main.TRUE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+ target="h1" )
+ step3Result = pingResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step3Result,
+ onpass="Pinged successfully between h1 and h2",
+ onfail="Pinged failed between h1 and h2" )
+ # Removed all added host intents
+ main.step( "Removing host intents" )
+ step4Result = main.TRUE
+ removeResult = main.TRUE
+ # Check remaining intents
+ intentsJson = json.loads( main.ONOS3.intents() )
+ main.ONOS3.removeIntent( intentId=intent1, purge=True )
+ #main.ONOS3.removeIntent( intentId=intent2, purge=True )
+ for intents in intentsJson:
+ main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+ app='org.onosproject.optical',
+ purge=True )
+ print json.loads( main.ONOS3.intents() )
+ if len( json.loads( main.ONOS3.intents() ) ):
+ removeResult = main.FALSE
+ step4Result = removeResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully removed host intents",
+ onfail="Failed to remove host intents" )
diff --git a/TestON/tests/IpOptical/IpOptical.topo b/TestON/tests/IpOptical/IpOptical.topo
new file mode 100755
index 0000000..9cef3f7
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.topo
@@ -0,0 +1,92 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOSbench>
+
+ <ONOS1>
+ <host>10.128.10.11</host>
+ <user>sdn</user>
+ <password>sdn</password>
+ <type>OnosDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1>
+
+ <ONOS2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2>
+
+ <ONOS3>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3>
+
+
+ <Mininet1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ <Mininet2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet2>
+
+ <LincOE1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>LincOEDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE1>
+
+ <LincOE2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE2>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/IpOptical/__init__.py b/TestON/tests/IpOptical/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/IpOptical/__init__.py
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.params b/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
new file mode 100755
index 0000000..c17bf21
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
@@ -0,0 +1,64 @@
+<PARAMS>
+
+ <testcases>20,21,22,10,25,23,24</testcases>
+ #Environment variables
+ <ENV>
+ <cellName>multi_test</cellName>
+ </ENV>
+
+ <CTRL>
+ <ip1>10.128.20.11</ip1>
+ <ip2>10.128.20.12</ip2>
+ <ip3>10.128.20.13</ip3>
+ <port1>6633</port1>
+ <port2>6633</port2>
+ <port3>6633</port3>
+ </CTRL>
+
+ <SDNIP>
+ <ethType>IPV4</ethType>
+ <tcpProto>6</tcpProto>
+ <icmpProto>1</icmpProto>
+ <srcPort>5001</srcPort>
+ <dstPort>5001</dstPort>
+ </SDNIP>
+
+ <MULTIPOINT_INTENT>
+ <device1>of:0000000000003008/1 </device1>
+ <device2>of:0000000000003009/1 </device2>
+ <device3>of:0000000000003010/1 </device3>
+ <mac1>00:00:00:00:00:0A </mac1>
+ <mac2>00:00:00:00:00:08 </mac2>
+ <ip1>10.0.3.0/24 </ip1>
+ <ip2>10.0.1.0/24 </ip2>
+ </MULTIPOINT_INTENT>
+
+ <PING>
+ <source1>h8</source1>
+ <source2>h9</source2>
+ <source3>h10</source3>
+ <source4>h11</source4>
+ <source5>h12</source5>
+ <source6>h13</source6>
+ <source7>h14</source7>
+ <source8>h15</source8>
+ <source9>h16</source9>
+ <source10>h17</source10>
+ <target1>10.0.0.18</target1>
+ <target2>10.0.0.19</target2>
+ <target3>10.0.0.20</target3>
+ <target4>10.0.0.21</target4>
+ <target5>10.0.0.22</target5>
+ <target6>10.0.0.23</target6>
+ <target7>10.0.0.24</target7>
+ <target8>10.0.0.25</target8>
+ <target9>10.0.0.26</target9>
+ <target10>10.0.0.27</target10>
+ </PING>
+
+ <timers>
+ <LinkDiscovery>5</LinkDiscovery>
+ <SwitchDiscovery>31</SwitchDiscovery>
+ </timers>
+
+</PARAMS>
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.py b/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
new file mode 100644
index 0000000..ff09766
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
@@ -0,0 +1,703 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep( 1 )
+
+class IpOpticalMulti:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-logs
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+ ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+ main.case( "Setting up test environment" )
+ main.log.report(
+ "This testcase is testing setting up test environment" )
+ main.log.report( "__________________________________" )
+
+ main.step( "Applying cell variable to environment" )
+ cellResult1 = main.ONOSbench.setCell( cellName )
+ # cellResult2 = main.ONOScli1.setCell( cellName )
+ # cellResult3 = main.ONOScli2.setCell( cellName )
+ # cellResult4 = main.ONOScli3.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+ cellResult = cellResult1
+
+ main.step( "Removing raft logs before a clen installation of ONOS" )
+ removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
+
+ main.step( "Git checkout, pull and get version" )
+ #main.ONOSbench.gitCheckout( "master" )
+ gitPullResult = main.ONOSbench.gitPull()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ versionResult = main.ONOSbench.getVersion( report=True )
+
+ if gitPullResult == 100:
+ main.step( "Using mvn clean & install" )
+ cleanInstallResult = main.ONOSbench.cleanInstall()
+ # cleanInstallResult = main.TRUE
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ # main.step( "Creating a cell" )
+ # cellCreateResult = main.ONOSbench.createCellFile( **************
+ # )
+
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS1Ip )
+ onos2InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS2Ip )
+ onos3InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS3Ip )
+ onosInstallResult = onos1InstallResult and onos2InstallResult and\
+ onos3InstallResult
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+ onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+ onosIsup = onos1Isup and onos2Isup and onos3Isup
+ if onosIsup == main.TRUE:
+ main.log.report( "ONOS instances are up and ready" )
+ else:
+ main.log.report( "ONOS instances may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.TRUE
+ # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+ startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+ startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+ print startcli1
+ print startcli2
+ print startcli3
+
+ case1Result = ( packageResult and
+ cellResult and verifyResult and onosInstallResult and
+ onosIsup and startResult )
+ utilities.assertEquals( expect=main.TRUE, actual=case1Result,
+ onpass="Test startup successful",
+ onfail="Test startup NOT successful" )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ import time
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+ ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Disconnecting mininet and restarting ONOS" )
+
+ main.step( "Disconnecting mininet and restarting ONOS" )
+ step1Result = main.TRUE
+ mininetDisconnect = main.Mininet1.disconnect()
+ print "mininetDisconnect = ", mininetDisconnect
+ step1Result = mininetDisconnect
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Mininet disconnect successfully",
+ onfail="Mininet failed to disconnect")
+ """
+ main.step( "Removing raft logs before a clean installation of ONOS" )
+ step2Result = main.TRUE
+ removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+ step2Result = removeRaftLogsResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Raft logs removed successfully",
+ onfail="Failed to remove raft logs")
+ """
+ main.step( "Applying cell variable to environment" )
+ step3Result = main.TRUE
+ setCellResult = main.ONOSbench.setCell( cellName )
+ verifyCellResult = main.ONOSbench.verifyCell()
+ step3Result = setCellResult and verifyCellResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Cell applied successfully",
+ onfail="Failed to apply cell")
+
+ main.step( "Uninstalling ONOS package" )
+ step4Result = main.TRUE
+ onos1UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS1Ip)
+ onos2UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS2Ip)
+ onos3UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS3Ip)
+ onosUninstallResult = onos1UninstallResult and onos2UninstallResult \
+ and onos3UninstallResult
+ step4Result = onosUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully uninstalled ONOS",
+ onfail="Failed to uninstall ONOS")
+
+ time.sleep( 5 )
+ main.step( "Installing ONOS package" )
+ step5Result = main.TRUE
+ onos1InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS1Ip )
+ onos2InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS2Ip )
+ onos3InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS3Ip )
+ onosInstallResult = onos1InstallResult and onos2InstallResult and\
+ onos3InstallResult
+
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+ onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+ onosIsUp = onos1Isup and onos2Isup and onos3Isup
+ if onosIsUp == main.TRUE:
+ main.log.report( "ONOS instances are up and ready" )
+ else:
+ main.log.report( "ONOS instances may not be up" )
+ step5Result = onosInstallResult and onosIsUp
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step5Result,
+ onpass="Successfully installed ONOS",
+ onfail="Failed to install ONOS")
+
+ main.step( "Starting ONOS service" )
+ step6Result = main.TRUE
+ startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ step6Result = startResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step6Result,
+ onpass="Successfully started ONOS",
+ onfail="Failed to start ONOS")
+
+ main.step( "Starting ONOS cli" )
+ step7Result = main.TRUE
+ startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+ startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+ startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+ startResult = startcli1 and startcli2 and startcli3
+ step7Result = startResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step7Result,
+ onpass="Successfully started ONOS cli",
+ onfail="Failed to start ONOS cli")
+
+ case20Result = step1Result and step3Result and\
+ step4Result and step5Result and step6Result and\
+ step7Result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case20Result,
+ onpass= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS successful",
+ onfail= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS failed" )
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
+ which spawns packet optical topology and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ import time
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+
+ main.step( "Activate optical app" )
+ step1Result = main.TRUE
+ activateOpticalResult = main.ONOScli2.activateApp( "org.onosproject.optical" )
+ step1Result = activateOpticalResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully activated optical app",
+ onfail="Failed to activate optical app")
+
+ appCheck = main.ONOScli2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli2.apps() )
+ main.log.warn( main.ONOScli2.appIDs() )
+
+ main.step( "Starting mininet and LINC-OE" )
+ step2Result = main.TRUE
+ time.sleep( 10 )
+ opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+ step2Result = opticalMnScript
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Started the topology successfully ",
+ onfail="Failed to start the topology")
+
+ case21Result = step1Result and step2Result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed" )
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 10 optical switches(ROADM's) and
+ 6 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 10,
+ packetLayerSWCount variable = 6, hostCount=6 and
+ links=46.
+ All this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ import time
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+
+ main.step( "Starts new ONOS cli" )
+ step1Result = main.TRUE
+ cliResult = main.ONOScli1.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+ [ 'ip1' ] )
+ step1Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully starts a new cli",
+ onfail="Failed to start new cli" )
+
+ main.step( "Compare topology" )
+ step2Result = main.TRUE
+ devicesResult = main.ONOScli1.devices( jsonFormat=False )
+ print "devices_result :\n", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 10:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+ if packetLayerSWCount == 6:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ # sleeps for sometime so the state of the switches will be active
+ time.sleep( 30 )
+ print "_________________________________"
+ linksResult = main.ONOScli1.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+ linkActiveCount = linksResult.count("state=ACTIVE")
+ main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+ if linkActiveCount == 46:
+ linkActiveResult = main.TRUE
+ main.log.info(
+ "Number of links in ACTIVE state are correct")
+ else:
+ linkActiveResult = main.FALSE
+ main.log.info(
+ "Number of links in ACTIVE state are wrong")
+ step2Result = opticalSWResult and packetSWResult and \
+ linkActiveResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfully loaded packet optical topology",
+ onfail="Failed to load packet optical topology" )
+
+ case22Result = step1Result and step2Result
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Install point intents between 2 packet layer device and " +
+ "ping the hosts" )
+
+ main.step( "Adding point intents" )
+ step1Result = main.TRUE
+ intentsId = []
+ pIntent1 = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0005/1" )
+ pIntent2 = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0005/1",
+ "of:0000ffffffff0001/1" )
+ intentsId.append( pIntent1 )
+ intentsId.append( pIntent2 )
+ main.log.info( "Checking intents state")
+ checkStateResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+ time.sleep( 30 )
+ main.log.info( "Checking flows state")
+ checkFlowResult = main.ONOScli1.checkFlowsState()
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 30 )
+ main.log.info( "Checking intents state one more time")
+ checkStateResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+ step1Result = checkStateResult and checkFlowResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully added point intents",
+ onfail="Failed to add point intents")
+
+ main.step( "Ping h1 and h5" )
+ step2Result = main.TRUE
+ main.log.info( "\n\nh1 is Pinging h5" )
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step2Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
+
+ case23Result = step1Result and step2Result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case23Result,
+ onpass="Point intents are installed properly",
+ onfail="Failed to install point intents" )
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ LINC uses its own switch IDs. You can use the following
+ command on the LINC console to find the mapping between
+ DPIDs and LINC IDs.
+ rp(application:get_all_key(linc)).
+
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+ so that link
+ ( between switch1 port20 - switch5 port50 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+
+ main.step( "Attach to the Linc-OE session" )
+ step1Result = main.TRUE
+ attachConsole = main.LincOE1.attachLincOESession()
+ step1Result = attachConsole
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully attached Linc-OE session",
+ onfail="Failed to attached Linc-OE session")
+
+ main.step( "Bring a port down and verify the link state" )
+ step2Result = main.TRUE
+ main.LincOE1.portDown( swId="9", ptId="20" )
+ linksNonjson = main.ONOScli1.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 2:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+ links = main.ONOScli1.links()
+ main.log.info( "links = " + links )
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "20":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+ 'dst' ][ 'port' ] == "50":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+ time.sleep( 10 )
+ checkFlowsState = main.ONOScli1.checkFlowsState()
+ step2Result = linksStateResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfuly brought down a link",
+ onfail="Failed to bring down a link")
+
+ main.step( "Verify Rerouting by a ping test" )
+ step3Result = main.TRUE
+ main.log.info( "\n\nh1 is Pinging h5" )
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step3Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
+
+ main.step( "Bring the downed port up and verify the link state" )
+ step4Result = main.TRUE
+ main.LincOE1.portUp( swId="9", ptId="20" )
+ linksNonjson = main.ONOScli1.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 0:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+ step4Result = main.FALSE
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully brought the port up",
+ onfail="Failed to bring the port up")
+
+ case24Result = step1Result and step2Result and step3Result \
+ and step4Result
+ utilities.assert_equals( expect=main.TRUE,
+ actual=case24Result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed" )
+
+ def CASE10( self ):
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ main.step( "Uninstalling reactive forwarding app" )
+ step1Result = main.TRUE
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ main.log.info( "deactivate reactive forwarding app" )
+ appUninstallResult = main.ONOScli2.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOScli2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli2.apps() )
+ main.log.warn( main.ONOScli2.appIDs() )
+ step1Result = appUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully deactivate reactive forwarding app",
+ onfail="Failed to deactivate reactive forwarding app")
+ # After reactive forwarding is disabled, the reactive flows on
+ # switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+ flows = main.ONOScli2.flows()
+ main.log.info( flows )
+
+ case10Result = step1Result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case10Result,
+ onpass="Reactive forwarding app uninstallation successful",
+ onfail="Reactive forwarding app uninstallation failed" )
+
+ def CASE25( self ):
+ """
+ Add host intents between 2 packet layer host
+ """
+ import time
+ import json
+ main.log.report( "Adding host intents between 2 optical layer host" )
+ main.case( "Test add host intents between optical layer host" )
+
+ main.step( "Discover host using arping" )
+ step1Result = main.TRUE
+ main.hostMACs = []
+ main.hostId = []
+ #Listing host MAC addresses
+ for i in range( 1 , 7 ):
+ main.hostMACs.append( "00:00:00:00:00:" +
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+ for macs in main.hostMACs:
+ main.hostId.append( macs + "/-1" )
+ host1 = main.hostId[ 0 ]
+ host2 = main.hostId[ 1 ]
+ # Use arping to discover the hosts
+ main.LincOE2.arping( host = "h1" )
+ main.LincOE2.arping( host = "h2" )
+ time.sleep( 5 )
+ hostsDict = main.ONOScli1.hosts()
+ if not len( hostsDict ):
+ step1Result = main.FALSE
+ # Adding host intent
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Hosts discovered",
+ onfail="Failed to discover hosts")
+
+ main.step( "Adding host intents to h1 and h2" )
+ step2Result = main.TRUE
+ intentsId = []
+ intent1 = main.ONOScli1.addHostIntent( hostIdOne = host1,
+ hostIdTwo = host2 )
+ intentsId.append( intent1 )
+ time.sleep( 5 )
+ intent2 = main.ONOScli1.addHostIntent( hostIdOne = host2,
+ hostIdTwo = host1 )
+ intentsId.append( intent2 )
+ # Checking intents state before pinging
+ main.log.info( "Checking intents state" )
+ time.sleep( 30 )
+ intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+ #check intent state again if intents are not in installed state
+ if not intentResult:
+ intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+ step2Result = intentResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step2Result,
+ onpass="All intents are in INSTALLED state ",
+ onfail="Some of the intents are not in " +
+ "INSTALLED state " )
+
+ # pinging h1 to h2 and then ping h2 to h1
+ main.step( "Pinging h1 and h2" )
+ step3Result = main.TRUE
+ pingResult = main.TRUE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+ target="h1" )
+ step3Result = pingResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step3Result,
+ onpass="Pinged successfully between h1 and h2",
+ onfail="Pinged failed between h1 and h2" )
+ # Removed all added host intents
+ main.step( "Removing host intents" )
+ step4Result = main.TRUE
+ removeResult = main.TRUE
+ # Check remaining intents
+ intentsJson = json.loads( main.ONOScli1.intents() )
+ main.ONOScli1.removeIntent( intentId=intent1, purge=True )
+ main.ONOScli1.removeIntent( intentId=intent2, purge=True )
+ for intents in intentsJson:
+ main.ONOScli1.removeIntent( intentId=intents.get( 'id' ),
+ app='org.onosproject.optical',
+ purge=True )
+ print json.loads( main.ONOScli1.intents() )
+ if len( json.loads( main.ONOScli1.intents() ) ):
+ removeResult = main.FALSE
+ step4Result = removeResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully removed host intents",
+ onfail="Failed to remove host intents" )
+ case25Result = step1Result and step2Result and step3Result and \
+ step4Result
+ utilities.assert_equals( expect=main.TRUE,
+ actual=case25Result,
+ onpass="Add host intent successful",
+ onfail="Add host intent failed" )
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo b/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo
new file mode 100755
index 0000000..4b1ab12
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo
@@ -0,0 +1,118 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli1>
+
+ <ONOScli2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli2>
+
+ <ONOScli3>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli3>
+
+ <ONOS1>
+ <host>10.128.10.11</host>
+ <user>sdn</user>
+ <password>sdn</password>
+ <type>OnosCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1>
+
+ <ONOS2>
+ <host>10.128.10.11</host>
+ <user>sdn</user>
+ <password>sdn</password>
+ <type>OnosCliDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS2>
+
+ <ONOS3>
+ <host>10.128.10.11</host>
+ <user>sdn</user>
+ <password>sdn</password>
+ <type>OnosCliDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3>
+
+
+ <Mininet1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ <Mininet2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>9</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet2>
+
+ <LincOE1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>LincOEDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE1>
+
+ <LincOE2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE2>
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py b/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py
new file mode 100644
index 0000000..d00410f
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py
@@ -0,0 +1,572 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep( 1 )
+
+class IpOpticalMulti:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-logs
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+ ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+ main.case( "Setting up test environment" )
+ main.log.report(
+ "This testcase is testing setting up test environment" )
+ main.log.report( "__________________________________" )
+
+ main.step( "Applying cell variable to environment" )
+ cellResult1 = main.ONOSbench.setCell( cellName )
+ # cellResult2 = main.ONOScli1.setCell( cellName )
+ # cellResult3 = main.ONOScli2.setCell( cellName )
+ # cellResult4 = main.ONOScli3.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+ cellResult = cellResult1
+
+ main.step( "Removing raft logs before a clen installation of ONOS" )
+ removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
+
+ main.step( "Git checkout, pull and get version" )
+ #main.ONOSbench.gitCheckout( "master" )
+ gitPullResult = main.ONOSbench.gitPull()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ versionResult = main.ONOSbench.getVersion( report=True )
+
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ cleanInstallResult = main.ONOSbench.cleanInstall()
+ # cleanInstallResult = main.TRUE
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ # main.step( "Creating a cell" )
+ # cellCreateResult = main.ONOSbench.createCellFile( **************
+ # )
+
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS1Ip )
+ onos2InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS2Ip )
+ onos3InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS3Ip )
+ onosInstallResult = onos1InstallResult and onos2InstallResult and\
+ onos3InstallResult
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+ onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+ onosIsup = onos1Isup and onos2Isup and onos3Isup
+ if onosIsup == main.TRUE:
+ main.log.report( "ONOS instances are up and ready" )
+ else:
+ main.log.report( "ONOS instances may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.TRUE
+ # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+ startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+ startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+ print startcli1
+ print startcli2
+ print startcli3
+
+ case1Result = ( packageResult and
+ cellResult and verifyResult and onosInstallResult and
+ onosIsup and startResult )
+ utilities.assertEquals( expect=main.TRUE, actual=case1Result,
+ onpass="Test startup successful",
+ onfail="Test startup NOT successful" )
+
+ def CASE10( self ):
+ import time
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli1.apps() )
+ main.log.warn( main.ONOScli1.appIDs() )
+ main.log.info( "onos-app-fwd uninstalled" )
+
+ # After reactive forwarding is disabled,
+ # the reactive flows on switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+
+ hosts = main.ONOScli1.hosts()
+ main.log.info( hosts )
+ case10Result = appInstallResult
+ utilities.assertEquals(
+ expect=main.TRUE,
+ actual=case10Result,
+ onpass="Reactive forwarding app uninstallation successful",
+ onfail="Reactive forwarding app uninstallation failed" )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+ ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ 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()
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS1Ip )
+ onos2InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS2Ip )
+ onos3InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS3Ip )
+ onosInstallResult = onos1InstallResult and onos2InstallResult and\
+ onos3InstallResult
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+ onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+ onosIsup = onos1Isup and onos2Isup and onos3Isup
+ if onosIsup == main.TRUE:
+ main.log.report( "ONOS instances are up and ready" )
+ else:
+ main.log.report( "ONOS instances may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.TRUE
+ # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+ startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+ startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+ startResult = startcli1 and startcli2 and startcli3
+ if startResult == main.TRUE:
+ main.log.report( "ONOS cli starts properly" )
+ case20Result = mininetDisconnect and cellResult and verifyResult \
+ and onosInstallResult and onosIsup and startResult
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case20Result,
+ onpass= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS successful",
+ onfail= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS failed" )
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+ which spawns packet optical topology and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+ main.step( "Starting LINC-OE and other components" )
+ main.log.info( "Activate optical app" )
+ appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ appCheck = appCheck and main.ONOScli2.appToIDCheck()
+ appCheck = appCheck and main.ONOScli3.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( "Checking ONOS application unsuccesful" )
+
+ ctrllerIP = []
+ ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
+ #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
+ #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
+ opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
+ case21Result = opticalMnScript and appInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed" )
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 10 optical switches(ROADM's) and
+ 6 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 10,
+ packetLayerSWCount variable = 6, hostCount=6 and
+ links=42.
+ All this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+ main.step( "Topology comparision" )
+ devicesResult = main.ONOScli3.devices( jsonFormat=False )
+
+ print "devices_result = ", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 10:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+
+ if packetLayerSWCount == 6:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ print "_________________________________"
+
+ linksResult = main.ONOScli3.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+ linkActiveCount = linksResult.count("state=ACTIVE")
+ main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+ if linkActiveCount == 42:
+ linkActiveResult = main.TRUE
+ main.log.info(
+ "Number of links in ACTIVE state are correct")
+ else:
+ linkActiveResult = main.FALSE
+ main.log.info(
+ "Number of links in ACTIVE state are wrong")
+
+ case22Result = opticalSWResult and packetSWResult and \
+ linkActiveResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Topology comparision" )
+ main.step( "Adding point intents" )
+ ptpIntentResult = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0005/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ ptpIntentResult = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0005/1",
+ "of:0000ffffffff0001/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ time.sleep( 30 )
+ flowHandle = main.ONOScli1.flows()
+ main.log.info( "flows :" + flowHandle )
+
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 60 )
+ intentHandle = main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "intents :" + intentHandle )
+
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Point intents for packet optical have not ben installed" +
+ " correctly. Cleaning up" )
+ if PingResult == main.TRUE:
+ main.log.report(
+ "Point Intents for packet optical have been " +
+ "installed correctly" )
+
+ case23Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case23Result,
+ onpass= "Point intents addition for packet optical and" +
+ "Pingall Test successful",
+ onfail= "Point intents addition for packet optical and" +
+ "Pingall Test NOT successful" )
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ LINC uses its own switch IDs. You can use the following
+ command on the LINC console to find the mapping between
+ DPIDs and LINC IDs.
+ rp(application:get_all_key(linc)).
+
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+ so that link
+ ( between switch1 port20 - switch5 port50 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+ main.step( "Attach to the Linc-OE session" )
+ attachConsole = main.LincOE1.attachLincOESession()
+ print "attachConsole = ", attachConsole
+
+ main.step( "Bring a port down and verify the link state" )
+ main.LincOE1.portDown( swId="9", ptId="20" )
+ linksNonjson = main.ONOScli3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+
+ linkInactiveCount = linksNonjson.count("state=INACTIVE")
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 2:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+
+ links = main.ONOScli3.links()
+ main.log.info( "links = " + links )
+
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "20":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+ 'dst' ][ 'port' ] == "50":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+
+ print "links_state_result = ", linksStateResult
+ time.sleep( 10 )
+ flowHandle = main.ONOScli3.flows()
+ main.log.info( "flows :" + flowHandle )
+
+ main.step( "Verify Rerouting by a ping test" )
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.TRUE:
+ main.log.report( "Ping test successful " )
+ if PingResult == main.FALSE:
+ main.log.report( "Ping test failed" )
+
+ case24Result = PingResult and linksStateResult
+ utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed" )
+
+ def CASE25( self ):
+ """
+ Add host intents between 2 packet layer host
+ """
+ import time
+ import json
+ main.log.report( "Adding host intents between 2 packet layer host" )
+ main.hostMACs = []
+ main.hostId = []
+ #Listing host MAC addresses
+ for i in range( 1 , 7 ):
+ main.hostMACs.append( "00:00:00:00:00:" +
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+ for macs in main.hostMACs:
+ main.hostId.append( macs + "/-1" )
+
+ host1 = main.hostId[ 0 ]
+ host2 = main.hostId[ 1 ]
+ intentsId = []
+ # Use arping to discover the hosts
+ main.LincOE2.arping( host = "h1" )
+ main.LincOE2.arping( host = "h2" )
+ # Adding host intent
+ main.log.step( "Adding host intents to h1 and h2" )
+ intent1 = main.ONOScli1.addHostIntent( hostIdOne = host1,
+ hostIdTwo = host2 )
+ intentsId.append( intent1 )
+ time.sleep( 5 )
+ intent2 = main.ONOScli1.addHostIntent( hostIdOne = host2,
+ hostIdTwo = host1 )
+ intentsId.append( intent2 )
+ # Checking intents state before pinging
+ main.log.step( "Checking intents state" )
+ time.sleep( 10 )
+ intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+ utilities.assert_equals( expect=main.TRUE, actual=intentResult,
+ onpass="All intents are in INSTALLED state ",
+ onfail="Some of the intents are not in " +
+ "INSTALLED state " )
+
+ # pinging h1 to h2 and then ping h2 to h1
+ main.log.step( "Pinging h1 and h2" )
+ pingResult = main.TRUE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+ target="h1" )
+
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+ onpass="Pinged successfully between h1 and h2",
+ onfail="Pinged failed between h1 and h2" )
+
+ case25Result = pingResult
+ utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+ onpass="Add host intent successful",
+ onfail="Add host intent failed" )
diff --git a/TestON/tests/IpOpticalMulti/__init__.py b/TestON/tests/IpOpticalMulti/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/__init__.py
diff --git a/TestON/tests/MultiProd/MultiProd.params b/TestON/tests/MultiProd/MultiProd.params
index 4818d09..3767ab9 100755
--- a/TestON/tests/MultiProd/MultiProd.params
+++ b/TestON/tests/MultiProd/MultiProd.params
@@ -1,15 +1,19 @@
<PARAMS>
-
- <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8</testcases>
+
+ <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8,20,21,22,10,23,24</testcases>
#Environment variables
<ENV>
<cellName>multi_test</cellName>
</ENV>
+ <GIT>
+ <pull>False</pull>
+ </GIT>
+
<CTRL>
<ip1>10.128.20.11</ip1>
- <ip2>10.128.20.12</ip2>
- <ip3>10.128.20.13</ip3>
+ <ip2>10.128.20.12</ip2>
+ <ip3>10.128.20.13</ip3>
<port1>6633</port1>
<port2>6633</port2>
<port3>6633</port3>
diff --git a/TestON/tests/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
index aac631f..6bf405b 100644
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -35,6 +35,7 @@
ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
main.case( "Setting up test environment" )
main.log.report(
@@ -52,19 +53,25 @@
main.step( "Removing raft logs before a clen installation of ONOS" )
removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
- main.step( "Git checkout, pull and get version" )
- #main.ONOSbench.gitCheckout( "master" )
- gitPullResult = main.ONOSbench.gitPull()
- main.log.info( "git_pull_result = " + str( gitPullResult ))
- versionResult = main.ONOSbench.getVersion( report=True )
-
- if gitPullResult == 1:
- main.step( "Using mvn clean & install" )
- cleanInstallResult = main.ONOSbench.cleanInstall()
- # cleanInstallResult = main.TRUE
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
+ main.step( "Git checkout and get version" )
+ main.ONOSbench.gitCheckout( "master" )
+ if gitPull == 'True':
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ main.ONOSbench.cleanInstall()
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+ elif gitPullResult == 0:
+ main.log.report(
+ "Git Pull Failed, look into logs for detailed reason" )
+ main.cleanup()
+ main.exit()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ else:
+ main.log.info( "Skipping git pull" )
+ main.ONOSbench.getVersion( report=True )
+ packageResult = main.TRUE
# main.step( "Creating a cell" )
# cellCreateResult = main.ONOSbench.createCellFile( **************
@@ -215,6 +222,14 @@
main.log.report( "Controller assignment successfull" )
else:
main.log.report( "Controller assignment failed" )
+ appInstallResult = main.TRUE
+ main.log.info( "Activating reactive forwarding app" )
+ appInstallResult = main.ONOScli1.activateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli1.apps() )
+ main.log.warn( main.ONOScli1.appIDs() )
+ time.sleep( 30 )
# REACTIVE FWD test
main.step( "Pingall" )
pingResult = main.FALSE
@@ -371,7 +386,6 @@
onpass="ONOS3 Switches view is correct",
onfail="ONOS3 Switches view is incorrect" )
- """
portsResults1 = main.Mininet1.comparePorts( MNTopo,
json.loads( ports1 ) )
utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
@@ -389,7 +403,7 @@
utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
onpass="ONOS3 Ports view is correct",
onfail="ONOS3 Ports view is incorrect" )
- """
+
linksResults1 = main.Mininet1.compareLinks(
MNTopo,
json.loads( links1 ) )
@@ -433,17 +447,17 @@
onfail="Topology Check Test NOT successful" )
def CASE10( self ):
+ import time
main.log.report(
"This testcase uninstalls the reactive forwarding app" )
main.log.report( "__________________________________" )
main.case( "Uninstalling reactive forwarding app" )
# Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult1 = main.ONOScli1.featureUninstall(
- "onos-app-fwd" )
- appUninstallResult2 = main.ONOScli2.featureUninstall(
- "onos-app-fwd" )
- appUninstallResult3 = main.ONOScli3.featureUninstall(
- "onos-app-fwd" )
+ appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli1.apps() )
+ main.log.warn( main.ONOScli1.appIDs() )
main.log.info( "onos-app-fwd uninstalled" )
# After reactive forwarding is disabled,
@@ -453,9 +467,7 @@
hosts = main.ONOScli1.hosts()
main.log.info( hosts )
-
- case10Result = appUninstallResult1 and\
- appUninstallResult2 and appUninstallResult3
+ case10Result = appInstallResult
utilities.assertEquals(
expect=main.TRUE,
actual=case10Result,
@@ -504,6 +516,7 @@
hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:11/-1",
"00:00:00:00:00:1B/-1" )
"""
+ intentsId = []
for i in range( 8, 18 ):
main.log.info(
"Adding host intent between h" + str( i ) +
@@ -517,8 +530,14 @@
host1Id = main.ONOScli1.getHost( host1 )[ 'id' ]
host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
tmpResult = main.ONOScli1.addHostIntent( host1Id, host2Id )
+ intentsId.append( tmpResult )
+
+ checkIntent1 = main.ONOScli1.checkIntentState( intentsId )
+ checkIntent2 = main.ONOScli2.checkIntentState( intentsId )
+ checkIntent3 = main.ONOScli3.checkIntentState( intentsId )
flowHandle = main.ONOScli1.flows()
+
main.log.info( "flows:" + flowHandle )
count = 1
@@ -571,6 +590,10 @@
if PingResult == main.TRUE:
main.log.report( "Host intents have been installed correctly" )
+ checkIntent1 = main.ONOScli1.checkIntentState( intentsId )
+ checkIntent2 = main.ONOScli2.checkIntentState( intentsId )
+ checkIntent3 = main.ONOScli3.checkIntentState( intentsId )
+
case6Result = PingResult
utilities.assertEquals(
expect=main.TRUE,
@@ -637,8 +660,8 @@
main.step( "Determine the current number of switches and links" )
topologyOutput = main.ONOScli1.topology()
topologyResult = main.ONOSbench.getTopology( topologyOutput )
- activeSwitches = topologyResult[ 'deviceCount' ]
- links = topologyResult[ 'linkCount' ]
+ activeSwitches = topologyResult[ 'devices' ]
+ links = topologyResult[ 'links' ]
main.log.info(
"Currently there are %s switches and %s links" %
( str( activeSwitches ), str( links ) ) )
@@ -881,14 +904,20 @@
main.step(
"Iterate through the intentids list and remove each intent" )
for id in intentids:
- main.ONOScli1.removeIntent( intentId=id )
+ main.ONOScli1.removeIntent( intentId=id ,purge=True )
- intentResult = main.ONOScli1.intents( jsonFormat=False )
- main.log.info( "intent_result = " + intentResult )
+ remainingIntent = main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Remaining intents " + remainingIntent )
+
case8Result = main.TRUE
-
+ intentResult = main.TRUE
+ if remainingIntent:
+ main.log.error( "There are still remaining intent" )
+ intentResult = main.FALSE
i = 8
+
PingResult = main.TRUE
+ """
while i < 18:
main.log.info(
"\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
@@ -903,7 +932,6 @@
else:
main.log.info( "Unknown error" )
PingResult = main.ERROR
-
# Note: If the ping result failed, that means the intents have been
# withdrawn correctly.
if PingResult == main.TRUE:
@@ -912,17 +940,17 @@
# main.exit()
if PingResult == main.FALSE:
main.log.report( "Host intents have been withdrawn correctly" )
+ """
+ case8Result = intentResult
- case8Result = case8Result and PingResult
-
- if case8Result == main.FALSE:
+ if case8Result == main.TRUE:
main.log.report( "Intent removal successful" )
else:
main.log.report( "Intent removal failed" )
- utilities.assertEquals( expect=main.FALSE, actual=case8Result,
- onpass="Intent removal test failed",
- onfail="Intent removal test successful" )
+ utilities.assertEquals( expect=main.TRUE, actual=case8Result,
+ onpass="Intent removal test successful",
+ onfail="Intent removal test failed" )
def CASE9( self ):
"""
@@ -941,28 +969,38 @@
main.step(
"Add point-to-point intents for mininet hosts" +
" h8 and h18 or ONOS hosts h8 and h12" )
+ macsDict = {}
+ for i in range( 1,29 ):
+ macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) )
+ print macsDict
+ # main.step(var1)
ptpIntentResult = main.ONOScli1.addPointIntent(
- "of:0000000000003008/1",
- "of:0000000000006018/1" )
+ ingressDevice="of:0000000000003008/1",
+ egressDevice="of:0000000000006018/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h8' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
ptpIntentResult = main.ONOScli1.addPointIntent(
- "of:0000000000006018/1",
- "of:0000000000003008/1" )
+ ingressDevice="of:0000000000006018/1",
+ egressDevice="of:0000000000003008/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h18' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts" +
- " h9 and h19 or ONOS hosts h9 and h13" )
+ var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+ main.step(var2)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003009/1",
- "of:0000000000006019/1" )
+ "of:0000000000006019/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h9' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -970,18 +1008,22 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006019/1",
- "of:0000000000003009/1" )
+ "of:0000000000003009/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h19' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet" +
- " hosts h10 and h20 or ONOS hosts hA and h14" )
+ var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+ main.step(var3)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003010/1",
- "of:0000000000006020/1" )
+ "of:0000000000006020/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h10' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -989,18 +1031,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006020/1",
- "of:0000000000003010/1" )
+ "of:0000000000003010/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h20' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet" +
- " hosts h11 and h21 or ONOS hosts hB and h15" )
+ var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+ " ONOS hosts hB and h15"
+ main.case(var4)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003011/1",
- "of:0000000000006021/1" )
+ "of:0000000000006021/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h11' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1008,18 +1056,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006021/1",
- "of:0000000000003011/1" )
+ "of:0000000000003011/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h21' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet" +
- " hosts h12 and h22 or ONOS hosts hC and h16" )
+ var5 = "Add point intents for mininet hosts h12 and h22 " +\
+ "ONOS hosts hC and h16"
+ main.case(var5)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003012/1",
- "of:0000000000006022/1" )
+ "of:0000000000006022/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h12' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1027,18 +1081,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006022/1",
- "of:0000000000003012/1" )
+ "of:0000000000003012/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h22' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet " +
- "hosts h13 and h23 or ONOS hosts hD and h17" )
+ var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+ " ONOS hosts hD and h17"
+ main.case(var6)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003013/1",
- "of:0000000000006023/1" )
+ "of:0000000000006023/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h13' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1046,18 +1106,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006023/1",
- "of:0000000000003013/1" )
+ "of:0000000000003013/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h23' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts" +
- " h14 and h24 or ONOS hosts hE and h18" )
+ var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+ " ONOS hosts hE and h18"
+ main.case(var7)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003014/1",
- "of:0000000000006024/1" )
+ "of:0000000000006024/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h14' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1065,18 +1131,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006024/1",
- "of:0000000000003014/1" )
+ "of:0000000000003014/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h24' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts" +
- " h15 and h25 or ONOS hosts hF and h19" )
+ var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+ " ONOS hosts hF and h19"
+ main.case(var8)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003015/1",
- "of:0000000000006025/1" )
+ "of:0000000000006025/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h15' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1084,18 +1156,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006025/1",
- "of:0000000000003015/1" )
+ "of:0000000000003015/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h25' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts" +
- " h16 and h26 or ONOS hosts h10 and h1A" )
+ var9 = "Add intents for mininet hosts h16 and h26 or" +\
+ " ONOS hosts h10 and h1A"
+ main.case(var9)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003016/1",
- "of:0000000000006026/1" )
+ "of:0000000000006026/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h16' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1103,37 +1181,41 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006026/1",
- "of:0000000000003016/1" )
+ "of:0000000000003016/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h26' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts h17" +
- " and h27 or ONOS hosts h11 and h1B" )
+ var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+ " ONOS hosts h11 and h1B"
+ main.case(var10)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003017/1",
- "of:0000000000006027/1" )
+ "of:0000000000006027/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h17' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
+ #main.log.info( getIntentResult )
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006027/1",
- "of:0000000000003017/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOScli1.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
+ "of:0000000000003017/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h27' ))
print(
"_______________________________________________________" +
"________________________________" )
flowHandle = main.ONOScli1.flows()
- # print "flowHandle = ", flowHandle
+ print "flowHandle = ", flowHandle
main.log.info( "flows :" + flowHandle )
count = 1
@@ -1226,13 +1308,13 @@
host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
for host in hostsJson:
if host[ 'id' ] == host1Id:
- ip1 = host[ 'ips' ][ 0 ]
+ ip1 = host[ 'ipAddresses' ][ 0 ]
ip1 = str( ip1 + "/32" )
- device1 = host[ 'location' ][ 'device' ]
+ device1 = host[ 'location' ][ 'elementId' ]
device1 = str( device1 + "/1" )
elif host[ 'id' ] == host2Id:
- ip2 = str( host[ 'ips' ][ 0 ] ) + "/32"
- device2 = host[ 'location' ][ "device" ]
+ ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32"
+ device2 = host[ 'location' ][ 'elementId' ]
device2 = str( device2 + "/1" )
pIntentResult1 = main.ONOScli1.addPointIntent(
@@ -1241,7 +1323,7 @@
ipSrc=ip1,
ipDst=ip2,
ethType=main.params[ 'SDNIP' ][ 'ethType' ],
- ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] )
+ ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ], )
getIntentResult = main.ONOScli1.intents( jsonFormat=False )
main.log.info( getIntentResult )
@@ -1256,7 +1338,7 @@
getIntentResult = main.ONOScli1.intents( jsonFormat=False )
main.log.info( getIntentResult )
- if ( pIntentResult1 and pIntentResult2 ) == main.TRUE:
+ if ( pIntentResult1 and pIntentResult2 ) :
# getIntentResult = main.ONOScli1.intents()
# main.log.info( getIntentResult )
main.log.info(
@@ -1322,7 +1404,7 @@
"Ping all test after Point intents related to" +
" SDN-IP matching on ICMP successful" )
- case31Result = PingResult and pIntentResult1 and pIntentResult2
+ case31Result = PingResult
utilities.assertEquals(
expect=main.TRUE,
actual=case31Result,
@@ -1378,13 +1460,13 @@
host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
for host in hostsJson:
if host[ 'id' ] == host1Id:
- ip1 = host[ 'ips' ][ 0 ]
+ ip1 = host[ 'ipAddresses' ][ 0 ]
ip1 = str( ip1 + "/32" )
- device1 = host[ 'location' ][ 'device' ]
+ device1 = host[ 'location' ][ 'elementId' ]
device1 = str( device1 + "/1" )
elif host[ 'id' ] == host2Id:
- ip2 = str( host[ 'ips' ][ 0 ] ) + "/32"
- device2 = host[ 'location' ][ "device" ]
+ ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32"
+ device2 = host[ 'location' ][ 'elementId' ]
device2 = str( device2 + "/1" )
pIntentResult1 = main.ONOScli1.addPointIntent(
@@ -1421,11 +1503,10 @@
ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ],
tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] )
- pIntentResult = pIntentResult1 and pIntentResult2 and\
- pIntentResult3 and pIntentResult4
- if pIntentResult == main.TRUE:
- getIntentResult = main.ONOScli1.intents( jsonFormat=False )
- main.log.info( getIntentResult )
+ getIntentResult = main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( getIntentResult )
+ pIntentResult = main.TRUE
+ if getIntentResult:
main.log.report(
"Point intent related to SDN-IP matching" +
" on TCP install successful" )
@@ -1433,6 +1514,7 @@
main.log.report(
"Point intent related to SDN-IP matching" +
" on TCP install failed" )
+ pIntentResult = main.FALSE
iperfResult = main.Mininet1.iperf( 'h8', 'h18' )
if iperfResult == main.TRUE:
@@ -1481,14 +1563,14 @@
"Installing multipoint to single point " +
"intent with rewrite mac address" )
main.step( "Uninstalling proxy arp app" )
- # Unistall onos-app-proxyarp app to disable reactive forwarding
- appUninstallResult1 = main.ONOScli1.featureUninstall(
- "onos-app-proxyarp" )
- appUninstallResult2 = main.ONOScli2.featureUninstall(
- "onos-app-proxyarp" )
- appUninstallResult3 = main.ONOScli3.featureUninstall(
- "onos-app-proxyarp" )
- main.log.info( "onos-app-proxyarp uninstalled" )
+ # deactivating proxyarp app
+ appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.proxyarp" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli1.apps() )
+ main.log.warn( main.ONOScli1.appIDs() )
+ time.sleep( 30 )
+ main.log.info( "onos-app-proxyarp deactivated" )
main.step( "Changing ipaddress of hosts h8,h9 and h18" )
main.Mininet1.changeIP(
@@ -1603,7 +1685,7 @@
" and h" +
str( i +
2 ) +
- "passed!" )
+ " passed!" )
PingResult = main.TRUE
else:
main.log.info( "Unknown error" )
@@ -1629,3 +1711,388 @@
" intent addition with rewrite mac address successful",
onfail="Ping all test after multipoint to single point intent" +
" addition with rewrite mac address failed" )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ import time
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+ ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ 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()
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ time.sleep( 5 )
+ main.step( "Uninstalling ONOS package" )
+ onos1UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS1Ip)
+ onos2UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS2Ip)
+ onos3UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS3Ip)
+ onosUninstallResult = onos1UninstallResult and onos2UninstallResult \
+ and onos3UninstallResult
+ time.sleep( 15 )
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS1Ip )
+ onos2InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS2Ip )
+ onos3InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS3Ip )
+ onosInstallResult = onos1InstallResult and onos2InstallResult and\
+ onos3InstallResult
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ time.sleep( 10 )
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+ onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+ onosIsup = onos1Isup and onos2Isup and onos3Isup
+ if onosIsup == main.TRUE:
+ main.log.report( "ONOS instances are up and ready" )
+ else:
+ main.log.report( "ONOS instances may not be up" )
+
+ main.step( "Starting ONOS service" )
+ time.sleep( 10 )
+ startResult = main.TRUE
+ # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+ startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+ startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+ startResult = startcli1 and startcli2 and startcli3
+ if startResult == main.TRUE:
+ main.log.report( "ONOS cli starts properly" )
+ case20Result = mininetDisconnect and cellResult and verifyResult \
+ and onosInstallResult and onosIsup and startResult
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case20Result,
+ onpass= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS successful",
+ onfail= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS failed" )
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+ which spawns packet optical topology and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+ main.step( "Starting LINC-OE and other components" )
+ main.log.info( "Activate optical app" )
+ appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ appCheck = appCheck and main.ONOScli2.appToIDCheck()
+ appCheck = appCheck and main.ONOScli3.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( "Checking ONOS application unsuccesful" )
+
+ ctrllerIP = []
+ ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
+ #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
+ #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
+ opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
+ case21Result = opticalMnScript and appInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed" )
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 10 optical switches(ROADM's) and
+ 6 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 10,
+ packetLayerSWCount variable = 6, hostCount=6 and
+ links=46.
+ All this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ import time
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+ main.step( "Topology comparision" )
+ devicesResult = main.ONOScli3.devices( jsonFormat=False )
+ time.sleep( 15 )
+ print "devices_result = ", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 10:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+
+ if packetLayerSWCount == 6:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ print "_________________________________"
+
+ linksResult = main.ONOScli3.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+ linkActiveCount = linksResult.count("state=ACTIVE")
+ main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+ if linkActiveCount == 46:
+ linkActiveResult = main.TRUE
+ main.log.info(
+ "Number of links in ACTIVE state are correct")
+ else:
+ linkActiveResult = main.FALSE
+ main.log.info(
+ "Number of links in ACTIVE state are wrong")
+
+ case22Result = opticalSWResult and packetSWResult and \
+ linkActiveResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Topology comparision" )
+ main.step( "Adding point intents" )
+ ptpIntentResult = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0005/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ ptpIntentResult = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0005/1",
+ "of:0000ffffffff0001/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ time.sleep( 30 )
+ #flowHandle = main.ONOScli1.flows()
+ #main.log.info( "flows :" + flowHandle )
+
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 60 )
+ intentHandle = main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "intents :" + intentHandle )
+
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Point intents for packet optical have not ben installed" +
+ " correctly. Cleaning up" )
+ if PingResult == main.TRUE:
+ main.log.report(
+ "Point Intents for packet optical have been " +
+ "installed correctly" )
+
+ case23Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case23Result,
+ onpass= "Point intents addition for packet optical and" +
+ "Pingall Test successful",
+ onfail= "Point intents addition for packet optical and" +
+ "Pingall Test NOT successful" )
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ LINC uses its own switch IDs. You can use the following
+ command on the LINC console to find the mapping between
+ DPIDs and LINC IDs.
+ rp(application:get_all_key(linc)).
+
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+ so that link
+ ( between switch1 port20 - switch5 port50 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+ main.step( "Attach to the Linc-OE session" )
+ attachConsole = main.LincOE1.attachLincOESession()
+ print "attachConsole = ", attachConsole
+
+ main.step( "Bring a port down and verify the link state" )
+ main.LincOE1.portDown( swId="9", ptId="20" )
+ linksNonjson = main.ONOScli3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+
+ linkInactiveCount = linksNonjson.count("state=INACTIVE")
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 2:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+
+ links = main.ONOScli3.links()
+ main.log.info( "links = " + links )
+
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "20":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+ 'dst' ][ 'port' ] == "50":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+
+ print "links_state_result = ", linksStateResult
+ time.sleep( 10 )
+ #flowHandle = main.ONOScli3.flows()
+ #main.log.info( "flows :" + flowHandle )
+
+ main.step( "Verify Rerouting by a ping test" )
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.TRUE:
+ main.log.report( "Ping test successful " )
+ if PingResult == main.FALSE:
+ main.log.report( "Ping test failed" )
+
+ case24Result = PingResult and linksStateResult
+ utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed" )
diff --git a/TestON/tests/MultiProd/MultiProd.topo b/TestON/tests/MultiProd/MultiProd.topo
index 28dfa92..040ec67 100755
--- a/TestON/tests/MultiProd/MultiProd.topo
+++ b/TestON/tests/MultiProd/MultiProd.topo
@@ -94,5 +94,25 @@
<controller> remote </controller>
</COMPONENTS>
</Mininet2>
+
+ <LincOE1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>LincOEDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE1>
+
+ <LincOE2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE2>
</COMPONENT>
</TOPOLOGY>
diff --git a/TestON/tests/MultiProd13/MultiProd13.params b/TestON/tests/MultiProd13/MultiProd13.params
index 6e5c85e..3767ab9 100755
--- a/TestON/tests/MultiProd13/MultiProd13.params
+++ b/TestON/tests/MultiProd13/MultiProd13.params
@@ -1,16 +1,19 @@
<PARAMS>
-
- <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8</testcases>
+ <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8,20,21,22,10,23,24</testcases>
#Environment variables
<ENV>
<cellName>multi_test</cellName>
</ENV>
+ <GIT>
+ <pull>False</pull>
+ </GIT>
+
<CTRL>
<ip1>10.128.20.11</ip1>
- <ip2>10.128.20.12</ip2>
- <ip3>10.128.20.13</ip3>
+ <ip2>10.128.20.12</ip2>
+ <ip3>10.128.20.13</ip3>
<port1>6633</port1>
<port2>6633</port2>
<port3>6633</port3>
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index 6c0b8d7..ee62ce7 100644
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -35,6 +35,7 @@
ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
main.case( "Setting up test environment" )
main.log.report(
@@ -52,19 +53,25 @@
main.step( "Removing raft logs before a clen installation of ONOS" )
removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
- main.step( "Git checkout, pull and get version" )
- #main.ONOSbench.gitCheckout( "master" )
- gitPullResult = main.ONOSbench.gitPull()
- main.log.info( "git_pull_result = " + str( gitPullResult ))
- versionResult = main.ONOSbench.getVersion( report=True )
-
- if gitPullResult == 1:
- main.step( "Using mvn clean & install" )
- cleanInstallResult = main.ONOSbench.cleanInstall()
- # cleanInstallResult = main.TRUE
-
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
+ main.step( "Git checkout and get version" )
+ main.ONOSbench.gitCheckout( "master" )
+ if gitPull == 'True':
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ main.ONOSbench.cleanInstall()
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+ elif gitPullResult == 0:
+ main.log.report(
+ "Git Pull Failed, look into logs for detailed reason" )
+ main.cleanup()
+ main.exit()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ else:
+ main.log.info( "Skipping git pull" )
+ main.ONOSbench.getVersion( report=True )
+ packageResult = main.TRUE
# main.step( "Creating a cell" )
# cellCreateResult = main.ONOSbench.createCellFile( **************
@@ -215,6 +222,14 @@
main.log.report( "Controller assignment successfull" )
else:
main.log.report( "Controller assignment failed" )
+ appInstallResult = main.TRUE
+ main.log.info( "Activating reactive forwarding app" )
+ appInstallResult = main.ONOScli1.activateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli1.apps() )
+ main.log.warn( main.ONOScli1.appIDs() )
+ time.sleep( 30 )
# REACTIVE FWD test
main.step( "Pingall" )
pingResult = main.FALSE
@@ -248,7 +263,7 @@
ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
main.log.report(
- "This testcase is testing if all ONOS nodes are in topologyi" +
+ "This testcase is testing if all ONOS nodes are in topology" +
" sync with mininet and its peer ONOS nodes" )
main.log.report( "__________________________________" )
main.case(
@@ -371,7 +386,6 @@
onpass="ONOS3 Switches view is correct",
onfail="ONOS3 Switches view is incorrect" )
- """
portsResults1 = main.Mininet1.comparePorts( MNTopo,
json.loads( ports1 ) )
utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
@@ -389,7 +403,7 @@
utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
onpass="ONOS3 Ports view is correct",
onfail="ONOS3 Ports view is incorrect" )
- """
+
linksResults1 = main.Mininet1.compareLinks(
MNTopo,
json.loads( links1 ) )
@@ -433,17 +447,17 @@
onfail="Topology Check Test NOT successful" )
def CASE10( self ):
+ import time
main.log.report(
"This testcase uninstalls the reactive forwarding app" )
main.log.report( "__________________________________" )
main.case( "Uninstalling reactive forwarding app" )
# Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult1 = main.ONOScli1.featureUninstall(
- "onos-app-fwd" )
- appUninstallResult2 = main.ONOScli2.featureUninstall(
- "onos-app-fwd" )
- appUninstallResult3 = main.ONOScli3.featureUninstall(
- "onos-app-fwd" )
+ appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli1.apps() )
+ main.log.warn( main.ONOScli1.appIDs() )
main.log.info( "onos-app-fwd uninstalled" )
# After reactive forwarding is disabled,
@@ -453,9 +467,7 @@
hosts = main.ONOScli1.hosts()
main.log.info( hosts )
-
- case10Result = appUninstallResult1 and\
- appUninstallResult2 and appUninstallResult3
+ case10Result = appInstallResult
utilities.assertEquals(
expect=main.TRUE,
actual=case10Result,
@@ -504,6 +516,7 @@
hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:11/-1",
"00:00:00:00:00:1B/-1" )
"""
+ intentsId = []
for i in range( 8, 18 ):
main.log.info(
"Adding host intent between h" + str( i ) +
@@ -517,8 +530,14 @@
host1Id = main.ONOScli1.getHost( host1 )[ 'id' ]
host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
tmpResult = main.ONOScli1.addHostIntent( host1Id, host2Id )
+ intentsId.append( tmpResult )
+
+ checkIntent1 = main.ONOScli1.checkIntentState( intentsId )
+ checkIntent2 = main.ONOScli2.checkIntentState( intentsId )
+ checkIntent3 = main.ONOScli3.checkIntentState( intentsId )
flowHandle = main.ONOScli1.flows()
+
main.log.info( "flows:" + flowHandle )
count = 1
@@ -571,6 +590,10 @@
if PingResult == main.TRUE:
main.log.report( "Host intents have been installed correctly" )
+ checkIntent1 = main.ONOScli1.checkIntentState( intentsId )
+ checkIntent2 = main.ONOScli2.checkIntentState( intentsId )
+ checkIntent3 = main.ONOScli3.checkIntentState( intentsId )
+
case6Result = PingResult
utilities.assertEquals(
expect=main.TRUE,
@@ -637,8 +660,8 @@
main.step( "Determine the current number of switches and links" )
topologyOutput = main.ONOScli1.topology()
topologyResult = main.ONOSbench.getTopology( topologyOutput )
- activeSwitches = topologyResult[ 'deviceCount' ]
- links = topologyResult[ 'linkCount' ]
+ activeSwitches = topologyResult[ 'devices' ]
+ links = topologyResult[ 'links' ]
main.log.info(
"Currently there are %s switches and %s links" %
( str( activeSwitches ), str( links ) ) )
@@ -881,14 +904,20 @@
main.step(
"Iterate through the intentids list and remove each intent" )
for id in intentids:
- main.ONOScli1.removeIntent( intentId=id )
+ main.ONOScli1.removeIntent( intentId=id ,purge=True )
- intentResult = main.ONOScli1.intents( jsonFormat=False )
- main.log.info( "intent_result = " + intentResult )
+ remainingIntent = main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Remaining intents " + remainingIntent )
+
case8Result = main.TRUE
-
+ intentResult = main.TRUE
+ if remainingIntent:
+ main.log.error( "There are still remaining intent" )
+ intentResult = main.FALSE
i = 8
+
PingResult = main.TRUE
+ """
while i < 18:
main.log.info(
"\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
@@ -903,7 +932,6 @@
else:
main.log.info( "Unknown error" )
PingResult = main.ERROR
-
# Note: If the ping result failed, that means the intents have been
# withdrawn correctly.
if PingResult == main.TRUE:
@@ -912,17 +940,17 @@
# main.exit()
if PingResult == main.FALSE:
main.log.report( "Host intents have been withdrawn correctly" )
+ """
+ case8Result = intentResult
- case8Result = case8Result and PingResult
-
- if case8Result == main.FALSE:
+ if case8Result == main.TRUE:
main.log.report( "Intent removal successful" )
else:
main.log.report( "Intent removal failed" )
- utilities.assertEquals( expect=main.FALSE, actual=case8Result,
- onpass="Intent removal test failed",
- onfail="Intent removal test successful" )
+ utilities.assertEquals( expect=main.TRUE, actual=case8Result,
+ onpass="Intent removal test successful",
+ onfail="Intent removal test failed" )
def CASE9( self ):
"""
@@ -941,28 +969,38 @@
main.step(
"Add point-to-point intents for mininet hosts" +
" h8 and h18 or ONOS hosts h8 and h12" )
+ macsDict = {}
+ for i in range( 1,29 ):
+ macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) )
+ print macsDict
+ # main.step(var1)
ptpIntentResult = main.ONOScli1.addPointIntent(
- "of:0000000000003008/1",
- "of:0000000000006018/1" )
+ ingressDevice="of:0000000000003008/1",
+ egressDevice="of:0000000000006018/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h8' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
ptpIntentResult = main.ONOScli1.addPointIntent(
- "of:0000000000006018/1",
- "of:0000000000003008/1" )
+ ingressDevice="of:0000000000006018/1",
+ egressDevice="of:0000000000003008/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h18' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts" +
- " h9 and h19 or ONOS hosts h9 and h13" )
+ var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+ main.step(var2)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003009/1",
- "of:0000000000006019/1" )
+ "of:0000000000006019/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h9' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -970,18 +1008,22 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006019/1",
- "of:0000000000003009/1" )
+ "of:0000000000003009/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h19' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet" +
- " hosts h10 and h20 or ONOS hosts hA and h14" )
+ var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+ main.step(var3)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003010/1",
- "of:0000000000006020/1" )
+ "of:0000000000006020/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h10' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -989,18 +1031,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006020/1",
- "of:0000000000003010/1" )
+ "of:0000000000003010/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h20' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet" +
- " hosts h11 and h21 or ONOS hosts hB and h15" )
+ var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+ " ONOS hosts hB and h15"
+ main.case(var4)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003011/1",
- "of:0000000000006021/1" )
+ "of:0000000000006021/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h11' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1008,18 +1056,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006021/1",
- "of:0000000000003011/1" )
+ "of:0000000000003011/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h21' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet" +
- " hosts h12 and h22 or ONOS hosts hC and h16" )
+ var5 = "Add point intents for mininet hosts h12 and h22 " +\
+ "ONOS hosts hC and h16"
+ main.case(var5)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003012/1",
- "of:0000000000006022/1" )
+ "of:0000000000006022/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h12' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1027,18 +1081,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006022/1",
- "of:0000000000003012/1" )
+ "of:0000000000003012/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h22' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet " +
- "hosts h13 and h23 or ONOS hosts hD and h17" )
+ var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+ " ONOS hosts hD and h17"
+ main.case(var6)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003013/1",
- "of:0000000000006023/1" )
+ "of:0000000000006023/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h13' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1046,18 +1106,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006023/1",
- "of:0000000000003013/1" )
+ "of:0000000000003013/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h23' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts" +
- " h14 and h24 or ONOS hosts hE and h18" )
+ var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+ " ONOS hosts hE and h18"
+ main.case(var7)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003014/1",
- "of:0000000000006024/1" )
+ "of:0000000000006024/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h14' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1065,18 +1131,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006024/1",
- "of:0000000000003014/1" )
+ "of:0000000000003014/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h24' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts" +
- " h15 and h25 or ONOS hosts hF and h19" )
+ var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+ " ONOS hosts hF and h19"
+ main.case(var8)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003015/1",
- "of:0000000000006025/1" )
+ "of:0000000000006025/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h15' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1084,18 +1156,24 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006025/1",
- "of:0000000000003015/1" )
+ "of:0000000000003015/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h25' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts" +
- " h16 and h26 or ONOS hosts h10 and h1A" )
+ var9 = "Add intents for mininet hosts h16 and h26 or" +\
+ " ONOS hosts h10 and h1A"
+ main.case(var9)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003016/1",
- "of:0000000000006026/1" )
+ "of:0000000000006026/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h16' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
@@ -1103,37 +1181,41 @@
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006026/1",
- "of:0000000000003016/1" )
+ "of:0000000000003016/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h26' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
- main.step(
- "Add point-to-point intents for mininet hosts h17" +
- " and h27 or ONOS hosts h11 and h1B" )
+ var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+ " ONOS hosts h11 and h1B"
+ main.case(var10)
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000003017/1",
- "of:0000000000006027/1" )
+ "of:0000000000006027/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h17' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOScli1.intents()
main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
+ #main.log.info( getIntentResult )
ptpIntentResult = main.ONOScli1.addPointIntent(
"of:0000000000006027/1",
- "of:0000000000003017/1" )
- if ptpIntentResult == main.TRUE:
- getIntentResult = main.ONOScli1.intents()
- main.log.info( "Point to point intent install successful" )
- # main.log.info( getIntentResult )
+ "of:0000000000003017/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h27' ))
print(
"_______________________________________________________" +
"________________________________" )
flowHandle = main.ONOScli1.flows()
- # print "flowHandle = ", flowHandle
+ print "flowHandle = ", flowHandle
main.log.info( "flows :" + flowHandle )
count = 1
@@ -1226,13 +1308,13 @@
host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
for host in hostsJson:
if host[ 'id' ] == host1Id:
- ip1 = host[ 'ips' ][ 0 ]
+ ip1 = host[ 'ipAddresses' ][ 0 ]
ip1 = str( ip1 + "/32" )
- device1 = host[ 'location' ][ 'device' ]
+ device1 = host[ 'location' ][ 'elementId' ]
device1 = str( device1 + "/1" )
elif host[ 'id' ] == host2Id:
- ip2 = str( host[ 'ips' ][ 0 ] ) + "/32"
- device2 = host[ 'location' ][ "device" ]
+ ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32"
+ device2 = host[ 'location' ][ 'elementId' ]
device2 = str( device2 + "/1" )
pIntentResult1 = main.ONOScli1.addPointIntent(
@@ -1241,7 +1323,7 @@
ipSrc=ip1,
ipDst=ip2,
ethType=main.params[ 'SDNIP' ][ 'ethType' ],
- ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] )
+ ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ], )
getIntentResult = main.ONOScli1.intents( jsonFormat=False )
main.log.info( getIntentResult )
@@ -1256,7 +1338,7 @@
getIntentResult = main.ONOScli1.intents( jsonFormat=False )
main.log.info( getIntentResult )
- if ( pIntentResult1 and pIntentResult2 ) == main.TRUE:
+ if ( pIntentResult1 and pIntentResult2 ) :
# getIntentResult = main.ONOScli1.intents()
# main.log.info( getIntentResult )
main.log.info(
@@ -1322,7 +1404,7 @@
"Ping all test after Point intents related to" +
" SDN-IP matching on ICMP successful" )
- case31Result = PingResult and pIntentResult1 and pIntentResult2
+ case31Result = PingResult
utilities.assertEquals(
expect=main.TRUE,
actual=case31Result,
@@ -1378,13 +1460,13 @@
host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
for host in hostsJson:
if host[ 'id' ] == host1Id:
- ip1 = host[ 'ips' ][ 0 ]
+ ip1 = host[ 'ipAddresses' ][ 0 ]
ip1 = str( ip1 + "/32" )
- device1 = host[ 'location' ][ 'device' ]
+ device1 = host[ 'location' ][ 'elementId' ]
device1 = str( device1 + "/1" )
elif host[ 'id' ] == host2Id:
- ip2 = str( host[ 'ips' ][ 0 ] ) + "/32"
- device2 = host[ 'location' ][ "device" ]
+ ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32"
+ device2 = host[ 'location' ][ 'elementId' ]
device2 = str( device2 + "/1" )
pIntentResult1 = main.ONOScli1.addPointIntent(
@@ -1421,11 +1503,10 @@
ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ],
tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] )
- pIntentResult = pIntentResult1 and pIntentResult2 and\
- pIntentResult3 and pIntentResult4
- if pIntentResult == main.TRUE:
- getIntentResult = main.ONOScli1.intents( jsonFormat=False )
- main.log.info( getIntentResult )
+ getIntentResult = main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( getIntentResult )
+ pIntentResult = main.TRUE
+ if getIntentResult:
main.log.report(
"Point intent related to SDN-IP matching" +
" on TCP install successful" )
@@ -1433,6 +1514,7 @@
main.log.report(
"Point intent related to SDN-IP matching" +
" on TCP install failed" )
+ pIntentResult = main.FALSE
iperfResult = main.Mininet1.iperf( 'h8', 'h18' )
if iperfResult == main.TRUE:
@@ -1481,14 +1563,14 @@
"Installing multipoint to single point " +
"intent with rewrite mac address" )
main.step( "Uninstalling proxy arp app" )
- # Unistall onos-app-proxyarp app to disable reactive forwarding
- appUninstallResult1 = main.ONOScli1.featureUninstall(
- "onos-app-proxyarp" )
- appUninstallResult2 = main.ONOScli2.featureUninstall(
- "onos-app-proxyarp" )
- appUninstallResult3 = main.ONOScli3.featureUninstall(
- "onos-app-proxyarp" )
- main.log.info( "onos-app-proxyarp uninstalled" )
+ # deactivating proxyarp app
+ appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.proxyarp" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOScli1.apps() )
+ main.log.warn( main.ONOScli1.appIDs() )
+ time.sleep( 30 )
+ main.log.info( "onos-app-proxyarp deactivated" )
main.step( "Changing ipaddress of hosts h8,h9 and h18" )
main.Mininet1.changeIP(
@@ -1603,7 +1685,7 @@
" and h" +
str( i +
2 ) +
- "passed!" )
+ " passed!" )
PingResult = main.TRUE
else:
main.log.info( "Unknown error" )
@@ -1629,3 +1711,388 @@
" intent addition with rewrite mac address successful",
onfail="Ping all test after multipoint to single point intent" +
" addition with rewrite mac address failed" )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ import time
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+ ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+ ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ 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()
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ time.sleep( 5 )
+ main.step( "Uninstalling ONOS package" )
+ onos1UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS1Ip)
+ onos2UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS2Ip)
+ onos3UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS3Ip)
+ onosUninstallResult = onos1UninstallResult and onos2UninstallResult \
+ and onos3UninstallResult
+ time.sleep( 15 )
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS1Ip )
+ onos2InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS2Ip )
+ onos3InstallResult = main.ONOSbench.onosInstall(
+ options="-f",
+ node=ONOS3Ip )
+ onosInstallResult = onos1InstallResult and onos2InstallResult and\
+ onos3InstallResult
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ time.sleep( 10 )
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+ onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+ onosIsup = onos1Isup and onos2Isup and onos3Isup
+ if onosIsup == main.TRUE:
+ main.log.report( "ONOS instances are up and ready" )
+ else:
+ main.log.report( "ONOS instances may not be up" )
+
+ main.step( "Starting ONOS service" )
+ time.sleep( 10 )
+ startResult = main.TRUE
+ # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+ startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+ startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+ startResult = startcli1 and startcli2 and startcli3
+ if startResult == main.TRUE:
+ main.log.report( "ONOS cli starts properly" )
+ case20Result = mininetDisconnect and cellResult and verifyResult \
+ and onosInstallResult and onosIsup and startResult
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case20Result,
+ onpass= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS successful",
+ onfail= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS failed" )
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+ which spawns packet optical topology and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+ main.step( "Starting LINC-OE and other components" )
+ main.log.info( "Activate optical app" )
+ appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
+ appCheck = main.ONOScli1.appToIDCheck()
+ appCheck = appCheck and main.ONOScli2.appToIDCheck()
+ appCheck = appCheck and main.ONOScli3.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( "Checking ONOS application unsuccesful" )
+
+ ctrllerIP = []
+ ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
+ #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
+ #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
+ opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
+ case21Result = opticalMnScript and appInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed" )
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 10 optical switches(ROADM's) and
+ 6 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 10,
+ packetLayerSWCount variable = 6, hostCount=6 and
+ links=46.
+ All this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ import time
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+ main.step( "Topology comparision" )
+ devicesResult = main.ONOScli3.devices( jsonFormat=False )
+ time.sleep( 15 )
+ print "devices_result = ", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 10:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+
+ if packetLayerSWCount == 6:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ print "_________________________________"
+
+ linksResult = main.ONOScli3.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+ linkActiveCount = linksResult.count("state=ACTIVE")
+ main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+ if linkActiveCount == 46:
+ linkActiveResult = main.TRUE
+ main.log.info(
+ "Number of links in ACTIVE state are correct")
+ else:
+ linkActiveResult = main.FALSE
+ main.log.info(
+ "Number of links in ACTIVE state are wrong")
+
+ case22Result = opticalSWResult and packetSWResult and \
+ linkActiveResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Topology comparision" )
+ main.step( "Adding point intents" )
+ ptpIntentResult = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0005/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ ptpIntentResult = main.ONOScli1.addPointIntent(
+ "of:0000ffffffff0005/1",
+ "of:0000ffffffff0001/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ time.sleep( 30 )
+ #flowHandle = main.ONOScli1.flows()
+ #main.log.info( "flows :" + flowHandle )
+
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 60 )
+ intentHandle = main.ONOScli1.intents( jsonFormat=False )
+ main.log.info( "intents :" + intentHandle )
+
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Point intents for packet optical have not ben installed" +
+ " correctly. Cleaning up" )
+ if PingResult == main.TRUE:
+ main.log.report(
+ "Point Intents for packet optical have been " +
+ "installed correctly" )
+
+ case23Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case23Result,
+ onpass= "Point intents addition for packet optical and" +
+ "Pingall Test successful",
+ onfail= "Point intents addition for packet optical and" +
+ "Pingall Test NOT successful" )
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ LINC uses its own switch IDs. You can use the following
+ command on the LINC console to find the mapping between
+ DPIDs and LINC IDs.
+ rp(application:get_all_key(linc)).
+
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+ so that link
+ ( between switch1 port20 - switch5 port50 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+ main.step( "Attach to the Linc-OE session" )
+ attachConsole = main.LincOE1.attachLincOESession()
+ print "attachConsole = ", attachConsole
+
+ main.step( "Bring a port down and verify the link state" )
+ main.LincOE1.portDown( swId="9", ptId="20" )
+ linksNonjson = main.ONOScli3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+
+ linkInactiveCount = linksNonjson.count("state=INACTIVE")
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 2:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+
+ links = main.ONOScli3.links()
+ main.log.info( "links = " + links )
+
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "20":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+ 'dst' ][ 'port' ] == "50":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+
+ print "links_state_result = ", linksStateResult
+ time.sleep( 10 )
+ #flowHandle = main.ONOScli3.flows()
+ #main.log.info( "flows :" + flowHandle )
+
+ main.step( "Verify Rerouting by a ping test" )
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.TRUE:
+ main.log.report( "Ping test successful " )
+ if PingResult == main.FALSE:
+ main.log.report( "Ping test failed" )
+
+ case24Result = PingResult and linksStateResult
+ utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed" )
diff --git a/TestON/tests/MultiProd13/MultiProd13.topo b/TestON/tests/MultiProd13/MultiProd13.topo
index a4fad91..4b1ab12 100755
--- a/TestON/tests/MultiProd13/MultiProd13.topo
+++ b/TestON/tests/MultiProd13/MultiProd13.topo
@@ -94,5 +94,25 @@
<controller> remote </controller>
</COMPONENTS>
</Mininet2>
+
+ <LincOE1>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>LincOEDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE1>
+
+ <LincOE2>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </LincOE2>
</COMPONENT>
</TOPOLOGY>
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index a91e17c..398ee96 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -1,25 +1,26 @@
<PARAMS>
- # 1,20,3,[40,5,60,70,80,10,90,71,81,10,93,10]*50,22,3,[41,5,61,72,82,10,91,73,83,10,94,10]*50,22,3,[42,5,62,10,92,10]*50
- # 1. ONOS brinup Test case
- # 2. Assign and Balance all Mininet switches across controllers
- # 3. Collect reference toplogy for topo compare
- # 4. Enable Reactive forwarding, Verify ping all and disable onos-app-fwd
- # 5. Compare curent topoology with reference
- # 6. Install 300 host intents and verify ping all
- # 7. Randomly bring some core links down and verify pingall
- # 8. Bring core links Up that were down and verify pingall
- # 9. Install 300 point intents and verify ping all
- # 10. Remove all intents on ONOS
+ # 1,20,3,[40,5,60,70,80,10,90,71,81,10,93,10]*50,21,3,[41,5,61,72,82,10,91,73,83,10,94,10]*50,22,3,[42,5,62,10,92,10,95,10,98,10]*50
+ # 1. Starts ONOS cluster with 5 nodes
+ # 20. Starts Att Topology
+ # 21. Starts Chordal Topology
+ # 22. Starts Spine-Leaf Topology
+ # 3. Checks the consistency of ONOS and Mininet's topologies
+ # 4X. Reactive forwarding | host discovery
+ # 5. ONOS Topology verification
+ # 6X. host intents
+ # 7X. Bring random links down( Unique for each topology)
+ # 8X. Bring random links back up
+ # 9X Point,Multi-single,Single-Multi Intents
- <testcases>1,20,3,[40,5,60,70,80,10,90,71,81,10,93,10]*50,22,3,[41,5,61,72,82,10,91,73,83,10,94,10]*50,22,3,[42,5,62,10,92,10]*50</testcases>
+ <testcases>1,20,3,[40,5,60,70,80,10,90,71,81,10]*50,21,3,[41,5,61,72,82,10,91,73,83,10]*50,22,3,[42,5,62,74,84,10,92,10]*50</testcases>
<ENV>
- <cellName>choTest5</cellName>
+ <cellName>choTest3</cellName>
</ENV>
- <GIT>
+ <GIT>
#autoPull 'on' or 'off'
<autoPull>off</autoPull>
<branch>master</branch>
- </GIT>-t
+ </GIT>
<TOPO1>
<topo>~/mininet/custom/topoAtt.py</topo>
<numSwitches>25</numSwitches>
@@ -42,24 +43,20 @@
<numPaths>1</numPaths>
</TOPO3>
<CTRL>
- <numCtrl>5</numCtrl>
- <ip1>10.128.10.21</ip1>
- <port1>6633</port1>
- <ip2>10.128.10.22</ip2>
- <port2>6633</port2>
- <ip3>10.128.10.23</ip3>
- <port3>6633</port3>
- <ip4>10.128.10.24</ip4>
- <port4>6633</port4>
- <ip5>10.128.10.25</ip5>
- <port5>6633</port5>
+ <numCtrl>3</numCtrl>
+ <ip1>10.128.40.41</ip1>
+ <port1>6633</port1>
+ <ip2>10.128.40.42</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.40.43</ip3>
+ <port3>6633</port3>
</CTRL>
<HOSTS>
<startMAC>00:00:00:00:00:01</startMAC>
<endMAC>00:00:00:00:00:19</endMAC>
</HOSTS>
<ATTCORELINKS>
- <toggleLinks>3</toggleLinks>
+ <toggleLinks>1</toggleLinks>
<linkS3a>s3</linkS3a>
<linkS3b>s1,s4,s7,s10,s16,s17,s18,s21,s22</linkS3b>
@@ -84,8 +81,8 @@
</SPINECORELINKS>
<timers>
- <LinkDiscovery>1</LinkDiscovery>
- <SwitchDiscovery>1</SwitchDiscovery>
+ <LinkDiscovery>10</LinkDiscovery>
+ <SwitchDiscovery>10</SwitchDiscovery>
</timers>
</PARAMS>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index d5b9400..1bd0696 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -32,13 +32,13 @@
main.ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
main.ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
main.ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
- main.ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
- main.ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
+ #main.ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
+ #main.ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
main.ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
main.ONOS2_port = main.params[ 'CTRL' ][ 'port2' ]
main.ONOS3_port = main.params[ 'CTRL' ][ 'port3' ]
- main.ONOS4_port = main.params[ 'CTRL' ][ 'port4' ]
- main.ONOS5_port = main.params[ 'CTRL' ][ 'port5' ]
+ #main.ONOS4_port = main.params[ 'CTRL' ][ 'port4' ]
+ #main.ONOS5_port = main.params[ 'CTRL' ][ 'port5' ]
cell_name = main.params[ 'ENV' ][ 'cellName' ]
git_pull = main.params[ 'GIT' ][ 'autoPull' ]
git_branch = main.params[ 'GIT' ][ 'branch' ]
@@ -158,7 +158,7 @@
main.log.info("Successful CLI startup")
startCliResult = main.TRUE
case1Result = installResult and uninstallResult and statusResult and startCliResult
-
+ time.sleep(30)
main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
utilities.assert_equals( expect=main.TRUE, actual=case1Result,
onpass="Set up test environment PASS",
@@ -175,7 +175,7 @@
main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
- main.pingTimeout = 60
+ main.pingTimeout = 300
main.log.report(
"Load Att topology and Balance all Mininet switches across controllers" )
main.log.report(
@@ -190,23 +190,19 @@
main.step( "Start Mininet with Att topology" )
main.newTopo = main.params['TOPO1']['topo']
startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
-
+ time.sleep(45)
main.step( "Assign switches to controllers" )
for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
main.Mininet1.assignSwController(
sw=str( i ),
- count= 1 ,
+ count=int( main.numCtrls ),
ip1=main.ONOS1_ip,
port1=main.ONOS1_port,
ip2=main.ONOS2_ip,
port2=main.ONOS2_port,
ip3=main.ONOS3_ip,
- port3=main.ONOS3_port,
- ip4=main.ONOS4_ip,
- port4=main.ONOS4_port,
- ip5=main.ONOS5_ip,
- port5=main.ONOS5_port )
- time.sleep(2)
+ port3=main.ONOS3_port )
+
switch_mastership = main.TRUE
for i in range( 1, ( main.numMNswitches + 1 ) ):
response = main.Mininet1.getSwController( "s" + str( i ) )
@@ -240,16 +236,15 @@
if topoFailed:
main.log.info("Att topology failed to start correctly")
"""
- time.sleep(15)
+ time.sleep(45)
#Don't balance master for now..
- """main.step( "Balance devices across controllers" )
+ main.step( "Balance devices across controllers" )
for i in range( int( main.numCtrls ) ):
balanceResult = main.ONOScli1.balanceMasters()
# giving some breathing time for ONOS to complete re-balance
- time.sleep( 3 )
+ time.sleep( 5 )
topology_output = main.ONOScli1.topology()
topology_result = main.ONOSbench.getTopology( topology_output )
- """
case2Result = ( switch_mastership and startStatus )
utilities.assert_equals(
expect=main.TRUE,
@@ -269,7 +264,7 @@
main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
- main.pingTimeout = 120
+ main.pingTimeout = 300
main.log.report(
"Load Chordal topology and Balance all Mininet switches across controllers" )
main.log.report(
@@ -277,8 +272,8 @@
main.case(
"Assign and Balance all Mininet switches across controllers" )
main.step( "Stop any previous Mininet network topology" )
- stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
- #time.sleep(10)
+ stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
+ time.sleep(10)
main.step( "Start Mininet with Chordal topology" )
startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
time.sleep(15)
@@ -292,11 +287,7 @@
ip2=main.ONOS2_ip,
port2=main.ONOS2_port,
ip3=main.ONOS3_ip,
- port3=main.ONOS3_port,
- ip4=main.ONOS4_ip,
- port4=main.ONOS4_port,
- ip5=main.ONOS5_ip,
- port5=main.ONOS5_port )
+ port3=main.ONOS3_port )
switch_mastership = main.TRUE
for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -313,14 +304,12 @@
main.log.report( "Controller assignment failed" )
time.sleep( 5 )
- #Don't balance master for now..
- """
main.step( "Balance devices across controllers" )
for i in range( int( main.numCtrls ) ):
balanceResult = main.ONOScli1.balanceMasters()
# giving some breathing time for ONOS to complete re-balance
time.sleep( 3 )
- """
+
case21Result = switch_mastership
time.sleep(30)
utilities.assert_equals(
@@ -341,7 +330,7 @@
main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
- main.pingTimeout = 400
+ main.pingTimeout = 600
main.log.report(
"Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
@@ -351,25 +340,21 @@
main.case(
"Assign and Balance all Mininet switches across controllers" )
main.step( "Stop any previous Mininet network topology" )
- #stopStatus = main.Mininet1.stopNet(fileName = "topoSpine" )
+ stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
main.step( "Start Mininet with Spine topology" )
startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
- time.sleep(20)
+ time.sleep(60)
main.step( "Assign switches to controllers" )
for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
main.Mininet1.assignSwController(
sw=str( i ),
- count= 1,
+ count=int( main.numCtrls ),
ip1=main.ONOS1_ip,
port1=main.ONOS1_port,
ip2=main.ONOS2_ip,
port2=main.ONOS2_port,
ip3=main.ONOS3_ip,
- port3=main.ONOS3_port,
- ip4=main.ONOS4_ip,
- port4=main.ONOS4_port,
- ip5=main.ONOS5_ip,
- port5=main.ONOS5_port )
+ port3=main.ONOS3_port )
switch_mastership = main.TRUE
for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -385,22 +370,15 @@
else:
main.log.report( "Controller assignment failed" )
time.sleep( 5 )
- """
- main.step( "Balance devices across controllers" )
-
- for i in range( int( main.numCtrls ) ):
- balanceResult = main.ONOScli1.balanceMasters()
- # giving some breathing time for ONOS to complete re-balance
- time.sleep( 3 )
main.step( "Balance devices across controllers" )
for i in range( int( main.numCtrls ) ):
balanceResult = main.ONOScli1.balanceMasters()
# giving some breathing time for ONOS to complete re-balance
time.sleep( 3 )
- """
+
case22Result = switch_mastership
- time.sleep(30)
+ time.sleep(60)
utilities.assert_equals(
expect=main.TRUE,
actual=case22Result,
@@ -428,8 +406,8 @@
main.step( "Collect and store current number of switches and links" )
topology_output = main.ONOScli1.topology()
topology_result = main.ONOSbench.getTopology( topology_output )
- numOnosDevices = topology_result[ 'deviceCount' ]
- numOnosLinks = topology_result[ 'linkCount' ]
+ numOnosDevices = topology_result[ 'devices' ]
+ numOnosLinks = topology_result[ 'links' ]
topoResult = main.TRUE
if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ):
@@ -453,7 +431,6 @@
linksResult = ansi_escape.sub( '', linksResult )
linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
linksResult = linksResult.splitlines()
- linksResult = linksResult[ 1: ]
main.deviceLinks = copy.copy( linksResult )
print "Device Links Stored: \n", str( main.deviceLinks )
# this will be asserted to check with the params provided count of
@@ -476,9 +453,9 @@
for thread in pool:
thread.join()
portResult = thread.result
- portTemp = re.split( r'\t+', portResult )
- portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
- main.devicePortsEnabledCount.append( portCount )
+ #portCount = re.split( r'\t+', portResult )
+ #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+ main.devicePortsEnabledCount.append( portResult )
print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
time2 = time.time()
main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
@@ -503,9 +480,9 @@
for thread in pool:
thread.join()
linkCountResult = thread.result
- linkCountTemp = re.split( r'\t+', linkCountResult )
- linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
- main.deviceActiveLinksCount.append( linkCount )
+ #linkCount = re.split( r'\t+', linkCountResult )
+ #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+ main.deviceActiveLinksCount.append( linkCountResult )
print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
time2 = time.time()
main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
@@ -601,7 +578,7 @@
main.log.warn( main.CLIs[0].appIDs() )
# Waiting for reative flows to be cleared.
- time.sleep( 10 )
+ time.sleep( 30 )
case40Result = installResult and uninstallResult and ping_result
utilities.assert_equals( expect=main.TRUE, actual=case40Result,
onpass="Reactive Mode Pingall test PASS",
@@ -681,7 +658,7 @@
main.log.warn( main.CLIs[0].appIDs() )
# Waiting for reative flows to be cleared.
- time.sleep( 10 )
+ time.sleep( 30 )
case41Result = installResult and uninstallResult and ping_result
utilities.assert_equals( expect=main.TRUE, actual=case41Result,
onpass="Reactive Mode Pingall test PASS",
@@ -761,7 +738,7 @@
main.log.warn( main.CLIs[0].appIDs() )
# Waiting for reative flows to be cleared.
- time.sleep( 10 )
+ time.sleep( 30 )
case42Result = installResult and uninstallResult and ping_result
utilities.assert_equals( expect=main.TRUE, actual=case42Result,
onpass="Reactive Mode Pingall test PASS",
@@ -803,10 +780,10 @@
for thread in pool:
thread.join()
portResult = thread.result
- portTemp = re.split( r'\t+', portResult )
- portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
- devicePortsEnabledCountTemp.append( portCount )
- print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
+ #portTemp = re.split( r'\t+', portResult )
+ #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+ devicePortsEnabledCountTemp.append( portResult )
+
time2 = time.time()
main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
main.log.info (
@@ -827,10 +804,12 @@
for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
pool = []
for cli in main.CLIs:
+ if i >= main.numMNswitches + 1:
+ break
dpid = "of:00000000000000" + format( i,'02x' )
t = main.Thread(target = cli.getDeviceLinksActiveCount,
threadID = main.threadID,
- name = "getDevicePortsEnabledCount",
+ name = "getDeviceLinksActiveCount",
args = [dpid])
t.start()
pool.append(t)
@@ -839,10 +818,10 @@
for thread in pool:
thread.join()
linkCountResult = thread.result
- linkCountTemp = re.split( r'\t+', linkCountResult )
- linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
- deviceActiveLinksCountTemp.append( linkCount )
- print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
+ #linkCountTemp = re.split( r'\t+', linkCountResult )
+ #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+ deviceActiveLinksCountTemp.append( linkCountResult )
+
time2 = time.time()
main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
main.log.info (
@@ -906,7 +885,7 @@
print "len of intent state results", str(len(getIntentStateResult))
print getIntentStateResult
# Takes awhile for all the onos to get the intents
- time.sleep( 15 )
+ time.sleep( 30 )
"""intentState = main.TRUE
for i in getIntentStateResult:
if getIntentStateResult.get( 'state' ) != 'INSTALLED':
@@ -916,7 +895,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -978,7 +957,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1039,7 +1018,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1096,15 +1075,17 @@
END1=link1End1,
END2=main.randomLink1[ i ],
OPTION="down" )
+ time.sleep( link_sleep )
main.Mininet1.link(
END1=link2End1,
END2=main.randomLink2[ i ],
OPTION="down" )
+ time.sleep( link_sleep )
main.Mininet1.link(
END1=link3End1,
END2=main.randomLink3[ i ],
OPTION="down" )
- time.sleep( link_sleep )
+ time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
linkDown = main.ONOSbench.checkStatus(
@@ -1160,15 +1141,17 @@
END1=link1End1,
END2=main.randomLink1[ i ],
OPTION="up" )
+ time.sleep( link_sleep )
main.Mininet1.link(
END1=link2End1,
END2=main.randomLink2[ i ],
OPTION="up" )
+ time.sleep( link_sleep )
main.Mininet1.link(
END1=link3End1,
END2=main.randomLink3[ i ],
OPTION="up" )
- time.sleep( link_sleep )
+ time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
linkUp = main.ONOSbench.checkStatus(
@@ -1240,15 +1223,17 @@
END1=link1End1,
END2=main.randomLink1[ i ],
OPTION="down" )
+ time.sleep( link_sleep )
main.Mininet1.link(
END1=link2End1,
END2=main.randomLink2[ i ],
OPTION="down" )
+ time.sleep( link_sleep )
main.Mininet1.link(
END1=link3End1,
END2=main.randomLink3[ i ],
OPTION="down" )
- time.sleep( link_sleep )
+ time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
linkDown = main.ONOSbench.checkStatus(
@@ -1304,15 +1289,17 @@
END1=link1End1,
END2=main.randomLink1[ i ],
OPTION="up" )
+ time.sleep( link_sleep )
main.Mininet1.link(
END1=link2End1,
END2=main.randomLink2[ i ],
OPTION="up" )
+ time.sleep( link_sleep )
main.Mininet1.link(
END1=link3End1,
END2=main.randomLink3[ i ],
OPTION="up" )
- time.sleep( link_sleep )
+ time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
linkUp = main.ONOSbench.checkStatus(
@@ -1371,7 +1358,7 @@
END1=switch[0],
END2=switch[1],
OPTION="down")
- time.sleep( link_sleep )
+ time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
linkDown = main.ONOSbench.checkStatus(
@@ -1388,7 +1375,7 @@
main.step( "Verify Ping across all hosts" )
pingResultLinkDown = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1424,8 +1411,7 @@
END1=switch[0],
END2=switch[1],
OPTION="up")
-
- time.sleep( link_sleep )
+ time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
linkUp = main.ONOSbench.checkStatus(
@@ -1443,7 +1429,7 @@
main.step( "Verify Ping across all hosts" )
pingResultLinkUp = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1484,7 +1470,7 @@
END1=switch[0],
END2=switch[1],
OPTION="down")
- time.sleep( link_sleep )
+ time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
linkDown = main.ONOSbench.checkStatus(
@@ -1501,7 +1487,7 @@
main.step( "Verify Ping across all hosts" )
pingResultLinkDown = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1537,8 +1523,7 @@
END1=switch[0],
END2=switch[1],
OPTION="up")
-
- time.sleep( link_sleep )
+ time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
linkUp = main.ONOSbench.checkStatus(
@@ -1556,7 +1541,7 @@
main.step( "Verify Ping across all hosts" )
pingResultLinkUp = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1604,8 +1589,8 @@
# main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
# main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
+ time.sleep( link_sleep )
main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
-
time.sleep( link_sleep )
topology_output = main.ONOScli2.topology()
@@ -1623,7 +1608,7 @@
main.step( "Verify Ping across all hosts" )
pingResultLinkDown = main.FALSE
time1 = time.time()
- pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1657,9 +1642,10 @@
#main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
#main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
- main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
-
time.sleep( link_sleep )
+ main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
+ time.sleep( link_sleep )
+
topology_output = main.ONOScli2.topology()
linkUp = main.ONOSbench.checkStatus(
topology_output,
@@ -1676,7 +1662,7 @@
main.step( "Verify Ping across all hosts" )
pingResultLinkUp = main.FALSE
time1 = time.time()
- pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1715,6 +1701,69 @@
t = main.Thread( target=cli.addPointIntent,
threadID=main.threadID,
name="addPointIntent",
+ args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4",main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ intentResult = main.TRUE
+ intentsJson = main.ONOScli2.intents()
+ getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+ intentsJson = intentsJson)
+ print getIntentStateResult
+ # Takes awhile for all the onos to get the intents
+ time.sleep(60)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+ onpass="PING tALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case90Result = ( intentResult and pingResult )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case90Result,
+ onpass="Install 600 point Intents and Ping All test PASS",
+ onfail="Install 600 point Intents and Ping All test FAIL" )
+
+ def CASE91( self ):
+ """
+ Install 600 point intents and verify ping all (Chordal Topology)
+ """
+ main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
+ main.log.report( "_______________________________________" )
+ import itertools
+ import time
+ main.case( "Install 600 point intents" )
+ main.step( "Add point Intents" )
+ intentResult = main.TRUE
+ deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
+
+ intentIdList = []
+ time1 = time.time()
+ for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( deviceCombos ):
+ break
+ t = main.Thread( target=cli.addPointIntent,
+ threadID=main.threadID,
+ name="addPointIntent",
args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
pool.append(t)
#time.sleep(1)
@@ -1736,70 +1785,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
- time2 = time.time()
- timeDiff = round( ( time2 - time1 ), 2 )
- main.log.report(
- "Time taken for Ping All: " +
- str( timeDiff ) +
- " seconds" )
- utilities.assert_equals( expect=main.TRUE, actual=pingResult,
- onpass="PING ALL PASS",
- onfail="PING ALL FAIL" )
-
- case90Result = ( intentResult and pingResult )
-
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case90Result,
- onpass="Install 600 point Intents and Ping All test PASS",
- onfail="Install 600 point Intents and Ping All test FAIL" )
-
- def CASE91( self ):
- """
- Install ###$$$ point intents and verify ping all (Chordal Topology)
- """
- main.log.report( "Add ###$$$ point intents and verify pingall (Chordal Topology)" )
- main.log.report( "_______________________________________" )
- import itertools
- import time
- main.case( "Install ###$$$ point intents" )
- main.step( "Add point Intents" )
- intentResult = main.TRUE
- deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
-
- intentIdList = []
- time1 = time.time()
- for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
- pool = []
- for cli in main.CLIs:
- if i >= len( deviceCombos ):
- break
- t = main.Thread( target=cli.addPointIntent,
- threadID=main.threadID,
- name="addPointIntent",
- args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
- pool.append(t)
- #time.sleep(1)
- t.start()
- i = i + 1
- main.threadID = main.threadID + 1
- for thread in pool:
- thread.join()
- intentIdList.append(thread.result)
- time2 = time.time()
- main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
- intentResult = main.TRUE
- intentsJson = main.ONOScli2.intents()
- getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
- intentsJson = intentsJson)
- print getIntentStateResult
- # Takes awhile for all the onos to get the intents
- time.sleep(30)
- main.step( "Verify Ping across all hosts" )
- pingResult = main.FALSE
- time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1815,8 +1801,8 @@
utilities.assert_equals(
expect=main.TRUE,
actual=case91Result,
- onpass="Install ###$$$ point Intents and Ping All test PASS",
- onfail="Install ###$$$ point Intents and Ping All test FAIL" )
+ onpass="Install 600 point Intents and Ping All test PASS",
+ onfail="Install 600 point Intents and Ping All test FAIL" )
def CASE92( self ):
"""
@@ -1865,7 +1851,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -1944,7 +1930,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -2000,7 +1986,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -2057,7 +2043,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -2112,7 +2098,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -2174,7 +2160,7 @@
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
time2 = time.time()
timeDiff = round( ( time2 - time1 ), 2 )
main.log.report(
@@ -2210,17 +2196,18 @@
"\r\r",
"" )
intentsList = intentsList.splitlines()
- intentsList = intentsList[ 1: ]
+ #intentsList = intentsList[ 1: ]
intentIdList = []
step1Result = main.TRUE
moreIntents = main.TRUE
removeIntentCount = 0
intentsCount = len(intentsList)
- print "Current number of intents" , len(intentsList)
+ main.log.info ( "Current number of intents: " + str(intentsCount) )
if ( len( intentsList ) > 1 ):
results = main.TRUE
main.log.info("Removing intent...")
while moreIntents:
+ #This is a work around for a major issue. We cycle through intents removal for up to 5 times.
if removeIntentCount == 5:
break
removeIntentCount = removeIntentCount + 1
@@ -2237,8 +2224,8 @@
"\r\r",
"" )
intentsList1 = intentsList1.splitlines()
- intentsList1 = intentsList1[ 1: ]
- print "Round %d intents to remove: " %(removeIntentCount)
+ #intentsList1 = intentsList1[ 1: ]
+ main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
print intentsList1
intentIdList1 = []
if ( len( intentsList1 ) > 0 ):
@@ -2246,8 +2233,8 @@
for i in range( len( intentsList1 ) ):
intentsTemp1 = intentsList1[ i ].split( ',' )
intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
- print "Leftover Intent IDs: ", intentIdList1
- print len(intentIdList1)
+ main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
+ main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
time1 = time.time()
for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
pool = []
@@ -2257,7 +2244,7 @@
t = main.Thread( target=cli.removeIntent,
threadID=main.threadID,
name="removeIntent",
- args=[intentIdList1[i],'org.onosproject.cli',True,False])
+ args=[intentIdList1[i],'org.onosproject.cli',False,False])
pool.append(t)
t.start()
i = i + 1
@@ -2265,15 +2252,29 @@
for thread in pool:
thread.join()
intentIdList.append(thread.result)
+ #time.sleep(2)
time2 = time.time()
main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
time.sleep(10)
+ main.log.info("Purging WITHDRAWN Intents")
+ purgeResult = main.TRUE
+ for i in range( int( main.numCtrls) ):
+ t = main.Thread( target=main.CLIs[i].purgeIntents,
+ threadID=main.threadID,
+ name="purgeIntents",
+ args=[ ] )
+ pool.append(t)
+ t.start()
+ main.threadID = main.threadID + 1
+ for t in pool:
+ t.join()
+ purgeResult = purgeResult and t.result
else:
- time.sleep(15)
+ time.sleep(10)
if len( main.ONOScli1.intents()):
continue
break
-
+ time.sleep(10)
else:
print "Removed %d intents" %(intentsCount)
step1Result = main.TRUE
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/OnosCHO/OnosCHO.topo
index 9b0c3e7..8205d2f 100644
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/OnosCHO/OnosCHO.topo
@@ -2,18 +2,18 @@
<COMPONENT>
<ONOSbench>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
<COMPONENTS>
- <home> ~/ONOS</home>
+ <home>~/ONOS</home>
</COMPONENTS>
</ONOSbench>
<ONOScli1>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -22,7 +22,7 @@
</ONOScli1>
<ONOScli2>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -31,34 +31,16 @@
</ONOScli2>
<ONOScli3>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
<connect_order>4</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOScli3>
-
- <ONOScli4>
- <host>10.128.10.20</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli4>
-
- <ONOScli5>
- <host>10.128.10.20</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>6</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli5>
<ONOS1>
- <host>10.128.10.21</host>
+ <host>10.128.40.41</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -67,7 +49,7 @@
</ONOS1>
<ONOS2>
- <host>10.128.10.22</host>
+ <host>10.128.40.42</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -76,31 +58,13 @@
</ONOS2>
<ONOS3>
- <host>10.128.10.23</host>
+ <host>10.128.40.43</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
<connect_order>9</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS3>
-
- <ONOS4>
- <host>10.128.10.24</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>10</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS4>
-
- <ONOS5>
- <host>10.128.10.25</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>11</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS5>
<Mininet1>
<host>10.128.40.50</host>
@@ -116,6 +80,20 @@
<controller> remote </controller>
</COMPONENTS>
</Mininet1>
- </COMPONENT>
+ <Mininet2>
+ <host>10.128.40.50</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>13</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/att-mpls-topo.py </arg1>
+ <arg2> --topo att </arg2>
+ <arg3> --link tc --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet2>
+ </COMPONENT>
</TOPOLOGY>
diff --git a/TestON/tests/ProdFunc/ProdFunc.params b/TestON/tests/ProdFunc/ProdFunc.params
index 55dc818..c8e125b 100755
--- a/TestON/tests/ProdFunc/ProdFunc.params
+++ b/TestON/tests/ProdFunc/ProdFunc.params
@@ -1,11 +1,13 @@
<PARAMS>
-
+ #1,4,10,5,6,7,8,9,8,11,8,20,21,22,10,23,24
<testcases>1,4,10,5,6,7,8,9,8,11,8,2,20,21,22,10,23,24</testcases>
#Environment variables
<ENV>
<cellName>driver_test</cellName>
</ENV>
-
+ <GIT>
+ <pull>True</pull>
+ </GIT>
<CTRL>
<ip1>10.128.20.11</ip1>
<port1>6633</port1>
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index f779b6b..adbdb24 100644
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -31,6 +31,7 @@
"""
cellName = main.params[ 'ENV' ][ 'cellName' ]
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
main.case( "Setting up test environment" )
main.log.report(
@@ -41,44 +42,54 @@
cellResult = main.ONOSbench.setCell( cellName )
verifyResult = main.ONOSbench.verifyCell()
- main.step( "Removing raft logs before a clen installation of ONOS" )
- main.ONOSbench.onosRemoveRaftLogs()
-
main.step( "Git checkout and get version" )
- #main.ONOSbench.gitCheckout( "master" )
- gitPullResult = main.ONOSbench.gitPull()
- main.log.info( "git_pull_result = " + str( gitPullResult ))
+ main.ONOSbench.gitCheckout( "master" )
+ if gitPull == 'True':
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ main.ONOSbench.cleanInstall()
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+ elif gitPullResult == 0:
+ main.log.report(
+ "Git Pull Failed, look into logs for detailed reason" )
+ main.cleanup()
+ main.exit()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ else:
+ main.log.info( "Skipping git pull" )
main.ONOSbench.getVersion( report=True )
+ packageResult = main.TRUE
- if gitPullResult == 1:
- main.step( "Using mvn clean & install" )
- main.ONOSbench.cleanInstall()
- elif gitPullResult == 0:
- main.log.report(
- "Git Pull Failed, look into logs for detailed reason" )
- main.cleanup()
- main.exit()
+ main.step( "Uninstalling ONOS package" )
+ onosInstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Uninstalling ONOS package successful" )
+ else:
+ main.log.report( "Uninstalling ONOS package failed" )
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
+ time.sleep( 20 )
main.step( "Installing ONOS package" )
- onosInstallResult = main.ONOSbench.onosInstall()
+ onosInstallResult = main.ONOSbench.onosInstall( ONOS1Ip )
+ print onosInstallResult
if onosInstallResult == main.TRUE:
main.log.report( "Installing ONOS package successful" )
else:
main.log.report( "Installing ONOS package failed" )
+ time.sleep( 20 )
onos1Isup = main.ONOSbench.isup()
if onos1Isup == main.TRUE:
main.log.report( "ONOS instance is up and ready" )
else:
main.log.report( "ONOS instance may not be up" )
- main.step( "Starting ONOS service" )
- startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startResult = main.TRUE
+ #main.step( "Starting ONOS service" )
+ #startResult = main.ONOSbench.onosStart( ONOS1Ip )
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ main.ONOS2.startOnosCli( ONOS1Ip )
main.step( "Starting Mininet CLI..." )
# Starting the mininet using the old way
@@ -183,6 +194,7 @@
Exit from mininet cli
reinstall ONOS
"""
+ import time
cellName = main.params[ 'ENV' ][ 'cellName' ]
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
@@ -190,22 +202,60 @@
"ONOS to switch over to Packet Optical topology" )
main.log.report( "_____________________________________________" )
main.case( "Disconnecting mininet and restarting ONOS" )
+
main.step( "Disconnecting mininet and restarting ONOS" )
+ step1Result = main.TRUE
mininetDisconnect = main.Mininet1.disconnect()
- print "mininetDisconnect = ", mininetDisconnect
-
- main.step( "Removing raft logs before a clen installation of ONOS" )
- main.ONOSbench.onosRemoveRaftLogs()
-
+ print "mininetDisconnect = ", mininetDisconnect
+ step1Result = mininetDisconnect
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Mininet disconnect successfully",
+ onfail="Mininet failed to disconnect")
+ """
+ main.step( "Removing raft logs before a clean installation of ONOS" )
+ step2Result = main.TRUE
+ removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+ step2Result = removeRaftLogsResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Raft logs removed successfully",
+ onfail="Failed to remove raft logs")
+ """
main.step( "Applying cell variable to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
+ step3Result = main.TRUE
+ setCellResult = main.ONOSbench.setCell( cellName )
+ verifyCellResult = main.ONOSbench.verifyCell()
+ step3Result = setCellResult and verifyCellResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Cell applied successfully",
+ onfail="Failed to apply cell")
- onosInstallResult = main.ONOSbench.onosInstall()
- if onosInstallResult == main.TRUE:
- main.log.report( "Installing ONOS package successful" )
- else:
- main.log.report( "Installing ONOS package failed" )
+ main.step( "Uninstalling ONOS package" )
+ step4Result = main.TRUE
+ ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+ onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+ step4Result = onosUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully uninstalled ONOS",
+ onfail="Failed to uninstall ONOS")
+
+ time.sleep( 5 )
+ main.step( "Installing ONOS package" )
+ step5Result = main.TRUE
+ onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+ step5Result = onosInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step5Result,
+ onpass="Successfully installed ONOS",
+ onfail="Failed to install ONOS")
onos1Isup = main.ONOSbench.isup()
if onos1Isup == main.TRUE:
@@ -214,19 +264,24 @@
main.log.report( "ONOS instance may not be up" )
main.step( "Starting ONOS service" )
+ step6Result = main.TRUE
startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- case20Result = mininetDisconnect and cellResult and verifyResult \
- and onosInstallResult and onos1Isup and \
- startResult
+ step6Result = startResult
utilities.assert_equals(
expect=main.TRUE,
- actual=case20Result,
- onpass= "Exiting functionality mininet topology and reinstalling" +
- " ONOS successful",
- onfail= "Exiting functionality mininet topology and reinstalling" +
- " ONOS failed" )
+ actual=step6Result,
+ onpass="Successfully started ONOS",
+ onfail="Failed to start ONOS")
+
+ main.step( "Starting ONOS cli" )
+ step7Result = main.TRUE
+ cliResult = main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ step7Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step7Result,
+ onpass="Successfully started ONOS cli",
+ onfail="Failed to start ONOS cli")
def CASE21( self, main ):
"""
@@ -238,20 +293,37 @@
from the topology, instead the links are learnt
from the json config file
"""
+ import time
main.log.report(
"This testcase starts the packet layer topology and REST" )
main.log.report( "_____________________________________________" )
main.case( "Starting LINC-OE and other components" )
- main.step( "Starting LINC-OE and other components" )
- appInstallResult = main.ONOS2.featureInstall( "onos-app-optical" )
- opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
- case21Result = opticalMnScript and appInstallResult
+ main.step( "Activate optical app" )
+ step1Result = main.TRUE
+ activateOpticalResult = main.ONOS2.activateApp( "org.onosproject.optical" )
+ step1Result = activateOpticalResult
utilities.assert_equals(
expect=main.TRUE,
- actual=case21Result,
- onpass="Packet optical topology spawned successsfully",
- onfail="Packet optical topology spawning failed" )
+ actual=step1Result,
+ onpass="Successfully activated optical app",
+ onfail="Failed to activate optical app")
+
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+
+ main.step( "Starting mininet and LINC-OE" )
+ step2Result = main.TRUE
+ time.sleep( 10 )
+ opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+ step2Result = opticalMnScript
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Started the topology successfully ",
+ onfail="Failed to start the topology")
def CASE22( self, main ):
"""
@@ -259,21 +331,32 @@
6 packet layer mininet switches each with one host.
Therefore, the roadmCount variable = 10,
packetLayerSWCount variable = 6, hostCount=6 and
- links=42.
+ links=46.
All this is hardcoded in the testcase. If the topology changes,
these hardcoded values need to be changed
"""
+ import time
main.log.report(
"This testcase compares the optical+packet topology against what" +
" is expected" )
main.case( "Topology comparision" )
- main.step( "Topology comparision" )
- main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- devicesResult = main.ONOS3.devices( jsonFormat=False )
- print "devices_result = ", devicesResult
+ main.step( "Starts new ONOS cli" )
+ step1Result = main.TRUE
+ cliResult = main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+ [ 'ip1' ] )
+ step1Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully starts a new cli",
+ onfail="Failed to start new cli" )
+
+ main.step( "Compare topology" )
+ step2Result = main.TRUE
+ devicesResult = main.ONOS3.devices( jsonFormat=False )
+ print "devices_result :\n", devicesResult
devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1: ]
roadmCount = 0
packetLayerSWCount = 0
for line in devicesLinewise:
@@ -299,7 +382,6 @@
str( roadmCount ) +
" and is wrong" )
opticalSWResult = main.FALSE
-
if packetLayerSWCount == 6:
print "Number of Packet layer or mininet Switches = %d "\
% packetLayerSWCount + "and is correctly detected"
@@ -316,14 +398,15 @@
str( packetLayerSWCount ) +
" and is wrong" )
packetSWResult = main.FALSE
+ # sleeps for sometime so the state of the switches will be active
+ time.sleep( 30 )
print "_________________________________"
-
linksResult = main.ONOS3.links( jsonFormat=False )
print "links_result = ", linksResult
print "_________________________________"
- linkActiveCount = linksResult.count("state=ACTIVE")
+ linkActiveCount = linksResult.count("state=ACTIVE")
main.log.info( "linkActiveCount = " + str( linkActiveCount ))
- if linkActiveCount == 42:
+ if linkActiveCount == 46:
linkActiveResult = main.TRUE
main.log.info(
"Number of links in ACTIVE state are correct")
@@ -331,41 +414,13 @@
linkActiveResult = main.FALSE
main.log.info(
"Number of links in ACTIVE state are wrong")
-
- # NOTE:Since only point intents are added, there is no
- # requirement to discover the hosts
- # Therfore, the below portion of the code is commented.
- """
- #Discover hosts using pingall
- pingallResult = main.LincOE2.pingall()
-
- hostsResult = main.ONOS3.hosts( jsonFormat=False )
- main.log.info( "hosts_result = "+hostsResult )
- main.log.info( "_________________________________" )
- hostsLinewise = hostsResult.split( "\n" )
- hostsLinewise = hostsLinewise[ 1:-1 ]
- hostCount = 0
- for line in hostsLinewise:
- hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
- hostCount +=1
- if hostCount ==2:
- print "Number of hosts = %d and is correctly detected" %hostCount
- main.log.info( "Number of hosts = " + str( hostCount ) +" and \
- is correctly detected" )
- hostDiscovery = main.TRUE
- else:
- print "Number of hosts = %d and is wrong" %hostCount
- main.log.info( "Number of hosts = " + str( hostCount ) +" and \
- is wrong" )
- hostDiscovery = main.FALSE
- """
- case22Result = opticalSWResult and packetSWResult and \
+ step2Result = opticalSWResult and packetSWResult and \
linkActiveResult
utilities.assert_equals(
expect=main.TRUE,
- actual=case22Result,
- onpass="Packet optical topology discovery successful",
- onfail="Packet optical topology discovery failed" )
+ actual=step2Result,
+ onpass="Successfully loaded packet optical topology",
+ onfail="Failed to load packet optical topology" )
def CASE23( self, main ):
import time
@@ -377,71 +432,50 @@
main.log.report(
"This testcase adds bidirectional point intents between 2 " +
"packet layer( mininet ) devices and ping mininet hosts" )
- main.case( "Topology comparision" )
+ main.case( "Install point intents between 2 packet layer device and " +
+ "ping the hosts" )
+
main.step( "Adding point intents" )
- ptpIntentResult = main.ONOS3.addPointIntent(
+ checkFlowResult = main.TRUE
+ step1Result = main.TRUE
+ main.pIntentsId = []
+ pIntent1 = main.ONOS3.addPointIntent(
"of:0000ffffffff0001/1",
"of:0000ffffffff0005/1" )
- if ptpIntentResult == main.TRUE:
- main.ONOS3.intents( jsonFormat=False )
- main.log.info( "Point to point intent install successful" )
-
- ptpIntentResult = main.ONOS3.addPointIntent(
+ pIntent2 = main.ONOS3.addPointIntent(
"of:0000ffffffff0005/1",
"of:0000ffffffff0001/1" )
- if ptpIntentResult == main.TRUE:
- main.ONOS3.intents( jsonFormat=False )
- main.log.info( "Point to point intent install successful" )
-
- time.sleep( 30 )
- flowHandle = main.ONOS3.flows()
- main.log.info( "flows :" + flowHandle )
-
+ main.pIntentsId.append( pIntent1 )
+ main.pIntentsId.append( pIntent2 )
+ time.sleep( 10 )
+ main.log.info( "Checking intents state")
+ checkStateResult = main.ONOS3.checkIntentState(
+ intentsId = main.pIntentsId )
+ time.sleep( 10 )
+ main.log.info( "Checking flows state")
+ checkFlowResult = main.ONOS3.checkFlowsState()
# Sleep for 30 seconds to provide time for the intent state to change
- time.sleep( 60 )
- intentHandle = main.ONOS3.intents( jsonFormat=False )
- main.log.info( "intents :" + intentHandle )
-
- PingResult = main.TRUE
- count = 1
- main.log.info( "\n\nh1 is Pinging h5" )
- ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
- # ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count < 5:
- count += 1
- PingResult = main.FALSE
- main.log.info(
- "Ping between h1 and h5 failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.info( "All ping attempts between h1 and h5 have failed" )
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h1 and h5 passed!" )
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- if PingResult == main.FALSE:
- main.log.report(
- "Point intents for packet optical have not ben installed" +
- " correctly. Cleaning up" )
- if PingResult == main.TRUE:
- main.log.report(
- "Point Intents for packet optical have been " +
- "installed correctly" )
-
- case23Result = PingResult
+ time.sleep( 10 )
+ main.log.info( "Checking intents state one more time")
+ checkStateResult = main.ONOS3.checkIntentState(
+ intentsId = main.pIntentsId )
+ step1Result = checkStateResult and checkFlowResult
utilities.assert_equals(
expect=main.TRUE,
- actual=case23Result,
- onpass= "Point intents addition for packet optical and" +
- "Pingall Test successful",
- onfail= "Point intents addition for packet optical and" +
- "Pingall Test NOT successful" )
+ actual=step1Result,
+ onpass="Successfully added point intents",
+ onfail="Failed to add point intents")
+
+ main.step( "Ping h1 and h5" )
+ step2Result = main.TRUE
+ main.log.info( "\n\nh1 is Pinging h5" )
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step2Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
def CASE24( self, main ):
import time
@@ -462,16 +496,23 @@
main.log.report(
"This testcase tests rerouting and pings mininet hosts" )
main.case( "Test rerouting and pings mininet hosts" )
+
main.step( "Attach to the Linc-OE session" )
- attachConsole = main.LincOE1.attachLincOESession()
- print "attachConsole = ", attachConsole
+ step1Result = main.TRUE
+ attachConsole = main.LincOE1.attachLincOESession()
+ step1Result = attachConsole
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully attached Linc-OE session",
+ onfail="Failed to attached Linc-OE session")
main.step( "Bring a port down and verify the link state" )
+ step2Result = main.TRUE
main.LincOE1.portDown( swId="9", ptId="20" )
linksNonjson = main.ONOS3.links( jsonFormat=False )
main.log.info( "links = " + linksNonjson )
-
- linkInactiveCount = linksNonjson.count("state=INACTIVE")
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
if linkInactiveCount == 2:
main.log.info(
@@ -479,10 +520,8 @@
else:
main.log.info(
"Number of links in INACTIVE state are wrong")
-
links = main.ONOS3.links()
main.log.info( "links = " + links )
-
linksResult = json.loads( links )
linksStateResult = main.FALSE
for item in linksResult:
@@ -506,45 +545,184 @@
main.log.report(
"Links state is not inactive as expected" )
linksStateResult = main.FALSE
-
- print "links_state_result = ", linksStateResult
time.sleep( 10 )
- flowHandle = main.ONOS3.flows()
- main.log.info( "flows :" + flowHandle )
+ checkFlowsState = main.ONOS3.checkFlowsState()
+ step2Result = linksStateResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfuly brought down a link",
+ onfail="Failed to bring down a link")
main.step( "Verify Rerouting by a ping test" )
- PingResult = main.TRUE
- count = 1
+ step3Result = main.TRUE
main.log.info( "\n\nh1 is Pinging h5" )
- ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
- # ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count < 5:
- count += 1
- PingResult = main.FALSE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step3Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
+
+ main.step( "Bring the downed port up and verify the link state" )
+ step4Result = main.TRUE
+ main.LincOE1.portUp( swId="9", ptId="20" )
+ linksNonjson = main.ONOS3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 0:
main.log.info(
- "Ping between h1 and h5 failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.info( "All ping attempts between h1 and h5 have failed" )
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h1 and h5 passed!" )
- PingResult = main.TRUE
+ "Number of links in INACTIVE state are correct")
else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+ step4Result = main.FALSE
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully brought the port up",
+ onfail="Failed to bring the port up")
+ """
+ main.step( "Removing host intents" )
+ step5Result = main.TRUE
+ removeResult = main.TRUE
+ # Check remaining intents
+ intentsJson = json.loads( main.ONOS3.intents() )
+ main.ONOS3.removeIntent( intentId=intent1, purge=True )
+ main.ONOS3.removeIntent( intentId=intent2, purge=True )
+ for intents in intentsJson:
+ main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+ app='org.onosproject.optical',
+ purge=True )
+ print json.loads( main.ONOS3.intents() )
+ if len( json.loads( main.ONOS3.intents() ) ):
+ removeResult = main.FALSE
+ step5Result = removeResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step5Result,
+ onpass="Successfully removed host intents",
+ onfail="Failed to remove host intents" )
+ """
+ def CASE10( self ):
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ main.step( "Uninstalling reactive forwarding app" )
+ step1Result = main.TRUE
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ main.log.info( "deactivate reactive forwarding app" )
+ appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+ step1Result = appUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully deactivate reactive forwarding app",
+ onfail="Failed to deactivate reactive forwarding app")
+ # After reactive forwarding is disabled, the reactive flows on
+ # switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+ flows = main.ONOS2.flows()
+ main.log.info( flows )
- if PingResult == main.TRUE:
- main.log.report( "Ping test successful " )
- if PingResult == main.FALSE:
- main.log.report( "Ping test failed" )
+ def CASE25( self ):
+ """
+ Add host intents between 2 packet layer host
+ """
+ import time
+ import json
+ main.log.report( "Adding host intents between 2 optical layer host" )
+ main.case( "Test add host intents between optical layer host" )
- case24Result = PingResult and linksStateResult
- utilities.assert_equals( expect=main.TRUE, actual=case24Result,
- onpass="Packet optical rerouting successful",
- onfail="Packet optical rerouting failed" )
+ main.step( "Discover host using arping" )
+ step1Result = main.TRUE
+ main.hostMACs = []
+ main.hostId = []
+ #Listing host MAC addresses
+ for i in range( 1 , 7 ):
+ main.hostMACs.append( "00:00:00:00:00:" +
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+ for macs in main.hostMACs:
+ main.hostId.append( macs + "/-1" )
+ host1 = main.hostId[ 0 ]
+ host2 = main.hostId[ 1 ]
+ # Use arping to discover the hosts
+ main.LincOE2.arping( host = "h1" )
+ main.LincOE2.arping( host = "h2" )
+ time.sleep( 5 )
+ hostsDict = main.ONOS3.hosts()
+ if not len( hostsDict ):
+ step1Result = main.FALSE
+ # Adding host intent
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Hosts discovered",
+ onfail="Failed to discover hosts")
+
+ main.step( "Adding host intents to h1 and h2" )
+ step2Result = main.TRUE
+ intentsId = []
+ intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
+ hostIdTwo = host2 )
+ intentsId.append( intent1 )
+ time.sleep( 5 )
+ intent2 = main.ONOS3.addHostIntent( hostIdOne = host2,
+ hostIdTwo = host1 )
+ intentsId.append( intent2 )
+ # Checking intents state before pinging
+ main.log.info( "Checking intents state" )
+ time.sleep( 15 )
+ intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ #check intent state again if intents are not in installed state
+ if not intentResult:
+ intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ step2Result = intentResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step2Result,
+ onpass="All intents are in INSTALLED state ",
+ onfail="Some of the intents are not in " +
+ "INSTALLED state " )
+
+ # pinging h1 to h2 and then ping h2 to h1
+ main.step( "Pinging h1 and h2" )
+ step3Result = main.TRUE
+ pingResult = main.TRUE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+ target="h1" )
+ step3Result = pingResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step3Result,
+ onpass="Pinged successfully between h1 and h2",
+ onfail="Pinged failed between h1 and h2" )
+ # Removed all added host intents
+ main.step( "Removing host intents" )
+ step4Result = main.TRUE
+ removeResult = main.TRUE
+ # Check remaining intents
+ intentsJson = json.loads( main.ONOS3.intents() )
+ main.ONOS3.removeIntent( intentId=intent1, purge=True )
+ main.ONOS3.removeIntent( intentId=intent2, purge=True )
+ for intents in intentsJson:
+ main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+ app='org.onosproject.optical',
+ purge=True )
+ print json.loads( main.ONOS3.intents() )
+ if len( json.loads( main.ONOS3.intents() ) ):
+ removeResult = main.FALSE
+ step4Result = removeResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully removed host intents",
+ onfail="Failed to remove host intents" )
def CASE4( self, main ):
import re
@@ -553,6 +731,7 @@
" all the switches to all the controllers and" +
" discovering the hosts in reactive mode" )
main.log.report( "__________________________________" )
+
main.case( "Pingall Test" )
main.step( "Assigning switches to controllers" )
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
@@ -651,6 +830,13 @@
ip5=ONOS5Ip,port5=ONOS5Port )
"""
# REACTIVE FWD test
+ main.log.info( "Activate fwd app" )
+ appInstallResult = main.ONOS2.activateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+ time.sleep( 10 )
main.step( "Get list of hosts from Mininet" )
hostList = main.Mininet1.getHosts()
@@ -687,31 +873,6 @@
onpass="Controller assignment and Pingall Test successful",
onfail="Controller assignment and Pingall Test NOT successful" )
- def CASE10( self ):
- main.log.report(
- "This testcase uninstalls the reactive forwarding app" )
- main.log.report( "__________________________________" )
- main.case( "Uninstalling reactive forwarding app" )
- # Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd uninstalled" )
-
- # After reactive forwarding is disabled, the reactive flows on
- # switches timeout in 10-15s
- # So sleep for 15s
- time.sleep( 15 )
-
- flows = main.ONOS2.flows()
- main.log.info( flows )
-
- case10Result = appUninstallResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case10Result,
- onpass="Reactive forwarding app uninstallation successful",
- onfail="Reactive forwarding app uninstallation failed" )
-
-
def CASE11( self ):
# NOTE: This testcase require reactive forwarding mode enabled
# NOTE: in the beginning and then uninstall it before adding
@@ -727,26 +888,40 @@
main.step( "Moving host h9 from device s9 and attach it to s8" )
main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
- time.sleep(15) #Time delay to have all the flows ready
+ main.log.info( "Activate fwd app" )
+ appInstallResult = main.ONOS2.activateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+
+ time.sleep(25) #Time delay to have all the flows ready
main.step( "Pingall" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall()
+ pingResult = main.Mininet1.pingall( timeout=120,
+ shortCircuit=True,
+ acceptableFailed=20 )
time2 = time.time()
print "Time for pingall: %2f seconds" % ( time2 - time1 )
hosts = main.ONOS2.hosts( jsonFormat = False )
main.log.info( hosts )
- main.case( "Uninstalling reactive forwarding app" )
- # Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd uninstalled" )
+ main.log.info( "deactivate reactive forwarding app" )
+ appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
main.step( "Add point intents between hosts on the same device")
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003008/1",
- "of:0000000000003008/3" )
+ "of:0000000000003008/3",
+ ethType='IPV4',
+ ethSrc='00:00:00:00:00:08',
+ ethDst='00:00:00:00:00:09' )
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -754,7 +929,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003008/3",
- "of:0000000000003008/1" )
+ "of:0000000000003008/1",
+ ethType='IPV4',
+ ethSrc='00:00:00:00:00:09',
+ ethDst='00:00:00:00:00:08' )
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -779,7 +957,7 @@
"Point intents for hosts on same devices" +
"installed correctly. Cleaning up" )
- case11Result = ping and pingResult
+ case11Result = ping
utilities.assert_equals(
expect = main.TRUE,
actual = case11Result,
@@ -788,7 +966,6 @@
onfail = "Point intents for hosts on same devices" +
"Ping Test NOT successful" )
-
def CASE12( self ):
"""
Verify the default flows on each switch in proactive mode
@@ -855,6 +1032,7 @@
"00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
print "______________________________________________________"
"""
+ intentsId = []
for i in range( 8, 18 ):
main.log.info(
"Adding host intent between h" + str( i ) +
@@ -869,8 +1047,9 @@
if host2:
host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
if host1Id and host2Id:
- main.ONOS2.addHostIntent( host1Id, host2Id )
+ intentsId.append( main.ONOS2.addHostIntent( host1Id, host2Id ) )
+ checkIntentResult = main.ONOS2.checkIntentState( intentsId )
time.sleep( 10 )
hIntents = main.ONOS2.intents( jsonFormat=False )
main.log.info( "intents:" + hIntents )
@@ -929,6 +1108,8 @@
main.log.report(
"Ping all test after Host intent addition successful" )
+ checkIntentResult = main.ONOS2.checkIntentState( intentsId )
+
case6Result = PingResult
utilities.assert_equals(
expect=main.TRUE,
@@ -1016,7 +1197,7 @@
main.step( "Compare ONOS Topology to MN Topology" )
devicesJson = main.ONOS2.devices()
linksJson = main.ONOS2.links()
- # portsJson = main.ONOS2.ports()
+ portsJson = main.ONOS2.ports()
result1 = main.Mininet1.compareSwitches(
MNTopo,
@@ -1024,9 +1205,8 @@
result2 = main.Mininet1.compareLinks(
MNTopo,
json.loads( linksJson ) )
- # result3 = main.Mininet1.comparePorts(
- # MNTopo, json.loads( portsJson ) )
+ result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
# result = result1 and result2 and result3
result = result1 and result2
@@ -1105,8 +1285,8 @@
main.step( "Determine the current number of switches and links" )
topologyOutput = main.ONOS2.topology()
topologyResult = main.ONOS1.getTopology( topologyOutput )
- activeSwitches = topologyResult[ 'deviceCount' ]
- links = topologyResult[ 'linkCount' ]
+ activeSwitches = topologyResult[ 'devices' ]
+ links = topologyResult[ 'links' ]
print "activeSwitches = ", type( activeSwitches )
print "links = ", type( links )
main.log.info(
@@ -1169,8 +1349,7 @@
result2 = main.Mininet1.compareLinks(
MNTopo,
json.loads( linksJson ) )
- # result3 = main.Mininet1.comparePorts(
- # MNTopo, json.loads( portsJson ) )
+ result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
# result = result1 and result2 and result3
result = result1 and result2
@@ -1209,9 +1388,9 @@
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" )
+ currentIntents = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intent_result = " + currentIntents )
+ intentLinewise = currentIntents.split( "\n" )
intentList = [line for line in intentLinewise \
if line.startswith( "id=")]
@@ -1223,30 +1402,31 @@
main.step(
"Iterate through the intentids list and remove each intent" )
for id in intentids:
- main.ONOS2.removeIntent( intentId=id )
+ main.ONOS2.removeIntent( intentId=id ,purge=True)
- intentResult = main.ONOS2.intents( jsonFormat=False )
- main.log.info( "intent_result = " + intentResult )
-
- intentList = [line for line in intentResult.split( "\n" ) \
+ remainingIntents = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intent_result = " + remainingIntents )
+ if remainingIntents:
+ main.log.info( "There are still remaining intents " )
+ intentResult = main.FALSE
+ else:
+ intentResult = main.TRUE
+
+ intentList = [line for line in remainingIntents.split( "\n" ) \
if line.startswith( "id=")]
intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
intentList]
for state in intentState:
print state
- case8Result = main.TRUE
+ case8Result = main.TRUE
for state in intentState:
if state != 'WITHDRAWN':
case8Result = main.FALSE
break
-
- if case8Result == main.TRUE:
- main.log.report( "Intent removal successful" )
- else:
- main.log.report( "Intent removal failed" )
PingResult = main.TRUE
+ """
if case8Result == main.TRUE:
i = 8
while i < 18:
@@ -1263,7 +1443,7 @@
else:
main.log.info( "Unknown error" )
PingResult = main.ERROR
-
+
# Note: If the ping result failed, that means the intents have been
# withdrawn correctly.
if PingResult == main.TRUE:
@@ -1272,15 +1452,14 @@
# main.exit()
if PingResult == main.FALSE:
main.log.report( "Installed intents have been withdrawn correctly" )
+ """
- case8Result = case8Result and PingResult
-
- if case8Result == main.FALSE:
+ if case8Result:
main.log.report( "Intent removal successful" )
else:
main.log.report( "Intent removal failed" )
- utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+ utilities.assert_equals( expect=main.TRUE, actual=case8Result,
onpass="Intent removal test passed",
onfail="Intent removal test failed" )
@@ -1296,21 +1475,28 @@
"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 )" )
-
+ macsDict = {}
+ for i in range( 1,29 ):
+ macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) )
+ print macsDict
main.step( "Add point intents for mn hosts h8 and h18 or" +
"ONOS hosts h8 and h12" )
# main.step(var1)
ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003008/1",
- "of:0000000000006018/1" )
+ ingressDevice="of:0000000000003008/1",
+ egressDevice="of:0000000000006018/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h8' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006018/1",
- "of:0000000000003008/1" )
+ ingressDevice="of:0000000000006018/1",
+ egressDevice="of:0000000000003008/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h18' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1320,7 +1506,9 @@
main.step(var2)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003009/1",
- "of:0000000000006019/1" )
+ "of:0000000000006019/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h9' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1328,7 +1516,9 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006019/1",
- "of:0000000000003009/1" )
+ "of:0000000000003009/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h19' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1338,7 +1528,10 @@
main.step(var3)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003010/1",
- "of:0000000000006020/1" )
+ "of:0000000000006020/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h10' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1346,7 +1539,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006020/1",
- "of:0000000000003010/1" )
+ "of:0000000000003010/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h20' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1357,7 +1553,10 @@
main.case(var4)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003011/1",
- "of:0000000000006021/1" )
+ "of:0000000000006021/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h11' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1365,7 +1564,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006021/1",
- "of:0000000000003011/1" )
+ "of:0000000000003011/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h21' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1376,7 +1578,10 @@
main.case(var5)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003012/1",
- "of:0000000000006022/1" )
+ "of:0000000000006022/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h12' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1384,7 +1589,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006022/1",
- "of:0000000000003012/1" )
+ "of:0000000000003012/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h22' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1395,7 +1603,10 @@
main.case(var6)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003013/1",
- "of:0000000000006023/1" )
+ "of:0000000000006023/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h13' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1403,7 +1614,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006023/1",
- "of:0000000000003013/1" )
+ "of:0000000000003013/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h23' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1414,7 +1628,10 @@
main.case(var7)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003014/1",
- "of:0000000000006024/1" )
+ "of:0000000000006024/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h14' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1422,7 +1639,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006024/1",
- "of:0000000000003014/1" )
+ "of:0000000000003014/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h24' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1433,7 +1653,10 @@
main.case(var8)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003015/1",
- "of:0000000000006025/1" )
+ "of:0000000000006025/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h15' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1441,7 +1664,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006025/1",
- "of:0000000000003015/1" )
+ "of:0000000000003015/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h25' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1452,7 +1678,10 @@
main.case(var9)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003016/1",
- "of:0000000000006026/1" )
+ "of:0000000000006026/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h16' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1460,7 +1689,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006026/1",
- "of:0000000000003016/1" )
+ "of:0000000000003016/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h26' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1471,7 +1703,10 @@
main.case(var10)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003017/1",
- "of:0000000000006027/1" )
+ "of:0000000000006027/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h17' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1479,7 +1714,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006027/1",
- "of:0000000000003017/1" )
+ "of:0000000000003017/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h27' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.py.save b/TestON/tests/ProdFunc/ProdFunc.py.save
new file mode 100644
index 0000000..00b895c
--- /dev/null
+++ b/TestON/tests/ProdFunc/ProdFunc.py.save
@@ -0,0 +1,1518 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+# import sys
+# import os
+# import re
+import json
+
+time.sleep( 1 )
+
+
+class ProdFunc:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import time
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-log
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.case( "Setting up test environment" )
+ main.log.report(
+ "This testcase is testing setting up test environment" )
+ main.log.report( "__________________________________" )
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ main.step( "Removing raft logs before a clen installation of ONOS" )
+ main.ONOSbench.onosRemoveRaftLogs()
+
+ main.step( "Git checkout and get version" )
+ #main.ONOSbench.gitCheckout( "master" )
+ gitPullResult = main.ONOSbench.gitPull()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ main.ONOSbench.getVersion( report=True )
+
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ main.ONOSbench.cleanInstall()
+ elif gitPullResult == 0:
+ main.log.report(
+ "Git Pull Failed, look into logs for detailed reason" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "Installing ONOS package" )
+ onosInstallResult = main.ONOSbench.onosInstall()
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup()
+ if onos1Isup == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up" )
+
+ main.step( "Starting ONOS service" )
+ 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
+ onos1Isup and startResult )
+ utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+ onpass="Test startup successful",
+ onfail="Test startup NOT successful" )
+
+ def CASE2( self, main ):
+ """
+ Switch Down
+ """
+ # NOTE: You should probably run a topology check after this
+ import time
+
+ main.case( "Switch down discovery" )
+ main.log.report( "This testcase is testing a switch down discovery" )
+ main.log.report( "__________________________________" )
+
+ switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
+
+ description = "Killing a switch to ensure it is discovered correctly"
+ main.log.report( description )
+ main.case( description )
+
+ # TODO: Make this switch parameterizable
+ main.step( "Kill s28 " )
+ main.log.report( "Deleting s28" )
+ # FIXME: use new dynamic topo functions
+ main.Mininet1.delSwitch( "s28" )
+ main.log.info(
+ "Waiting " +
+ str( switchSleep ) +
+ " seconds for switch down to be discovered" )
+ time.sleep( switchSleep )
+ # Peek at the deleted switch
+ device = main.ONOS2.getDevice( dpid="0028" )
+ print "device = ", device
+ if device[ u'available' ] == 'False':
+ case2Result = main.FALSE
+ else:
+ case2Result = main.TRUE
+ utilities.assert_equals( expect=main.TRUE, actual=case2Result,
+ onpass="Switch down discovery successful",
+ onfail="Switch down discovery failed" )
+
+ def CASE101( self, main ):
+ """
+ Cleanup sequence:
+ onos-service <nodeIp> stop
+ onos-uninstall
+
+ TODO: Define rest of cleanup
+
+ """
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.case( "Cleaning up test environment" )
+
+ main.step( "Testing ONOS kill function" )
+ killResult = main.ONOSbench.onosKill( ONOS1Ip )
+
+ main.step( "Stopping ONOS service" )
+ stopResult = main.ONOSbench.onosStop( ONOS1Ip )
+
+ main.step( "Uninstalling ONOS service" )
+ uninstallResult = main.ONOSbench.onosUninstall()
+
+ case11Result = killResult and stopResult and uninstallResult
+ utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+ onpass="Cleanup successful",
+ onfail="Cleanup failed" )
+
+ def CASE3( self, main ):
+ """
+ Test 'onos' command and its functionality in driver
+ """
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.case( "Testing 'onos' command" )
+
+ main.step( "Sending command 'onos -w <onos-ip> system:name'" )
+ cmdstr1 = "system:name"
+ cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
+ main.log.info( "onos command returned: " + cmdResult1 )
+
+ main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
+ cmdstr2 = "onos:topology"
+ cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
+ main.log.info( "onos command returned: " + cmdResult2 )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ 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()
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ onosInstallResult = main.ONOSbench.onosInstall()
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup()
+ if onos1Isup == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+ main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ case20Result = mininetDisconnect and cellResult and verifyResult \
+ and onosInstallResult and onos1Isup and \
+ startResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case20Result,
+ onpass= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS successful",
+ onfail= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS failed" )
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ ./~/ONOS/tools/test/bin/onos-topo-cfg
+ which starts the rest and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+ main.step( "Starting LINC-OE and other components" )
+ startConsoleResult = main.LincOE1.startConsole()
+ opticalMnScript = main.LincOE2.runOpticalMnScript()
+ onosTopoCfgResult = main.ONOSbench.runOnosTopoCfg(
+ instanceName=main.params[ 'CTRL' ][ 'ip1' ],
+ jsonFile=main.params[ 'OPTICAL' ][ 'jsonfile' ] )
+
+ print "start_console_result =", startConsoleResult
+ print "optical_mn_script = ", opticalMnScript
+ print "onos_topo_cfg_result =", onosTopoCfgResult
+
+ case21Result = startConsoleResult and opticalMnScript and \
+ onosTopoCfgResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed" )
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 4 linear switch optical topology and
+ 2 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 4,
+ packetLayerSWCount variable = 2 and hostCount = 2
+ and this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+ main.step( "Topology comparision" )
+ main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ devicesResult = main.ONOS3.devices( jsonFormat=False )
+
+ print "devices_result = ", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ devicesLinewise = devicesLinewise[ 1: ]
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 4:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+
+ if packetLayerSWCount == 2:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ print "_________________________________"
+
+ linksResult = main.ONOS3.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+
+ # NOTE:Since only point intents are added, there is no
+ # requirement to discover the hosts
+ # Therfore, the below portion of the code is commented.
+ """
+ #Discover hosts using pingall
+ pingallResult = main.LincOE2.pingall()
+
+ hostsResult = main.ONOS3.hosts( jsonFormat=False )
+ main.log.info( "hosts_result = "+hostsResult )
+ main.log.info( "_________________________________" )
+ hostsLinewise = hostsResult.split( "\n" )
+ hostsLinewise = hostsLinewise[ 1:-1 ]
+ hostCount = 0
+ for line in hostsLinewise:
+ hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
+ hostCount +=1
+ if hostCount ==2:
+ print "Number of hosts = %d and is correctly detected" %hostCount
+ main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+ is correctly detected" )
+ hostDiscovery = main.TRUE
+ else:
+ print "Number of hosts = %d and is wrong" %hostCount
+ main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+ is wrong" )
+ hostDiscovery = main.FALSE
+ """
+ case22Result = opticalSWResult and packetSWResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Topology comparision" )
+ main.step( "Adding point intents" )
+ ptpIntentResult = main.ONOS3.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0002/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOS3.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ ptpIntentResult = main.ONOS3.addPointIntent(
+ "of:0000ffffffff0002/1",
+ "of:0000ffffffff0001/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOS3.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ time.sleep( 10 )
+ flowHandle = main.ONOS3.flows()
+ main.log.info( "flows :" + flowHandle )
+
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 30 )
+ intentHandle = main.ONOS3.intents( jsonFormat=False )
+ main.log.info( "intents :" + intentHandle )
+
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h2" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h2 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h2 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h2 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Point intents for packet optical have not ben installed" +
+ " correctly. Cleaning up" )
+ if PingResult == main.TRUE:
+ main.log.report(
+ "Point Intents for packet optical have been " +
+ "installed correctly" )
+
+ case23Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case23Result,
+ onpass= "Point intents addition for packet optical and" +
+ "Pingall Test successful",
+ onfail= "Point intents addition for packet optical and" +
+ "Pingall Test NOT successful" )
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 22 ) of a switch( switchID=1 ), so that link
+ ( between switch1 port22 - switch4-port30 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+ main.step( "Bring a port down and verify the link state" )
+ main.LincOE1.portDown( swId="1", ptId="22" )
+ linksNonjson = main.ONOS3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+
+ links = main.ONOS3.links()
+ main.log.info( "links = " + links )
+
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "22":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff04" and item[
+ 'dst' ][ 'port' ] == "30":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+
+ print "links_state_result = ", linksStateResult
+ time.sleep( 10 )
+ flowHandle = main.ONOS3.flows()
+ main.log.info( "flows :" + flowHandle )
+
+ main.step( "Verify Rerouting by a ping test" )
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h2" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h2 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h2 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h2 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.TRUE:
+ main.log.report( "Ping test successful " )
+ if PingResult == main.FALSE:
+ main.log.report( "Ping test failed" )
+
+ case24Result = PingResult and linksStateResult
+ utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed" )
+
+ def CASE4( self, main ):
+ import re
+ import time
+ main.log.report( "This testcase is testing the assignment of" +
+ " all the switches to all the controllers and" +
+ " discovering the hosts in reactive mode" )
+ main.log.report( "__________________________________" )
+ main.case( "Pingall Test" )
+ main.step( "Assigning switches to controllers" )
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ for i in range( 1, 29 ):
+ if i == 1:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ elif i >= 2 and i < 5:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ elif i >= 5 and i < 8:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ elif i >= 8 and i < 18:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ elif i >= 18 and i < 28:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ else:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ SwitchMastership = main.TRUE
+ for i in range( 1, 29 ):
+ if i == 1:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ elif i >= 2 and i < 5:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ elif i >= 5 and i < 8:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ elif i >= 8 and i < 18:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ elif i >= 18 and i < 28:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ else:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is" + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+
+ if SwitchMastership == main.TRUE:
+ main.log.report( "Controller assignmnet successful" )
+ else:
+ main.log.report( "Controller assignmnet failed" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=SwitchMastership,
+ onpass="MasterControllers assigned correctly" )
+ """
+ for i in range ( 1,29 ):
+ main.Mininet1.assignSwController( sw=str( i ),count=5,
+ ip1=ONOS1Ip,port1=ONOS1Port,
+ ip2=ONOS2Ip,port2=ONOS2Port,
+ ip3=ONOS3Ip,port3=ONOS3Port,
+ ip4=ONOS4Ip,port4=ONOS4Port,
+ ip5=ONOS5Ip,port5=ONOS5Port )
+ """
+ # REACTIVE FWD test
+
+ main.step( "Get list of hosts from Mininet" )
+ hostList = main.Mininet1.getHosts()
+ main.log.info( hostList )
+
+ main.step( "Get host list in ONOS format" )
+ hostOnosList = main.ONOS2.getHostsId( hostList )
+ main.log.info( hostOnosList )
+ # time.sleep( 5 )
+
+ main.step( "Pingall" )
+ pingResult = main.FALSE
+ 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
+ # if there was no activity
+ main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+
+ case4Result = SwitchMastership and pingResult
+ if pingResult == main.TRUE:
+ main.log.report( "Pingall Test in reactive mode to" +
+ " discover the hosts successful" )
+ else:
+ main.log.report( "Pingall Test in reactive mode to" +
+ " discover the hosts failed" )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case4Result,
+ onpass="Controller assignment and Pingall Test successful",
+ onfail="Controller assignment and Pingall Test NOT successful" )
+
+ def CASE10( self ):
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+ main.log.info( "onos-app-fwd uninstalled" )
+
+ # After reactive forwarding is disabled, the reactive flows on
+ # switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+
+ flows = main.ONOS2.flows()
+ main.log.info( flows )
+
+ case10Result = appUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case10Result,
+ onpass="Reactive forwarding app uninstallation successful",
+ onfail="Reactive forwarding app uninstallation failed" )
+
+
+ def CASE11( self ):
+ # NOTE: This testcase require reactive forwarding mode enabled
+ # NOTE: in the beginning and then uninstall it before adding
+ # NOTE: point intents. Again the app is installed so that
+ # NOTE: testcase 10 can be ran successively
+ import time
+ main.log.report(
+ "This testcase moves a host from one switch to another to add" +
+ "point intents between them and then perform ping" )
+ main.log.report( "__________________________________" )
+ main.log.info( "Moving host from one switch to another" )
+ main.case( "Moving host from a device and attach it to another device" )
+ main.step( "Moving host h9 from device s9 and attach it to s8" )
+ main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
+
+ time.sleep(15) #Time delay to have all the flows ready
+ main.step( "Pingall" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+ hosts = main.ONOS2.hosts( jsonFormat = False )
+ main.log.info( hosts )
+
+ main.case( "Uninstalling reactive forwarding app" )
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+ main.log.info( "onos-app-fwd uninstalled" )
+
+ main.step( "Add point intents between hosts on the same device")
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003008/1",
+ "of:0000000000003008/3" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003008/3",
+ "of:0000000000003008/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ main.case( "Ping hosts on the same devices" )
+ ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
+
+ '''
+ main.case( "Installing reactive forwarding app" )
+ # Install onos-app-fwd app to enable reactive forwarding
+ appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
+ main.log.info( "onos-app-fwd installed" )
+ '''
+
+ if ping == main.FALSE:
+ main.log.report(
+ "Point intents for hosts on same devices haven't" +
+ " been installed correctly. Cleaning up" )
+ if ping == main.TRUE:
+ main.log.report(
+ "Point intents for hosts on same devices" +
+ "installed correctly. Cleaning up" )
+
+ case11Result = ping and pingResult
+ utilities.assert_equals(
+ expect = main.TRUE,
+ actual = case11Result,
+ onpass = "Point intents for hosts on same devices" +
+ "Ping Test successful",
+ onfail = "Point intents for hosts on same devices" +
+ "Ping Test NOT successful" )
+
+
+ def CASE12( self ):
+ """
+ Verify the default flows on each switch in proactive mode
+ """
+ main.log.report( "This testcase is verifying num of default" +
+ " flows on each switch" )
+ main.log.report( "__________________________________" )
+ main.case( "Verify num of default flows on each switch" )
+ main.step( "Obtaining the device id's and flowrule count on them" )
+
+ case12Result = main.TRUE
+ idList = main.ONOS2.getAllDevicesId()
+ for id in idList:
+ count = main.ONOS2.FlowAddedCount( id )
+ main.log.info("count = " +count)
+ if int(count) != 3:
+ case12Result = main.FALSE
+ break
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case12Result,
+ onpass = "Expected default num of flows exist",
+ onfail = "Expected default num of flows do not exist")
+
+
+
+
+ def CASE6( self ):
+ import time
+ main.log.report( "This testcase is testing the addition of" +
+ " host intents and then does pingall" )
+ main.log.report( "__________________________________" )
+ main.case( "Obtaining host id's" )
+ main.step( "Get hosts" )
+ hosts = main.ONOS2.hosts()
+ main.log.info( hosts )
+
+ main.step( "Get all devices id" )
+ devicesIdList = main.ONOS2.getAllDevicesId()
+ main.log.info( devicesIdList )
+
+ # ONOS displays the hosts in hex format unlike mininet which does
+ # in decimal format
+ # So take care while adding intents
+ """
+ main.step( "Add host-to-host intents for mininet hosts h8 and h18 or
+ ONOS hosts h8 and h12" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
+ print "______________________________________________________"
+ """
+ for i in range( 8, 18 ):
+ main.log.info(
+ "Adding host intent between h" + str( i ) +
+ " and h" + str( i + 10 ) )
+ host1 = "00:00:00:00:00:" + \
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper()
+ host2 = "00:00:00:00:00:" + \
+ str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
+ # NOTE: get host can return None
+ # TODO: handle this
+ host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
+
+ host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
+ main.ONOS2.addHostIntent( host1Id, host2Id )
+
+ time.sleep( 10 )
+ hIntents = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intents:" + hIntents )
+ flows = main.ONOS2.flows()
+ main.log.info( "flows:" + flows )
+
+ count = 1
+ i = 8
+ PingResult = main.TRUE
+ # while i<10:
+ while i < 18:
+ main.log.info(
+ "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+ ping = main.Mininet1.pingHost(
+ src="h" + str( i ), target="h" + str( i + 10 ) )
+ if ping == main.FALSE and count < 5:
+ count += 1
+ # i = 8
+ PingResult = main.FALSE
+ main.log.report( "Ping between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ " failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.report( "All ping attempts between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ "have failed" )
+ i = 19
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ "passed!" )
+ i += 1
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Ping all test after Host intent addition failed.Cleaning up" )
+ # main.cleanup()
+ # main.exit()
+ if PingResult == main.TRUE:
+ main.log.report(
+ "Ping all test after Host intent addition successful" )
+
+ case6Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case6Result,
+ onpass="Pingall Test after Host intents addition successful",
+ onfail="Pingall Test after Host intents addition failed" )
+
+ def CASE5( self, main ):
+ import json
+ # assumes that sts is already in you PYTHONPATH
+ from sts.topology.teston_topology import TestONTopology
+ # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ main.log.report( "This testcase is testing if all ONOS nodes" +
+ " are in topology sync with mininet" )
+ main.log.report( "__________________________________" )
+ main.case( "Comparing Mininet topology with the topology of ONOS" )
+ main.step( "Start continuous pings" )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source1' ],
+ target=main.params[ 'PING' ][ 'target1' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source2' ],
+ target=main.params[ 'PING' ][ 'target2' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source3' ],
+ target=main.params[ 'PING' ][ 'target3' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source4' ],
+ target=main.params[ 'PING' ][ 'target4' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source5' ],
+ target=main.params[ 'PING' ][ 'target5' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source6' ],
+ target=main.params[ 'PING' ][ 'target6' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source7' ],
+ target=main.params[ 'PING' ][ 'target7' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source8' ],
+ target=main.params[ 'PING' ][ 'target8' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source9' ],
+ target=main.params[ 'PING' ][ 'target9' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source10' ],
+ target=main.params[ 'PING' ][ 'target10' ],
+ pingTime=500 )
+
+ main.step( "Create TestONTopology object" )
+ global ctrls
+ ctrls = []
+ count = 1
+ while True:
+ temp = ()
+ if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
+ temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
+ temp = temp + ( "ONOS" + str( count ), )
+ temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
+ temp = temp + \
+ ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
+ ctrls.append( temp )
+ count = count + 1
+ else:
+ break
+ global MNTopo
+ Topo = TestONTopology(
+ main.Mininet1,
+ ctrls ) # can also add Intent API info for intent operations
+ MNTopo = Topo
+
+ TopologyCheck = main.TRUE
+ main.step( "Compare ONOS Topology to MN Topology" )
+ devicesJson = main.ONOS2.devices()
+ linksJson = main.ONOS2.links()
+ # portsJson = main.ONOS2.ports()
+
+ result1 = main.Mininet1.compareSwitches(
+ MNTopo,
+ json.loads( devicesJson ) )
+ result2 = main.Mininet1.compareLinks(
+ MNTopo,
+ json.loads( linksJson ) )
+ # result3 = main.Mininet1.comparePorts(
+ # MNTopo, json.loads( portsJson ) )
+
+ # result = result1 and result2 and result3
+ result = result1 and result2
+
+ print "***********************"
+pr if result == main.TRUE:
+ main.log.report( "ONOS" + " Topology matches MN Topology" )
+ else:
+ main.log.report( "ONOS" + " Topology does not match MN Topology" )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=result,
+ onpass="ONOS" +
+ " Topology matches MN Topology",
+ onfail="ONOS" +
+ " Topology does not match MN Topology" )
+
+ TopologyCheck = TopologyCheck and result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=TopologyCheck,
+ onpass="Topology checks passed",
+ onfail="Topology checks failed" )
+
+ def CASE7( self, main ):
+ from sts.topology.teston_topology import TestONTopology
+
+ linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+ main.log.report( "This testscase is killing a link to ensure that" +
+ " link discovery is consistent" )
+ main.log.report( "__________________________________" )
+ main.log.report( "Killing a link to ensure that link discovery" +
+ " is consistent" )
+ main.case( "Killing a link to Ensure that Link Discovery" +
+ "is Working Properly" )
+ """
+ main.step( "Start continuous pings" )
+
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
+ target=main.params[ 'PING' ][ 'target1' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
+ target=main.params[ 'PING' ][ 'target2' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
+ target=main.params[ 'PING' ][ 'target3' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
+ target=main.params[ 'PING' ][ 'target4' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
+ target=main.params[ 'PING' ][ 'target5' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
+ target=main.params[ 'PING' ][ 'target6' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
+ target=main.params[ 'PING' ][ 'target7' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
+ target=main.params[ 'PING' ][ 'target8' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
+ target=main.params[ 'PING' ][ 'target9' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
+ target=main.params[ 'PING' ][ 'target10' ],
+ pingTime=500 )
+ """
+ main.step( "Determine the current number of switches and links" )
+ topologyOutput = main.ONOS2.topology()
+ topologyResult = main.ONOS1.getTopology( topologyOutput )
+ activeSwitches = topologyResult[ 'deviceCount' ]
+ links = topologyResult[ 'linkCount' ]
+ print "activeSwitches = ", type( activeSwitches )
+ print "links = ", type( links )
+ main.log.info(
+ "Currently there are %s switches and %s links" %
+ ( str( activeSwitches ), str( links ) ) )
+
+ main.step( "Kill Link between s3 and s28" )
+ main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
+ time.sleep( linkSleep )
+ topologyOutput = main.ONOS2.topology()
+ LinkDown = main.ONOS1.checkStatus(
+ topologyOutput, activeSwitches, str(
+ int( links ) - 2 ) )
+ if LinkDown == main.TRUE:
+ main.log.report( "Link Down discovered properly" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=LinkDown,
+ onpass="Link Down discovered properly",
+ onfail="Link down was not discovered in " +
+ str( linkSleep ) +
+ " seconds" )
+
+ # Check ping result here..add code for it
+
+ main.step( "Bring link between s3 and s28 back up" )
+ LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
+ time.sleep( linkSleep )
+ topologyOutput = main.ONOS2.topology()
+ LinkUp = main.ONOS1.checkStatus(
+ topologyOutput,
+ activeSwitches,
+ str( links ) )
+ if LinkUp == main.TRUE:
+ main.log.report( "Link up discovered properly" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=LinkUp,
+ onpass="Link up discovered properly",
+ onfail="Link up was not discovered in " +
+ str( linkSleep ) +
+ " seconds" )
+
+ # NOTE Check ping result here..add code for it
+
+ main.step( "Compare ONOS Topology to MN Topology" )
+ Topo = TestONTopology(
+ main.Mininet1,
+ ctrls ) # can also add Intent API info for intent operations
+ MNTopo = Topo
+ TopologyCheck = main.TRUE
+
+ devicesJson = main.ONOS2.devices()
+ linksJson = main.ONOS2.links()
+ portsJson = main.ONOS2.ports()
+
+ result1 = main.Mininet1.compareSwitches(
+ MNTopo,
+ json.loads( devicesJson ) )
+ result2 = main.Mininet1.compareLinks(
+ MNTopo,
+ json.loads( linksJson ) )
+ # result3 = main.Mininet1.comparePorts(
+ # MNTopo, json.loads( portsJson ) )
+
+ # result = result1 and result2 and result3
+ result = result1 and result2
+ print "***********************"
+
+ if result == main.TRUE:
+ main.log.report( "ONOS" + " Topology matches MN Topology" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=result,
+ onpass="ONOS" +
+ " Topology matches MN Topology",
+ onfail="ONOS" +
+ " Topology does not match MN Topology" )
+
+ TopologyCheck = TopologyCheck and result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=TopologyCheck,
+ onpass="Topology checks passed",
+ onfail="Topology checks failed" )
+
+ result = LinkDown and LinkUp and TopologyCheck
+ utilities.assert_equals( expect=main.TRUE, actual=result,
+ onpass="Link failure is discovered correctly",
+ onfail="Link Discovery failed" )
+
+ def CASE8( self ):
+ """
+ Intent removal
+ """
+ import time
+ main.log.report( "This testcase removes any previously added intents" +
+ " before adding any new set of intents" )
+ main.log.report( "__________________________________" )
+ 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 = [line for line in intentLinewise \
+ if line.startswith( "id=")]
+ intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
+ intentList]
+ for id in intentids:
+ print "id = ", id
+
+ main.step(
+ "Iterate through the intentids list and remove each intent" )
+ for id in intentids:
+ main.ONOS2.removeIntent( intentId=id )
+
+ intentResult = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intent_result = " + intentResult )
+
+ intentList = [line for line in intentResult.split( "\n" ) \
+ if line.startswith( "id=")]
+ intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
+ intentList]
+ for state in intentState:
+ print state
+
+ case8Result = main.TRUE
+ for state in intentState:
+ if state != 'WITHDRAWN':
+ case8Result = main.FALSE
+ break
+
+ if case8Result == main.TRUE:
+ main.log.report( "Intent removal successful" )
+ else:
+ main.log.report( "Intent removal failed" )
+
+ PingResult = main.TRUE
+ if case8Result == main.TRUE:
+ i = 8
+ while i < 18:
+ main.log.info(
+ "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+ ping = main.Mininet1.pingHost(
+ src="h" + str( i ), target="h" + str( i + 10 ) )
+ if ping == main.TRUE:
+ i = 19
+ PingResult = PingResult and main.TRUE
+ elif ping == main.FALSE:
+ i += 1
+ PingResult = PingResult and main.FALSE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ # Note: If the ping result failed, that means the intents have been
+ # withdrawn correctly.
+ if PingResult == main.TRUE:
+ main.log.report( "Installed intents have not been withdrawn correctly" )
+ # main.cleanup()
+ # main.exit()
+ if PingResult == main.FALSE:
+ main.log.report( "Installed intents have been withdrawn correctly" )
+
+ case8Result = case8Result and PingResult
+
+ if case8Result == main.FALSE:
+ main.log.report( "Intent removal successful" )
+ else:
+ main.log.report( "Intent removal failed" )
+
+ utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+ onpass="Intent removal test passed",
+ onfail="Intent removal test failed" )
+
+ def CASE9( self ):
+ main.log.report(
+ "This testcase adds point intents and then does pingall" )
+ 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 )" )
+
+ main.step( "Add point intents for mn hosts h8 and h18 or" +
+ "ONOS hosts h8 and h12" )
+ # main.step(var1)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003008/1",
+ "of:0000000000006018/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006018/1",
+ "of:0000000000003008/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+ main.step(var2)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003009/1",
+ "of:0000000000006019/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006019/1",
+ "of:0000000000003009/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+ main.step(var3)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003010/1",
+ "of:0000000000006020/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006020/1",
+ "of:0000000000003010/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+ " ONOS hosts hB and h15"
+ main.case(var4)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003011/1",
+ "of:0000000000006021/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006021/1",
+ "of:0000000000003011/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var5 = "Add point intents for mininet hosts h12 and h22 " +\
+ "ONOS hosts hC and h16"
+ main.case(var5)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003012/1",
+ "of:0000000000006022/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006022/1",
+ "of:0000000000003012/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+ " ONOS hosts hD and h17"
+ main.case(var6)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003013/1",
+ "of:0000000000006023/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006023/1",
+ "of:0000000000003013/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+ " ONOS hosts hE and h18"
+ main.case(var7)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003014/1",
+ "of:0000000000006024/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006024/1",
+ "of:0000000000003014/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+ " ONOS hosts hF and h19"
+ main.case(var8)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003015/1",
+ "of:0000000000006025/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006025/1",
+ "of:0000000000003015/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var9 = "Add intents for mininet hosts h16 and h26 or" +\
+ " ONOS hosts h10 and h1A"
+ main.case(var9)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003016/1",
+ "of:0000000000006026/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006026/1",
+ "of:0000000000003016/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+ " ONOS hosts h11 and h1B"
+ main.case(var10)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003017/1",
+ "of:0000000000006027/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ #main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006027/1",
+ "of:0000000000003017/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ #main.log.info( getIntentResult )
+
+ print(
+ "___________________________________________________________" )
+
+ flowHandle = main.ONOS2.flows()
+ #main.log.info( "flows :" + flowHandle )
+
+ count = 1
+ i = 8
+ PingResult = main.TRUE
+ while i < 18:
+ main.log.info(
+ "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+ ping = main.Mininet1.pingHost(
+ src="h" + str( i ), target="h" + str( i + 10 ) )
+ if ping == main.FALSE and count < 5:
+ count += 1
+ # i = 8
+ PingResult = main.FALSE
+ main.log.report( "Ping between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ " failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.report( "All ping attempts between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ "have failed" )
+ i = 19
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ "passed!" )
+ i += 1
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Point intents have not ben installed correctly. Cleaning up" )
+ # main.cleanup()
+ # main.exit()
+ if PingResult == main.TRUE:
+ main.log.report( "Point Intents have been installed correctly" )
+
+ case9Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case9Result,
+ onpass="Point intents addition and Pingall Test successful",
+ onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.topo b/TestON/tests/ProdFunc/ProdFunc.topo
index 3f3323e..292a8a4 100755
--- a/TestON/tests/ProdFunc/ProdFunc.topo
+++ b/TestON/tests/ProdFunc/ProdFunc.topo
@@ -64,6 +64,7 @@
<arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
<arg2> --topo mytopo </arg2>
<arg3> --switch ovs,protocols=OpenFlow10 </arg3>
+ <arg4> --mac </arg4>
<controller> remote </controller>
</COMPONENTS>
</Mininet2>
diff --git a/TestON/tests/ProdFunc/ProdFunc2.py b/TestON/tests/ProdFunc/ProdFunc2.py
new file mode 100644
index 0000000..2cd04c1
--- /dev/null
+++ b/TestON/tests/ProdFunc/ProdFunc2.py
@@ -0,0 +1,1542 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+# import sys
+# import os
+# import re
+import json
+
+time.sleep( 1 )
+
+
+class ProdFunc:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import time
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-log
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.case( "Setting up test environment" )
+ main.log.report(
+ "This testcase is testing setting up test environment" )
+ main.log.report( "__________________________________" )
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ main.step( "Removing raft logs before a clen installation of ONOS" )
+ main.ONOSbench.onosRemoveRaftLogs()
+
+ main.step( "Git checkout and get version" )
+ #main.ONOSbench.gitCheckout( "master" )
+ gitPullResult = main.ONOSbench.gitPull()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ main.ONOSbench.getVersion( report=True )
+
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ main.ONOSbench.cleanInstall()
+ elif gitPullResult == 0:
+ main.log.report(
+ "Git Pull Failed, look into logs for detailed reason" )
+ main.cleanup()
+ main.exit()
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "Installing ONOS package" )
+ onosInstallResult = main.ONOSbench.onosInstall()
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup()
+ if onos1Isup == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up" )
+
+ main.step( "Starting ONOS service" )
+ 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
+ onos1Isup and startResult )
+ utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+ onpass="Test startup successful",
+ onfail="Test startup NOT successful" )
+
+ def CASE2( self, main ):
+ """
+ Switch Down
+ """
+ # NOTE: You should probably run a topology check after this
+ import time
+
+ main.case( "Switch down discovery" )
+ main.log.report( "This testcase is testing a switch down discovery" )
+ main.log.report( "__________________________________" )
+
+ switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
+
+ description = "Killing a switch to ensure it is discovered correctly"
+ main.log.report( description )
+ main.case( description )
+
+ # TODO: Make this switch parameterizable
+ main.step( "Kill s28 " )
+ main.log.report( "Deleting s28" )
+ # FIXME: use new dynamic topo functions
+ main.Mininet1.delSwitch( "s28" )
+ main.log.info(
+ "Waiting " +
+ str( switchSleep ) +
+ " seconds for switch down to be discovered" )
+ time.sleep( switchSleep )
+ # Peek at the deleted switch
+ device = main.ONOS2.getDevice( dpid="0028" )
+ print "device = ", device
+ if device[ u'available' ] == 'False':
+ case2Result = main.FALSE
+ else:
+ case2Result = main.TRUE
+ utilities.assert_equals( expect=main.TRUE, actual=case2Result,
+ onpass="Switch down discovery successful",
+ onfail="Switch down discovery failed" )
+
+ def CASE101( self, main ):
+ """
+ Cleanup sequence:
+ onos-service <nodeIp> stop
+ onos-uninstall
+
+ TODO: Define rest of cleanup
+
+ """
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.case( "Cleaning up test environment" )
+
+ main.step( "Testing ONOS kill function" )
+ killResult = main.ONOSbench.onosKill( ONOS1Ip )
+
+ main.step( "Stopping ONOS service" )
+ stopResult = main.ONOSbench.onosStop( ONOS1Ip )
+
+ main.step( "Uninstalling ONOS service" )
+ uninstallResult = main.ONOSbench.onosUninstall()
+
+ case11Result = killResult and stopResult and uninstallResult
+ utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+ onpass="Cleanup successful",
+ onfail="Cleanup failed" )
+
+ def CASE3( self, main ):
+ """
+ Test 'onos' command and its functionality in driver
+ """
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.case( "Testing 'onos' command" )
+
+ main.step( "Sending command 'onos -w <onos-ip> system:name'" )
+ cmdstr1 = "system:name"
+ cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
+ main.log.info( "onos command returned: " + cmdResult1 )
+
+ main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
+ cmdstr2 = "onos:topology"
+ cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
+ main.log.info( "onos command returned: " + cmdResult2 )
+
+ def CASE20( self ):
+ """
+ Exit from mininet cli
+ reinstall ONOS
+ """
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.log.report( "This testcase exits the mininet cli and reinstalls" +
+ "ONOS to switch over to Packet Optical topology" )
+ main.log.report( "_____________________________________________" )
+ 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()
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ onosInstallResult = main.ONOSbench.onosInstall()
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Installing ONOS package successful" )
+ else:
+ main.log.report( "Installing ONOS package failed" )
+
+ onos1Isup = main.ONOSbench.isup()
+ if onos1Isup == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up" )
+
+ main.step( "Starting ONOS service" )
+ startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+ main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ case20Result = mininetDisconnect and cellResult and verifyResult \
+ and onosInstallResult and onos1Isup and \
+ startResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case20Result,
+ onpass= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS successful",
+ onfail= "Exiting functionality mininet topology and reinstalling" +
+ " ONOS failed" )
+
+ def CASE21( self, main ):
+ """
+ On ONOS bench, run this command:
+ sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
+ which spawns packet optical topology and copies the links
+ json file to the onos instance.
+ Note that in case of Packet Optical, the links are not learnt
+ from the topology, instead the links are learnt
+ from the json config file
+ """
+ main.log.report(
+ "This testcase starts the packet layer topology and REST" )
+ main.log.report( "_____________________________________________" )
+ main.case( "Starting LINC-OE and other components" )
+ main.step( "Starting LINC-OE and other components" )
+ appInstallResult = main.ONOS2.featureInstall( "onos-app-optical" )
+ opticalMnScript = main.LincOE2.runOpticalMnScript()
+
+ case21Result = opticalMnScript and appInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed" )
+
+ def CASE22( self, main ):
+ """
+ Curretly we use, 10 optical switches(ROADM's) and
+ 6 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 10,
+ packetLayerSWCount variable = 6, hostCount=6 and
+ links=42.
+ All this is hardcoded in the testcase. If the topology changes,
+ these hardcoded values need to be changed
+ """
+ main.log.report(
+ "This testcase compares the optical+packet topology against what" +
+ " is expected" )
+ main.case( "Topology comparision" )
+ main.step( "Topology comparision" )
+ main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ devicesResult = main.ONOS3.devices( jsonFormat=False )
+
+ print "devices_result = ", devicesResult
+ devicesLinewise = devicesResult.split( "\n" )
+ devicesLinewise = devicesLinewise[ 1: ]
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devicesLinewise:
+ components = line.split( "," )
+ availability = components[ 1 ].split( "=" )[ 1 ]
+ type = components[ 3 ].split( "=" )[ 1 ]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type == 'SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 10:
+ print "Number of Optical Switches = %d and is" % roadmCount +\
+ " correctly detected"
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is correctly detected" )
+ opticalSWResult = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" % roadmCount
+ main.log.info(
+ "Number of Optical Switches = " +
+ str( roadmCount ) +
+ " and is wrong" )
+ opticalSWResult = main.FALSE
+
+ if packetLayerSWCount == 6:
+ print "Number of Packet layer or mininet Switches = %d "\
+ % packetLayerSWCount + "and is correctly detected"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is correctly detected" )
+ packetSWResult = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and"\
+ % packetLayerSWCount + " is wrong"
+ main.log.info(
+ "Number of Packet layer or mininet Switches = " +
+ str( packetLayerSWCount ) +
+ " and is wrong" )
+ packetSWResult = main.FALSE
+ print "_________________________________"
+
+ linksResult = main.ONOS3.links( jsonFormat=False )
+ print "links_result = ", linksResult
+ print "_________________________________"
+ linkActiveCount = linksResult.count("state=ACTIVE")
+ main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+ if linkActiveCount == 42:
+ linkActiveResult = main.TRUE
+ main.log.info(
+ "Number of links in ACTIVE state are correct")
+ else:
+ linkActiveResult = main.FALSE
+ main.log.info(
+ "Number of links in ACTIVE state are wrong")
+
+ # NOTE:Since only point intents are added, there is no
+ # requirement to discover the hosts
+ # Therfore, the below portion of the code is commented.
+ """
+ #Discover hosts using pingall
+ pingallResult = main.LincOE2.pingall()
+
+ hostsResult = main.ONOS3.hosts( jsonFormat=False )
+ main.log.info( "hosts_result = "+hostsResult )
+ main.log.info( "_________________________________" )
+ hostsLinewise = hostsResult.split( "\n" )
+ hostsLinewise = hostsLinewise[ 1:-1 ]
+ hostCount = 0
+ for line in hostsLinewise:
+ hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
+ hostCount +=1
+ if hostCount ==2:
+ print "Number of hosts = %d and is correctly detected" %hostCount
+ main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+ is correctly detected" )
+ hostDiscovery = main.TRUE
+ else:
+ print "Number of hosts = %d and is wrong" %hostCount
+ main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+ is wrong" )
+ hostDiscovery = main.FALSE
+ """
+ case22Result = opticalSWResult and packetSWResult and \
+ linkActiveResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed" )
+
+ def CASE23( self, main ):
+ import time
+ """
+ Add bidirectional point intents between 2 packet layer( mininet )
+ devices and
+ ping mininet hosts
+ """
+ main.log.report(
+ "This testcase adds bidirectional point intents between 2 " +
+ "packet layer( mininet ) devices and ping mininet hosts" )
+ main.case( "Topology comparision" )
+ main.step( "Adding point intents" )
+ ptpIntentResult = main.ONOS3.addPointIntent(
+ "of:0000ffffffff0001/1",
+ "of:0000ffffffff0005/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOS3.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ ptpIntentResult = main.ONOS3.addPointIntent(
+ "of:0000ffffffff0005/1",
+ "of:0000ffffffff0001/1" )
+ if ptpIntentResult == main.TRUE:
+ main.ONOS3.intents( jsonFormat=False )
+ main.log.info( "Point to point intent install successful" )
+
+ time.sleep( 30 )
+ flowHandle = main.ONOS3.flows()
+ main.log.info( "flows :" + flowHandle )
+
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep( 60 )
+ intentHandle = main.ONOS3.intents( jsonFormat=False )
+ main.log.info( "intents :" + intentHandle )
+
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Point intents for packet optical have not ben installed" +
+ " correctly. Cleaning up" )
+ if PingResult == main.TRUE:
+ main.log.report(
+ "Point Intents for packet optical have been " +
+ "installed correctly" )
+
+ case23Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case23Result,
+ onpass= "Point intents addition for packet optical and" +
+ "Pingall Test successful",
+ onfail= "Point intents addition for packet optical and" +
+ "Pingall Test NOT successful" )
+
+ def CASE24( self, main ):
+ import time
+ import json
+ """
+ LINC uses its own switch IDs. You can use the following
+ command on the LINC console to find the mapping between
+ DPIDs and LINC IDs.
+ rp(application:get_all_key(linc)).
+
+ Test Rerouting of Packet Optical by bringing a port down
+ ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+ so that link
+ ( between switch1 port20 - switch5 port50 ) is inactive
+ and do a ping test. If rerouting is successful,
+ ping should pass. also check the flows
+ """
+ main.log.report(
+ "This testcase tests rerouting and pings mininet hosts" )
+ main.case( "Test rerouting and pings mininet hosts" )
+ main.step( "Attach to the Linc-OE session" )
+ attachConsole = main.LincOE1.attachLincOESession()
+ print "attachConsole = ", attachConsole
+
+ main.step( "Bring a port down and verify the link state" )
+ main.LincOE1.portDown( swId="9", ptId="20" )
+ linksNonjson = main.ONOS3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+
+ linkInactiveCount = linksNonjson.count("state=INACTIVE")
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 2:
+ main.log.info(
+ "Number of links in INACTIVE state are correct")
+ else:
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+
+ links = main.ONOS3.links()
+ main.log.info( "links = " + links )
+
+ linksResult = json.loads( links )
+ linksStateResult = main.FALSE
+ for item in linksResult:
+ if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+ 'src' ][ 'port' ] == "20":
+ if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+ 'dst' ][ 'port' ] == "50":
+ linksState = item[ 'state' ]
+ if linksState == "INACTIVE":
+ main.log.info(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ main.log.report(
+ "Links state is inactive as expected due to one" +
+ " of the ports being down" )
+ linksStateResult = main.TRUE
+ break
+ else:
+ main.log.info(
+ "Links state is not inactive as expected" )
+ main.log.report(
+ "Links state is not inactive as expected" )
+ linksStateResult = main.FALSE
+
+ print "links_state_result = ", linksStateResult
+ time.sleep( 10 )
+ flowHandle = main.ONOS3.flows()
+ main.log.info( "flows :" + flowHandle )
+
+ main.step( "Verify Rerouting by a ping test" )
+ PingResult = main.TRUE
+ count = 1
+ main.log.info( "\n\nh1 is Pinging h5" )
+ ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ # ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count < 5:
+ count += 1
+ PingResult = main.FALSE
+ main.log.info(
+ "Ping between h1 and h5 failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.info( "All ping attempts between h1 and h5 have failed" )
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h1 and h5 passed!" )
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.TRUE:
+ main.log.report( "Ping test successful " )
+ if PingResult == main.FALSE:
+ main.log.report( "Ping test failed" )
+
+ case24Result = PingResult and linksStateResult
+ utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed" )
+
+ def CASE4( self, main ):
+ import re
+ import time
+ main.log.report( "This testcase is testing the assignment of" +
+ " all the switches to all the controllers and" +
+ " discovering the hosts in reactive mode" )
+ main.log.report( "__________________________________" )
+ main.case( "Pingall Test" )
+ main.step( "Assigning switches to controllers" )
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+ for i in range( 1, 29 ):
+ if i == 1:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ elif i >= 2 and i < 5:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ elif i >= 5 and i < 8:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ elif i >= 8 and i < 18:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ elif i >= 18 and i < 28:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ else:
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+ SwitchMastership = main.TRUE
+ for i in range( 1, 29 ):
+ if i == 1:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ elif i >= 2 and i < 5:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ elif i >= 5 and i < 8:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ elif i >= 8 and i < 18:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ elif i >= 18 and i < 28:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+ else:
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is" + str( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ SwitchMastership = SwitchMastership and main.TRUE
+ else:
+ SwitchMastership = main.FALSE
+
+ if SwitchMastership == main.TRUE:
+ main.log.report( "Controller assignmnet successful" )
+ else:
+ main.log.report( "Controller assignmnet failed" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=SwitchMastership,
+ onpass="MasterControllers assigned correctly" )
+ """
+ for i in range ( 1,29 ):
+ main.Mininet1.assignSwController( sw=str( i ),count=5,
+ ip1=ONOS1Ip,port1=ONOS1Port,
+ ip2=ONOS2Ip,port2=ONOS2Port,
+ ip3=ONOS3Ip,port3=ONOS3Port,
+ ip4=ONOS4Ip,port4=ONOS4Port,
+ ip5=ONOS5Ip,port5=ONOS5Port )
+ """
+ # REACTIVE FWD test
+
+ main.step( "Get list of hosts from Mininet" )
+ hostList = main.Mininet1.getHosts()
+ main.log.info( hostList )
+
+ main.step( "Get host list in ONOS format" )
+ hostOnosList = main.ONOS2.getHostsId( hostList )
+ main.log.info( hostOnosList )
+ # time.sleep( 5 )
+
+ main.step( "Pingall" )
+ pingResult = main.FALSE
+ 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
+ # if there was no activity
+ main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+
+ case4Result = SwitchMastership and pingResult
+ if pingResult == main.TRUE:
+ main.log.report( "Pingall Test in reactive mode to" +
+ " discover the hosts successful" )
+ else:
+ main.log.report( "Pingall Test in reactive mode to" +
+ " discover the hosts failed" )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case4Result,
+ onpass="Controller assignment and Pingall Test successful",
+ onfail="Controller assignment and Pingall Test NOT successful" )
+
+ def CASE10( self ):
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+ main.log.info( "onos-app-fwd uninstalled" )
+
+ # After reactive forwarding is disabled, the reactive flows on
+ # switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+
+ flows = main.ONOS2.flows()
+ main.log.info( flows )
+
+ case10Result = appUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case10Result,
+ onpass="Reactive forwarding app uninstallation successful",
+ onfail="Reactive forwarding app uninstallation failed" )
+
+
+ def CASE11( self ):
+ # NOTE: This testcase require reactive forwarding mode enabled
+ # NOTE: in the beginning and then uninstall it before adding
+ # NOTE: point intents. Again the app is installed so that
+ # NOTE: testcase 10 can be ran successively
+ import time
+ main.log.report(
+ "This testcase moves a host from one switch to another to add" +
+ "point intents between them and then perform ping" )
+ main.log.report( "__________________________________" )
+ main.log.info( "Moving host from one switch to another" )
+ main.case( "Moving host from a device and attach it to another device" )
+ main.step( "Moving host h9 from device s9 and attach it to s8" )
+ main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
+
+ time.sleep(15) #Time delay to have all the flows ready
+ main.step( "Pingall" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+ hosts = main.ONOS2.hosts( jsonFormat = False )
+ main.log.info( hosts )
+
+ main.case( "Uninstalling reactive forwarding app" )
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+ main.log.info( "onos-app-fwd uninstalled" )
+
+ main.step( "Add point intents between hosts on the same device")
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003008/1",
+ "of:0000000000003008/3" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003008/3",
+ "of:0000000000003008/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ main.case( "Ping hosts on the same devices" )
+ ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
+
+ '''
+ main.case( "Installing reactive forwarding app" )
+ # Install onos-app-fwd app to enable reactive forwarding
+ appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
+ main.log.info( "onos-app-fwd installed" )
+ '''
+
+ if ping == main.FALSE:
+ main.log.report(
+ "Point intents for hosts on same devices haven't" +
+ " been installed correctly. Cleaning up" )
+ if ping == main.TRUE:
+ main.log.report(
+ "Point intents for hosts on same devices" +
+ "installed correctly. Cleaning up" )
+
+ case11Result = ping and pingResult
+ utilities.assert_equals(
+ expect = main.TRUE,
+ actual = case11Result,
+ onpass = "Point intents for hosts on same devices" +
+ "Ping Test successful",
+ onfail = "Point intents for hosts on same devices" +
+ "Ping Test NOT successful" )
+
+
+ def CASE12( self ):
+ """
+ Verify the default flows on each switch in proactive mode
+ """
+ main.log.report( "This testcase is verifying num of default" +
+ " flows on each switch" )
+ main.log.report( "__________________________________" )
+ main.case( "Verify num of default flows on each switch" )
+ main.step( "Obtaining the device id's and flowrule count on them" )
+
+ case12Result = main.TRUE
+ idList = main.ONOS2.getAllDevicesId()
+ for id in idList:
+ count = main.ONOS2.FlowAddedCount( id )
+ main.log.info("count = " +count)
+ if int(count) != 3:
+ case12Result = main.FALSE
+ break
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case12Result,
+ onpass = "Expected default num of flows exist",
+ onfail = "Expected default num of flows do not exist")
+
+
+
+
+ def CASE6( self ):
+ import time
+ main.log.report( "This testcase is testing the addition of" +
+ " host intents and then does pingall" )
+ main.log.report( "__________________________________" )
+ main.case( "Obtaining host id's" )
+ main.step( "Get hosts" )
+ hosts = main.ONOS2.hosts()
+ main.log.info( hosts )
+
+ main.step( "Get all devices id" )
+ devicesIdList = main.ONOS2.getAllDevicesId()
+ main.log.info( devicesIdList )
+
+ # ONOS displays the hosts in hex format unlike mininet which does
+ # in decimal format
+ # So take care while adding intents
+ """
+ main.step( "Add host-to-host intents for mininet hosts h8 and h18 or
+ ONOS hosts h8 and h12" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
+ hthIntentResult = main.ONOS2.addHostIntent(
+ "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
+ print "______________________________________________________"
+ """
+ for i in range( 8, 18 ):
+ main.log.info(
+ "Adding host intent between h" + str( i ) +
+ " and h" + str( i + 10 ) )
+ host1 = "00:00:00:00:00:" + \
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper()
+ host2 = "00:00:00:00:00:" + \
+ str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
+ # NOTE: get host can return None
+ if host1:
+ host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
+ if host2:
+ host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
+ if host1Id and host2Id:
+ main.ONOS2.addHostIntent( host1Id, host2Id )
+
+ time.sleep( 10 )
+ hIntents = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intents:" + hIntents )
+ flows = main.ONOS2.flows()
+ main.log.info( "flows:" + flows )
+
+ count = 1
+ i = 8
+ PingResult = main.TRUE
+ # while i<10:
+ while i < 18:
+ main.log.info(
+ "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+ ping = main.Mininet1.pingHost(
+ src="h" + str( i ), target="h" + str( i + 10 ) )
+ if ping == main.FALSE and count < 5:
+ count += 1
+ # i = 8
+ PingResult = main.FALSE
+ main.log.report( "Ping between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ " failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.report( "All ping attempts between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ "have failed" )
+ i = 19
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ "passed!" )
+ i += 1
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Ping all test after Host intent addition failed.Cleaning up" )
+ # main.cleanup()
+ # main.exit()
+ if PingResult == main.TRUE:
+ main.log.report(
+ "Ping all test after Host intent addition successful" )
+
+ case6Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case6Result,
+ onpass="Pingall Test after Host intents addition successful",
+ onfail="Pingall Test after Host intents addition failed" )
+
+ def CASE5( self, main ):
+ import json
+ # assumes that sts is already in you PYTHONPATH
+ from sts.topology.teston_topology import TestONTopology
+ # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ main.log.report( "This testcase is testing if all ONOS nodes" +
+ " are in topology sync with mininet" )
+ main.log.report( "__________________________________" )
+ main.case( "Comparing Mininet topology with the topology of ONOS" )
+ main.step( "Start continuous pings" )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source1' ],
+ target=main.params[ 'PING' ][ 'target1' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source2' ],
+ target=main.params[ 'PING' ][ 'target2' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source3' ],
+ target=main.params[ 'PING' ][ 'target3' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source4' ],
+ target=main.params[ 'PING' ][ 'target4' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source5' ],
+ target=main.params[ 'PING' ][ 'target5' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source6' ],
+ target=main.params[ 'PING' ][ 'target6' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source7' ],
+ target=main.params[ 'PING' ][ 'target7' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source8' ],
+ target=main.params[ 'PING' ][ 'target8' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source9' ],
+ target=main.params[ 'PING' ][ 'target9' ],
+ pingTime=500 )
+ main.Mininet2.pingLong(
+ src=main.params[ 'PING' ][ 'source10' ],
+ target=main.params[ 'PING' ][ 'target10' ],
+ pingTime=500 )
+
+ main.step( "Create TestONTopology object" )
+ global ctrls
+ ctrls = []
+ count = 1
+ while True:
+ temp = ()
+ if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
+ temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
+ temp = temp + ( "ONOS" + str( count ), )
+ temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
+ temp = temp + \
+ ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
+ ctrls.append( temp )
+ count = count + 1
+ else:
+ break
+ global MNTopo
+ Topo = TestONTopology(
+ main.Mininet1,
+ ctrls ) # can also add Intent API info for intent operations
+ MNTopo = Topo
+
+ TopologyCheck = main.TRUE
+ main.step( "Compare ONOS Topology to MN Topology" )
+ devicesJson = main.ONOS2.devices()
+ linksJson = main.ONOS2.links()
+ # portsJson = main.ONOS2.ports()
+
+ result1 = main.Mininet1.compareSwitches(
+ MNTopo,
+ json.loads( devicesJson ) )
+ result2 = main.Mininet1.compareLinks(
+ MNTopo,
+ json.loads( linksJson ) )
+ # result3 = main.Mininet1.comparePorts(
+ # MNTopo, json.loads( portsJson ) )
+
+ # result = result1 and result2 and result3
+ result = result1 and result2
+
+ print "***********************"
+ if result == main.TRUE:
+ main.log.report( "ONOS" + " Topology matches MN Topology" )
+ else:
+ main.log.report( "ONOS" + " Topology does not match MN Topology" )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=result,
+ onpass="ONOS" +
+ " Topology matches MN Topology",
+ onfail="ONOS" +
+ " Topology does not match MN Topology" )
+
+ TopologyCheck = TopologyCheck and result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=TopologyCheck,
+ onpass="Topology checks passed",
+ onfail="Topology checks failed" )
+
+ def CASE7( self, main ):
+ from sts.topology.teston_topology import TestONTopology
+
+ linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+ main.log.report( "This testscase is killing a link to ensure that" +
+ " link discovery is consistent" )
+ main.log.report( "__________________________________" )
+ main.log.report( "Killing a link to ensure that link discovery" +
+ " is consistent" )
+ main.case( "Killing a link to Ensure that Link Discovery" +
+ "is Working Properly" )
+ """
+ main.step( "Start continuous pings" )
+
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
+ target=main.params[ 'PING' ][ 'target1' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
+ target=main.params[ 'PING' ][ 'target2' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
+ target=main.params[ 'PING' ][ 'target3' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
+ target=main.params[ 'PING' ][ 'target4' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
+ target=main.params[ 'PING' ][ 'target5' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
+ target=main.params[ 'PING' ][ 'target6' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
+ target=main.params[ 'PING' ][ 'target7' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
+ target=main.params[ 'PING' ][ 'target8' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
+ target=main.params[ 'PING' ][ 'target9' ],
+ pingTime=500 )
+ main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
+ target=main.params[ 'PING' ][ 'target10' ],
+ pingTime=500 )
+ """
+ main.step( "Determine the current number of switches and links" )
+ topologyOutput = main.ONOS2.topology()
+ topologyResult = main.ONOS1.getTopology( topologyOutput )
+ activeSwitches = topologyResult[ 'deviceCount' ]
+ links = topologyResult[ 'linkCount' ]
+ print "activeSwitches = ", type( activeSwitches )
+ print "links = ", type( links )
+ main.log.info(
+ "Currently there are %s switches and %s links" %
+ ( str( activeSwitches ), str( links ) ) )
+
+ main.step( "Kill Link between s3 and s28" )
+ main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
+ time.sleep( linkSleep )
+ topologyOutput = main.ONOS2.topology()
+ LinkDown = main.ONOS1.checkStatus(
+ topologyOutput, activeSwitches, str(
+ int( links ) - 2 ) )
+ if LinkDown == main.TRUE:
+ main.log.report( "Link Down discovered properly" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=LinkDown,
+ onpass="Link Down discovered properly",
+ onfail="Link down was not discovered in " +
+ str( linkSleep ) +
+ " seconds" )
+
+ # Check ping result here..add code for it
+
+ main.step( "Bring link between s3 and s28 back up" )
+ LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
+ time.sleep( linkSleep )
+ topologyOutput = main.ONOS2.topology()
+ LinkUp = main.ONOS1.checkStatus(
+ topologyOutput,
+ activeSwitches,
+ str( links ) )
+ if LinkUp == main.TRUE:
+ main.log.report( "Link up discovered properly" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=LinkUp,
+ onpass="Link up discovered properly",
+ onfail="Link up was not discovered in " +
+ str( linkSleep ) +
+ " seconds" )
+
+ # NOTE Check ping result here..add code for it
+
+ main.step( "Compare ONOS Topology to MN Topology" )
+ Topo = TestONTopology(
+ main.Mininet1,
+ ctrls ) # can also add Intent API info for intent operations
+ MNTopo = Topo
+ TopologyCheck = main.TRUE
+
+ devicesJson = main.ONOS2.devices()
+ linksJson = main.ONOS2.links()
+ portsJson = main.ONOS2.ports()
+
+ result1 = main.Mininet1.compareSwitches(
+ MNTopo,
+ json.loads( devicesJson ) )
+ result2 = main.Mininet1.compareLinks(
+ MNTopo,
+ json.loads( linksJson ) )
+ # result3 = main.Mininet1.comparePorts(
+ # MNTopo, json.loads( portsJson ) )
+
+ # result = result1 and result2 and result3
+ result = result1 and result2
+ print "***********************"
+
+ if result == main.TRUE:
+ main.log.report( "ONOS" + " Topology matches MN Topology" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=result,
+ onpass="ONOS" +
+ " Topology matches MN Topology",
+ onfail="ONOS" +
+ " Topology does not match MN Topology" )
+
+ TopologyCheck = TopologyCheck and result
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=TopologyCheck,
+ onpass="Topology checks passed",
+ onfail="Topology checks failed" )
+
+ result = LinkDown and LinkUp and TopologyCheck
+ utilities.assert_equals( expect=main.TRUE, actual=result,
+ onpass="Link failure is discovered correctly",
+ onfail="Link Discovery failed" )
+
+ def CASE8( self ):
+ """
+ Intent removal
+ """
+ import time
+ main.log.report( "This testcase removes any previously added intents" +
+ " before adding any new set of intents" )
+ main.log.report( "__________________________________" )
+ 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 = [line for line in intentLinewise \
+ if line.startswith( "id=")]
+ intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
+ intentList]
+ for id in intentids:
+ print "id = ", id
+
+ main.step(
+ "Iterate through the intentids list and remove each intent" )
+ for id in intentids:
+ main.ONOS2.removeIntent( intentId=id )
+
+ intentResult = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intent_result = " + intentResult )
+
+ intentList = [line for line in intentResult.split( "\n" ) \
+ if line.startswith( "id=")]
+ intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
+ intentList]
+ for state in intentState:
+ print state
+
+ case8Result = main.TRUE
+ for state in intentState:
+ if state != 'WITHDRAWN':
+ case8Result = main.FALSE
+ break
+
+ if case8Result == main.TRUE:
+ main.log.report( "Intent removal successful" )
+ else:
+ main.log.report( "Intent removal failed" )
+
+ PingResult = main.TRUE
+ if case8Result == main.TRUE:
+ i = 8
+ while i < 18:
+ main.log.info(
+ "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+ ping = main.Mininet1.pingHost(
+ src="h" + str( i ), target="h" + str( i + 10 ) )
+ if ping == main.TRUE:
+ i = 19
+ PingResult = PingResult and main.TRUE
+ elif ping == main.FALSE:
+ i += 1
+ PingResult = PingResult and main.FALSE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ # Note: If the ping result failed, that means the intents have been
+ # withdrawn correctly.
+ if PingResult == main.TRUE:
+ main.log.report( "Installed intents have not been withdrawn correctly" )
+ # main.cleanup()
+ # main.exit()
+ if PingResult == main.FALSE:
+ main.log.report( "Installed intents have been withdrawn correctly" )
+
+ case8Result = case8Result and PingResult
+
+ if case8Result == main.FALSE:
+ main.log.report( "Intent removal successful" )
+ else:
+ main.log.report( "Intent removal failed" )
+
+ utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+ onpass="Intent removal test passed",
+ onfail="Intent removal test failed" )
+
+ def CASE9( self ):
+ main.log.report(
+ "This testcase adds point intents and then does pingall" )
+ 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 )" )
+
+ main.step( "Add point intents for mn hosts h8 and h18 or" +
+ "ONOS hosts h8 and h12" )
+ # main.step(var1)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003008/1",
+ "of:0000000000006018/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006018/1",
+ "of:0000000000003008/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+ main.step(var2)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003009/1",
+ "of:0000000000006019/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006019/1",
+ "of:0000000000003009/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+ main.step(var3)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003010/1",
+ "of:0000000000006020/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006020/1",
+ "of:0000000000003010/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+ " ONOS hosts hB and h15"
+ main.case(var4)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003011/1",
+ "of:0000000000006021/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006021/1",
+ "of:0000000000003011/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var5 = "Add point intents for mininet hosts h12 and h22 " +\
+ "ONOS hosts hC and h16"
+ main.case(var5)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003012/1",
+ "of:0000000000006022/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006022/1",
+ "of:0000000000003012/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+ " ONOS hosts hD and h17"
+ main.case(var6)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003013/1",
+ "of:0000000000006023/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006023/1",
+ "of:0000000000003013/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+ " ONOS hosts hE and h18"
+ main.case(var7)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003014/1",
+ "of:0000000000006024/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006024/1",
+ "of:0000000000003014/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+ " ONOS hosts hF and h19"
+ main.case(var8)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003015/1",
+ "of:0000000000006025/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006025/1",
+ "of:0000000000003015/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var9 = "Add intents for mininet hosts h16 and h26 or" +\
+ " ONOS hosts h10 and h1A"
+ main.case(var9)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003016/1",
+ "of:0000000000006026/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006026/1",
+ "of:0000000000003016/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ # main.log.info( getIntentResult )
+
+ var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+ " ONOS hosts h11 and h1B"
+ main.case(var10)
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000003017/1",
+ "of:0000000000006027/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ #main.log.info( getIntentResult )
+
+ ptpIntentResult = main.ONOS2.addPointIntent(
+ "of:0000000000006027/1",
+ "of:0000000000003017/1" )
+ if ptpIntentResult == main.TRUE:
+ getIntentResult = main.ONOS2.intents()
+ main.log.info( "Point to point intent install successful" )
+ #main.log.info( getIntentResult )
+
+ print(
+ "___________________________________________________________" )
+
+ flowHandle = main.ONOS2.flows()
+ #main.log.info( "flows :" + flowHandle )
+
+ count = 1
+ i = 8
+ PingResult = main.TRUE
+ while i < 18:
+ main.log.info(
+ "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+ ping = main.Mininet1.pingHost(
+ src="h" + str( i ), target="h" + str( i + 10 ) )
+ if ping == main.FALSE and count < 5:
+ count += 1
+ # i = 8
+ PingResult = main.FALSE
+ main.log.report( "Ping between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ " failed. Making attempt number " +
+ str( count ) +
+ " in 2 seconds" )
+ time.sleep( 2 )
+ elif ping == main.FALSE:
+ main.log.report( "All ping attempts between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ "have failed" )
+ i = 19
+ PingResult = main.FALSE
+ elif ping == main.TRUE:
+ main.log.info( "Ping test between h" +
+ str( i ) +
+ " and h" +
+ str( i +
+ 10 ) +
+ "passed!" )
+ i += 1
+ PingResult = main.TRUE
+ else:
+ main.log.info( "Unknown error" )
+ PingResult = main.ERROR
+
+ if PingResult == main.FALSE:
+ main.log.report(
+ "Point intents have not ben installed correctly. Cleaning up" )
+ # main.cleanup()
+ # main.exit()
+ if PingResult == main.TRUE:
+ main.log.report( "Point Intents have been installed correctly" )
+
+ case9Result = PingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case9Result,
+ onpass="Point intents addition and Pingall Test successful",
+ onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.params b/TestON/tests/ProdFunc13/ProdFunc13.params
index 4367bf4..b926dad 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.params
+++ b/TestON/tests/ProdFunc13/ProdFunc13.params
@@ -1,11 +1,13 @@
<PARAMS>
-
+ #1,4,10,5,6,7,8,9,8,11,8,20,21,22,10,23,24
<testcases>1,4,10,5,6,7,8,9,8,11,8,2,20,21,22,10,23,24</testcases>
#Environment variables
<ENV>
<cellName>driver_test</cellName>
</ENV>
-
+ <GIT>
+ <pull>False</pull>
+ </GIT>
<CTRL>
<ip1>10.128.20.11</ip1>
<port1>6633</port1>
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index a4d819c..ade6d07 100644
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -31,6 +31,7 @@
"""
cellName = main.params[ 'ENV' ][ 'cellName' ]
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
main.case( "Setting up test environment" )
main.log.report(
@@ -41,44 +42,54 @@
cellResult = main.ONOSbench.setCell( cellName )
verifyResult = main.ONOSbench.verifyCell()
- main.step( "Removing raft logs before a clen installation of ONOS" )
- main.ONOSbench.onosRemoveRaftLogs()
-
main.step( "Git checkout and get version" )
- #main.ONOSbench.gitCheckout( "master" )
- gitPullResult = main.ONOSbench.gitPull()
- main.log.info( "git_pull_result = " + str( gitPullResult ))
+ main.ONOSbench.gitCheckout( "master" )
+ if gitPull == 'True':
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == 1:
+ main.step( "Using mvn clean & install" )
+ main.ONOSbench.cleanInstall()
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+ elif gitPullResult == 0:
+ main.log.report(
+ "Git Pull Failed, look into logs for detailed reason" )
+ main.cleanup()
+ main.exit()
+ main.log.info( "git_pull_result = " + str( gitPullResult ))
+ else:
+ main.log.info( "Skipping git pull" )
main.ONOSbench.getVersion( report=True )
+ packageResult = main.TRUE
- if gitPullResult == 1:
- main.step( "Using mvn clean & install" )
- main.ONOSbench.cleanInstall()
- elif gitPullResult == 0:
- main.log.report(
- "Git Pull Failed, look into logs for detailed reason" )
- main.cleanup()
- main.exit()
+ main.step( "Uninstalling ONOS package" )
+ onosInstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
+ if onosInstallResult == main.TRUE:
+ main.log.report( "Uninstalling ONOS package successful" )
+ else:
+ main.log.report( "Uninstalling ONOS package failed" )
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
+ time.sleep( 20 )
main.step( "Installing ONOS package" )
- onosInstallResult = main.ONOSbench.onosInstall()
+ onosInstallResult = main.ONOSbench.onosInstall( ONOS1Ip )
+ print onosInstallResult
if onosInstallResult == main.TRUE:
main.log.report( "Installing ONOS package successful" )
else:
main.log.report( "Installing ONOS package failed" )
+ time.sleep( 20 )
onos1Isup = main.ONOSbench.isup()
if onos1Isup == main.TRUE:
main.log.report( "ONOS instance is up and ready" )
else:
main.log.report( "ONOS instance may not be up" )
- main.step( "Starting ONOS service" )
- startResult = main.ONOSbench.onosStart( ONOS1Ip )
+ startResult = main.TRUE
+ #main.step( "Starting ONOS service" )
+ #startResult = main.ONOSbench.onosStart( ONOS1Ip )
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ main.ONOS2.startOnosCli( ONOS1Ip )
main.step( "Starting Mininet CLI..." )
# Starting the mininet using the old way
@@ -183,6 +194,7 @@
Exit from mininet cli
reinstall ONOS
"""
+ import time
cellName = main.params[ 'ENV' ][ 'cellName' ]
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
@@ -190,22 +202,60 @@
"ONOS to switch over to Packet Optical topology" )
main.log.report( "_____________________________________________" )
main.case( "Disconnecting mininet and restarting ONOS" )
+
main.step( "Disconnecting mininet and restarting ONOS" )
+ step1Result = main.TRUE
mininetDisconnect = main.Mininet1.disconnect()
- print "mininetDisconnect = ", mininetDisconnect
-
- main.step( "Removing raft logs before a clen installation of ONOS" )
- main.ONOSbench.onosRemoveRaftLogs()
-
+ print "mininetDisconnect = ", mininetDisconnect
+ step1Result = mininetDisconnect
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Mininet disconnect successfully",
+ onfail="Mininet failed to disconnect")
+ """
+ main.step( "Removing raft logs before a clean installation of ONOS" )
+ step2Result = main.TRUE
+ removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+ step2Result = removeRaftLogsResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Raft logs removed successfully",
+ onfail="Failed to remove raft logs")
+ """
main.step( "Applying cell variable to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
+ step3Result = main.TRUE
+ setCellResult = main.ONOSbench.setCell( cellName )
+ verifyCellResult = main.ONOSbench.verifyCell()
+ step3Result = setCellResult and verifyCellResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Cell applied successfully",
+ onfail="Failed to apply cell")
- onosInstallResult = main.ONOSbench.onosInstall()
- if onosInstallResult == main.TRUE:
- main.log.report( "Installing ONOS package successful" )
- else:
- main.log.report( "Installing ONOS package failed" )
+ main.step( "Uninstalling ONOS package" )
+ step4Result = main.TRUE
+ ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+ onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+ step4Result = onosUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully uninstalled ONOS",
+ onfail="Failed to uninstall ONOS")
+
+ time.sleep( 5 )
+ main.step( "Installing ONOS package" )
+ step5Result = main.TRUE
+ onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+ step5Result = onosInstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step5Result,
+ onpass="Successfully installed ONOS",
+ onfail="Failed to install ONOS")
onos1Isup = main.ONOSbench.isup()
if onos1Isup == main.TRUE:
@@ -214,19 +264,24 @@
main.log.report( "ONOS instance may not be up" )
main.step( "Starting ONOS service" )
+ step6Result = main.TRUE
startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
- main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- case20Result = mininetDisconnect and cellResult and verifyResult \
- and onosInstallResult and onos1Isup and \
- startResult
+ step6Result = startResult
utilities.assert_equals(
expect=main.TRUE,
- actual=case20Result,
- onpass= "Exiting functionality mininet topology and reinstalling" +
- " ONOS successful",
- onfail= "Exiting functionality mininet topology and reinstalling" +
- " ONOS failed" )
+ actual=step6Result,
+ onpass="Successfully started ONOS",
+ onfail="Failed to start ONOS")
+
+ main.step( "Starting ONOS cli" )
+ step7Result = main.TRUE
+ cliResult = main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+ step7Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step7Result,
+ onpass="Successfully started ONOS cli",
+ onfail="Failed to start ONOS cli")
def CASE21( self, main ):
"""
@@ -238,20 +293,37 @@
from the topology, instead the links are learnt
from the json config file
"""
+ import time
main.log.report(
"This testcase starts the packet layer topology and REST" )
main.log.report( "_____________________________________________" )
main.case( "Starting LINC-OE and other components" )
- main.step( "Starting LINC-OE and other components" )
- appInstallResult = main.ONOS2.featureInstall( "onos-app-optical" )
- opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
- case21Result = opticalMnScript and appInstallResult
+ main.step( "Activate optical app" )
+ step1Result = main.TRUE
+ activateOpticalResult = main.ONOS2.activateApp( "org.onosproject.optical" )
+ step1Result = activateOpticalResult
utilities.assert_equals(
expect=main.TRUE,
- actual=case21Result,
- onpass="Packet optical topology spawned successsfully",
- onfail="Packet optical topology spawning failed" )
+ actual=step1Result,
+ onpass="Successfully activated optical app",
+ onfail="Failed to activate optical app")
+
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+
+ main.step( "Starting mininet and LINC-OE" )
+ step2Result = main.TRUE
+ time.sleep( 10 )
+ opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+ step2Result = opticalMnScript
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Started the topology successfully ",
+ onfail="Failed to start the topology")
def CASE22( self, main ):
"""
@@ -259,21 +331,32 @@
6 packet layer mininet switches each with one host.
Therefore, the roadmCount variable = 10,
packetLayerSWCount variable = 6, hostCount=6 and
- links=42.
+ links=46.
All this is hardcoded in the testcase. If the topology changes,
these hardcoded values need to be changed
"""
+ import time
main.log.report(
"This testcase compares the optical+packet topology against what" +
" is expected" )
main.case( "Topology comparision" )
- main.step( "Topology comparision" )
- main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
- devicesResult = main.ONOS3.devices( jsonFormat=False )
- print "devices_result = ", devicesResult
+ main.step( "Starts new ONOS cli" )
+ step1Result = main.TRUE
+ cliResult = main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+ [ 'ip1' ] )
+ step1Result = cliResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully starts a new cli",
+ onfail="Failed to start new cli" )
+
+ main.step( "Compare topology" )
+ step2Result = main.TRUE
+ devicesResult = main.ONOS3.devices( jsonFormat=False )
+ print "devices_result :\n", devicesResult
devicesLinewise = devicesResult.split( "\n" )
- devicesLinewise = devicesLinewise[ 1: ]
roadmCount = 0
packetLayerSWCount = 0
for line in devicesLinewise:
@@ -299,7 +382,6 @@
str( roadmCount ) +
" and is wrong" )
opticalSWResult = main.FALSE
-
if packetLayerSWCount == 6:
print "Number of Packet layer or mininet Switches = %d "\
% packetLayerSWCount + "and is correctly detected"
@@ -316,14 +398,15 @@
str( packetLayerSWCount ) +
" and is wrong" )
packetSWResult = main.FALSE
+ # sleeps for sometime so the state of the switches will be active
+ time.sleep( 30 )
print "_________________________________"
-
linksResult = main.ONOS3.links( jsonFormat=False )
print "links_result = ", linksResult
print "_________________________________"
- linkActiveCount = linksResult.count("state=ACTIVE")
+ linkActiveCount = linksResult.count("state=ACTIVE")
main.log.info( "linkActiveCount = " + str( linkActiveCount ))
- if linkActiveCount == 42:
+ if linkActiveCount == 46:
linkActiveResult = main.TRUE
main.log.info(
"Number of links in ACTIVE state are correct")
@@ -331,41 +414,13 @@
linkActiveResult = main.FALSE
main.log.info(
"Number of links in ACTIVE state are wrong")
-
- # NOTE:Since only point intents are added, there is no
- # requirement to discover the hosts
- # Therfore, the below portion of the code is commented.
- """
- #Discover hosts using pingall
- pingallResult = main.LincOE2.pingall()
-
- hostsResult = main.ONOS3.hosts( jsonFormat=False )
- main.log.info( "hosts_result = "+hostsResult )
- main.log.info( "_________________________________" )
- hostsLinewise = hostsResult.split( "\n" )
- hostsLinewise = hostsLinewise[ 1:-1 ]
- hostCount = 0
- for line in hostsLinewise:
- hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
- hostCount +=1
- if hostCount ==2:
- print "Number of hosts = %d and is correctly detected" %hostCount
- main.log.info( "Number of hosts = " + str( hostCount ) +" and \
- is correctly detected" )
- hostDiscovery = main.TRUE
- else:
- print "Number of hosts = %d and is wrong" %hostCount
- main.log.info( "Number of hosts = " + str( hostCount ) +" and \
- is wrong" )
- hostDiscovery = main.FALSE
- """
- case22Result = opticalSWResult and packetSWResult and \
+ step2Result = opticalSWResult and packetSWResult and \
linkActiveResult
utilities.assert_equals(
expect=main.TRUE,
- actual=case22Result,
- onpass="Packet optical topology discovery successful",
- onfail="Packet optical topology discovery failed" )
+ actual=step2Result,
+ onpass="Successfully loaded packet optical topology",
+ onfail="Failed to load packet optical topology" )
def CASE23( self, main ):
import time
@@ -377,71 +432,50 @@
main.log.report(
"This testcase adds bidirectional point intents between 2 " +
"packet layer( mininet ) devices and ping mininet hosts" )
- main.case( "Topology comparision" )
+ main.case( "Install point intents between 2 packet layer device and " +
+ "ping the hosts" )
+
main.step( "Adding point intents" )
- ptpIntentResult = main.ONOS3.addPointIntent(
+ checkFlowResult = main.TRUE
+ step1Result = main.TRUE
+ main.pIntentsId = []
+ pIntent1 = main.ONOS3.addPointIntent(
"of:0000ffffffff0001/1",
"of:0000ffffffff0005/1" )
- if ptpIntentResult == main.TRUE:
- main.ONOS3.intents( jsonFormat=False )
- main.log.info( "Point to point intent install successful" )
-
- ptpIntentResult = main.ONOS3.addPointIntent(
+ pIntent2 = main.ONOS3.addPointIntent(
"of:0000ffffffff0005/1",
"of:0000ffffffff0001/1" )
- if ptpIntentResult == main.TRUE:
- main.ONOS3.intents( jsonFormat=False )
- main.log.info( "Point to point intent install successful" )
-
- time.sleep( 30 )
- flowHandle = main.ONOS3.flows()
- main.log.info( "flows :" + flowHandle )
-
+ main.pIntentsId.append( pIntent1 )
+ main.pIntentsId.append( pIntent2 )
+ time.sleep( 10 )
+ main.log.info( "Checking intents state")
+ checkStateResult = main.ONOS3.checkIntentState(
+ intentsId = main.pIntentsId )
+ time.sleep( 10 )
+ main.log.info( "Checking flows state")
+ checkFlowResult = main.ONOS3.checkFlowsState()
# Sleep for 30 seconds to provide time for the intent state to change
- time.sleep( 60 )
- intentHandle = main.ONOS3.intents( jsonFormat=False )
- main.log.info( "intents :" + intentHandle )
-
- PingResult = main.TRUE
- count = 1
- main.log.info( "\n\nh1 is Pinging h5" )
- ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
- # ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count < 5:
- count += 1
- PingResult = main.FALSE
- main.log.info(
- "Ping between h1 and h5 failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.info( "All ping attempts between h1 and h5 have failed" )
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h1 and h5 passed!" )
- PingResult = main.TRUE
- else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
-
- if PingResult == main.FALSE:
- main.log.report(
- "Point intents for packet optical have not ben installed" +
- " correctly. Cleaning up" )
- if PingResult == main.TRUE:
- main.log.report(
- "Point Intents for packet optical have been " +
- "installed correctly" )
-
- case23Result = PingResult
+ time.sleep( 10 )
+ main.log.info( "Checking intents state one more time")
+ checkStateResult = main.ONOS3.checkIntentState(
+ intentsId = main.pIntentsId )
+ step1Result = checkStateResult and checkFlowResult
utilities.assert_equals(
expect=main.TRUE,
- actual=case23Result,
- onpass= "Point intents addition for packet optical and" +
- "Pingall Test successful",
- onfail= "Point intents addition for packet optical and" +
- "Pingall Test NOT successful" )
+ actual=step1Result,
+ onpass="Successfully added point intents",
+ onfail="Failed to add point intents")
+
+ main.step( "Ping h1 and h5" )
+ step2Result = main.TRUE
+ main.log.info( "\n\nh1 is Pinging h5" )
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step2Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
def CASE24( self, main ):
import time
@@ -462,16 +496,23 @@
main.log.report(
"This testcase tests rerouting and pings mininet hosts" )
main.case( "Test rerouting and pings mininet hosts" )
+
main.step( "Attach to the Linc-OE session" )
- attachConsole = main.LincOE1.attachLincOESession()
- print "attachConsole = ", attachConsole
+ step1Result = main.TRUE
+ attachConsole = main.LincOE1.attachLincOESession()
+ step1Result = attachConsole
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully attached Linc-OE session",
+ onfail="Failed to attached Linc-OE session")
main.step( "Bring a port down and verify the link state" )
+ step2Result = main.TRUE
main.LincOE1.portDown( swId="9", ptId="20" )
linksNonjson = main.ONOS3.links( jsonFormat=False )
main.log.info( "links = " + linksNonjson )
-
- linkInactiveCount = linksNonjson.count("state=INACTIVE")
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
if linkInactiveCount == 2:
main.log.info(
@@ -479,10 +520,8 @@
else:
main.log.info(
"Number of links in INACTIVE state are wrong")
-
links = main.ONOS3.links()
main.log.info( "links = " + links )
-
linksResult = json.loads( links )
linksStateResult = main.FALSE
for item in linksResult:
@@ -506,45 +545,184 @@
main.log.report(
"Links state is not inactive as expected" )
linksStateResult = main.FALSE
-
- print "links_state_result = ", linksStateResult
time.sleep( 10 )
- flowHandle = main.ONOS3.flows()
- main.log.info( "flows :" + flowHandle )
+ checkFlowsState = main.ONOS3.checkFlowsState()
+ step2Result = linksStateResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step2Result,
+ onpass="Successfuly brought down a link",
+ onfail="Failed to bring down a link")
main.step( "Verify Rerouting by a ping test" )
- PingResult = main.TRUE
- count = 1
+ step3Result = main.TRUE
main.log.info( "\n\nh1 is Pinging h5" )
- ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
- # ping = main.LincOE2.pinghost()
- if ping == main.FALSE and count < 5:
- count += 1
- PingResult = main.FALSE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+ step3Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step3Result,
+ onpass="Successfully pinged h1 and h5",
+ onfail="Failed to ping between h1 and h5")
+
+ main.step( "Bring the downed port up and verify the link state" )
+ step4Result = main.TRUE
+ main.LincOE1.portUp( swId="9", ptId="20" )
+ linksNonjson = main.ONOS3.links( jsonFormat=False )
+ main.log.info( "links = " + linksNonjson )
+ linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+ main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+ if linkInactiveCount == 0:
main.log.info(
- "Ping between h1 and h5 failed. Making attempt number " +
- str( count ) +
- " in 2 seconds" )
- time.sleep( 2 )
- elif ping == main.FALSE:
- main.log.info( "All ping attempts between h1 and h5 have failed" )
- PingResult = main.FALSE
- elif ping == main.TRUE:
- main.log.info( "Ping test between h1 and h5 passed!" )
- PingResult = main.TRUE
+ "Number of links in INACTIVE state are correct")
else:
- main.log.info( "Unknown error" )
- PingResult = main.ERROR
+ main.log.info(
+ "Number of links in INACTIVE state are wrong")
+ step4Result = main.FALSE
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully brought the port up",
+ onfail="Failed to bring the port up")
+ """
+ main.step( "Removing host intents" )
+ step5Result = main.TRUE
+ removeResult = main.TRUE
+ # Check remaining intents
+ intentsJson = json.loads( main.ONOS3.intents() )
+ main.ONOS3.removeIntent( intentId=intent1, purge=True )
+ main.ONOS3.removeIntent( intentId=intent2, purge=True )
+ for intents in intentsJson:
+ main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+ app='org.onosproject.optical',
+ purge=True )
+ print json.loads( main.ONOS3.intents() )
+ if len( json.loads( main.ONOS3.intents() ) ):
+ removeResult = main.FALSE
+ step5Result = removeResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step5Result,
+ onpass="Successfully removed host intents",
+ onfail="Failed to remove host intents" )
+ """
+ def CASE10( self ):
+ main.log.report(
+ "This testcase uninstalls the reactive forwarding app" )
+ main.log.report( "__________________________________" )
+ main.case( "Uninstalling reactive forwarding app" )
+ main.step( "Uninstalling reactive forwarding app" )
+ step1Result = main.TRUE
+ # Unistall onos-app-fwd app to disable reactive forwarding
+ main.log.info( "deactivate reactive forwarding app" )
+ appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+ step1Result = appUninstallResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Successfully deactivate reactive forwarding app",
+ onfail="Failed to deactivate reactive forwarding app")
+ # After reactive forwarding is disabled, the reactive flows on
+ # switches timeout in 10-15s
+ # So sleep for 15s
+ time.sleep( 15 )
+ flows = main.ONOS2.flows()
+ main.log.info( flows )
- if PingResult == main.TRUE:
- main.log.report( "Ping test successful " )
- if PingResult == main.FALSE:
- main.log.report( "Ping test failed" )
+ def CASE25( self ):
+ """
+ Add host intents between 2 packet layer host
+ """
+ import time
+ import json
+ main.log.report( "Adding host intents between 2 optical layer host" )
+ main.case( "Test add host intents between optical layer host" )
- case24Result = PingResult and linksStateResult
- utilities.assert_equals( expect=main.TRUE, actual=case24Result,
- onpass="Packet optical rerouting successful",
- onfail="Packet optical rerouting failed" )
+ main.step( "Discover host using arping" )
+ step1Result = main.TRUE
+ main.hostMACs = []
+ main.hostId = []
+ #Listing host MAC addresses
+ for i in range( 1 , 7 ):
+ main.hostMACs.append( "00:00:00:00:00:" +
+ str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+ for macs in main.hostMACs:
+ main.hostId.append( macs + "/-1" )
+ host1 = main.hostId[ 0 ]
+ host2 = main.hostId[ 1 ]
+ # Use arping to discover the hosts
+ main.LincOE2.arping( host = "h1" )
+ main.LincOE2.arping( host = "h2" )
+ time.sleep( 5 )
+ hostsDict = main.ONOS3.hosts()
+ if not len( hostsDict ):
+ step1Result = main.FALSE
+ # Adding host intent
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=step1Result,
+ onpass="Hosts discovered",
+ onfail="Failed to discover hosts")
+
+ main.step( "Adding host intents to h1 and h2" )
+ step2Result = main.TRUE
+ intentsId = []
+ intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
+ hostIdTwo = host2 )
+ intentsId.append( intent1 )
+ time.sleep( 5 )
+ intent2 = main.ONOS3.addHostIntent( hostIdOne = host2,
+ hostIdTwo = host1 )
+ intentsId.append( intent2 )
+ # Checking intents state before pinging
+ main.log.info( "Checking intents state" )
+ time.sleep( 15 )
+ intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ #check intent state again if intents are not in installed state
+ if not intentResult:
+ intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+ step2Result = intentResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step2Result,
+ onpass="All intents are in INSTALLED state ",
+ onfail="Some of the intents are not in " +
+ "INSTALLED state " )
+
+ # pinging h1 to h2 and then ping h2 to h1
+ main.step( "Pinging h1 and h2" )
+ step3Result = main.TRUE
+ pingResult = main.TRUE
+ pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+ pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+ target="h1" )
+ step3Result = pingResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step3Result,
+ onpass="Pinged successfully between h1 and h2",
+ onfail="Pinged failed between h1 and h2" )
+ # Removed all added host intents
+ main.step( "Removing host intents" )
+ step4Result = main.TRUE
+ removeResult = main.TRUE
+ # Check remaining intents
+ intentsJson = json.loads( main.ONOS3.intents() )
+ main.ONOS3.removeIntent( intentId=intent1, purge=True )
+ main.ONOS3.removeIntent( intentId=intent2, purge=True )
+ for intents in intentsJson:
+ main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+ app='org.onosproject.optical',
+ purge=True )
+ print json.loads( main.ONOS3.intents() )
+ if len( json.loads( main.ONOS3.intents() ) ):
+ removeResult = main.FALSE
+ step4Result = removeResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=step4Result,
+ onpass="Successfully removed host intents",
+ onfail="Failed to remove host intents" )
def CASE4( self, main ):
import re
@@ -553,6 +731,7 @@
" all the switches to all the controllers and" +
" discovering the hosts in reactive mode" )
main.log.report( "__________________________________" )
+
main.case( "Pingall Test" )
main.step( "Assigning switches to controllers" )
ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
@@ -651,6 +830,13 @@
ip5=ONOS5Ip,port5=ONOS5Port )
"""
# REACTIVE FWD test
+ main.log.info( "Activate fwd app" )
+ appInstallResult = main.ONOS2.activateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+ time.sleep( 10 )
main.step( "Get list of hosts from Mininet" )
hostList = main.Mininet1.getHosts()
@@ -687,31 +873,6 @@
onpass="Controller assignment and Pingall Test successful",
onfail="Controller assignment and Pingall Test NOT successful" )
- def CASE10( self ):
- main.log.report(
- "This testcase uninstalls the reactive forwarding app" )
- main.log.report( "__________________________________" )
- main.case( "Uninstalling reactive forwarding app" )
- # Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd uninstalled" )
-
- # After reactive forwarding is disabled, the reactive flows on
- # switches timeout in 10-15s
- # So sleep for 15s
- time.sleep( 15 )
-
- flows = main.ONOS2.flows()
- main.log.info( flows )
-
- case10Result = appUninstallResult
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case10Result,
- onpass="Reactive forwarding app uninstallation successful",
- onfail="Reactive forwarding app uninstallation failed" )
-
-
def CASE11( self ):
# NOTE: This testcase require reactive forwarding mode enabled
# NOTE: in the beginning and then uninstall it before adding
@@ -727,26 +888,40 @@
main.step( "Moving host h9 from device s9 and attach it to s8" )
main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
- time.sleep(15) #Time delay to have all the flows ready
+ main.log.info( "Activate fwd app" )
+ appInstallResult = main.ONOS2.activateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
+
+ time.sleep(25) #Time delay to have all the flows ready
main.step( "Pingall" )
pingResult = main.FALSE
time1 = time.time()
- pingResult = main.Mininet1.pingall()
+ pingResult = main.Mininet1.pingall( timeout=120,
+ shortCircuit=True,
+ acceptableFailed=20 )
time2 = time.time()
print "Time for pingall: %2f seconds" % ( time2 - time1 )
hosts = main.ONOS2.hosts( jsonFormat = False )
main.log.info( hosts )
- main.case( "Uninstalling reactive forwarding app" )
- # Unistall onos-app-fwd app to disable reactive forwarding
- appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
- main.log.info( "onos-app-fwd uninstalled" )
+ main.log.info( "deactivate reactive forwarding app" )
+ appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+ appCheck = main.ONOS2.appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.ONOS2.apps() )
+ main.log.warn( main.ONOS2.appIDs() )
main.step( "Add point intents between hosts on the same device")
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003008/1",
- "of:0000000000003008/3" )
+ "of:0000000000003008/3",
+ ethType='IPV4',
+ ethSrc='00:00:00:00:00:08',
+ ethDst='00:00:00:00:00:09' )
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -754,7 +929,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003008/3",
- "of:0000000000003008/1" )
+ "of:0000000000003008/1",
+ ethType='IPV4',
+ ethSrc='00:00:00:00:00:09',
+ ethDst='00:00:00:00:00:08' )
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -779,7 +957,7 @@
"Point intents for hosts on same devices" +
"installed correctly. Cleaning up" )
- case11Result = ping and pingResult
+ case11Result = ping
utilities.assert_equals(
expect = main.TRUE,
actual = case11Result,
@@ -788,7 +966,6 @@
onfail = "Point intents for hosts on same devices" +
"Ping Test NOT successful" )
-
def CASE12( self ):
"""
Verify the default flows on each switch in proactive mode
@@ -812,9 +989,6 @@
actual=case12Result,
onpass = "Expected default num of flows exist",
onfail = "Expected default num of flows do not exist")
-
-
-
def CASE6( self ):
import time
@@ -858,6 +1032,7 @@
"00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
print "______________________________________________________"
"""
+ intentsId = []
for i in range( 8, 18 ):
main.log.info(
"Adding host intent between h" + str( i ) +
@@ -872,8 +1047,9 @@
if host2:
host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
if host1Id and host2Id:
- main.ONOS2.addHostIntent( host1Id, host2Id )
+ intentsId.append( main.ONOS2.addHostIntent( host1Id, host2Id ) )
+ checkIntentResult = main.ONOS2.checkIntentState( intentsId )
time.sleep( 10 )
hIntents = main.ONOS2.intents( jsonFormat=False )
main.log.info( "intents:" + hIntents )
@@ -932,6 +1108,8 @@
main.log.report(
"Ping all test after Host intent addition successful" )
+ checkIntentResult = main.ONOS2.checkIntentState( intentsId )
+
case6Result = PingResult
utilities.assert_equals(
expect=main.TRUE,
@@ -940,6 +1118,9 @@
onfail="Pingall Test after Host intents addition failed" )
def CASE5( self, main ):
+ """
+ Check ONOS topology matches with mininet
+ """
import json
# assumes that sts is already in you PYTHONPATH
from sts.topology.teston_topology import TestONTopology
@@ -1016,7 +1197,7 @@
main.step( "Compare ONOS Topology to MN Topology" )
devicesJson = main.ONOS2.devices()
linksJson = main.ONOS2.links()
- # portsJson = main.ONOS2.ports()
+ portsJson = main.ONOS2.ports()
result1 = main.Mininet1.compareSwitches(
MNTopo,
@@ -1024,9 +1205,8 @@
result2 = main.Mininet1.compareLinks(
MNTopo,
json.loads( linksJson ) )
- # result3 = main.Mininet1.comparePorts(
- # MNTopo, json.loads( portsJson ) )
+ result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
# result = result1 and result2 and result3
result = result1 and result2
@@ -1052,6 +1232,11 @@
onfail="Topology checks failed" )
def CASE7( self, main ):
+ """
+ Link discovery test case. Checks if ONOS can discover a link
+ down or up properly.
+ """
+
from sts.topology.teston_topology import TestONTopology
linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
@@ -1100,8 +1285,8 @@
main.step( "Determine the current number of switches and links" )
topologyOutput = main.ONOS2.topology()
topologyResult = main.ONOS1.getTopology( topologyOutput )
- activeSwitches = topologyResult[ 'deviceCount' ]
- links = topologyResult[ 'linkCount' ]
+ activeSwitches = topologyResult[ 'devices' ]
+ links = topologyResult[ 'links' ]
print "activeSwitches = ", type( activeSwitches )
print "links = ", type( links )
main.log.info(
@@ -1164,8 +1349,7 @@
result2 = main.Mininet1.compareLinks(
MNTopo,
json.loads( linksJson ) )
- # result3 = main.Mininet1.comparePorts(
- # MNTopo, json.loads( portsJson ) )
+ result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
# result = result1 and result2 and result3
result = result1 and result2
@@ -1204,9 +1388,9 @@
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" )
+ currentIntents = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intent_result = " + currentIntents )
+ intentLinewise = currentIntents.split( "\n" )
intentList = [line for line in intentLinewise \
if line.startswith( "id=")]
@@ -1218,30 +1402,31 @@
main.step(
"Iterate through the intentids list and remove each intent" )
for id in intentids:
- main.ONOS2.removeIntent( intentId=id )
+ main.ONOS2.removeIntent( intentId=id ,purge=True)
- intentResult = main.ONOS2.intents( jsonFormat=False )
- main.log.info( "intent_result = " + intentResult )
-
- intentList = [line for line in intentResult.split( "\n" ) \
+ remainingIntents = main.ONOS2.intents( jsonFormat=False )
+ main.log.info( "intent_result = " + remainingIntents )
+ if remainingIntents:
+ main.log.info( "There are still remaining intents " )
+ intentResult = main.FALSE
+ else:
+ intentResult = main.TRUE
+
+ intentList = [line for line in remainingIntents.split( "\n" ) \
if line.startswith( "id=")]
intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
intentList]
for state in intentState:
print state
- case8Result = main.TRUE
+ case8Result = main.TRUE
for state in intentState:
if state != 'WITHDRAWN':
case8Result = main.FALSE
break
-
- if case8Result == main.TRUE:
- main.log.report( "Intent removal successful" )
- else:
- main.log.report( "Intent removal failed" )
PingResult = main.TRUE
+ """
if case8Result == main.TRUE:
i = 8
while i < 18:
@@ -1258,7 +1443,7 @@
else:
main.log.info( "Unknown error" )
PingResult = main.ERROR
-
+
# Note: If the ping result failed, that means the intents have been
# withdrawn correctly.
if PingResult == main.TRUE:
@@ -1267,42 +1452,51 @@
# main.exit()
if PingResult == main.FALSE:
main.log.report( "Installed intents have been withdrawn correctly" )
+ """
- case8Result = case8Result and PingResult
-
- if case8Result == main.FALSE:
+ if case8Result:
main.log.report( "Intent removal successful" )
else:
main.log.report( "Intent removal failed" )
- utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+ utilities.assert_equals( expect=main.TRUE, actual=case8Result,
onpass="Intent removal test passed",
onfail="Intent removal test failed" )
def CASE9( self ):
+ """
+ Testing Point intents
+ """
main.log.report(
- "This testcase adds point intents and then does pingall" )
+ "This test case adds point intents and then does pingall" )
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 )" )
-
+ macsDict = {}
+ for i in range( 1,29 ):
+ macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) )
+ print macsDict
main.step( "Add point intents for mn hosts h8 and h18 or" +
"ONOS hosts h8 and h12" )
# main.step(var1)
ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000003008/1",
- "of:0000000000006018/1" )
+ ingressDevice="of:0000000000003008/1",
+ egressDevice="of:0000000000006018/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h8' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
# main.log.info( getIntentResult )
ptpIntentResult = main.ONOS2.addPointIntent(
- "of:0000000000006018/1",
- "of:0000000000003008/1" )
+ ingressDevice="of:0000000000006018/1",
+ egressDevice="of:0000000000003008/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h18' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1312,7 +1506,9 @@
main.step(var2)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003009/1",
- "of:0000000000006019/1" )
+ "of:0000000000006019/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h9' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1320,7 +1516,9 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006019/1",
- "of:0000000000003009/1" )
+ "of:0000000000003009/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h19' ))
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1330,7 +1528,10 @@
main.step(var3)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003010/1",
- "of:0000000000006020/1" )
+ "of:0000000000006020/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h10' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1338,7 +1539,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006020/1",
- "of:0000000000003010/1" )
+ "of:0000000000003010/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h20' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1349,7 +1553,10 @@
main.case(var4)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003011/1",
- "of:0000000000006021/1" )
+ "of:0000000000006021/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h11' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1357,7 +1564,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006021/1",
- "of:0000000000003011/1" )
+ "of:0000000000003011/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h21' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1368,7 +1578,10 @@
main.case(var5)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003012/1",
- "of:0000000000006022/1" )
+ "of:0000000000006022/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h12' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1376,7 +1589,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006022/1",
- "of:0000000000003012/1" )
+ "of:0000000000003012/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h22' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1387,7 +1603,10 @@
main.case(var6)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003013/1",
- "of:0000000000006023/1" )
+ "of:0000000000006023/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h13' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1395,7 +1614,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006023/1",
- "of:0000000000003013/1" )
+ "of:0000000000003013/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h23' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1406,7 +1628,10 @@
main.case(var7)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003014/1",
- "of:0000000000006024/1" )
+ "of:0000000000006024/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h14' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1414,7 +1639,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006024/1",
- "of:0000000000003014/1" )
+ "of:0000000000003014/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h24' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1425,7 +1653,10 @@
main.case(var8)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003015/1",
- "of:0000000000006025/1" )
+ "of:0000000000006025/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h15' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1433,7 +1664,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006025/1",
- "of:0000000000003015/1" )
+ "of:0000000000003015/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h25' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1444,7 +1678,10 @@
main.case(var9)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003016/1",
- "of:0000000000006026/1" )
+ "of:0000000000006026/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h16' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1452,7 +1689,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006026/1",
- "of:0000000000003016/1" )
+ "of:0000000000003016/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h26' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1463,7 +1703,10 @@
main.case(var10)
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000003017/1",
- "of:0000000000006027/1" )
+ "of:0000000000006027/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h17' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
@@ -1471,7 +1714,10 @@
ptpIntentResult = main.ONOS2.addPointIntent(
"of:0000000000006027/1",
- "of:0000000000003017/1" )
+ "of:0000000000003017/1",
+ ethType='IPV4',
+ ethSrc=macsDict.get( 'h27' ))
+
if ptpIntentResult == main.TRUE:
getIntentResult = main.ONOS2.intents()
main.log.info( "Point to point intent install successful" )
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.topo b/TestON/tests/ProdFunc13/ProdFunc13.topo
index 9cef3f7..2605b2e 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.topo
+++ b/TestON/tests/ProdFunc13/ProdFunc13.topo
@@ -49,6 +49,7 @@
<arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
<arg2> --topo mytopo </arg2>
<arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <arg4> --mac </arg4>
<controller> remote </controller>
</COMPONENTS>
</Mininet1>
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params
index d4fa651..4e3ffdb 100644
--- a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params
+++ b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params
@@ -15,43 +15,43 @@
</TEST>
<GIT>
- <autopull>on</autopull>
+ <autopull>off</autopull>
<checkout>master</checkout>
</GIT>
<CTRL>
<USER>admin</USER>
- <ip1>10.128.5.51</ip1>
+ <ip1>OC1</ip1>
<port1>6633</port1>
- <ip2>10.128.5.52</ip2>
+ <ip2>OC2</ip2>
<port2>6633</port2>
- <ip3>10.128.5.53</ip3>
+ <ip3>OC3</ip3>
<port3>6633</port3>
- <ip4>10.128.5.54</ip4>
+ <ip4>OC4</ip4>
<port4>6633</port4>
- <ip5>10.128.5.65</ip5>
+ <ip5>OC5</ip5>
<port5>6633</port5>
- <ip6>10.128.5.66</ip6>
+ <ip6>OC6</ip6>
<port6>6633</port6>
- <ip7>10.128.5.67</ip7>
+ <ip7>OC7</ip7>
<port7>6633</port7>
</CTRL>
<MN>
- <ip1>10.128.5.55</ip1>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
<user>admin</user>
- <ip1>10.128.5.55</ip1>
+ <ip1>OCN</ip1>
</BENCH>
<JSON>
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py
new file mode 100644
index 0000000..a8d21d2
--- /dev/null
+++ b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py
@@ -0,0 +1,121 @@
+# ScaleOutTemplate
+#
+# CASE1 starts number of nodes specified in param file
+#
+# cameron@onlab.us
+
+import sys
+import os.path
+
+
+class ScaleOutTemplate:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+
+ import time
+ global init
+
+ try:
+ if type(init) is not bool:
+ init = False
+ except NameError:
+ init = False
+
+ #Load values from params file
+ checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
+ gitPull = main.params[ 'GIT' ][ 'autopull' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ Apps = main.params[ 'ENV' ][ 'cellApps' ]
+ BENCHUser = main.params[ 'BENCH' ][ 'user' ]
+ maxNodes = int(main.params[ 'availableNodes' ])
+ skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+
+ # -- INIT SECTION, ONLY RUNS ONCE -- #
+ if init == False:
+ init = True
+ global clusterCount #number of nodes running
+ global ONOSIp #list of ONOS IP addresses
+ global scale
+
+ clusterCount = 0
+ ONOSIp = [ 0 ]
+ scale = (main.params[ 'SCALE' ]).split(",")
+ clusterCount = int(scale[0])
+
+ #Populate ONOSIp with ips from params
+ ONOSIp = [0]
+ ONOSIp.extend(main.ONOSbench.getOnosIps())
+ MN1Ip = ONOSIp[len(ONOSIp) -1]
+ BENCHIp = ONOSIp[len(ONOSIp) -2]
+
+ #git
+ main.step( "Git checkout and pull " + checkoutBranch )
+ if gitPull == 'on':
+ checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
+ pullResult = main.ONOSbench.gitPull()
+ else:
+ main.log.info( "Skipped git checkout and pull" )
+
+ if skipMvn != "yes":
+ mvnResult = main.ONOSbench.cleanInstall()
+
+ # -- END OF INIT SECTION --#
+
+ clusterCount = int(scale[0])
+ scale.remove(scale[0])
+
+ #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])
+
+ #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] )
+
+ #construct the cell file
+ main.log.info("Creating cell file")
+ cellIp = []
+ for node in range (1, clusterCount + 1):
+ cellIp.append(ONOSIp[node])
+
+ main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+
+ main.step( "Set Cell" )
+ main.ONOSbench.setCell(cellName)
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "verify cells" )
+ verifyCellResult = main.ONOSbench.verifyCell()
+
+ main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
+ for node in range(1, clusterCount + 1):
+ main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
+ main.ONOSbench.onosInstall( ONOSIp[node])
+
+ for node in range(1, clusterCount + 1):
+ for i in range( 2 ):
+ isup = main.ONOSbench.isup( ONOSIp[node] )
+ if isup:
+ main.log.info("ONOS " + str(node) + " is up\n")
+ break
+ if not isup:
+ main.log.report( "ONOS " + str(node) + " didn't start!" )
+ main.log.info("Startup sequence complete")
+
+ def CASE2( self, main ):
+
+ print ("clusterCount: " + str(clusterCount))
+ print ("scale: " + str(scale))
+ print ("ONOSIp: " + str(ONOSIp))
+ print ("INIT: " + str(init))
+
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo
index 0802eca..d82f3fd 100644
--- a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo
+++ b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo
@@ -3,25 +3,25 @@
<COMPONENT>
<ONOSbench>
- <host>10.128.5.55</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
+ <COMPONENTS><home>~/onos</home></COMPONENTS>
</ONOSbench>
<ONOS1cli>
- <host>10.128.5.55</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
<connect_order>2</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS1cli>
-
+
<ONOS2cli>
- <host>10.128.5.55</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,16 +30,52 @@
</ONOS2cli>
<ONOS3cli>
- <host>10.128.5.55</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
<connect_order>4</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS3cli>
-
+
+ <ONOS4cli>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS4cli>
+
+ <ONOS5cli>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS5cli>
+
+ <ONOS6cli>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS6cli>
+
+ <ONOS7cli>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS7cli>
+
<ONOS1>
- <host>10.128.5.51</host>
+ <host>OC1</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -48,7 +84,7 @@
</ONOS1>
<ONOS2>
- <host>10.128.5.52</host>
+ <host>OC2</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -57,7 +93,7 @@
</ONOS2>
<ONOS3>
- <host>10.128.5.53</host>
+ <host>OC3</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -65,21 +101,44 @@
<COMPONENTS> </COMPONENTS>
</ONOS3>
- <Mininet1>
- <host>10.128.5.55</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>MininetCliDriver</type>
- <connect_order>16</connect_order>
- <COMPONENTS>
- <arg1> --custom ~/mininet/custom/topo-2sw-2host.py </arg1>
- <arg2> --arp --mac --topo mytopo</arg2>
- <arg3> </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
+ <ONOS4>
+ <host>OC4</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>12</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS4>
+
+
+ <ONOS5>
+ <host>OC5</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>13</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS5>
+
+ <ONOS6>
+ <host>OC6</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>14</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS6>
+
+ <ONOS7>
+ <host>OC7</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/flowTP1g/flowTP1g.params b/TestON/tests/flowTP1g/flowTP1g.params
index 54320a7..a3b104f 100644
--- a/TestON/tests/flowTP1g/flowTP1g.params
+++ b/TestON/tests/flowTP1g/flowTP1g.params
@@ -1,8 +1,8 @@
<PARAMS>
- <testcases>1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2</testcases>
+ <testcases>1,2,1,2,1,2,1,2,1,2,1,2,1,2</testcases>
- <isOnBaremetal>False</isOnBaremetal>
+ <isOnBaremetal>True</isOnBaremetal>
<SCALE>1,3,3,5,5,7,7</SCALE>
<availableNodes>7</availableNodes>
@@ -28,43 +28,43 @@
</TEST>
<GIT>
- <autopull>on</autopull>
+ <autopull>off</autopull>
<checkout>master</checkout>
</GIT>
<CTRL>
<USER>admin</USER>
- <ip1>10.128.5.51</ip1>
+ <ip1>OC1</ip1>
<port1>6633</port1>
- <ip2>10.128.5.52</ip2>
+ <ip2>OC2</ip2>
<port2>6633</port2>
- <ip3>10.128.5.53</ip3>
+ <ip3>OC3</ip3>
<port3>6633</port3>
- <ip4>10.128.5.54</ip4>
+ <ip4>OC4</ip4>
<port4>6633</port4>
- <ip5>10.128.5.55</ip5>
+ <ip5>OC5</ip5>
<port5>6633</port5>
- <ip6>10.128.5.56</ip6>
+ <ip6>OC6</ip6>
<port6>6633</port6>
- <ip7>10.128.5.57</ip7>
+ <ip7>OC7</ip7>
<port7>6633</port7>
</CTRL>
<MN>
- <ip1>10.128.5.59</ip1>
+ <ip1>OCN</ip1>
</MN>
<BENCH>
<user>admin</user>
- <ip1>10.128.5.50</ip1>
+ <ip1>OCN</ip1>
</BENCH>
<JSON>
diff --git a/TestON/tests/flowTP1g/flowTP1g.py b/TestON/tests/flowTP1g/flowTP1g.py
index cbea039..22bc737 100644
--- a/TestON/tests/flowTP1g/flowTP1g.py
+++ b/TestON/tests/flowTP1g/flowTP1g.py
@@ -28,9 +28,7 @@
gitPull = main.params[ 'GIT' ][ 'autopull' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
Apps = main.params[ 'ENV' ][ 'cellApps' ]
- BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- MN1Ip = main.params[ 'MN' ][ 'ip1' ]
maxNodes = int(main.params[ 'availableNodes' ])
skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
@@ -59,6 +57,11 @@
ipString = 'ip' + str(i)
ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
+ ONOSIp = [0]
+ ONOSIp.extend(main.ONOSbench.getOnosIps())
+ MN1Ip = ONOSIp[len(ONOSIp)-1]
+ BENCHIp = ONOSIp[len(ONOSIp)-2]
+
#mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
if skipMvn != "yes":
mvnResult = main.ONOSbench.cleanInstall()
@@ -152,7 +155,7 @@
try:
currentNeighbors
except:
- currentNeighbors = "0"
+ currentNeighbors = (main.params[ 'TEST' ][ 'neighbors' ]).split(",")[0]
else:
if currentNeighbors == "r": #reset
currentNeighbors = "0"
@@ -189,7 +192,7 @@
currentNeighbors = "r"
else:
neighborList = ['0']
-
+
main.log.info("neightborlist: " + str(neighborList))
ts = time.time()
@@ -226,31 +229,35 @@
if i < int(maxNodes):
ipCSV +=","
+ for i in range(5):
+ main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount 35" """)
+ main.ONOSbench.handle.expect(":~")
+ time.sleep(3)
+ main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """)
+ main.ONOSbench.handle.expect(":~")
+ time.sleep(3)
+ main.ONOSbench.handle.sendline("""onos $OC1 "null-simulation start" """)
+ main.ONOSbench.handle.expect(":~")
+ time.sleep(3)
+ main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """)
+ main.ONOSbench.handle.expect(":~")
+ time.sleep(3)
+ main.log.info("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBackup + """" """)
+ main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBackup + """" """)
+ main.ONOSbench.handle.expect(":~")
- main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount 35" """)
- main.ONOSbench.handle.expect(":~")
- time.sleep(3)
- main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """)
- main.ONOSbench.handle.expect(":~")
- time.sleep(3)
- main.ONOSbench.handle.sendline("""onos $OC1 "null-simulation start" """)
- main.ONOSbench.handle.expect(":~")
- time.sleep(3)
- main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """)
- main.ONOSbench.handle.expect(":~")
- time.sleep(3)
- main.log.info("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBackup + """" """)
- main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBackup + """" """)
- main.ONOSbench.handle.expect(":~")
-
- main.ONOSbench.handle.sendline("onos $OC1 summary")
- main.ONOSbench.handle.expect(":~")
- check = main.ONOSbench.handle.before
+ main.ONOSbench.handle.sendline("""onos $OC1 "cfg get" """)
+ main.ONOSbench.handle.expect(":~")
+ main.log.info(main.ONOSbench.handle.before)
- main.ONOSbench.handle.sendline("""onos $OC1 "cfg get" """)
- main.ONOSbench.handle.expect(":~")
- check = main.ONOSbench.handle.before
- main.log.info("\nStart up check: \n" + check + "\n")
+ time.sleep(3)
+ main.ONOSbench.handle.sendline("onos $OC1 summary")
+ main.ONOSbench.handle.expect(":~")
+ check = main.ONOSbench.handle.before
+ main.log.info("\nStart up check: \n" + check + "\n")
+ if "SCC(s)=1," in check:
+ break
+ time.sleep(5)
#devide flows
flows = int(main.params[ 'TEST' ][ 'flows' ])
@@ -288,7 +295,15 @@
if "failed" in rawResult:
main.log.report("FLOW_TESTER.PY FAILURE")
- main.log.report( " \n" + rawResult + " \n")
+ main.log.report( " \n" + rawResult + " \n")
+ for i in range(clusterCount):
+ main.log.report("=======================================================")
+ main.log.report(" ONOS " + str(i) + "LOG REPORT")
+ main.ONOSbench.logReport(ONOSIp[i], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
+ main.ONOSbench.handle.sendline("onos $OC1 flows")
+ main.ONOSbench.handle.expect(":~")
+ main.log.info(main.ONOSbench.handle.before)
+
break
########################################################################################
@@ -303,10 +318,7 @@
for word in temp:
#print ("word: " + word)
if "elapsed" in repr(word):
- #print("in elapsed ==========")
index = temp.index(word) + 1
- #print ("index: " + str(index))
- #print ("temp[index]: " + temp[index])
myParsed = (temp[index]).replace(",","")
myParsed = myParsed.replace("}","")
myParsed = int(myParsed)
@@ -400,4 +412,4 @@
main.log.report("Result line to file: " + resultString)
- main.ONOSbench.onosErrorLog(ONOSIp[1])
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
diff --git a/TestON/tests/flowTP1g/flowTP1g.topo b/TestON/tests/flowTP1g/flowTP1g.topo
index 763a4d6..d82f3fd 100644
--- a/TestON/tests/flowTP1g/flowTP1g.topo
+++ b/TestON/tests/flowTP1g/flowTP1g.topo
@@ -3,7 +3,7 @@
<COMPONENT>
<ONOSbench>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
@@ -12,7 +12,7 @@
</ONOSbench>
<ONOS1cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -21,7 +21,7 @@
</ONOS1cli>
<ONOS2cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,7 +30,7 @@
</ONOS2cli>
<ONOS3cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -39,7 +39,7 @@
</ONOS3cli>
<ONOS4cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -48,7 +48,7 @@
</ONOS4cli>
<ONOS5cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -57,7 +57,7 @@
</ONOS5cli>
<ONOS6cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -66,7 +66,7 @@
</ONOS6cli>
<ONOS7cli>
- <host>10.128.5.50</host>
+ <host>OCN</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -75,7 +75,7 @@
</ONOS7cli>
<ONOS1>
- <host>10.128.5.51</host>
+ <host>OC1</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -84,7 +84,7 @@
</ONOS1>
<ONOS2>
- <host>10.128.5.52</host>
+ <host>OC2</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -93,7 +93,7 @@
</ONOS2>
<ONOS3>
- <host>10.128.5.53</host>
+ <host>OC3</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -102,7 +102,7 @@
</ONOS3>
<ONOS4>
- <host>10.128.5.54</host>
+ <host>OC4</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -112,7 +112,7 @@
<ONOS5>
- <host>10.128.5.55</host>
+ <host>OC5</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -121,7 +121,7 @@
</ONOS5>
<ONOS6>
- <host>10.128.5.56</host>
+ <host>OC6</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -130,7 +130,7 @@
</ONOS6>
<ONOS7>
- <host>10.128.5.57</host>
+ <host>OC7</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>