Added option in startNet to start Mininet using sudo mn command
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 76c74b9..b7e96a1 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -96,7 +96,7 @@
main.cleanup()
main.exit()
- def startNet( self, topoFile='', args='', timeout=120 ):
+ def startNet( self, topoFile='', args='', mnCmd='', timeout=120 ):
"""
Starts Mininet accepts a topology(.py) file and/or an optional
argument ,to start the mininet, as a parameter.
@@ -131,26 +131,31 @@
"Mininet took too long... " )
# Craft the string to start mininet
cmdString = "sudo "
- if topoFile is None or topoFile == '': # If no file is given
- main.log.info( self.name + ": building fresh Mininet" )
- cmdString += "mn "
- if args is None or args == '':
- # If no args given, use args from .topo file
- args = self.options[ 'arg1' ] +\
- " " + self.options[ 'arg2' ] +\
- " --mac --controller " +\
- self.options[ 'controller' ] + " " +\
- self.options[ 'arg3' ]
- else: # else only use given args
- pass
- # TODO: allow use of topo args and method args?
- else: # Use given topology file
- main.log.info( "Starting Mininet from topo file " + topoFile )
- cmdString += topoFile + " "
- if args is None:
- args = ''
- # TODO: allow use of args from .topo file?
- cmdString += args
+ if not mnCmd:
+ if topoFile is None or topoFile == '': # If no file is given
+ main.log.info( self.name + ": building fresh Mininet" )
+ cmdString += "mn "
+ if args is None or args == '':
+ # If no args given, use args from .topo file
+ args = self.options[ 'arg1' ] +\
+ " " + self.options[ 'arg2' ] +\
+ " --mac --controller " +\
+ self.options[ 'controller' ] + " " +\
+ self.options[ 'arg3' ]
+ else: # else only use given args
+ pass
+ # TODO: allow use of topo args and method args?
+ else: # Use given topology file
+ main.log.info( "Starting Mininet from topo file " + topoFile )
+ cmdString += topoFile + " "
+ if args is None:
+ args = ''
+ # TODO: allow use of args from .topo file?
+ cmdString += args
+ else:
+ main.log.info( "Starting Mininet topology using '" + mnCmd +
+ "' command" )
+ cmdString += mnCmd
# Send the command and check if network started
self.handle.sendline( "" )
self.handle.expect( '\$' )
diff --git a/TestON/tests/FuncIntent/FuncIntent.py b/TestON/tests/FuncIntent/FuncIntent.py
index eb2321c..d74f9a9 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -453,7 +453,6 @@
expectedLink=18 )
stepResult = main.TRUE
- main.step( "NOOPTION: Add point intents between h1 and h9" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="NOOPTION: Add point intent successful",
diff --git a/TestON/tests/FuncTopo/FuncTopo.params b/TestON/tests/FuncTopo/FuncTopo.params
deleted file mode 100755
index ca464ae..0000000
--- a/TestON/tests/FuncTopo/FuncTopo.params
+++ /dev/null
@@ -1,34 +0,0 @@
-<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
index f691957..456f2be 100644
--- a/TestON/tests/FuncTopo/FuncTopo.py
+++ b/TestON/tests/FuncTopo/FuncTopo.py
@@ -13,6 +13,7 @@
def CASE10( self, main ):
import time
import os
+ import imp
"""
Startup sequence:
cell <name>
@@ -32,6 +33,10 @@
except NameError:
init = False
+ main.wrapper = imp.load_source( 'FuncTopoFunction', '/home/admin/' +
+ 'TestON/tests/FuncTopo/Dependency/' +
+ 'FuncTopoFunction.py')
+
#Local variables
cellName = main.params[ 'ENV' ][ 'cellName' ]
apps = main.params[ 'ENV' ][ 'cellApps' ]
@@ -42,13 +47,16 @@
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+ main.hostsData = {}
PULLCODE = False
if main.params[ 'GIT' ][ 'pull' ] == 'True':
PULLCODE = True
main.case( "Setting up test environment" )
main.CLIs = []
+ main.nodes = []
for i in range( 1, int( main.numCtrls ) + 1 ):
main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+ main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
# -- INIT SECTION, ONLY RUNS ONCE -- #
if init == False:
@@ -188,7 +196,32 @@
"s" )
#main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
- def CASE1001( self, main )
- """
- Test topology discovery
- """
+ def CASE1001( self, main ):
+ """
+ Test topology discovery
+ """
+ main.case( "Topology discovery test" )
+ main.topoName = ""
+
+ stepResult = main.TRUE
+ main.step( "Tree 3-3 topology" )
+ mnCmd = "mn --topo=tree,3,3 --controller=remote,ip=$OC1 --mac"
+ stepResult = main.wrapper.testTopology( main,
+ mnCmd=mnCmd,
+ clean=False )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Tree 3-3 topology successful",
+ onfail="Tree 3-3 topology failed" )
+
+ """
+ main.step( "Tree 4-3 topology" )
+ mnCmd = "mn --topo=tree,4,3 --controller=remote,ip=$OC1 --mac"
+ stepResult = main.wrapper.testTopology( main,
+ mnCmd=mnCmd,
+ clean=True)
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Tree 4-3 topology successful",
+ onfail="Tree 4-3 topology failed" )
+ """
diff --git a/TestON/tests/FuncTopo/FuncTopo.topo b/TestON/tests/FuncTopo/FuncTopo.topo
deleted file mode 100755
index e6613de..0000000
--- a/TestON/tests/FuncTopo/FuncTopo.topo
+++ /dev/null
@@ -1,52 +0,0 @@
-<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>