Merge "ONOS-2388 Error handling for incorrect and blank passwords for the cli driver connect() function"
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..c24bb9d
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.onosproject.org
+port=29418
+project=OnosSystemTest.git
+defaultremote=origin
+defaultbranch=master
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 8eea845..e4dbf9d 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -93,6 +93,7 @@
self.Thread = Thread
self.cleanupFlag = False
self.cleanupLock = threading.Lock()
+ self.initiated = False
self.configparser()
verifyOptions(options)
@@ -151,6 +152,7 @@
This method will initialize specified component
'''
global driver_options
+ self.initiated = False
self.log.info("Creating component Handle: "+component)
driver_options = {}
if 'COMPONENTS' in self.componentDictionary[component].keys():
@@ -176,6 +178,7 @@
self.exit()
vars(self)[component] = driverObject
+ self.initiated = True
def run(self):
'''
@@ -353,7 +356,8 @@
try:
if self.cleanupFlag is False: # First thread to run this
self.cleanupFlag = True
- self.logger.testSummary(self)
+ if self.initiated:
+ self.logger.testSummary(self)
for component in self.componentDictionary.keys():
try :
tempObject = vars(self)[component]
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index b877d93..27ce3dc 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1795,11 +1795,14 @@
"""
# Regex patterns to parse dump output
# Example host: <Host h1: h1-eth0:10.0.0.1 pid=5227>
- # or <Host h1: pid=12725>
+ # <Host h1: pid=12725>
+ # <VLANHost h12: h12-eth0.100.100.100:100.1.0.3 pid=30186>
+ # <dualStackHost h19: h19-eth0:10.1.0.9 pid=30200>
+ # <IPv6Host h18: h18-eth0:10.0.0.18 pid=30198>
# NOTE: Does not correctly match hosts with multi-links
# <Host h2: h2-eth0:10.0.0.2,h2-eth1:10.0.1.2 pid=14386>
# FIXME: Fix that
- hostRE = r"<Host\s(?P<name>[^:]+)\:((\s(?P<ifname>[^:]+)\:" +\
+ hostRE = r"Host\s(?P<name>[^:]+)\:((\s(?P<ifname>[^:]+)\:" +\
"(?P<ip>[^\s]+))|(\s)\spid=(?P<pid>[^>]+))"
# update mn port info
self.update()
@@ -1807,7 +1810,7 @@
dump = self.dump().split( "\n" )
hosts = {}
for line in dump:
- if line.startswith( "<Host" ):
+ if "Host" in line :
result = re.search( hostRE, line )
name = result.group( 'name' )
interfaces = []
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 870293d..2f8bd47 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2578,14 +2578,6 @@
Optional argument:
* jsonFormat - boolean indicating if you want output in json
"""
- # FIXME: add json output
- # Sample JSON
- # {
- # "electedTime": "13m ago",
- # "epoch": 4,
- # "leader": "10.128.30.17",
- # "topic": "intent-partition-3"
- # },
try:
cmdStr = "onos:leaders"
if jsonFormat:
@@ -2605,6 +2597,63 @@
main.cleanup()
main.exit()
+ def leaderCandidates( self, jsonFormat=True ):
+ """
+ Returns the output of the leaders -c command.
+ Optional argument:
+ * jsonFormat - boolean indicating if you want output in json
+ """
+ try:
+ cmdStr = "onos:leaders -c"
+ if jsonFormat:
+ cmdStr += " -j"
+ output = self.sendline( cmdStr )
+ return output
+ 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 specificLeaderCandidate(self,topic):
+ """
+ Returns a list in format [leader,candidate1,candidate2,...] for a given
+ topic parameter and an empty list if the topic doesn't exist
+ If no leader is elected leader in the returned list will be "none"
+ Returns None if there is a type error processing the json object
+ """
+ try:
+ cmdStr = "onos:leaders -c -j"
+ output = self.sendline( cmdStr )
+ output = json.loads(output)
+ results = []
+ for dict in output:
+ if dict["topic"] == topic:
+ leader = dict["leader"]
+ candidates = re.split(", ",dict["candidates"][1:-1])
+ results.append(leader)
+ results.extend(candidates)
+ return results
+ 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 pendingMap( self, jsonFormat=True ):
"""
Returns the output of the intent Pending map.
@@ -3511,7 +3560,7 @@
except AssertionError:
main.log.error( "Error in processing 'set-test-get' command: " +
str( output ) )
- return None
+ return None
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
return None
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 8a87a49..8e9b3e0 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -18,6 +18,7 @@
"""
import sys
import time
+import types
import pexpect
import os
import os.path
@@ -58,26 +59,36 @@
self.name = self.options[ 'name' ]
+ # The 'nodes' tag is optional and it is not required in .topo file
for key in self.options:
if key == "nodes":
- # Maximum number of ONOS nodes to run
+ # Maximum number of ONOS nodes to run, if there is any
self.maxNodes = int( self.options[ 'nodes' ] )
break
self.maxNodes = None
+ if self.maxNodes == None or self.maxNodes == "":
+ self.maxNodes = 100
- # Grabs all OC environment variables
+
+ # Grabs all OC environment variables based on max number of nodes
self.onosIps = {} # Dictionary of all possible ONOS ip
try:
if self.maxNodes:
- main.log.info( self.name + ": Creating cluster data with " +
- str( self.maxNodes ) + " maximum number" +
- " of nodes" )
-
for i in range( self.maxNodes ):
envString = "OC" + str( i + 1 )
- self.onosIps[ envString ] = os.getenv( envString )
+ # If there is no more OC# then break the loop
+ if os.getenv( envString ):
+ self.onosIps[ envString ] = os.getenv( envString )
+ else:
+ self.maxNodes = len( self.onosIps )
+ main.log.info( self.name +
+ ": Created cluster data with " +
+ str( self.maxNodes ) +
+ " maximum number" +
+ " of nodes" )
+ break
if not self.onosIps:
main.log.info( "Could not read any environment variable"
@@ -87,7 +98,6 @@
main.log.info( self.name + ": Found " +
str( self.onosIps.values() ) +
" ONOS IPs" )
-
except KeyError:
main.log.info( "Invalid environment variable" )
except Exception as inst:
@@ -100,7 +110,6 @@
main.log.info( self.name +
": Trying to connect to " +
self.ip_address )
-
except KeyError:
main.log.info( "Invalid host name," +
" connecting to local host instead" )
@@ -115,15 +124,13 @@
pwd=self.pwd,
home=self.home )
- self.handle.sendline( "cd " + self.home )
- self.handle.expect( "\$" )
-
if self.handle:
+ self.handle.sendline( "cd " + self.home )
+ self.handle.expect( "\$" )
return self.handle
else:
- main.log.info( "NO ONOS HANDLE" )
+ main.log.info( "Failed to create ONOS handle" )
return main.FALSE
-
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
@@ -662,12 +669,14 @@
~/<self.home>/tools/test/cells/
"""
# Variable initialization
- cellDirectory = os.environ["ONOS_ROOT"] + "/tools/test/cells/"
+ cellDirectory = self.home + "/tools/test/cells/"
# We want to create the cell file in the dependencies directory
# of TestON first, then copy over to ONOS bench
tempDirectory = "/tmp/"
# Create the cell file in the directory for writing ( w+ )
cellFile = open( tempDirectory + fileName, 'w+' )
+ if isinstance( onosIpAddrs, types.StringType ):
+ onosIpAddrs = [ onosIpAddrs ]
# App string is hardcoded environment variables
# That you may wish to use by default on startup.
@@ -713,8 +722,8 @@
# Note that even if TestON is located on the same cluster
# as ONOS bench, you must setup passwordless ssh
# between TestON and ONOS bench in order to automate the test.
- os.system( "scp " + tempDirectory + fileName +
- " admin@" + benchIp + ":" + cellDirectory )
+ os.system( "scp " + tempDirectory + fileName + " " +
+ self.user_name + "@" + self.ip_address + ":" + cellDirectory )
return main.TRUE
@@ -1919,7 +1928,7 @@
linkGraph.close()
#SCP
- os.system( "scp " + tempFile + " admin@" + benchIp + ":" + linkGraphPath)
+ os.system( "scp " + tempFile + " " + self.user_name + "@" + benchIp + ":" + linkGraphPath)
main.log.info("linkGraph.cfg creation complete")
def configNullDev( self, ONOSIpList, deviceCount, numPorts=10):
diff --git a/TestON/drivers/component.py b/TestON/drivers/component.py
index f05be55..9199a4e 100644
--- a/TestON/drivers/component.py
+++ b/TestON/drivers/component.py
@@ -45,9 +45,8 @@
return getattr( self.wrapped, name )
except AttributeError as error:
# NOTE: The first time we load a driver module we get this error
- if "'module' object has no attribute '__path__'" in error\
- and self.count == 0:
- self.count += 1
+ if "'module' object has no attribute '__path__'" in error:
+ pass
else:
main.log.error( str(error.__class__) + " " + str(error) )
try:
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/CHOtest/CHOtest.params
similarity index 92%
rename from TestON/tests/OnosCHO/OnosCHO.params
rename to TestON/tests/CHOtest/CHOtest.params
index 024bd11..31b4e08 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/CHOtest/CHOtest.params
@@ -12,13 +12,11 @@
# 8X. Bring random links back up
# 9X Point,Multi-single,Single-Multi Intents
- <testcases>1,20,3,40,5,60</testcases>
- <ENV>
- <cellName>choTest3</cellName>
- </ENV>
+ <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>
+
<GIT>
#autoPull 'on' or 'off'
- <autoPull>off</autoPull>
+ <autoPull>on</autoPull>
<branch>master</branch>
</GIT>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/CHOtest/CHOtest.py
similarity index 94%
rename from TestON/tests/OnosCHO/OnosCHO.py
rename to TestON/tests/CHOtest/CHOtest.py
index dfdfd39..20daf09 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -6,7 +6,7 @@
import itertools
-class OnosCHO:
+class CHOtest:
def __init__( self ):
self.default = ''
@@ -14,13 +14,13 @@
def CASE1( self, main ):
"""
Startup sequence:
+ apply cell <name>
git pull
mvn clean install
onos-package
- apply cell <name>
onos-verify-cell
onos-uninstall
- onos-install
+ onos-install
onos-start-cli
"""
import time
@@ -29,7 +29,6 @@
main.threadID = 0
main.pingTimeout = 300
main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
- cell_name = main.params[ 'ENV' ][ 'cellName' ]
git_pull = main.params[ 'GIT' ][ 'autoPull' ]
git_branch = main.params[ 'GIT' ][ 'branch' ]
karafTimeout = main.params['CTRL']['karafCliTimeout']
@@ -44,6 +43,21 @@
main.log.report( "Set up test environment" )
main.log.report( "_______________________" )
+ main.step( "Apply Cell environment for ONOS" )
+ if ( main.onoscell ):
+ cellName = main.onoscell
+ cell_result = main.ONOSbench.setCell( cellName )
+ onosNodes = main.ONOSbench.getOnosIPfromCell()
+ main.onosIPs = onosNodes
+ utilities.assert_equals( expect=main.TRUE, actual=cell_result,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ else:
+ main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
+ main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
+ main.clean()
+ main.exit()
+
main.step( "Git checkout and pull " + git_branch )
if git_pull == 'on':
checkout_result = main.ONOSbench.gitCheckout( git_branch )
@@ -70,14 +84,6 @@
main.ONOSbench.getVersion( report=True )
- main.step( "Apply Cell environment for ONOS" )
- cell_result = main.ONOSbench.setCell( cell_name )
- onosNodes = main.ONOSbench.getOnosIPfromCell()
- main.onosIPs = onosNodes
- utilities.assert_equals( expect=main.TRUE, actual=cell_result,
- onpass="Test step PASS",
- onfail="Test step FAIL" )
-
main.step( "Create ONOS package" )
packageResult = main.ONOSbench.onosPackage()
utilities.assert_equals( expect=main.TRUE, actual=packageResult,
@@ -820,7 +826,7 @@
main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
intentResult = main.TRUE
- intentsJson = main.ONOScli2.intents()
+ intentsJson = main.ONOScli1.intents()
getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
intentsJson = intentsJson)
print "len of intent ID", str(len(intentIdList))
@@ -849,8 +855,6 @@
onfail="PING ALL FAIL" )
case60Result = ( intentResult and pingResult )
- waitForDebug = int (main.params[ 'ENV' ][ 'debugWait' ])
- time.sleep(waitForDebug)
utilities.assert_equals(
expect=main.TRUE,
actual=case60Result,
@@ -892,7 +896,7 @@
time2 = time.time()
main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
intentResult = main.TRUE
- intentsJson = main.ONOScli2.intents()
+ intentsJson = main.ONOScli1.intents()
getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
intentsJson = intentsJson)
print getIntentStateResult
@@ -953,7 +957,7 @@
time2 = time.time()
main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
intentResult = main.TRUE
- intentsJson = main.ONOScli2.intents()
+ intentsJson = main.ONOScli1.intents()
getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
intentsJson = intentsJson)
print getIntentStateResult
@@ -1030,7 +1034,7 @@
OPTION="down" )
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkDown = main.ONOSbench.checkStatus(
topology_output, main.numMNswitches, str(
int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
@@ -1096,7 +1100,7 @@
OPTION="up" )
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkUp = main.ONOSbench.checkStatus(
topology_output,
main.numMNswitches,
@@ -1178,7 +1182,7 @@
OPTION="down" )
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkDown = main.ONOSbench.checkStatus(
topology_output, main.numMNswitches, str(
int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
@@ -1244,7 +1248,7 @@
OPTION="up" )
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkUp = main.ONOSbench.checkStatus(
topology_output,
main.numMNswitches,
@@ -1303,7 +1307,7 @@
OPTION="down")
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkDown = main.ONOSbench.checkStatus(
topology_output, main.numMNswitches, str(
int( main.numMNlinks ) - 5 * 2 ) )
@@ -1356,7 +1360,7 @@
OPTION="up")
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkUp = main.ONOSbench.checkStatus(
topology_output,
main.numMNswitches,
@@ -1415,7 +1419,7 @@
OPTION="down")
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkDown = main.ONOSbench.checkStatus(
topology_output, main.numMNswitches, str(
int( main.numMNlinks ) - 5 * 2 ) )
@@ -1468,7 +1472,7 @@
OPTION="up")
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkUp = main.ONOSbench.checkStatus(
topology_output,
main.numMNswitches,
@@ -1522,13 +1526,15 @@
main.log.report( "___________________________________________________________________________" )
linkIndex = range(4)
- linkIndexS9 = random.sample(linkIndex,1)[0]
+ linkIndexS9 = random.sample(linkIndex,1)[0]
linkIndex.remove(linkIndexS9)
linkIndexS10 = random.sample(linkIndex,1)[0]
main.randomLink1 = link1End2top[linkIndexS9]
main.randomLink2 = link2End2top[linkIndexS10]
main.randomLink3 = random.sample(link1End2bot,1)[0]
main.randomLink4 = random.sample(link2End2bot,1)[0]
+
+ # Work around for link state propagation delay. Added some sleep time.
# 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" )
@@ -1536,7 +1542,7 @@
main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkDown = main.ONOSbench.checkStatus(
topology_output, main.numMNswitches, str(
int( main.numMNlinks ) - 8 ))
@@ -1581,15 +1587,16 @@
"__________________________________________________________________" )
main.case(
"Host intents - Bring the core links up that are down and verify ping all" )
-
- #main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
- #main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
+
+ # Work around for link state propagation delay. Added some sleep time.
+ # 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" )
time.sleep( link_sleep )
main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
time.sleep( link_sleep )
- topology_output = main.ONOScli2.topology()
+ topology_output = main.ONOScli1.topology()
linkUp = main.ONOSbench.checkStatus(
topology_output,
main.numMNswitches,
@@ -1646,7 +1653,6 @@
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
@@ -1654,9 +1660,9 @@
thread.join()
intentIdList.append(thread.result)
time2 = time.time()
- main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
intentResult = main.TRUE
- intentsJson = main.ONOScli2.intents()
+ intentsJson = main.ONOScli1.intents()
getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
intentsJson = intentsJson)
print getIntentStateResult
@@ -1717,9 +1723,9 @@
thread.join()
intentIdList.append(thread.result)
time2 = time.time()
- main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
intentResult = main.TRUE
- intentsJson = main.ONOScli2.intents()
+ intentsJson = main.ONOScli1.intents()
getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
intentsJson = intentsJson)
print getIntentStateResult
@@ -1783,9 +1789,9 @@
thread.join()
intentIdList.append(thread.result)
time2 = time.time()
- main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
intentResult = main.TRUE
- intentsJson = main.ONOScli2.intents()
+ intentsJson = main.ONOScli1.intents()
getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
intentsJson = intentsJson)
#print getIntentStateResult
@@ -2139,7 +2145,6 @@
"\r\r",
"" )
intentsList = intentsList.splitlines()
- #intentsList = intentsList[ 1: ]
intentIdList = []
step1Result = main.TRUE
moreIntents = main.TRUE
@@ -2150,7 +2155,7 @@
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.
+ # This is a work around only: cycle through intents removal for up to 5 times.
if removeIntentCount == 5:
break
removeIntentCount = removeIntentCount + 1
@@ -2167,7 +2172,6 @@
"\r\r",
"" )
intentsList1 = intentsList1.splitlines()
- #intentsList1 = intentsList1[ 1: ]
main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
print intentsList1
intentIdList1 = []
@@ -2200,7 +2204,7 @@
main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
time.sleep(10)
main.log.info("Purging WITHDRAWN Intents")
- purgeResult = main.ONOScli2.purgeWithdrawnIntents()
+ purgeResult = main.ONOScli1.purgeWithdrawnIntents()
else:
time.sleep(10)
if len( main.ONOScli1.intents()):
@@ -2228,7 +2232,6 @@
import copy
import time
- Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
threadID = 0
main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
@@ -2237,7 +2240,7 @@
main.step( "Enable intent based Reactive forwarding" )
installResult = main.FALSE
feature = "onos-app-ifwd"
-
+
pool = []
time1 = time.time()
for cli,feature in main.CLIs:
@@ -2313,63 +2316,3 @@
utilities.assert_equals( expect=main.TRUE, actual=case11Result,
onpass="Intent based Reactive forwarding Pingall test PASS",
onfail="Intent based Reactive forwarding Pingall test FAIL" )
-
- def CASE99(self):
- import time
- # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
- main.step( "Stop ONOS on all Nodes" )
- stopResult = main.TRUE
- for i in range( 1, int( main.numCtrls ) + 1 ):
- ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
- main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
- sresult = main.ONOSbench.onosStop( ONOS_ip )
- utilities.assert_equals( expect=main.TRUE, actual=sresult,
- onpass="Test step PASS",
- onfail="Test step FAIL" )
- stopResult = ( stopResult and sresult )
-
- main.step( "Start ONOS on all Nodes" )
- startResult = main.TRUE
- for i in range( 1, int( main.numCtrls ) + 1 ):
- ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
- main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
- sresult = main.ONOSbench.onosStart( ONOS_ip )
- utilities.assert_equals( expect=main.TRUE, actual=sresult,
- onpass="Test step PASS",
- onfail="Test step FAIL" )
- startResult = ( startResult and sresult )
-
- main.step( "Start ONOS CLI on all nodes" )
- cliResult = main.TRUE
- time.sleep( 30 )
- main.log.step(" Start ONOS cli using thread ")
- pool = []
- time1 = time.time()
- for i in range( int( main.numCtrls ) ):
- t = main.Thread(target=main.CLIs[i].startOnosCli,
- threadID=main.threadID,
- name="startOnosCli",
- args=main.onosIPs[i])
- pool.append(t)
- t.start()
- main.threadID = main.threadID + 1
- for t in pool:
- t.join()
- cliResult = cliResult and t.result
- time2 = time.time()
-
- if not cliResult:
- main.log.info("ONOS CLI did not start up properly")
- #main.cleanup()
- #main.exit()
- else:
- main.log.info("Successful CLI startup")
- main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
-
- case99Result = ( startResult and cliResult )
- time.sleep(30)
- utilities.assert_equals(
- expect=main.TRUE,
- actual=case99Result,
- onpass="Starting new Chordal topology test PASS",
- onfail="Starting new Chordal topology test FAIL" )
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/CHOtest/CHOtest.topo
similarity index 96%
rename from TestON/tests/OnosCHO/OnosCHO.topo
rename to TestON/tests/CHOtest/CHOtest.topo
index 76205b0..8b596e7 100644
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/CHOtest/CHOtest.topo
@@ -40,7 +40,7 @@
</ONOScli3>
<Mininet1>
- <host>chONOS-MN</host>
+ <host>OCN</host>
<user>admin</user>
<password></password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/OnosCHO/Dependencies/topoAtt.py b/TestON/tests/CHOtest/Dependencies/topoAtt.py
similarity index 100%
rename from TestON/tests/OnosCHO/Dependencies/topoAtt.py
rename to TestON/tests/CHOtest/Dependencies/topoAtt.py
diff --git a/TestON/tests/OnosCHO/Dependencies/topoChordal.py b/TestON/tests/CHOtest/Dependencies/topoChordal.py
similarity index 100%
rename from TestON/tests/OnosCHO/Dependencies/topoChordal.py
rename to TestON/tests/CHOtest/Dependencies/topoChordal.py
diff --git a/TestON/tests/OnosCHO/Dependencies/topoSpine.py b/TestON/tests/CHOtest/Dependencies/topoSpine.py
similarity index 100%
rename from TestON/tests/OnosCHO/Dependencies/topoSpine.py
rename to TestON/tests/CHOtest/Dependencies/topoSpine.py
diff --git a/TestON/tests/OnosCHO/README b/TestON/tests/CHOtest/README
similarity index 100%
rename from TestON/tests/OnosCHO/README
rename to TestON/tests/CHOtest/README
diff --git a/TestON/tests/OnosCHO/__init__.py b/TestON/tests/CHOtest/__init__.py
similarity index 100%
rename from TestON/tests/OnosCHO/__init__.py
rename to TestON/tests/CHOtest/__init__.py
diff --git a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
new file mode 100644
index 0000000..304ed29
--- /dev/null
+++ b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
@@ -0,0 +1,1108 @@
+"""
+ Wrapper functions for FuncIntent
+ This functions include Onosclidriver and Mininetclidriver driver functions
+ Author: kelvin@onlab.us
+"""
+import time
+import copy
+import json
+
+def __init__( self ):
+ self.default = ''
+
+def hostIntent( main,
+ name,
+ host1,
+ host2,
+ onosNode=0,
+ host1Id="",
+ host2Id="",
+ mac1="",
+ mac2="",
+ vlan1="-1",
+ vlan2="-1",
+ sw1="",
+ sw2="",
+ expectedLink=0 ):
+ """
+ Description:
+ Verify add-host-intent
+ Steps:
+ - Discover hosts
+ - Add host intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of host intent to add eg. IPV4 | VLAN | Dualstack
+ host1 - Name of first host
+ host2 - Name of second host
+ Optional:
+ host1Id - ONOS id of the first host eg. 00:00:00:00:00:01/-1
+ host2Id - ONOS id of the second host
+ mac1 - Mac address of first host
+ mac2 - Mac address of the second host
+ vlan1 - Vlan tag of first host, defaults to -1
+ vlan2 - Vlan tag of second host, defaults to -1
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
+ """
+
+ # Assert variables
+ assert main, "There is no main variable"
+ assert name, "variable name is empty"
+ assert host1 and host2, "You must specify hosts"
+
+ global itemName
+ itemName = name
+ h1Id = host1Id
+ h2Id = host2Id
+ h1Mac = mac1
+ h2Mac = mac2
+ vlan1 = vlan1
+ vlan2 = vlan2
+ hostNames = [ host1 , host2 ]
+ intentsId = []
+ stepResult = main.TRUE
+ pingResult = main.TRUE
+ intentResult = main.TRUE
+ removeIntentResult = main.TRUE
+ flowResult = main.TRUE
+ topoResult = main.TRUE
+ linkDownResult = main.TRUE
+ linkUpResult = main.TRUE
+ onosNode = int( onosNode )
+
+ if main.hostsData:
+ if not h1Mac:
+ h1Mac = main.hostsData[ host1 ][ 'mac' ]
+ if not h2Mac:
+ h2Mac = main.hostsData[ host2 ][ 'mac' ]
+ if main.hostsData[ host1 ][ 'vlan' ] != '-1':
+ vlan1 = main.hostsData[ host1 ][ 'vlan' ]
+ if main.hostsData[ host2 ][ 'vlan' ] != '-1':
+ vlan2 = main.hostsData[ host2 ][ 'vlan' ]
+ if not h1Id:
+ h1Id = main.hostsData[ host1 ][ 'id' ]
+ if not h2Id:
+ h2Id = main.hostsData[ host2 ][ 'id' ]
+
+ assert h1Id and h2Id, "You must specify host IDs"
+ if not ( h1Id and h2Id ):
+ main.log.info( "There are no host IDs" )
+ return main.FALSE
+
+ # Discover hosts using arping
+ if not main.hostsData:
+ main.log.info( itemName + ": Discover host using arping" )
+ main.Mininet1.arping( host=host1 )
+ main.Mininet1.arping( host=host2 )
+ host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
+ host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Checking connectivity before installing intents
+ main.log.info( itemName + ": Check hosts connection before adding intents" )
+ checkPing = pingallHosts( main, hostNames )
+ if not checkPing:
+ main.log.info( itemName + ": Ping did not go through " +
+ "before adding intents" )
+ else:
+ main.log.debug( itemName + ": Pinged successful before adding " +
+ "intents,please check fwd app if it is activated" )
+
+ # Adding host intents
+ main.log.info( itemName + ": Adding host intents" )
+ intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=h1Id,
+ hostIdTwo=h2Id )
+ intentsId.append( intent1 )
+
+ # Check intents state
+ time.sleep( main.checkIntentSleep )
+ intentResult = checkIntentState( main, intentsId )
+ checkFlowsCount( main )
+
+ # Check intents state again if first check fails...
+ if not intentResult:
+ intentResult = checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Ping hosts
+ firstPingResult = pingallHosts( main, hostNames )
+ if not firstPingResult:
+ main.log.debug( "First ping failed, there must be" +
+ " something wrong with ONOS performance" )
+
+ # Ping hosts again...
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ # Test rerouting if these variables exist
+ if sw1 and sw2 and expectedLink:
+ # link down
+ linkDownResult = link( main, sw1, sw2, "down" )
+ intentResult = intentResult and checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, expectedLink )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link down
+ if linkDownResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link down" )
+ else:
+ main.log.error( itemName + ": Failed to bring link down" )
+
+ # link up
+ linkUpResult = link( main, sw1, sw2, "up" )
+ time.sleep( main.rerouteSleep )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, main.numLinks )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link up
+ if linkUpResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link back up" )
+ else:
+ main.log.error( itemName + ": Failed to bring link back up" )
+
+ # Remove all intents
+ removeIntentResult = removeAllIntents( main, intentsId )
+
+ stepResult = pingResult and linkDownResult and linkUpResult \
+ and intentResult and removeIntentResult
+
+ return stepResult
+
+def pointIntent( main,
+ name,
+ host1,
+ host2,
+ onosNode=0,
+ deviceId1="",
+ deviceId2="",
+ port1="",
+ port2="",
+ ethType="",
+ mac1="",
+ mac2="",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ip1="",
+ ip2="",
+ tcp1="",
+ tcp2="",
+ sw1="",
+ sw2="",
+ expectedLink=0 ):
+
+ """
+ Description:
+ Verify add-point-intent
+ Steps:
+ - Get device ids | ports
+ - Add point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ host1 - Name of first host
+ host2 - Name of second host
+ Optional:
+ deviceId1 - ONOS device id of the first switch, the same as the
+ location of the first host eg. of:0000000000000001/1,
+ located at device 1 port 1
+ deviceId2 - ONOS device id of the second switch
+ port1 - The port number where the first host is attached
+ port2 - The port number where the second host is attached
+ ethType - Ethernet type eg. IPV4, IPV6
+ mac1 - Mac address of first host
+ mac2 - Mac address of the second host
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ ip1 - IP address of first host
+ ip2 - IP address of second host
+ tcp1 - TCP port of first host
+ tcp2 - TCP port of second host
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
+ """
+
+ assert main, "There is no main variable"
+ assert name, "variable name is empty"
+ assert host1 and host2, "You must specify hosts"
+
+ global itemName
+ itemName = name
+ host1 = host1
+ host2 = host2
+ hostNames = [ host1, host2 ]
+ intentsId = []
+
+ pingResult = main.TRUE
+ intentResult = main.TRUE
+ removeIntentResult = main.TRUE
+ flowResult = main.TRUE
+ topoResult = main.TRUE
+ linkDownResult = main.TRUE
+ linkUpResult = main.TRUE
+ onosNode = int( onosNode )
+
+ # Checking connectivity before installing intents
+ main.log.info( itemName + ": Check hosts connection before adding intents" )
+ checkPing = pingallHosts( main, hostNames )
+ if not checkPing:
+ main.log.info( itemName + ": Ping did not go through " +
+ "before adding intents" )
+ else:
+ main.log.debug( itemName + ": Pinged successful before adding " +
+ "intents,please check fwd app if it is activated" )
+
+ # Adding bidirectional point intents
+ main.log.info( itemName + ": Adding point intents" )
+ intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
+ egressDevice=deviceId2,
+ portIngress=port1,
+ portEgress=port2,
+ ethType=ethType,
+ ethSrc=mac1,
+ ethDst=mac2,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip1,
+ ipDst=ip2,
+ tcpSrc=tcp1,
+ tcpDst=tcp2 )
+
+ intentsId.append( intent1 )
+ intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
+ egressDevice=deviceId1,
+ portIngress=port2,
+ portEgress=port1,
+ ethType=ethType,
+ ethSrc=mac2,
+ ethDst=mac1,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip2,
+ ipDst=ip1,
+ tcpSrc=tcp2,
+ tcpDst=tcp1 )
+ intentsId.append( intent2 )
+
+ # Check intents state
+ time.sleep( main.checkIntentSleep )
+ intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Check intents state again if first check fails...
+ if not intentResult:
+ intentResult = checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Ping hosts
+ firstPingResult = pingallHosts( main, hostNames )
+ if not firstPingResult:
+ main.log.debug( "First ping failed, there must be" +
+ " something wrong with ONOS performance" )
+
+ # Ping hosts again...
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ # Test rerouting if these variables exist
+ if sw1 and sw2 and expectedLink:
+ # link down
+ linkDownResult = link( main, sw1, sw2, "down" )
+ intentResult = intentResult and checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, expectedLink )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link down
+ if linkDownResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link down" )
+ else:
+ main.log.error( itemName + ": Failed to bring link down" )
+
+ # link up
+ linkUpResult = link( main, sw1, sw2, "up" )
+ time.sleep( main.rerouteSleep )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, main.numLinks )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link up
+ if linkUpResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link back up" )
+ else:
+ main.log.error( itemName + ": Failed to bring link back up" )
+
+ # Remove all intents
+ removeIntentResult = removeAllIntents( main, intentsId )
+
+ stepResult = pingResult and linkDownResult and linkUpResult \
+ and intentResult and removeIntentResult
+
+ return stepResult
+
+def singleToMultiIntent( main,
+ name,
+ hostNames,
+ onosNode=0,
+ devices="",
+ ports=None,
+ ethType="",
+ macs=None,
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="",
+ sw2="",
+ expectedLink=0 ):
+ """
+ Verify Single to Multi Point intents
+ NOTE:If main.hostsData is not defined, variables data should be passed in the
+ same order index wise. All devices in the list should have the same
+ format, either all the devices have its port or it doesn't.
+ eg. hostName = [ 'h1', 'h2' ,.. ]
+ devices = [ 'of:0000000000000001', 'of:0000000000000002', ...]
+ ports = [ '1', '1', ..]
+ ...
+ Description:
+ Verify add-single-to-multi-intent iterates through the list of given
+ host | devices and add intents
+ Steps:
+ - Get device ids | ports
+ - Add single to multi point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ hostNames - List of host names
+ Optional:
+ devices - List of device ids in the same order as the hosts
+ in hostNames
+ ports - List of port numbers in the same order as the device in
+ devices
+ ethType - Ethernet type eg. IPV4, IPV6
+ macs - List of hosts mac address in the same order as the hosts in
+ hostNames
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ ipAddresses - IP addresses of host in the same order as the hosts in
+ hostNames
+ tcp - TCP ports in the same order as the hosts in hostNames
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
+ """
+
+ assert main, "There is no main variable"
+ assert hostNames, "You must specify hosts"
+ assert devices or main.hostsData, "You must specify devices"
+
+ global itemName
+ itemName = name
+ tempHostsData = {}
+ intentsId = []
+ onosNode = int( onosNode )
+
+ macsDict = {}
+ ipDict = {}
+ if hostNames and devices:
+ if len( hostNames ) != len( devices ):
+ main.log.debug( "hosts and devices does not have the same length" )
+ #print "len hostNames = ", len( hostNames )
+ #print "len devices = ", len( devices )
+ return main.FALSE
+ if ports:
+ if len( ports ) != len( devices ):
+ main.log.error( "Ports and devices does " +
+ "not have the same length" )
+ #print "len devices = ", len( devices )
+ #print "len ports = ", len( ports )
+ return main.FALSE
+ else:
+ main.log.info( "Device Ports are not specified" )
+ if macs:
+ for i in range( len( devices ) ):
+ macsDict[ devices[ i ] ] = macs[ i ]
+
+ elif hostNames and not devices and main.hostsData:
+ devices = []
+ main.log.info( "singleToMultiIntent function is using main.hostsData" )
+ for host in hostNames:
+ devices.append( main.hostsData.get( host ).get( 'location' ) )
+ macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
+ main.hostsData.get( host ).get( 'mac' )
+ ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
+ main.hostsData.get( host ).get( 'ipAddresses' )
+ #print main.hostsData
+
+ #print 'host names = ', hostNames
+ #print 'devices = ', devices
+ #print "macsDict = ", macsDict
+
+ pingResult = main.TRUE
+ intentResult = main.TRUE
+ removeIntentResult = main.TRUE
+ flowResult = main.TRUE
+ topoResult = main.TRUE
+ linkDownResult = main.TRUE
+ linkUpResult = main.TRUE
+
+ devicesCopy = copy.copy( devices )
+ if ports:
+ portsCopy = copy.copy( ports )
+ main.log.info( itemName + ": Adding single point to multi point intents" )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Checking connectivity before installing intents
+ main.log.info( itemName + ": Check hosts connection before adding intents" )
+ checkPing = pingallHosts( main, hostNames )
+ if not checkPing:
+ main.log.info( itemName + ": Ping did not go through " +
+ "before adding intents" )
+ else:
+ main.log.debug( itemName + ": Pinged successful before adding " +
+ "intents,please check fwd app if it is activated" )
+
+ # Adding bidirectional point intents
+ for i in range( len( devices ) ):
+ ingressDevice = devicesCopy[ i ]
+ egressDeviceList = copy.copy( devicesCopy )
+ egressDeviceList.remove( ingressDevice )
+ if ports:
+ portIngress = portsCopy[ i ]
+ portEgressList = copy.copy( portsCopy )
+ del portEgressList[ i ]
+ else:
+ portIngress = ""
+ portEgressList = None
+ if not macsDict:
+ srcMac = ""
+ else:
+ srcMac = macsDict[ ingressDevice ]
+ if srcMac == None:
+ main.log.debug( "There is no MAC in device - " + ingressDevice )
+ srcMac = ""
+
+ intentsId.append(
+ main.CLIs[ onosNode ].addSinglepointToMultipointIntent(
+ ingressDevice=ingressDevice,
+ egressDeviceList=egressDeviceList,
+ portIngress=portIngress,
+ portEgressList=portEgressList,
+ ethType=ethType,
+ ethSrc=srcMac,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc="",
+ ipDst="",
+ tcpSrc="",
+ tcpDst="" ) )
+
+ # Wait some time for the flow to go through when using multi instance
+ pingResult = pingallHosts( main, hostNames )
+
+ # Check intents state
+ time.sleep( main.checkIntentSleep )
+ intentResult = checkIntentState( main, intentsId )
+
+ # Check intents state again if first check fails...
+ if not intentResult:
+ intentResult = checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ # Test rerouting if these variables exist
+ if sw1 and sw2 and expectedLink:
+ # link down
+ linkDownResult = link( main, sw1, sw2, "down" )
+ intentResult = intentResult and checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, expectedLink )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link down
+ if linkDownResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link down" )
+ else:
+ main.log.error( itemName + ": Failed to bring link down" )
+
+ # link up
+ linkUpResult = link( main, sw1, sw2, "up" )
+ time.sleep( main.rerouteSleep )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, main.numLinks )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link up
+ if linkUpResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link back up" )
+ else:
+ main.log.error( itemName + ": Failed to bring link back up" )
+
+ # Remove all intents
+ removeIntentResult = removeAllIntents( main, intentsId )
+
+ stepResult = pingResult and linkDownResult and linkUpResult \
+ and intentResult and removeIntentResult
+
+ return stepResult
+
+def multiToSingleIntent( main,
+ name,
+ hostNames,
+ onosNode=0,
+ devices="",
+ ports=None,
+ ethType="",
+ macs=None,
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="",
+ sw2="",
+ expectedLink=0 ):
+ """
+ Verify Single to Multi Point intents
+ NOTE:If main.hostsData is not defined, variables data should be passed in the
+ same order index wise. All devices in the list should have the same
+ format, either all the devices have its port or it doesn't.
+ eg. hostName = [ 'h1', 'h2' ,.. ]
+ devices = [ 'of:0000000000000001', 'of:0000000000000002', ...]
+ ports = [ '1', '1', ..]
+ ...
+ Description:
+ Verify add-multi-to-single-intent
+ Steps:
+ - Get device ids | ports
+ - Add multi to single point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ hostNames - List of host names
+ Optional:
+ devices - List of device ids in the same order as the hosts
+ in hostNames
+ ports - List of port numbers in the same order as the device in
+ devices
+ ethType - Ethernet type eg. IPV4, IPV6
+ macs - List of hosts mac address in the same order as the hosts in
+ hostNames
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ ipAddresses - IP addresses of host in the same order as the hosts in
+ hostNames
+ tcp - TCP ports in the same order as the hosts in hostNames
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
+ """
+
+ assert main, "There is no main variable"
+ assert hostNames, "You must specify hosts"
+ assert devices or main.hostsData, "You must specify devices"
+
+ global itemName
+ itemName = name
+ tempHostsData = {}
+ intentsId = []
+ onosNode = int( onosNode )
+
+ macsDict = {}
+ ipDict = {}
+ if hostNames and devices:
+ if len( hostNames ) != len( devices ):
+ main.log.debug( "hosts and devices does not have the same length" )
+ #print "len hostNames = ", len( hostNames )
+ #print "len devices = ", len( devices )
+ return main.FALSE
+ if ports:
+ if len( ports ) != len( devices ):
+ main.log.error( "Ports and devices does " +
+ "not have the same length" )
+ #print "len devices = ", len( devices )
+ #print "len ports = ", len( ports )
+ return main.FALSE
+ else:
+ main.log.info( "Device Ports are not specified" )
+ if macs:
+ for i in range( len( devices ) ):
+ macsDict[ devices[ i ] ] = macs[ i ]
+ elif hostNames and not devices and main.hostsData:
+ devices = []
+ main.log.info( "multiToSingleIntent function is using main.hostsData" )
+ for host in hostNames:
+ devices.append( main.hostsData.get( host ).get( 'location' ) )
+ macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
+ main.hostsData.get( host ).get( 'mac' )
+ ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
+ main.hostsData.get( host ).get( 'ipAddresses' )
+ #print main.hostsData
+
+ #print 'host names = ', hostNames
+ #print 'devices = ', devices
+ #print "macsDict = ", macsDict
+
+ pingResult = main.TRUE
+ intentResult = main.TRUE
+ removeIntentResult = main.TRUE
+ flowResult = main.TRUE
+ topoResult = main.TRUE
+ linkDownResult = main.TRUE
+ linkUpResult = main.TRUE
+
+ devicesCopy = copy.copy( devices )
+ if ports:
+ portsCopy = copy.copy( ports )
+ main.log.info( itemName + ": Adding multi point to single point intents" )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Checking connectivity before installing intents
+ main.log.info( itemName + ": Check hosts connection before adding intents" )
+ checkPing = pingallHosts( main, hostNames )
+ if not checkPing:
+ main.log.info( itemName + ": Ping did not go through " +
+ "before adding intents" )
+ else:
+ main.log.debug( itemName + ": Pinged successful before adding " +
+ "intents,please check fwd app if it is activated" )
+
+ # Adding bidirectional point intents
+ for i in range( len( devices ) ):
+ egressDevice = devicesCopy[ i ]
+ ingressDeviceList = copy.copy( devicesCopy )
+ ingressDeviceList.remove( egressDevice )
+ if ports:
+ portEgress = portsCopy[ i ]
+ portIngressList = copy.copy( portsCopy )
+ del portIngressList[ i ]
+ else:
+ portEgress = ""
+ portIngressList = None
+ if not macsDict:
+ dstMac = ""
+ else:
+ dstMac = macsDict[ egressDevice ]
+ if dstMac == None:
+ main.log.debug( "There is no MAC in device - " + egressDevice )
+ dstMac = ""
+
+ intentsId.append(
+ main.CLIs[ onosNode ].addMultipointToSinglepointIntent(
+ ingressDeviceList=ingressDeviceList,
+ egressDevice=egressDevice,
+ portIngressList=portIngressList,
+ portEgress=portEgress,
+ ethType=ethType,
+ ethDst=dstMac,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc="",
+ ipDst="",
+ tcpSrc="",
+ tcpDst="" ) )
+
+ pingResult = pingallHosts( main, hostNames )
+
+ # Check intents state
+ time.sleep( main.checkIntentSleep )
+ intentResult = checkIntentState( main, intentsId )
+
+ # Check intents state again if first check fails...
+ if not intentResult:
+ intentResult = checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+ # Ping hosts again...
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ # Test rerouting if these variables exist
+ if sw1 and sw2 and expectedLink:
+ # link down
+ linkDownResult = link( main, sw1, sw2, "down" )
+ intentResult = intentResult and checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, expectedLink )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link down
+ if linkDownResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link down" )
+ else:
+ main.log.error( itemName + ": Failed to bring link down" )
+
+ # link up
+ linkUpResult = link( main, sw1, sw2, "up" )
+ time.sleep( main.rerouteSleep )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, main.numLinks )
+
+ # Ping hosts
+ pingResult = pingResult and pingallHosts( main, hostNames )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link up
+ if linkUpResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link back up" )
+ else:
+ main.log.error( itemName + ": Failed to bring link back up" )
+
+ # Remove all intents
+ removeIntentResult = removeAllIntents( main, intentsId )
+
+ stepResult = pingResult and linkDownResult and linkUpResult \
+ and intentResult and removeIntentResult
+
+ return stepResult
+
+def pingallHosts( main, hostList, pingType="ipv4" ):
+ # Ping all host in the hosts list variable
+ print "Pinging : ", hostList
+ pingResult = main.TRUE
+ pingResult = main.Mininet1.pingallHosts( hostList, pingType )
+ return pingResult
+
+def getHostsData( main ):
+ """
+ Use fwd app and pingall to discover all the hosts
+ """
+
+ activateResult = main.TRUE
+ appCheck = main.TRUE
+ getDataResult = main.TRUE
+ main.log.info( "Activating reactive forwarding app " )
+ activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
+
+ for i in range( main.numCtrls ):
+ appCheck = appCheck and main.CLIs[ i ].appToIDCheck()
+ if appCheck != main.TRUE:
+ main.log.warn( main.CLIs[ i ].apps() )
+ main.log.warn( main.CLIs[ i ].appIDs() )
+
+ pingResult = main.Mininet1.pingall( timeout = 600 )
+ hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
+ hosts = main.Mininet1.getHosts().keys()
+ # TODO: Make better use of new getHosts function
+ for host in hosts:
+ main.hostsData[ host ] = {}
+ main.hostsData[ host ][ 'mac' ] = \
+ main.Mininet1.getMacAddress( host ).upper()
+ for hostj in hostsJson:
+ if main.hostsData[ host ][ 'mac' ] == hostj[ 'mac' ]:
+ main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
+ main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
+ main.hostsData[ host ][ 'location' ] = \
+ hostj[ 'location' ][ 'elementId' ] + '/' + \
+ hostj[ 'location' ][ 'port' ]
+ main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
+
+ main.log.info( "Deactivating reactive forwarding app " )
+ deactivateResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
+ if activateResult and deactivateResult and main.hostsData:
+ main.log.info( "Successfully used fwd app to discover hosts " )
+ getDataResult = main.TRUE
+ else:
+ main.log.info( "Failed to use fwd app to discover hosts " )
+ getDataResult = main.FALSE
+
+ print main.hostsData
+
+ return getDataResult
+
+def checkTopology( main, expectedLink ):
+ statusResult = main.TRUE
+ # Check onos topology
+ main.log.info( itemName + ": Checking ONOS topology " )
+
+ for i in range( main.numCtrls ):
+ topologyResult = main.CLIs[ i ].topology()
+ statusResult = main.ONOSbench.checkStatus( topologyResult,
+ main.numSwitch,
+ expectedLink )\
+ and statusResult
+ if not statusResult:
+ main.log.error( itemName + ": Topology mismatch" )
+ else:
+ main.log.info( itemName + ": Topology match" )
+ return statusResult
+
+def checkIntentState( main, intentsId ):
+ """
+ This function will check intent state to make sure all the intents
+ are in INSTALLED state
+ """
+
+ intentResult = main.TRUE
+ results = []
+
+ main.log.info( itemName + ": Checking intents state" )
+ # First check of intents
+ for i in range( main.numCtrls ):
+ tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+ results.append( tempResult )
+
+ expectedState = [ 'INSTALLED', 'INSTALLING' ]
+
+ if all( result == main.TRUE for result in results ):
+ main.log.info( itemName + ": Intents are installed correctly" )
+ else:
+ # Wait for at least 5 second before checking the intents again
+ time.sleep( 5 )
+ results = []
+ # Second check of intents since some of the intents may be in
+ # INSTALLING state, they should be in INSTALLED at this time
+ for i in range( main.numCtrls ):
+ tempResult = main.CLIs[ i ].checkIntentState(
+ intentsId=intentsId )
+ results.append( tempResult )
+ if all( result == main.TRUE for result in results ):
+ main.log.info( itemName + ": Intents are installed correctly" )
+ else:
+ main.log.error( itemName + ": Intents are NOT installed correctly" )
+ intentResult = main.FALSE
+
+ return intentResult
+
+def checkFlowsState( main ):
+
+ main.log.info( itemName + ": Check flows state" )
+ checkFlowsResult = main.CLIs[ 0 ].checkFlowsState()
+ return checkFlowsResult
+
+def link( main, sw1, sw2, option):
+
+ # link down
+ main.log.info( itemName + ": Bring link " + option + "between " +
+ sw1 + " and " + sw2 )
+ linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
+ return linkResult
+
+def removeAllIntents( main, intentsId ):
+ """
+ Remove all intents in the intentsId
+ """
+
+ intentsRemaining = []
+ removeIntentResult = main.TRUE
+ # Remove intents
+ for intent in intentsId:
+ main.CLIs[ 0 ].removeIntent( intentId=intent, purge=True )
+
+ time.sleep( 5 )
+ # Checks if there is remaining intents using intents()
+ intentsRemaining = main.CLIs[ 0 ].intents( jsonFormat=False )
+ # If there is remianing intents then remove intents should fail
+
+ if intentsRemaining:
+ main.log.info( itemName + ": There are " +
+ str( len( intentsRemaining ) ) + " intents remaining, "
+ + "failed to remove all the intents " )
+ removeIntentResult = main.FALSE
+ main.log.info( intentsRemaining )
+ else:
+ main.log.info( itemName + ": There are no intents remaining, " +
+ "successfully removed all the intents." )
+ removeIntentResult = main.TRUE
+ return removeIntentResult
+
+def checkFlowsCount( main ):
+ """
+ Check flows count in each node
+ """
+
+ flowsCount = []
+ main.log.info( itemName + ": Checking flows count in each ONOS node" )
+ for i in range( main.numCtrls ):
+ summaryResult = main.CLIs[ i ].summary()
+ if not summaryResult:
+ main.log.error( itemName + ": There is something wrong with " +
+ "summary command" )
+ return main.FALSE
+ else:
+ summaryJson = json.loads( summaryResult )
+ flowsCount.append( summaryJson.get( 'flows' ) )
+
+ if flowsCount:
+ if all( flows==flowsCount[ 0 ] for flows in flowsCount ):
+ main.log.info( itemName + ": There are " + str( flowsCount[ 0 ] ) +
+ " flows in all ONOS node" )
+ else:
+ for i in range( main.numCtrls ):
+ main.log.debug( itemName + ": ONOS node " + str( i ) + " has " +
+ flowsCount[ i ] + " flows" )
+ else:
+ main.log.error( "Checking flows count failed, check summary command" )
+ return main.FALSE
+
+ return main.TRUE
+
diff --git a/TestON/tests/FUNCintent/Dependency/newFuncTopo.py b/TestON/tests/FUNCintent/Dependency/newFuncTopo.py
new file mode 100755
index 0000000..5552aa9
--- /dev/null
+++ b/TestON/tests/FUNCintent/Dependency/newFuncTopo.py
@@ -0,0 +1,148 @@
+#!/usr/bin/python
+
+"""
+Custom topology for Mininet
+"""
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import Host, RemoteController
+from mininet.node import Node
+from mininet.node import CPULimitedHost
+from mininet.link import TCLink
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.util import dumpNodeConnections
+from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
+
+class VLANHost( Host ):
+ def config( self, vlan=100, **params ):
+ r = super( Host, self ).config( **params )
+ intf = self.defaultIntf()
+ self.cmd( 'ifconfig %s inet 0' % intf )
+ self.cmd( 'vconfig add %s %d' % ( intf, vlan ) )
+ self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) )
+ newName = '%s.%d' % ( intf, vlan )
+ intf.name = newName
+ self.nameToIntf[ newName ] = intf
+ return r
+
+class IPv6Host( Host ):
+ def config( self, v6Addr='1000:1/64', **params ):
+ r = super( Host, self ).config( **params )
+ intf = self.defaultIntf()
+ self.cmd( 'ifconfig %s inet 0' % intf )
+ self.cmd( 'ip -6 addr add %s dev %s' % ( v6Addr, intf ) )
+ return r
+
+class dualStackHost( Host ):
+ def config( self, v6Addr='2000:1/64', **params ):
+ r = super( Host, self ).config( **params )
+ intf = self.defaultIntf()
+ self.cmd( 'ip -6 addr add %s dev %s' % ( v6Addr, intf ) )
+ return r
+
+class MyTopo( Topo ):
+
+ def __init__( self ):
+ # Initialize topology
+ Topo.__init__( self )
+ # Switch S5 Hosts
+ host1=self.addHost( 'h1', ip='10.1.0.2/24' )
+ host2=self.addHost( 'h2', cls=IPv6Host, v6Addr='1000::2/64' )
+ host3=self.addHost( 'h3', ip='10.1.0.3/24', cls=dualStackHost, v6Addr='2000::2/64' )
+ #VLAN hosts
+ host4=self.addHost( 'h4', ip='100.1.0.2/24', cls=VLANHost, vlan=100 )
+ host5=self.addHost( 'h5', ip='200.1.0.2/24', cls=VLANHost, vlan=200 )
+ #VPN-1 and VPN-2 Hosts
+ host6=self.addHost( 'h6', ip='11.1.0.2/24' )
+ host7=self.addHost( 'h7', ip='12.1.0.2/24' )
+ #Multicast Sender
+ host8=self.addHost( 'h8', ip='10.1.0.4/24' )
+
+ # Switch S6 Hosts
+ host9=self.addHost( 'h9', ip='10.1.0.5/24' )
+ host10=self.addHost( 'h10', cls=IPv6Host, v6Addr='1000::3/64' )
+ host11=self.addHost( 'h11', ip='10.1.0.6/24', cls=dualStackHost, v6Addr='2000::3/64' )
+ #VLAN hosts
+ host12=self.addHost( 'h12', ip='100.1.0.3/24', cls=VLANHost, vlan=100 )
+ host13=self.addHost( 'h13', ip='200.1.0.3/24', cls=VLANHost, vlan=200 )
+ #VPN-1 and VPN-2 Hosts
+ host14=self.addHost( 'h14', ip='11.1.0.3/24' )
+ host15=self.addHost( 'h15', ip='12.1.0.3/24' )
+ #Multicast Receiver
+ host16=self.addHost( 'h16', ip='10.1.0.7/24' )
+
+ # Switch S7 Hosts
+ host17=self.addHost( 'h17', ip='10.1.0.8/24' )
+ host18=self.addHost( 'h18', cls=IPv6Host, v6Addr='1000::4/64' )
+ host19=self.addHost( 'h19', ip='10.1.0.9/24', cls=dualStackHost, v6Addr='2000::4/64' )
+ #VLAN hosts
+ host20=self.addHost( 'h20', ip='100.1.0.4/24', cls=VLANHost, vlan=100 )
+ host21=self.addHost( 'h21', ip='200.1.0.4/24', cls=VLANHost, vlan=200 )
+ #VPN-1 and VPN-2 Hosts
+ host22=self.addHost( 'h22', ip='11.1.0.4/24' )
+ host23=self.addHost( 'h23', ip='12.1.0.4/24' )
+ #Multicast Receiver
+ host24=self.addHost( 'h24', ip='10.1.0.10/24' )
+
+ s1 = self.addSwitch( 's1' )
+ s2 = self.addSwitch( 's2' )
+ s3 = self.addSwitch( 's3' )
+ s4 = self.addSwitch( 's4' )
+ s5 = self.addSwitch( 's5' )
+ s6 = self.addSwitch( 's6' )
+ s7 = self.addSwitch( 's7' )
+
+ self.addLink(s5,host1)
+ self.addLink(s5,host2)
+ self.addLink(s5,host3)
+ self.addLink(s5,host4)
+ self.addLink(s5,host5)
+ self.addLink(s5,host6)
+ self.addLink(s5,host7)
+ self.addLink(s5,host8)
+
+ self.addLink(s6,host9)
+ self.addLink(s6,host10)
+ self.addLink(s6,host11)
+ self.addLink(s6,host12)
+ self.addLink(s6,host13)
+ self.addLink(s6,host14)
+ self.addLink(s6,host15)
+ self.addLink(s6,host16)
+
+ self.addLink(s7,host17)
+ self.addLink(s7,host18)
+ self.addLink(s7,host19)
+ self.addLink(s7,host20)
+ self.addLink(s7,host21)
+ self.addLink(s7,host22)
+ self.addLink(s7,host23)
+ self.addLink(s7,host24)
+
+ self.addLink(s1,s2)
+ self.addLink(s1,s3)
+ self.addLink(s1,s4)
+ self.addLink(s1,s5)
+ self.addLink(s2,s3)
+ self.addLink(s2,s5)
+ self.addLink(s2,s6)
+ self.addLink(s3,s4)
+ self.addLink(s3,s6)
+ self.addLink(s4,s7)
+ topos = { 'mytopo': ( lambda: MyTopo() ) }
+
+# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
+
+def setupNetwork():
+ "Create network"
+ topo = MyTopo()
+ network = Mininet(topo=topo, autoSetMacs=True, controller=None)
+ network.start()
+ CLI( network )
+ network.stop()
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ #setLogLevel('debug')
+ setupNetwork()
diff --git a/TestON/tests/FUNCintent/Dependency/startUp.py b/TestON/tests/FUNCintent/Dependency/startUp.py
new file mode 100644
index 0000000..bf2a2b6
--- /dev/null
+++ b/TestON/tests/FUNCintent/Dependency/startUp.py
@@ -0,0 +1,38 @@
+"""
+ This wrapper function is use for starting up onos instance
+"""
+
+import time
+import os
+import json
+
+def onosBuild( main, gitBranch ):
+ """
+ This includes pulling ONOS and building it using maven install
+ """
+
+ buildResult = main.FALSE
+
+ # Git checkout a branch of ONOS
+ checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
+ # Does the git pull on the branch that was checked out
+ if not checkOutResult:
+ main.log.warn( "Failed to checked out " + gitBranch +
+ " branch")
+ else:
+ main.log.info( "Successfully checked out " + gitBranch +
+ " branch")
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == main.ERROR:
+ main.log.error( "Error pulling git branch" )
+ else:
+ main.log.info( "Successfully pulled " + gitBranch + " branch" )
+
+ # Maven clean install
+ buildResult = main.ONOSbench.cleanInstall()
+
+ return buildResult
+
+
+
+
diff --git a/TestON/tests/FUNCintent/FUNCintent.params b/TestON/tests/FUNCintent/FUNCintent.params
new file mode 100644
index 0000000..e1021d3
--- /dev/null
+++ b/TestON/tests/FUNCintent/FUNCintent.params
@@ -0,0 +1,35 @@
+<PARAMS>
+
+ <testcases>1,2,11,12,13,1001,1002,1003,1004</testcases>
+
+ <SCALE>
+ <size>1,3</size>
+ </SCALE>
+
+ <DEPENDENCY>
+ <path>/tests/FUNCintent/Dependency/</path>
+ <wrapper1>startUp</wrapper1>
+ <wrapper2>FuncIntentFunction</wrapper2>
+ <topology>newFuncTopo.py</topology>
+ </DEPENDENCY>
+
+ <ENV>
+ <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
+ </ENV>
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <SLEEP>
+ <startup>15</startup>
+ <reroute>5</reroute>
+ <checkintent>5</checkintent>
+ </SLEEP>
+
+ <MININET>
+ <switch>7</switch>
+ <links>20</links>
+ </MININET>
+
+</PARAMS>
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
new file mode 100644
index 0000000..0a8092f
--- /dev/null
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -0,0 +1,869 @@
+
+# Testing the basic intent functionality of ONOS
+
+import time
+import json
+
+class FUNCintent:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import time
+ import os
+ import imp
+
+ """
+ - Construct tests variables
+ - GIT ( optional )
+ - Checkout ONOS master branch
+ - Pull latest ONOS code
+ - Building ONOS ( optional )
+ - Install ONOS package
+ - Build ONOS package
+ """
+
+ main.case( "Constructing test variables and building ONOS package" )
+ main.step( "Constructing test variables" )
+ stepResult = main.FALSE
+
+ # Test variables
+ main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+ main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+ gitBranch = main.params[ 'GIT' ][ 'branch' ]
+ main.dependencyPath = main.testOnDirectory + \
+ main.params[ 'DEPENDENCY' ][ 'path' ]
+ main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+ main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
+ main.maxNodes = int( main.ONOSbench.maxNodes )
+ wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+ wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
+ main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+ main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
+ main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
+ main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
+ main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
+ main.cellData = {} # for creating cell file
+ main.hostsData = {}
+ main.CLIs = []
+ main.ONOSip = []
+
+ main.ONOSip = main.ONOSbench.getOnosIps()
+ print main.ONOSip
+
+ # Assigning ONOS cli handles to a list
+ for i in range( 1, main.maxNodes + 1 ):
+ main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+
+ # -- INIT SECTION, ONLY RUNS ONCE -- #
+ main.startUp = imp.load_source( wrapperFile1,
+ main.dependencyPath +
+ wrapperFile1 +
+ ".py" )
+
+ main.intentFunction = imp.load_source( wrapperFile2,
+ main.dependencyPath +
+ wrapperFile2 +
+ ".py" )
+
+ copyResult = main.ONOSbench.copyMininetFile( main.topology,
+ main.dependencyPath,
+ main.Mininet1.user_name,
+ main.Mininet1.ip_address )
+ if main.CLIs:
+ stepResult = main.TRUE
+ else:
+ main.log.error( "Did not properly created list of ONOS CLI handle" )
+ stepResult = main.FALSE
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully construct " +
+ "test variables ",
+ onfail="Failed to construct test variables" )
+
+ if gitPull == 'True':
+ main.step( "Building ONOS in " + gitBranch + " branch" )
+ onosBuildResult = main.startUp.onosBuild( main, gitBranch )
+ stepResult = onosBuildResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully compiled " +
+ "latest ONOS",
+ onfail="Failed to compile " +
+ "latest ONOS" )
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
+
+ def CASE2( self, main ):
+ """
+ - Set up cell
+ - Create cell file
+ - Set cell file
+ - Verify cell file
+ - Kill ONOS process
+ - Uninstall ONOS cluster
+ - Verify ONOS start up
+ - Install ONOS cluster
+ - Connect to cli
+ """
+
+ # main.scale[ 0 ] determines the current number of ONOS controller
+ main.numCtrls = int( main.scale[ 0 ] )
+
+ main.case( "Starting up " + str( main.numCtrls ) +
+ " node(s) ONOS cluster" )
+
+ #kill off all onos processes
+ main.log.info( "Safety check, killing all ONOS processes" +
+ " before initiating enviornment setup" )
+
+ for i in range( main.maxNodes ):
+ main.ONOSbench.onosDie( main.ONOSip[ i ] )
+
+ print "NODE COUNT = ", main.numCtrls
+
+ tempOnosIp = []
+ for i in range( main.numCtrls ):
+ tempOnosIp.append( main.ONOSip[i] )
+
+ main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "temp", main.Mininet1.ip_address, main.apps, tempOnosIp )
+
+ main.step( "Apply cell to environment" )
+ cellResult = main.ONOSbench.setCell( "temp" )
+ verifyResult = main.ONOSbench.verifyCell()
+ stepResult = cellResult and verifyResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully applied cell to " + \
+ "environment",
+ onfail="Failed to apply cell to environment " )
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+ stepResult = packageResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully created ONOS package",
+ onfail="Failed to create ONOS package" )
+
+ time.sleep( main.startUpSleep )
+ main.step( "Uninstalling ONOS package" )
+ onosUninstallResult = main.TRUE
+ for i in range( main.numCtrls ):
+ onosUninstallResult = onosUninstallResult and \
+ main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
+ stepResult = onosUninstallResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully uninstalled ONOS package",
+ onfail="Failed to uninstall ONOS package" )
+
+ time.sleep( main.startUpSleep )
+ main.step( "Installing ONOS package" )
+ onosInstallResult = main.TRUE
+ for i in range( main.numCtrls ):
+ onosInstallResult = onosInstallResult and \
+ main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
+ stepResult = onosInstallResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully installed ONOS package",
+ onfail="Failed to install ONOS package" )
+
+ time.sleep( main.startUpSleep )
+ main.step( "Starting ONOS service" )
+ stopResult = main.TRUE
+ startResult = main.TRUE
+ onosIsUp = main.TRUE
+
+ for i in range( main.numCtrls ):
+ onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+ if onosIsUp == main.TRUE:
+ main.log.report( "ONOS instance is up and ready" )
+ else:
+ main.log.report( "ONOS instance may not be up, stop and " +
+ "start ONOS again " )
+ for i in range( main.numCtrls ):
+ stopResult = stopResult and \
+ main.ONOSbench.onosStop( main.ONOSip[ i ] )
+ for i in range( main.numCtrls ):
+ startResult = startResult and \
+ main.ONOSbench.onosStart( main.ONOSip[ i ] )
+ stepResult = onosIsUp and stopResult and startResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="ONOS service is ready",
+ onfail="ONOS service did not start properly" )
+
+ main.step( "Start ONOS cli" )
+ cliResult = main.TRUE
+ for i in range( main.numCtrls ):
+ cliResult = cliResult and \
+ main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
+ stepResult = cliResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully start ONOS cli",
+ onfail="Failed to start ONOS cli" )
+
+ # Remove the first element in main.scale list
+ main.scale.remove( main.scale[ 0 ] )
+
+ def CASE9( self, main ):
+ '''
+ Report errors/warnings/exceptions
+ '''
+ main.log.info( "Error report: \n" )
+ main.ONOSbench.logReport( globalONOSip[0],
+ [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ],
+ "s" )
+ #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
+
+ def CASE11( self, main ):
+ """
+ Start mininet
+ """
+ main.log.report( "Start Mininet topology" )
+ main.log.case( "Start Mininet topology" )
+
+ main.step( "Starting Mininet Topology" )
+ topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
+ main.topology )
+ stepResult = topoResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully loaded topology",
+ onfail="Failed to load topology" )
+ # Exit if topology did not load properly
+ if not topoResult:
+ main.cleanup()
+ main.exit()
+
+ def CASE12( self, main ):
+ """
+ Assign mastership to controllers
+ """
+ import re
+
+ main.case( "Assign switches to controllers" )
+ main.step( "Assigning switches to controllers" )
+ assignResult = main.TRUE
+ switchList = []
+
+ # Creates a list switch name, use getSwitch() function later...
+ for i in range( 1, ( main.numSwitch + 1 ) ):
+ switchList.append( 's' + str( i ) )
+
+ tempONOSip = []
+ for i in range( main.numCtrls ):
+ tempONOSip.append( main.ONOSip[ i ] )
+
+ assignResult = main.Mininet1.assignSwController( sw=switchList,
+ ip=tempONOSip,
+ port='6633' )
+ if not assignResult:
+ main.cleanup()
+ main.exit()
+
+ for i in range( 1, ( main.numSwitch + 1 ) ):
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
+ assignResult = assignResult and main.TRUE
+ else:
+ assignResult = main.FALSE
+ stepResult = assignResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully assigned switches" +
+ "to controller",
+ onfail="Failed to assign switches to " +
+ "controller" )
+ def CASE13( self, main ):
+ """
+ Discover all hosts and store its data to a dictionary
+ """
+ main.case( "Discover all hosts" )
+
+ stepResult = main.TRUE
+ main.step( "Discover all hosts using pingall " )
+ stepResult = main.intentFunction.getHostsData( main )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully discovered hosts",
+ onfail="Failed to discover hosts" )
+
+ def CASE14( self, main ):
+ """
+ Stop mininet
+ """
+ main.log.report( "Stop Mininet topology" )
+ main.log.case( "Stop Mininet topology" )
+
+ main.step( "Stopping Mininet Topology" )
+ topoResult = main.Mininet1.stopNet( )
+ stepResult = topoResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully stop mininet",
+ onfail="Failed to stop mininet" )
+ # Exit if topology did not load properly
+ if not topoResult:
+ main.cleanup()
+ main.exit()
+
+ def CASE1001( self, main ):
+ """
+ Add host intents between 2 host:
+ - Discover hosts
+ - Add host intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ """
+ import time
+ import json
+ import re
+
+ # Assert variables - These variable's name|format must be followed
+ # if you want to use the wrapper function
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+
+ main.case( "Add host intents between 2 host" )
+
+ stepResult = main.TRUE
+ main.step( "IPV4: Add host intents between h1 and h9" )
+ stepResult = main.intentFunction.hostIntent( main,
+ onosNode='0',
+ name='IPV4',
+ host1='h1',
+ host2='h9',
+ host1Id='00:00:00:00:00:01/-1',
+ host2Id='00:00:00:00:00:09/-1',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV4: Add host intent successful",
+ onfail="IPV4: Add host intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "DUALSTACK1: Add host intents between h3 and h11" )
+ stepResult = main.intentFunction.hostIntent( main,
+ name='DUALSTACK',
+ host1='h3',
+ host2='h11',
+ host1Id='00:00:00:00:00:03/-1',
+ host2Id='00:00:00:00:00:0B/-1',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="DUALSTACK1: Add host intent" +
+ " successful",
+ onfail="DUALSTACK1: Add host intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "DUALSTACK2: Add host intents between h1 and h11" )
+ stepResult = main.intentFunction.hostIntent( main,
+ name='DUALSTACK2',
+ host1='h1',
+ host2='h11',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="DUALSTACK2: Add host intent" +
+ " successful",
+ onfail="DUALSTACK2: Add host intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "1HOP: Add host intents between h1 and h3" )
+ stepResult = main.intentFunction.hostIntent( main,
+ name='1HOP',
+ host1='h1',
+ host2='h3' )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="1HOP: Add host intent" +
+ " successful",
+ onfail="1HOP: Add host intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "VLAN1: Add vlan host intents between h4 and h12" )
+ stepResult = main.intentFunction.hostIntent( main,
+ name='VLAN1',
+ host1='h4',
+ host2='h12',
+ host1Id='00:00:00:00:00:04/100',
+ host2Id='00:00:00:00:00:0C/100',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN1: Add vlan host" +
+ " intent successful",
+ onfail="VLAN1: Add vlan host intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
+ stepResult = main.intentFunction.hostIntent( main,
+ name='VLAN2',
+ host1='h13',
+ host2='h20' )
+
+ utilities.assert_equals( expect=main.FALSE,
+ actual=stepResult,
+ onpass="VLAN2: Add inter vlan host" +
+ " intent successful",
+ onfail="VLAN2: Add inter vlan host" +
+ " intent failed" )
+
+ def CASE1002( self, main ):
+ """
+ Add point intents between 2 hosts:
+ - Get device ids | ports
+ - Add point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ """
+ import time
+ import json
+ import re
+
+ # Assert variables - These variable's name|format must be followed
+ # if you want to use the wrapper function
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+
+ main.case( "Add point intents between 2 devices" )
+
+ stepResult = main.TRUE
+ # No option point intents
+ main.step( "NOOPTION: Add point intents between h1 and h9" )
+ stepResult = main.intentFunction.pointIntent(
+ main,
+ name="NOOPTION",
+ host1="h1",
+ host2="h9",
+ deviceId1="of:0000000000000005/1",
+ deviceId2="of:0000000000000006/1",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ stepResult = main.TRUE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="NOOPTION: Add point intent successful",
+ onfail="NOOPTION: Add point intent failed" )
+
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.pointIntent(
+ main,
+ name="IPV4",
+ host1="h1",
+ host2="h9",
+ deviceId1="of:0000000000000005/1",
+ deviceId2="of:0000000000000006/1",
+ port1="",
+ port2="",
+ ethType="IPV4",
+ mac1="00:00:00:00:00:01",
+ mac2="00:00:00:00:00:09",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ip1="",
+ ip2="",
+ tcp1="",
+ tcp2="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV4: Add point intent successful",
+ onfail="IPV4: Add point intent failed" )
+
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.pointIntent(
+ main,
+ name="IPV4_2",
+ host1="h1",
+ host2="h9",
+ deviceId1="of:0000000000000005/1",
+ deviceId2="of:0000000000000006/1",
+ ipProto=1,
+ ip1="",
+ ip2="",
+ tcp1="",
+ tcp2="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV4_2: Add point intent successful",
+ onfail="IPV4_2: Add point intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "DUALSTACK1: Add point intents between h1 and h9" )
+ stepResult = main.intentFunction.pointIntent(
+ main,
+ name="DUALSTACK1",
+ host1="h3",
+ host2="h11",
+ deviceId1="of:0000000000000005",
+ deviceId2="of:0000000000000006",
+ port1="3",
+ port2="3",
+ ethType="IPV4",
+ mac1="00:00:00:00:00:03",
+ mac2="00:00:00:00:00:0B",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ip1="",
+ ip2="",
+ tcp1="",
+ tcp2="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="DUALSTACK1: Add point intent" +
+ " successful",
+ onfail="DUALSTACK1: Add point intent failed" )
+ stepResult = main.TRUE
+ main.step( "VLAN: Add point intents between h5 and h21" )
+ stepResult = main.intentFunction.pointIntent(
+ main,
+ name="VLAN",
+ host1="h5",
+ host2="h21",
+ deviceId1="of:0000000000000005/5",
+ deviceId2="of:0000000000000007/5",
+ port1="",
+ port2="",
+ ethType="IPV4",
+ mac1="00:00:00:00:00:05",
+ mac2="00:00:00:00:00:15",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ip1="",
+ ip2="",
+ tcp1="",
+ tcp2="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN: Add point intent successful",
+ onfail="VLAN: Add point intent failed" )
+
+ stepResult = main.TRUE
+ main.step( "1HOP: Add point intents between h1 and h3" )
+ stepResult = main.intentFunction.hostIntent( main,
+ name='1HOP',
+ host1='h1',
+ host2='h3' )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="1HOP: Add point intent" +
+ " successful",
+ onfail="1HOP: Add point intent failed" )
+
+ def CASE1003( self, main ):
+ """
+ Add single point to multi point intents
+ - Get device ids
+ - Add single point to multi point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ """
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+
+ main.case( "Add single point to multi point intents between devices" )
+
+ stepResult = main.TRUE
+ hostNames = [ 'h8', 'h16', 'h24' ]
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
+ 'of:0000000000000007/8' ]
+ macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
+
+ main.step( "NOOPTION: Add single point to multi point intents" )
+ stepResult = main.intentFunction.singleToMultiIntent(
+ main,
+ name="NOOPTION",
+ hostNames=hostNames,
+ devices=devices,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="NOOPTION: Successfully added single "
+ + " point to multi point intents",
+ onfail="NOOPTION: Failed to add single point" +
+ " to multi point intents" )
+
+ stepResult = main.TRUE
+ main.step( "IPV4: Add single point to multi point intents" )
+ stepResult = main.intentFunction.singleToMultiIntent(
+ main,
+ name="IPV4",
+ hostNames=hostNames,
+ devices=devices,
+ ports=None,
+ ethType="IPV4",
+ macs=macs,
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV4: Successfully added single point"
+ + " to multi point intents",
+ onfail="IPV4: Failed to add single point" +
+ " to multi point intents" )
+
+ stepResult = main.TRUE
+ main.step( "IPV4_2: Add single point to multi point intents" )
+ hostNames = [ 'h8', 'h16', 'h24' ]
+ stepResult = main.intentFunction.singleToMultiIntent(
+ main,
+ name="IPV4",
+ hostNames=hostNames,
+ ethType="IPV4",
+ lambdaAlloc=False )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV4_2: Successfully added single "
+ + " point to multi point intents",
+ onfail="IPV4_2: Failed to add single point" +
+ " to multi point intents" )
+ stepResult = main.TRUE
+ main.step( "VLAN: Add single point to multi point intents" )
+ hostNames = [ 'h4', 'h12', 'h20' ]
+ devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
+ 'of:0000000000000007/4' ]
+ macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
+ stepResult = main.intentFunction.singleToMultiIntent(
+ main,
+ name="VLAN",
+ hostNames=hostNames,
+ devices=devices,
+ ports=None,
+ ethType="IPV4",
+ macs=macs,
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN: Successfully added single point"
+ + " to multi point intents",
+ onfail="VLAN: Failed to add single point" +
+ " to multi point intents" )
+
+ def CASE1004( self, main ):
+ """
+ Add multi point to single point intents
+ - Get device ids
+ - Add multi point to single point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ """
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+
+ main.case( "Add multi point to single point intents between devices" )
+
+ stepResult = main.TRUE
+ hostNames = [ 'h8', 'h16', 'h24' ]
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
+ 'of:0000000000000007/8' ]
+ macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
+
+ main.step( "NOOPTION: Add multi point to single point intents" )
+ stepResult = main.intentFunction.multiToSingleIntent(
+ main,
+ name="NOOPTION",
+ hostNames=hostNames,
+ devices=devices,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="NOOPTION: Successfully added multi "
+ + " point to single point intents",
+ onfail="NOOPTION: Failed to add multi point" +
+ " to single point intents" )
+
+ stepResult = main.TRUE
+ main.step( "IPV4: Add multi point to single point intents" )
+ stepResult = main.intentFunction.multiToSingleIntent(
+ main,
+ name="IPV4",
+ hostNames=hostNames,
+ devices=devices,
+ ports=None,
+ ethType="IPV4",
+ macs=macs,
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV4: Successfully added multi point"
+ + " to single point intents",
+ onfail="IPV4: Failed to add multi point" +
+ " to single point intents" )
+
+ stepResult = main.TRUE
+ main.step( "IPV4_2: Add multi point to single point intents" )
+ hostNames = [ 'h8', 'h16', 'h24' ]
+ stepResult = main.intentFunction.multiToSingleIntent(
+ main,
+ name="IPV4",
+ hostNames=hostNames,
+ ethType="IPV4",
+ lambdaAlloc=False )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV4_2: Successfully added multi point"
+ + " to single point intents",
+ onfail="IPV4_2: Failed to add multi point" +
+ " to single point intents" )
+
+ stepResult = main.TRUE
+ main.step( "VLAN: Add multi point to single point intents" )
+ hostNames = [ 'h5', 'h13', 'h21' ]
+ devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
+ 'of:0000000000000007/5' ]
+ macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
+ stepResult = main.intentFunction.multiToSingleIntent(
+ main,
+ name="VLAN",
+ hostNames=hostNames,
+ devices=devices,
+ ports=None,
+ ethType="IPV4",
+ macs=macs,
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN: Successfully added multi point"
+ + " to single point intents",
+ onfail="VLAN: Failed to add multi point" +
+ " to single point intents" )
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/FUNCintent/FUNCintent.topo
old mode 100644
new mode 100755
similarity index 84%
copy from TestON/tests/OnosCHO/OnosCHO.topo
copy to TestON/tests/FUNCintent/FUNCintent.topo
index 76205b0..cb6628b
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/FUNCintent/FUNCintent.topo
@@ -5,10 +5,10 @@
<host>localhost</host>
<user>admin</user>
<password></password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
<COMPONENTS>
- <home>~/ONOS</home>
+ <nodes>3</nodes>
</COMPONENTS>
</ONOSbench>
@@ -30,7 +30,7 @@
<COMPONENTS> </COMPONENTS>
</ONOScli2>
- <ONOScli3>
+ <ONOScli3>
<host>localhost</host>
<user>admin</user>
<password></password>
@@ -40,13 +40,13 @@
</ONOScli3>
<Mininet1>
- <host>chONOS-MN</host>
+ <host>localhost</host>
<user>admin</user>
<password></password>
<type>MininetCliDriver</type>
- <connect_order>12</connect_order>
+ <connect_order>5</connect_order>
<COMPONENTS> </COMPONENTS>
</Mininet1>
</COMPONENT>
-</TOPOLOGY>
\ No newline at end of file
+</TOPOLOGY>
diff --git a/TestON/tests/OnosCHO/__init__.py b/TestON/tests/FUNCintent/__init__.py
similarity index 100%
copy from TestON/tests/OnosCHO/__init__.py
copy to TestON/tests/FUNCintent/__init__.py
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
index acd899d..96d24a9 100644
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
@@ -1,6 +1,6 @@
-# Testing the basic functionality of ONOS Next
-# For sanity and driver functionality excercises only.
+# This is a sample template that starts up ONOS cluster, this template
+# is used as a starting script for creating functionality and performance test
class SAMPstartTemplate:
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
index 4a116c3..cd2640f 100755
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
@@ -8,7 +8,6 @@
<type>OnosDriver</type>
<connect_order>1</connect_order>
<COMPONENTS>
- <nodes>3</nodes>
</COMPONENTS>
</ONOSbench>
diff --git a/TestON/tests/SCPFcbench/README b/TestON/tests/SCPFcbench/README
new file mode 100644
index 0000000..755caf1
--- /dev/null
+++ b/TestON/tests/SCPFcbench/README
@@ -0,0 +1,4 @@
+Summary: This is a performance test suite to test onos single instance with Cbench TP mode.
+Pre-requisites: OC1 - is the single onos cell also has cbench pre-installed for all users;
+ this env variable is required on the TestStation. Passwordless login is set
+ from TestStation "admin" root user.
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPFcbench/SCPFcbench.py
index 42ebf5e..fd15862 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPFcbench/SCPFcbench.py
@@ -19,6 +19,8 @@
import time
import os
global init
+ main.case("pre-condition for cbench test.")
+
try:
if type(init) is not bool:
init = False
@@ -107,7 +109,7 @@
main.step( "verify cells" )
verifyCellResult = main.ONOSbench.verifyCell()
- main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
+ main.log.report( "Initializing " + 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])
@@ -130,18 +132,26 @@
check = main.ONOSbench.handle.before
if "value=true" in check:
main.log.info("cfg set successful")
+ stepResult = main.TRUE
break
if i == 4:
- main.log.info("Cfg set failed")
+ main.log.info("Cfg set failed")
+ stepResult = main.FALSE
else:
time.sleep(5)
-
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully configure onos for cbench test ",
+ onfail="Failed to configure onos for cbench test" )
def CASE2( self, main ):
-
+ main.case("Running Cbench")
+ main.step("Issuing cbench commands and grab returned results")
+ validFlag = False
mode = main.params[ 'TEST' ][ 'mode' ]
if mode != "t":
mode = " "
@@ -155,45 +165,52 @@
output = output.splitlines()
for line in output:
- if "RESULT: " in line:
+ if "RESULT: " in line:
+ validFlag = True
print line
- break
-
- try:
- resultLine = line.split(" ")
- for word in resultLine:
- if word == "min/max/avg/stdev":
- resultsIndex = resultLine.index(word)
- print resultsIndex
- 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]
+ 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)
+ 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]
- commit = main.ONOSbench.getVersion()
- commit = (commit.split(" "))[1]
+ try:
+ dbFileName="/tmp/CbenchDB"
+ dbfile = open(dbFileName, "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")
+ except IOError:
+ main.log.warn("Error opening " + dbFileName + " to write results.")
+
+ stepResult = main.TRUE
+ break
+ if ( validFlag == False ):
+ main.log.warn("Cbench Test produced no valid results!!!!")
+ stepResult = main.FALSE
- dbfile = open("CbenchDB", "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")
- except:
- main.log.warn("Cbench test produced no valid results!!!")
-
-
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully tested onos for cbench. ",
+ onfail="Failed to obtain valid onos cbench result!" )
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.topo b/TestON/tests/SCPFcbench/SCPFcbench.topo
index d4df2ed..7299023 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.topo
+++ b/TestON/tests/SCPFcbench/SCPFcbench.topo
@@ -5,7 +5,7 @@
<ONOSbench>
<host>localhost</host>
<user>admin</user>
- <password>onos_test</password>
+ <password></password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
<COMPONENTS>
@@ -17,7 +17,7 @@
<ONOS1>
<host>OC1</host>
<user>sdn</user>
- <password>rocks</password>
+ <password></password>
<type>OnosDriver</type>
<connect_order>9</connect_order>
<COMPONENTS> </COMPONENTS>
diff --git a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.params b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.params
index a3b104f..25a7b5c 100644
--- a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.params
+++ b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.params
@@ -4,7 +4,7 @@
<isOnBaremetal>True</isOnBaremetal>
<SCALE>1,3,3,5,5,7,7</SCALE>
- <availableNodes>7</availableNodes>
+ <max>7</max>
@@ -64,7 +64,7 @@
<BENCH>
<user>admin</user>
- <ip1>OCN</ip1>
+ <ip1>localhost</ip1>
</BENCH>
<JSON>
diff --git a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
index 0a3e0aa..3c1805a 100644
--- a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
@@ -29,7 +29,8 @@
cellName = main.params[ 'ENV' ][ 'cellName' ]
Apps = main.params[ 'ENV' ][ 'cellApps' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- maxNodes = int(main.params[ 'availableNodes' ])
+ BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+ main.maxNodes = int(main.params[ 'max' ])
skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
@@ -49,7 +50,7 @@
clusterCount = int(scale[0])
#Populate ONOSIp with ips from params
- for i in range(1, maxNodes + 1):
+ for i in range(1, main.maxNodes + 1):
ipString = 'ip' + str(i)
ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
@@ -74,7 +75,7 @@
commit = main.ONOSbench.getVersion()
commit = (commit.split(" "))[1]
- resultsDB = open("flowTP1gDB", "w+")
+ resultsDB = open("/tmp/flowTP1gDB", "w+")
resultsDB.close()
# -- END OF INIT SECTION --#
@@ -83,18 +84,15 @@
scale.remove(scale[0])
main.log.info("CLUSTER COUNT: " + str(clusterCount))
- MN1Ip = ONOSIp[len(ONOSIp)-1]
- BENCHIp = ONOSIp[len(ONOSIp)-2]
-
#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):
+ for node in range(1, main.maxNodes + 1):
main.ONOSbench.onosDie(ONOSIp[node])
#Uninstall everywhere
main.log.step( "Cleaning Enviornment..." )
- for i in range(1, maxNodes + 1):
+ for i in range(1, main.maxNodes + 1):
main.log.info(" Uninstalling ONOS " + str(i) )
main.ONOSbench.onosUninstall( ONOSIp[i] )
@@ -104,7 +102,7 @@
for node in range (1, clusterCount + 1):
cellIp.append(ONOSIp[node])
- main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+ main.ONOSbench.createCellFile(BENCHIp,cellName,"localhost",str(Apps), cellIp)
main.log.info("Cell Ip list: " + str(cellIp))
main.step( "Set Cell" )
@@ -135,8 +133,7 @@
a(ONOSIp[node])
main.log.info("Startup sequence complete")
- main.ONOSbench.onosErrorLog(ONOSIp[1])
-
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
def CASE2( self, main ):
#
# This is the flow TP test
@@ -166,14 +163,13 @@
neighborList = (main.params[ 'TEST' ][ 'neighbors' ]).split(",")
testCMD[0] = main.params[ 'TEST' ][ 'testCMD0' ]
testCMD[1] = main.params[ 'TEST' ][ 'testCMD1' ]
- maxNodes = main.params[ 'availableNodes' ]
+ main.maxNodes = main.params[ 'max' ]
onBaremetal = main.params['isOnBaremetal']
cooldown = main.params[ 'TEST' ][ 'cooldown' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
MN1Ip = main.params[ 'MN' ][ 'ip1' ]
- maxNodes = int(main.params[ 'availableNodes' ])
homeDir = os.path.expanduser('~')
flowRuleBackup = str(main.params[ 'TEST' ][ 'enableFlowRuleStoreBackup' ])
main.log.info("Flow Rule Backup is set to:" + flowRuleBackup)
@@ -197,20 +193,7 @@
#write file to change mem limit to 32 gigs (BAREMETAL ONLY!)
if onBaremetal == "true":
- filename = "/onos/tools/package/bin/onos-service"
- serviceConfig = open(homeDir + filename, 'w+')
- serviceConfig.write("#!/bin/bash\n ")
- serviceConfig.write("#------------------------------------- \n ")
- serviceConfig.write("# Starts ONOS Apache Karaf container\n ")
- serviceConfig.write("#------------------------------------- \n ")
- serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ")
- serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G}" \n """)
- serviceConfig.write("")
- serviceConfig.write("ONOS_HOME=/opt/onos \n ")
- serviceConfig.write("")
- serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n")
- serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """)
- serviceConfig.close()
+ main.ONOSbench.jvmSet()
for n in neighborList:
main.log.step("\tSTARTING TEST")
@@ -220,10 +203,10 @@
main.log.info("=============================================================")
#write file to configure nil link
ipCSV = ""
- for i in range (1, int(maxNodes) + 1):
+ for i in range (1, int(main.maxNodes) + 1):
tempstr = "ip" + str(i)
ipCSV += main.params[ 'CTRL' ][ tempstr ]
- if i < int(maxNodes):
+ if i < int(main.maxNodes):
ipCSV +=","
for i in range(3):
@@ -313,7 +296,8 @@
if test >= warmUp:
for i in result:
if i == "":
- main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
+ main.log.error("Missing data point, critical failure incoming")
+
print result
maxes[test-warmUp] = max(result)
main.log.info("Data collection iteration: " + str(test-warmUp) + " of " + str(sampleSize))
@@ -383,7 +367,7 @@
main.log.info("Average thoughput: " + str(avgTP) + " Kflows/second" )
main.log.info("Standard deviation of throughput: " + str(stdTP) + " Kflows/second")
- resultsLog = open("flowTP1gDB","a")
+ resultsLog = open("/tmp/flowTP1gDB","a")
resultString = ("'" + commit + "',")
resultString += ("'1gig',")
resultString += ((main.params[ 'TEST' ][ 'flows' ]) + ",")
diff --git a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.topo b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.topo
index d82f3fd..01370b6 100644
--- a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.topo
+++ b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.topo
@@ -3,16 +3,19 @@
<COMPONENT>
<ONOSbench>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
- <COMPONENTS><home>~/onos</home></COMPONENTS>
+ <COMPONENTS>
+ <home>~/onos</home>
+ <nodes>7</nodes>
+ </COMPONENTS>
</ONOSbench>
<ONOS1cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -21,7 +24,7 @@
</ONOS1cli>
<ONOS2cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,7 +33,7 @@
</ONOS2cli>
<ONOS3cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -39,7 +42,7 @@
</ONOS3cli>
<ONOS4cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -48,7 +51,7 @@
</ONOS4cli>
<ONOS5cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -57,7 +60,7 @@
</ONOS5cli>
<ONOS6cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -66,7 +69,7 @@
</ONOS6cli>
<ONOS7cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.params b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.params
index eefe54b..d1689de 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.params
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.params
@@ -11,7 +11,7 @@
</ENV>
<SCALE>1,3,3,5,5,7,7</SCALE>
- <availableNodes>7</availableNodes>
+ <max>7</max>
<GIT>
<autopull>off</autopull>
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
index 6fe4f73..06fc028 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
@@ -34,7 +34,8 @@
BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
MN1Ip = main.params[ 'MN' ][ 'ip1' ]
- maxNodes = int(main.params[ 'availableNodes' ])
+ maxNodes = int(main.params[ 'max' ])
+ main.maxNodes = maxNodes
skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",")
@@ -55,7 +56,10 @@
global commit
clusterCount = 0
- ONOSIp = []
+ ONOSIp = main.ONOSbench.getOnosIps()
+ print ONOSIp
+ print main.ONOSbench.onosIps.values()
+
scale = (main.params[ 'SCALE' ]).split(",")
clusterCount = int(scale[0])
@@ -76,15 +80,20 @@
checkoutResult = main.TRUE
pullResult = main.TRUE
main.log.info( "Skipped git checkout and pull" )
-
+
+ main.log.step("Grabbing commit number")
commit = main.ONOSbench.getVersion()
commit = (commit.split(" "))[1]
- resultsDB = open("IntentEventTPDB", "w+")
+ main.log.step("Creating results file")
+ resultsDB = open("/tmp/IntentEventTPDB", "w+")
resultsDB.close()
# -- END OF INIT SECTION --#
-
+
+ main.log.step("Adjusting scale")
+ print str(scale)
+ print str(ONOSIp)
clusterCount = int(scale[0])
scale.remove(scale[0])
@@ -116,7 +125,7 @@
for node in range (clusterCount):
cellIp.append(ONOSIp[node])
- main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+ main.ONOSbench.createCellFile("localhost",cellName,MN1Ip,str(Apps), cellIp)
main.step( "Set Cell" )
main.ONOSbench.setCell(cellName)
@@ -331,7 +340,7 @@
main.ONOSbench.handle.expect(":~")
main.log.info("Stopping intentperf" )
- resultsDB = open("IntentEventTPDB", "a")
+ resultsDB = open("/tmp/IntentEventTPDB", "a")
for node in groupResult:
resultString = "'" + commit + "',"
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.topo b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.topo
index d82f3fd..01370b6 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.topo
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.topo
@@ -3,16 +3,19 @@
<COMPONENT>
<ONOSbench>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
- <COMPONENTS><home>~/onos</home></COMPONENTS>
+ <COMPONENTS>
+ <home>~/onos</home>
+ <nodes>7</nodes>
+ </COMPONENTS>
</ONOSbench>
<ONOS1cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -21,7 +24,7 @@
</ONOS1cli>
<ONOS2cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,7 +33,7 @@
</ONOS2cli>
<ONOS3cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -39,7 +42,7 @@
</ONOS3cli>
<ONOS4cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -48,7 +51,7 @@
</ONOS4cli>
<ONOS5cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -57,7 +60,7 @@
</ONOS5cli>
<ONOS6cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -66,7 +69,7 @@
</ONOS6cli>
<ONOS7cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
diff --git a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
index 8aad63b..3aa47d8 100644
--- a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
+++ b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
@@ -3,7 +3,7 @@
<testcases>1,2,1,2,1,2,1,2</testcases>
<SCALE>1,3,5,7</SCALE>
- <availableNodes>7</availableNodes>
+ <max>7</max>
<ENV>
<cellName>IntentInstallWithdrawCell</cellName>
@@ -52,12 +52,12 @@
</CTRL>
<MN>
- <ip1>OCN</ip1>
+ <ip1>localhost</ip1>
</MN>
<BENCH>
<user>admin</user>
- <ip1>OCN</ip1>
+ <ip1>localhost</ip1>
</BENCH>
<JSON>
diff --git a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index 34e9a8d..ef92e58 100644
--- a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -31,7 +31,7 @@
BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
MN1Ip = main.params[ 'MN' ][ 'ip1' ]
- maxNodes = int(main.params[ 'availableNodes' ])
+ main.maxNodes = int(main.params[ 'max' ])
skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
switchCount = main.params[ 'TEST' ][ 'switchCount' ]
@@ -71,7 +71,7 @@
commit = main.ONOSbench.getVersion()
commit = (commit.split(" "))[1]
- resultsDB = open("IntentInstallWithdrawLatDB", "w+")
+ resultsDB = open("/tmp/IntentInstallWithdrawLatDB", "w+")
resultsDB.close()
# -- END OF INIT SECTION --#
@@ -79,18 +79,15 @@
clusterCount = int(scale[0])
scale.remove(scale[0])
- MN1Ip = ONOSIp[len(ONOSIp)-1]
- BENCHIp = ONOSIp[len(ONOSIp)-2]
-
#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):
+ for node in range(1, main.maxNodes + 1):
main.ONOSbench.onosDie(ONOSIp[node])
#Uninstall everywhere
main.log.step( "Cleaning Enviornment..." )
- for i in range(1, maxNodes + 1):
+ for i in range(1, main.maxNodes + 1):
main.log.info(" Uninstalling ONOS " + str(i) )
main.ONOSbench.onosUninstall( ONOSIp[i] )
@@ -100,7 +97,7 @@
for node in range (1, clusterCount + 1):
cellIp.append(ONOSIp[node])
- main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+ main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), cellIp)
main.step( "Set Cell" )
main.ONOSbench.setCell(cellName)
@@ -270,7 +267,7 @@
resultString += str(numpy.std(installed)) + ","
resultString += str(numpy.mean(withdrawn)) + ","
resultString += str(numpy.std(withdrawn)) + "\n"
- resultsDB = open("IntentInstallWithdrawLatDB", "a")
+ resultsDB = open("/tmp/IntentInstallWithdrawLatDB", "a")
resultsDB.write(resultString)
resultsDB.close()
diff --git a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
index d82f3fd..01370b6 100644
--- a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
+++ b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
@@ -3,16 +3,19 @@
<COMPONENT>
<ONOSbench>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
- <COMPONENTS><home>~/onos</home></COMPONENTS>
+ <COMPONENTS>
+ <home>~/onos</home>
+ <nodes>7</nodes>
+ </COMPONENTS>
</ONOSbench>
<ONOS1cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -21,7 +24,7 @@
</ONOS1cli>
<ONOS2cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,7 +33,7 @@
</ONOS2cli>
<ONOS3cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -39,7 +42,7 @@
</ONOS3cli>
<ONOS4cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -48,7 +51,7 @@
</ONOS4cli>
<ONOS5cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -57,7 +60,7 @@
</ONOS5cli>
<ONOS6cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -66,7 +69,7 @@
</ONOS6cli>
<ONOS7cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
diff --git a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.params b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.params
index 2e43679..896ef7f 100644
--- a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.params
+++ b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.params
@@ -3,7 +3,7 @@
<testcases>1,2,1,2,1,2,1,2</testcases>
<SCALE>1,3,5,7</SCALE>
- <availableNodes>7</availableNodes>
+ <max>7</max>
<ENV>
<cellName>intentRerouteCell</cellName>
@@ -65,12 +65,12 @@
</CTRL>
<MN>
- <ip1>OCN</ip1>
+ <ip1>localhost</ip1>
</MN>
<BENCH>
<user>admin</user>
- <ip1>OCN</ip1>
+ <ip1>localhost</ip1>
</BENCH>
<JSON>
diff --git a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index cc8892e..07871f9 100644
--- a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -30,7 +30,9 @@
cellName = main.params[ 'ENV' ][ 'cellName' ]
Apps = main.params[ 'ENV' ][ 'cellApps' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- maxNodes = int(main.params[ 'availableNodes' ])
+ BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+ MN1Ip = main.params[ 'MN' ][ 'ip1' ]
+ main.maxNodes = int(main.params[ 'max' ])
skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
@@ -70,7 +72,7 @@
commit = main.ONOSbench.getVersion()
commit = (commit.split(" "))[1]
- resultsDB = open("IntentRerouteLatDB", "w+")
+ resultsDB = open("/tmp/IntentRerouteLatDB", "w+")
resultsDB.close()
# -- END OF INIT SECTION --#
@@ -78,18 +80,15 @@
clusterCount = int(scale[0])
scale.remove(scale[0])
- MN1Ip = ONOSIp[len(ONOSIp)-1]
- BENCHIp = ONOSIp[len(ONOSIp)-2]
-
#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):
+ for node in range(1, main.maxNodes + 1):
main.ONOSbench.onosDie(ONOSIp[node])
#Uninstall everywhere
main.log.step( "Cleaning Enviornment..." )
- for i in range(1, maxNodes + 1):
+ for i in range(1, main.maxNodes + 1):
main.log.info(" Uninstalling ONOS " + str(i) )
main.ONOSbench.onosUninstall( ONOSIp[i] )
@@ -98,8 +97,8 @@
cellIp = []
for node in range (1, clusterCount + 1):
cellIp.append(ONOSIp[node])
-
- main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+
+ main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), cellIp)
main.step( "Set Cell" )
main.ONOSbench.setCell(cellName)
@@ -342,8 +341,6 @@
main.ONOSbench.handle.sendline(cmd)
main.ONOSbench.handle.expect(":~")
-
-
#wait for intent withdraw
main.ONOSbench.handle.sendline(withdrawCmd)
main.log.info(withdrawCmd)
@@ -400,7 +397,7 @@
main.log.report("Mode of last node to respond:..." + str(nodeMode))
main.log.report("________________________________________________________")
- resultsDB = open("IntentRerouteLatDB", "a")
+ resultsDB = open("/tmp/IntentRerouteLatDB", "a")
resultsDB.write("'" + commit + "',")
resultsDB.write(str(clusterCount) + ",")
resultsDB.write(str(intents) + ",")
diff --git a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.topo b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.topo
index d82f3fd..01370b6 100644
--- a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.topo
+++ b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.topo
@@ -3,16 +3,19 @@
<COMPONENT>
<ONOSbench>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
- <COMPONENTS><home>~/onos</home></COMPONENTS>
+ <COMPONENTS>
+ <home>~/onos</home>
+ <nodes>7</nodes>
+ </COMPONENTS>
</ONOSbench>
<ONOS1cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -21,7 +24,7 @@
</ONOS1cli>
<ONOS2cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -30,7 +33,7 @@
</ONOS2cli>
<ONOS3cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -39,7 +42,7 @@
</ONOS3cli>
<ONOS4cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -48,7 +51,7 @@
</ONOS4cli>
<ONOS5cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -57,7 +60,7 @@
</ONOS5cli>
<ONOS6cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -66,7 +69,7 @@
</ONOS6cli>
<ONOS7cli>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>