Added more explicit type case for assignSwController in mininet driver
diff --git a/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
index a953640..783c166 100644
--- a/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
+++ b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
@@ -4,6 +4,7 @@
"""
import time
import json
+import re
def __init__( self ):
self.default = ''
@@ -168,7 +169,7 @@
tempResult = main.Mininet1.compareSwitches( MNTopo, devices[ i ] )
switchResult.append( tempResult )
if tempResult == main.FALSE:
- main.log.error( main.topoName + ": ONOS-" + str( i ) +
+ main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
" switch view is incorrect " )
if all( result == main.TRUE for result in switchResult ):
@@ -184,7 +185,7 @@
tempResult = main.Mininet1.comparePorts( MNTopo, ports[ i ] )
portsResult.append( tempResult )
if tempResult == main.FALSE:
- main.log.error( main.topoName + ": ONOS-" + str( i ) +
+ main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
" ports view are incorrect " )
if all( result == main.TRUE for result in portsResult ):
@@ -200,7 +201,7 @@
tempResult = main.Mininet1.compareLinks( MNTopo, links[ i ] )
linksResult.append( tempResult )
if tempResult == main.FALSE:
- main.log.error( main.topoName + ": ONOS-" + str( i ) +
+ main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
" links view are incorrect " )
if all( result == main.TRUE for result in linksResult ):
@@ -216,7 +217,7 @@
tempResult = main.Mininet1.compareHosts( MNTopo, hosts[ i ] )
hostsResult.append( tempResult )
if tempResult == main.FALSE:
- main.log.error( main.topoName + ": ONOS-" + str( i ) +
+ main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
" hosts view are incorrect " )
if all( result == main.TRUE for result in hostsResult ):
@@ -231,8 +232,20 @@
"""
Returns switch list using getSwitch in Mininet driver
"""
+ switchList = []
+ assignResult = main.TRUE
switchList = main.Mininet1.getSwitch()
- print switchList
+ assignResult = main.Mininet1.assignSwController( sw=switchList,
+ ip=main.ONOSip,
+ port=6633 )
+
+ for sw in switchList:
+ response = main.Mininet1.getSwController( sw )
+ if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
+ assignResult = assignResult and main.TRUE
+ else:
+ assignResult = main.FALSE
+
return switchList
def getHostsData( main ):
diff --git a/TestON/tests/FuncTopo/FuncTopo.py b/TestON/tests/FuncTopo/FuncTopo.py
index 35d9049..0b25315 100644
--- a/TestON/tests/FuncTopo/FuncTopo.py
+++ b/TestON/tests/FuncTopo/FuncTopo.py
@@ -47,6 +47,7 @@
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+ main.ONOSport = []
main.hostsData = {}
main.topoName = " "
PULLCODE = False
@@ -58,12 +59,12 @@
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 ) ) )
+ main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + 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 ] )
@@ -195,7 +196,7 @@
main.topoName = "TREE3-3"
stepResult = main.TRUE
main.step( "Tree 3-3 topology" )
- mnCmd = "mn --topo=tree,3,3 --controller=remote,ip=$OC1 --mac"
+ mnCmd = "mn --topo=tree,3,3 --mac"
stepResult = main.wrapper.testTopology( main,
mnCmd=mnCmd,
clean=False )
@@ -206,7 +207,7 @@
main.step( "Torus 5-5 topology" )
main.topoName = "TORUS5-5"
- mnCmd = "mn --topo=torus,5,5 --controller=remote,ip=$OC1 --mac"
+ mnCmd = "mn --topo=torus,5,5 --mac"
stepResult = main.wrapper.testTopology( main,
mnCmd=mnCmd,
clean=True )