<New Test Added> Topology test suite FuncTopo
diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index 1733649..3ceb24b 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -81,6 +81,7 @@
topoResult = main.TRUE
linkDownResult = main.TRUE
linkUpResult = main.TRUE
+ onosNode = int( onosNode )
if main.hostsData:
if not h1Mac:
@@ -109,6 +110,19 @@
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,
@@ -119,11 +133,14 @@
# Check intents state
time.sleep( 30 )
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 )
@@ -143,6 +160,8 @@
linkDownResult = link( main, sw1, sw2, "down" )
intentResult = intentResult and checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -164,6 +183,8 @@
linkUpResult = link( main, sw1, sw2, "up" )
time.sleep( 5 )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -278,6 +299,17 @@
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" )
@@ -317,11 +349,15 @@
# Check intents state
time.sleep( 30 )
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 )
@@ -341,6 +377,8 @@
linkDownResult = link( main, sw1, sw2, "down" )
intentResult = intentResult and checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -362,6 +400,8 @@
linkUpResult = link( main, sw1, sw2, "up" )
time.sleep( 5 )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -465,6 +505,7 @@
itemName = name
tempHostsData = {}
intentsId = []
+ onosNode = int( onosNode )
macsDict = {}
ipDict = {}
@@ -514,6 +555,20 @@
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 ]
@@ -550,6 +605,7 @@
tcpSrc="",
tcpDst="" ) )
+ # Wait some time for the flow to go through when using multi instance
time.sleep( 10 )
pingResult = pingallHosts( main, hostNames )
@@ -561,6 +617,8 @@
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -576,6 +634,8 @@
linkDownResult = link( main, sw1, sw2, "down" )
intentResult = intentResult and checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -597,6 +657,8 @@
linkUpResult = link( main, sw1, sw2, "up" )
time.sleep( 5 )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -699,6 +761,7 @@
itemName = name
tempHostsData = {}
intentsId = []
+ onosNode = int( onosNode )
macsDict = {}
ipDict = {}
@@ -747,6 +810,20 @@
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 ]
@@ -793,6 +870,8 @@
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -808,6 +887,8 @@
linkDownResult = link( main, sw1, sw2, "down" )
intentResult = intentResult and checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -829,6 +910,8 @@
linkUpResult = link( main, sw1, sw2, "up" )
time.sleep( 5 )
+ # Check flows count in each node
+ checkFlowsCount( main )
# Verify flows
checkFlowsState( main )
@@ -982,3 +1065,36 @@
"successfully removed all the intents." )
removeIntentResult = main.TRUE
return removeIntentResult
+
+def checkFlowsCount( main ):
+ """
+ Check flows count in each node
+ """
+ import json
+
+ 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/FuncIntent.py b/TestON/tests/FuncIntent/FuncIntent.py
index 7ae9df9..eb2321c 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -311,6 +311,7 @@
stepResult = main.TRUE
main.step( "IPV4: Add host intents between h1 and h9" )
stepResult = main.wrapper.hostIntent( main,
+ onosNode='0',
name='IPV4',
host1='h1',
host2='h9',
@@ -324,8 +325,8 @@
actual=stepResult,
onpass="IPV4: Add host intent successful",
onfail="IPV4: Add host intent failed" )
- stepResult = main.TRUE
+ stepResult = main.TRUE
main.step( "DUALSTACK1: Add host intents between h3 and h11" )
stepResult = main.wrapper.hostIntent( main,
name='DUALSTACK',
@@ -372,6 +373,7 @@
" successful",
onfail="1HOP: Add host intent failed" )
+ stepResult = main.TRUE
main.step( "VLAN1: Add vlan host intents between h4 and h12" )
stepResult = main.wrapper.hostIntent( main,
name='VLAN1',
@@ -457,6 +459,7 @@
onpass="NOOPTION: Add point intent successful",
onfail="NOOPTION: Add point intent failed" )
+ stepResult = main.TRUE
stepResult = main.wrapper.pointIntent(
main,
name="IPV4",
@@ -486,6 +489,28 @@
onfail="IPV4: Add point intent failed" )
stepResult = main.TRUE
+ stepResult = main.wrapper.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.wrapper.pointIntent(
main,
@@ -608,8 +633,7 @@
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.wrapper.singleToMultiIntent(
main,
@@ -635,6 +659,7 @@
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.wrapper.singleToMultiIntent(
@@ -730,7 +755,7 @@
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.wrapper.multiToSingleIntent(
main,
@@ -756,6 +781,7 @@
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.wrapper.multiToSingleIntent(
diff --git a/TestON/tests/FuncTopo/FuncTopo.params b/TestON/tests/FuncTopo/FuncTopo.params
new file mode 100755
index 0000000..ca464ae
--- /dev/null
+++ b/TestON/tests/FuncTopo/FuncTopo.params
@@ -0,0 +1,34 @@
+<PARAMS>
+
+ <testcases>10,9,10,9</testcases>
+
+ <SCALE>1,3</SCALE>
+ <availableNodes>3</availableNodes>
+ <ENV>
+ <cellName>functionality</cellName>
+ <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
+ </ENV>
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+ <CTRL>
+ <num>3</num>
+ <ip1>OC1</ip1>
+ <port1>6633</port1>
+ <ip2>OC2</ip2>
+ <port2>6633</port2>
+ <ip3>OC3</ip3>
+ <port3>6633</port3>
+ </CTRL>
+ <BENCH>
+ <user>admin</user>
+ <ip1>OCN</ip1>
+ </BENCH>
+ <MININET>
+ <switch>7</switch>
+ <links>20</links>
+ <topo>~/mininet/custom/newFuncTopo.py</topo>
+ </MININET>
+
+</PARAMS>
diff --git a/TestON/tests/FuncTopo/FuncTopo.py b/TestON/tests/FuncTopo/FuncTopo.py
new file mode 100644
index 0000000..f691957
--- /dev/null
+++ b/TestON/tests/FuncTopo/FuncTopo.py
@@ -0,0 +1,194 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import json
+
+class FuncTopo:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE10( self, main ):
+ import time
+ import os
+ """
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-log
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ """
+ global init
+ global globalONOSip
+ try:
+ if type(init) is not bool:
+ init = False
+ except NameError:
+ init = False
+
+ #Local variables
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ apps = main.params[ 'ENV' ][ 'cellApps' ]
+ gitBranch = main.params[ 'GIT' ][ 'branch' ]
+ benchIp = os.environ[ 'OCN' ]
+ benchUser = main.params[ 'BENCH' ][ 'user' ]
+ topology = main.params[ 'MININET' ][ 'topo' ]
+ main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
+ main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
+ main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+ 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
+
+ main.ONOSport = []
+ main.scale = ( main.params[ 'SCALE' ] ).split( "," )
+ main.numCtrls = int( main.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" )
+
+ globalONOSip = main.ONOSbench.getOnosIps()
+ maxNodes = ( len(globalONOSip) - 2 )
+
+ main.numCtrls = int( main.scale[ 0 ] )
+ main.scale.remove( main.scale[ 0 ] )
+
+ main.ONOSip = []
+ for i in range( maxNodes ):
+ main.ONOSip.append( globalONOSip[i] )
+
+ #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( globalONOSip[ i ] )
+
+ print "NODE COUNT = ", main.numCtrls
+ main.log.info( "Creating cell file" )
+ cellIp = []
+ for i in range( main.numCtrls ):
+ cellIp.append( str( main.ONOSip[ i ] ) )
+ print cellIp
+ main.ONOSbench.createCellFile( benchIp, cellName, "",
+ str( apps ), *cellIp )
+
+ 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( "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" )
+
+ 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( 5 )
+ 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( 20 )
+ 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" )
+
+ 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 CASE1001( self, main )
+ """
+ Test topology discovery
+ """
diff --git a/TestON/tests/FuncTopo/FuncTopo.topo b/TestON/tests/FuncTopo/FuncTopo.topo
new file mode 100755
index 0000000..e6613de
--- /dev/null
+++ b/TestON/tests/FuncTopo/FuncTopo.topo
@@ -0,0 +1,52 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <home>~/ONOS</home>
+ </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli1>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli1>
+
+ <ONOScli2>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli2>
+
+ <ONOScli3>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli3>
+
+ <Mininet1>
+ <host>OCN</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/FuncTopo/__init__.py b/TestON/tests/FuncTopo/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/FuncTopo/__init__.py
diff --git a/TestON/tests/PingallExample/PingallExample.params b/TestON/tests/PingallExample/PingallExample.params
new file mode 100644
index 0000000..1e4cfc1
--- /dev/null
+++ b/TestON/tests/PingallExample/PingallExample.params
@@ -0,0 +1,12 @@
+<PARAMS>
+ <testcases>1,2,3</testcases>
+ <ENV>
+ <cellName>SingleHA</cellName>
+ </ENV>
+ <Git>xe</Git>
+
+ <CTRL>
+ <ip1>10.128.30.11</ip1>
+ <port1>6633</port1>
+ </CTRL>
+</PARAMS>
diff --git a/TestON/tests/PingallExample/PingallExample.py b/TestON/tests/PingallExample/PingallExample.py
new file mode 100644
index 0000000..c03b0f1
--- /dev/null
+++ b/TestON/tests/PingallExample/PingallExample.py
@@ -0,0 +1,171 @@
+"""
+Description: This test is an example of a simple single node ONOS test
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machine
+CASE2: Assign mastership to controller
+CASE3: Pingall
+"""
+class PingallExample:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ CASE1 is to compile ONOS and push it to the test machines
+
+ Startup sequence:
+ git pull
+ mvn clean install
+ onos-package
+ cell <name>
+ onos-verify-cell
+ onos-install -f
+ onos-wait-for-start
+ """
+ desc = "ONOS Single node cluster restart HA test - initialization"
+ main.log.report( desc )
+ main.case( "Setting up test environment" )
+
+ # load some vairables from the params file
+ PULLCODE = False
+ if main.params[ 'Git' ] == 'True':
+ PULLCODE = True
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+ main.step( "Applying cell variable to environment" )
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+
+ main.log.report( "Uninstalling ONOS" )
+ main.ONOSbench.onosUninstall( ONOS1Ip )
+
+ cleanInstallResult = main.TRUE
+ gitPullResult = main.TRUE
+
+ main.step( "Compiling the latest version of ONOS" )
+ if PULLCODE:
+ main.step( "Git checkout and pull master" )
+ main.ONOSbench.gitCheckout( "master" )
+ gitPullResult = main.ONOSbench.gitPull()
+
+ main.step( "Using mvn clean & install" )
+ cleanInstallResult = main.TRUE
+ if gitPullResult == main.TRUE:
+ cleanInstallResult = main.ONOSbench.cleanInstall()
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
+ main.ONOSbench.getVersion( report=True )
+
+ cellResult = main.ONOSbench.setCell( cellName )
+ verifyResult = main.ONOSbench.verifyCell()
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+
+ main.step( "Installing ONOS package" )
+ onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
+ node=ONOS1Ip )
+
+ main.step( "Checking if ONOS is up yet" )
+ for i in range( 2 ):
+ onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+ if onos1Isup:
+ break
+ if not onos1Isup:
+ main.log.report( "ONOS1 didn't start!" )
+
+ # TODO: if it becomes an issue, we can retry this step a few times
+
+ cliResult = main.ONOScli1.startOnosCli( ONOS1Ip )
+
+ case1Result = ( cleanInstallResult and packageResult and
+ cellResult and verifyResult and
+ onos1InstallResult and
+ onos1Isup and cliResult )
+
+ utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+ onpass="Test startup successful",
+ onfail="Test startup NOT successful" )
+
+ if case1Result == main.FALSE:
+ main.cleanup()
+ main.exit()
+
+ # Starting the mininet using the old way
+ main.step( "Starting Mininet ..." )
+ netIsUp = main.Mininet1.startNet()
+ if netIsUp:
+ main.log.info("Mininet CLI is up")
+ else:
+ main.log.info("Mininet CLI is down")
+
+ def CASE2( self, main ):
+ """
+ Assign mastership to controller
+ """
+ import re
+
+ main.log.report( "Assigning switches to controller" )
+ main.case( "Assigning Controller" )
+ main.step( "Assign switches to controller" )
+
+ ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+ ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+
+ for i in range( 1, 14 ):
+ main.Mininet1.assignSwController(
+ sw=str( i ),
+ ip1=ONOS1Ip,
+ port1=ONOS1Port )
+
+ mastershipCheck = main.TRUE
+ for i in range( 1, 14 ):
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ try:
+ main.log.info( str( response ) )
+ except Exception:
+ main.log.info( repr( response ) )
+ if re.search( "tcp:" + ONOS1Ip, response ):
+ mastershipCheck = mastershipCheck and main.TRUE
+ else:
+ mastershipCheck = main.FALSE
+ if mastershipCheck == main.TRUE:
+ main.log.report( "Switch mastership assigned correctly" )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=mastershipCheck,
+ onpass="Switch mastership assigned correctly",
+ onfail="Switches not assigned correctly to controllers" )
+
+ def CASE3( self, main ):
+ """
+ Install forwarding app, Pingall and unistall the app
+ """
+ import time
+
+ main.log.report( "Run Pingall" )
+ main.case( "Run Pingall" )
+
+ # install onos-app-fwd
+ main.step( "Activate reactive forwarding app" )
+ main.ONOScli1.activateApp( "org.onosproject.fwd" )
+
+ # REACTIVE FWD test
+ main.step( "Run the pingall command in Mininet" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ main.log.info( "Time for pingall: %2f seconds" % ( time2 - time1 ) )
+
+ # uninstall onos-app-fwd
+ main.step( "Deactivate reactive forwarding app" )
+ main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+ onpass="All hosts are reachable",
+ onfail="Some pings failed" )
diff --git a/TestON/tests/PingallExample/PingallExample.topo b/TestON/tests/PingallExample/PingallExample.topo
new file mode 100644
index 0000000..3eda540
--- /dev/null
+++ b/TestON/tests/PingallExample/PingallExample.topo
@@ -0,0 +1,47 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>10.128.30.10</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli1>
+ <host>10.128.30.10</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli1>
+
+ <ONOS1>
+ <host>10.128.30.11</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS1>
+
+ <Mininet1>
+ <host>10.128.30.9</host>
+ <user>admin</user>
+ <password></password>
+ <type>MininetCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --topo=tree,3,3 </arg1>
+ <arg2> </arg2>
+ <arg3> </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>