Update initialization test case to have scaling functionality
diff --git a/TestON/tests/SingleFunc/SingleFunc.params b/TestON/tests/SingleFunc/SingleFunc.params
index 553b15b..9db302f 100755
--- a/TestON/tests/SingleFunc/SingleFunc.params
+++ b/TestON/tests/SingleFunc/SingleFunc.params
@@ -1,17 +1,30 @@
<PARAMS>
- <testcases>10,11,1000</testcases>
+ <testcases>10,11</testcases>
+
+ <SCALE>1,3</SCALE>
+ <availableNodes>3</availableNodes>
<ENV>
<cellName>single_func</cellName>
+ <cellApps>drivers,openflow,proxyarp,mobility,fwd</cellApps>
</ENV>
<GIT>
<pull>False</pull>
<branch>master</branch>
</GIT>
<CTRL>
+ <num>3</num>
<ip1>10.128.10.21</ip1>
<port1>6633</port1>
+ <ip2>10.128.10.22</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.10.23</ip3>
+ <port3>6633</port3>
</CTRL>
+ <BENCH>
+ <user>admin</user>
+ <ip1>10.128.10.20</ip1>
+ </BENCH>
<MININET>
<switch>7</switch>
<links>20</links>
diff --git a/TestON/tests/SingleFunc/SingleFunc.py b/TestON/tests/SingleFunc/SingleFunc.py
index 93fd0a3..9a69d8d 100644
--- a/TestON/tests/SingleFunc/SingleFunc.py
+++ b/TestON/tests/SingleFunc/SingleFunc.py
@@ -26,18 +26,100 @@
onos-install -f
onos-wait-for-start
"""
+ global init
+ try:
+ if type(init) is not bool:
+ init = False
+ except NameError:
+ init = False
#Local variables
cellName = main.params[ 'ENV' ][ 'cellName' ]
- main.ONOS1ip = os.environ[ 'OC1' ]
+ apps = main.params[ 'ENV' ][ 'cellApps' ]
+ main.ONOS1ip = main.params[ 'CTRL' ][ 'ip1' ]
+ gitBranch = main.params[ 'GIT' ][ 'branch' ]
main.ONOS1port = main.params[ 'CTRL' ][ 'port1' ]
+ benchIp = main.params[ 'BENCH' ][ 'ip1' ]
+ benchUser = main.params[ 'BENCH' ][ 'user' ]
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
- gitBranch = main.params[ 'GIT' ][ 'branch' ]
+ main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
topology = main.params[ 'MININET' ][ 'topo' ]
+ maxNodes = int( main.params[ 'availableNodes' ] )
PULLCODE = False
if main.params[ 'GIT' ][ 'pull' ] == 'True':
PULLCODE = True
main.case( "Setting up test environment" )
+ main.CLIs = []
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+
+ # -- INIT SECTION, ONLY RUNS ONCE -- #
+ if init == False:
+ init = True
+ global nodeCount #number of nodes running
+ global ONOSIp #list of ONOS IP addresses
+ global scale
+
+ ONOSIp = [ ]
+ scale = ( main.params[ 'SCALE' ] ).split( "," )
+ nodeCount = int( scale[ 0 ] )
+
+ if PULLCODE:
+ main.step( "Git checkout and pull " + gitBranch )
+ main.ONOSbench.gitCheckout( gitBranch )
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == main.ERROR:
+ main.log.error( "Error pulling git branch" )
+ main.step( "Using mvn clean & install" )
+ cleanInstallResult = main.ONOSbench.cleanInstall()
+ stepResult = cleanInstallResult
+ 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" )
+ # Populate ONOSIp with ips from params
+ for i in range( 1, maxNodes + 1):
+ ONOSIp.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
+
+ nodeCount = int( scale[ 0 ] )
+ scale.remove( scale[ 0 ] )
+ #kill off all onos processes
+ main.log.info( "Safety check, killing all ONOS processes" +
+ " before initiating enviornment setup" )
+ for i in range( maxNodes ):
+ main.ONOSbench.onosDie( ONOSIp[ i ] )
+ """
+ main.step( "Apply cell to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ 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( "Removing raft logs" )
+ removeRaftResult = main.ONOSbench.onosRemoveRaftLogs()
+ stepResult = removeRaftResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully removed raft logs",
+ onfail="Failed to remove raft logs" )
+ """
+ print "NODE COUNT = ", nodeCount
+ main.log.info( "Creating cell file" )
+ cellIp = []
+ for i in range( nodeCount ):
+ cellIp.append( str( ONOSIp[ i ] ) )
+ print cellIp
+ main.ONOSbench.createCellFile( benchIp, cellName, "",
+ str( apps ), *cellIp )
main.step( "Apply cell to environment" )
cellResult = main.ONOSbench.setCell( cellName )
@@ -48,30 +130,6 @@
onpass="Successfully applied cell to " + \
"environment",
onfail="Failed to apply cell to environment " )
- """main.step( "Removing raft logs" )
- removeRaftResult = main.ONOSbench.onosRemoveRaftLogs()
- stepResult = removeRaftResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully removed raft logs",
- onfail="Failed to remove raft logs" )
- """
- if PULLCODE:
- main.step( "Git checkout and pull " + gitBranch )
- main.ONOSbench.gitCheckout( gitBranch )
- gitPullResult = main.ONOSbench.gitPull()
- if gitPullResult == main.ERROR:
- main.log.error( "Error pulling git branch" )
- main.step( "Using mvn clean & install" )
- cleanInstallResult = main.ONOSbench.cleanInstall()
- stepResult = cleanInstallResult
- 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" )
main.step( "Creating ONOS package" )
packageResult = main.ONOSbench.onosPackage()
@@ -82,8 +140,10 @@
onfail="Failed to create ONOS package" )
main.step( "Uninstalling ONOS package" )
- onosUninstallResult = main.ONOSbench.onosUninstall(
- nodeIp=main.ONOS1ip )
+ onosUninstallResult = main.TRUE
+ for i in range( nodeCount):
+ onosUninstallResult = onosUninstallResult and \
+ main.ONOSbench.onosUninstall( nodeIp=ONOSIp[ i ] )
stepResult = onosUninstallResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -91,44 +151,44 @@
onfail="Failed to uninstall ONOS package" )
time.sleep( 5 )
main.step( "Installing ONOS package" )
- onosInstallResult = main.ONOSbench.onosInstall( node=main.ONOS1ip )
+ onosInstallResult = main.TRUE
+ for i in range( nodeCount):
+ onosInstallResult = onosInstallResult and \
+ main.ONOSbench.onosInstall( node=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( 5 )
main.step( "Starting ONOS service" )
stopResult = main.TRUE
startResult = main.TRUE
- onosIsUp = main.ONOSbench.isup()
+ onosIsUp = main.TRUE
+ for i in range( nodeCount ):
+ onosIsUp = onosIsUp and main.ONOSbench.isup( 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 " )
- stopResult = main.ONOSbench.onosStop( main.ONOS1ip )
- startResult = main.ONOSbench.onosStart( main.ONOS1ip )
+ for i in range( nodeCount ):
+ stopResult = stopResult and \
+ main.ONOSbench.onosStop( ONOSIp[ i ] )
+ for i in range( nodeCount ):
+ startResult = startResult and \
+ main.ONOSbench.onosStart( 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( "Starting Mininet Topology" )
- topoResult = main.Mininet1.startNet( topoFile=topology )
- stepResult = topoResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully loaded topology",
- onfail="Failed to load topology" )
- # Exit if topology did not load properly
- if not topoResult:
- main.cleanup()
- main.exit()
-
+
main.step( "Start ONOS cli" )
- cliResult = main.ONOScli1.startOnosCli( ONOSIp=main.ONOS1ip )
+ cliResult = main.TRUE
+ for i in range( nodeCount ):
+ cliResult = cliResult and main.CLIs[i].startOnosCli( ONOSIp[ i ] )
stepResult = cliResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -143,6 +203,18 @@
main.log.report( "Assigning switches to controllers" )
main.log.case( "Assigning swithes to controllers" )
+ main.step( "Starting Mininet Topology" )
+ topoResult = main.Mininet1.startNet( topoFile=topology )
+ stepResult = topoResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully loaded topology",
+ onfail="Failed to load topology" )
+ # Exit if topology did not load properly
+ if not topoResult:
+ main.cleanup()
+ main.exit()
+
main.step( "Assigning switches to controllers" )
assignResult = main.TRUE
for i in range( 1, ( main.numSwitch + 1 ) ):
@@ -166,7 +238,7 @@
"controller" )
- def CASE1000( self, main ):
+ def CASE1001( self, main ):
"""
Add host intents between 2 host:
- Discover hosts
@@ -204,13 +276,14 @@
dualStack1 = { 'name': 'DUALSTACK1', 'host1':
{ 'name': 'h3', 'MAC': '00:00:00:00:00:03',
'id':'00:00:00:00:00:03/-1' } , 'host2':
- { 'name': '', 'MAC': '00:00:00:00:00:0B',
+ { 'name': 'h11', 'MAC': '00:00:00:00:00:0B',
'id':'00:00:00:00:00:0B/-1'}, 'link': { 'switch1': 's5',
'switch2': 's2', 'num':'18' } }
items.append( ipv4 )
+ items.append( dualStack1 )
# Global variables
- main.case( "Add host intents between 2 host" )
+ main.log.case( "Add host intents between 2 host" )
for item in items:
stepResult = main.TRUE
@@ -358,7 +431,7 @@
" host intent successful",
onfail=item[ 'name' ] +
"Add host intent failed" )
- def CASE2000( self, main ):
+ def CASE1002( self, main ):
"""
Add point intents between 2 hosts:
- Get device ids
@@ -374,7 +447,7 @@
- Remove intents
"""
- def CASE3000( self, main ):
+ def CASE1003( self, main ):
"""
Add single point to multi point intents
- Get device ids
@@ -390,7 +463,7 @@
- Remove intents
"""
- def CASE4000( self, main ):
+ def CASE1004( self, main ):
"""
Add multi point to single point intents
- Get device ids
diff --git a/TestON/tests/SingleFunc/SingleFunc2.py b/TestON/tests/SingleFunc/SingleFunc2.py
new file mode 100644
index 0000000..e991dee
--- /dev/null
+++ b/TestON/tests/SingleFunc/SingleFunc2.py
@@ -0,0 +1,123 @@
+# ScaleOutTemplate
+#
+# CASE1 starts number of nodes specified in param file
+#
+# cameron@onlab.us
+
+import sys
+import os.path
+
+
+class SingleFunc:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ import time
+ global init
+ try:
+ if type(init) is not bool:
+ init = False
+ except NameError:
+ init = False
+
+ #Load values from params file
+ checkoutBranch = main.params[ 'GIT' ][ 'branch' ]
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ Apps = main.params[ 'ENV' ][ 'cellApps' ]
+ BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+ BENCHUser = main.params[ 'BENCH' ][ 'user' ]
+ maxNodes = int(main.params[ 'availableNodes' ])
+ skipMvn = main.params[ 'skipCleanInstall' ]
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+
+ # -- INIT SECTION, ONLY RUNS ONCE -- #
+ if init == False:
+ init = True
+ global clusterCount #number of nodes running
+ global ONOSIp #list of ONOS IP addresses
+ global scale
+
+ clusterCount = 0
+ ONOSIp = [ 0 ]
+ scale = (main.params[ 'SCALE' ]).split(",")
+ clusterCount = int(scale[0])
+
+ #Populate ONOSIp with ips from params
+ for i in range(1, maxNodes + 1):
+ ipString = 'ip' + str(i)
+ ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
+
+ #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
+ if skipMvn != "yes":
+ mvnResult = main.ONOSbench.cleanInstall()
+
+ #git
+ main.step( "Git checkout and pull " + checkoutBranch )
+ if gitPull == 'True':
+ checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
+ pullResult = main.ONOSbench.gitPull()
+
+ else:
+ checkoutResult = main.TRUE
+ pullResult = main.TRUE
+ main.log.info( "Skipped git checkout and pull" )
+
+ # -- END OF INIT SECTION --#
+
+ clusterCount = int(scale[0])
+ scale.remove(scale[0])
+
+ #kill off all onos processes
+ main.log.step("Safety check, killing all ONOS processes")
+ main.log.step("before initiating enviornment setup")
+ for node in range(1, maxNodes + 1):
+ main.ONOSbench.onosDie(ONOSIp[node])
+
+ #Uninstall everywhere
+ main.log.step( "Cleaning Enviornment..." )
+ for i in range(1, maxNodes + 1):
+ main.log.info(" Uninstalling ONOS " + str(i) )
+ main.ONOSbench.onosUninstall( ONOSIp[i] )
+
+ #construct the cell file
+ main.log.info("Creating cell file")
+ cellIp = []
+ for node in range (1, clusterCount + 1):
+ cellIp.append(ONOSIp[node])
+
+ main.ONOSbench.createCellFile(BENCHIp,cellName,"",str(Apps), *cellIp)
+
+ main.step( "Set Cell" )
+ main.ONOSbench.setCell(cellName)
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "verify cells" )
+ verifyCellResult = main.ONOSbench.verifyCell()
+
+ main.log.report( "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])
+
+ for node in range(1, clusterCount + 1):
+ for i in range( 2 ):
+ isup = main.ONOSbench.isup( ONOSIp[node] )
+ if isup:
+ main.log.info("ONOS " + str(node) + " is up\n")
+ break
+ if not isup:
+ main.log.report( "ONOS " + str(node) + " didn't start!" )
+ main.log.info("Startup sequence complete")
+
+ def CASE2( self, main ):
+
+ print ("clusterCount: " + str(clusterCount))
+ print ("scale: " + str(scale))
+ print ("ONOSIp: " + str(ONOSIp))
+ print ("INIT: " + str(init))
+