Implemented topology comparison case
Change-Id: I696f0532eb5a8d065c7a3bd0d937a2aa23870919
diff --git a/TestON/tests/FUNCflow/FUNCflow.params b/TestON/tests/FUNCflow/FUNCflow.params
index e12ee6c..d6312b3 100755
--- a/TestON/tests/FUNCflow/FUNCflow.params
+++ b/TestON/tests/FUNCflow/FUNCflow.params
@@ -12,7 +12,7 @@
# 4000 - Modify flow rule treatments
# 5000 - flow rule controller
# 100 - Compare switch flow table with ONOS
- <testcases>1,2,10</testcases>
+ <testcases>1,2,10,8</testcases>
<SCALE>
<max>3</max>
@@ -21,18 +21,19 @@
<DEPENDENCY>
<path>/tests/FUNCflow/Dependency/</path>
<wrapper1>startUp</wrapper1>
+ <wrapper2>topo</wrapper2>
<topology>flow-2sw.py</topology>
</DEPENDENCY>
<TOPO>
<numSwitches>2</numSwitches>
<numHosts>4</numHosts>
- <numLinks>10</numLinks>
+ <numLinks>2</numLinks>
</TOPO>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
+ <cellApps>drivers,openflow,proxyarp,mobility,fwd</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/FUNCflow/FUNCflow.py b/TestON/tests/FUNCflow/FUNCflow.py
index c2ee323..74c3464 100644
--- a/TestON/tests/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNCflow/FUNCflow.py
@@ -36,6 +36,7 @@
main.numHosts = int( main.params[ 'TOPO' ][ 'numHosts' ] )
main.numLinks = int( main.params[ 'TOPO' ][ 'numLinks' ] )
wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+ wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
gitPull = main.params[ 'GIT' ][ 'pull' ]
main.cellData = {} # for creating cell file
@@ -55,6 +56,11 @@
wrapperFile1 +
".py" )
+ main.topo = imp.load_source( wrapperFile2,
+ main.dependencyPath +
+ wrapperFile2 +
+ ".py" )
+
copyResult = main.ONOSbench.scp( main.Mininet1,
main.dependencyPath+main.topology,
main.Mininet1.home+'/custom/',
@@ -201,6 +207,71 @@
'''
Compare topology
'''
+ import json
+
+ main.case( "Compare ONOS Topology view to Mininet topology" )
+ main.caseExplanation = "Compare topology elements between Mininet" +\
+ " and ONOS"
+
+ main.step( "Gathering topology information" )
+ # TODO: add a paramaterized sleep here
+ devicesResults = main.TRUE
+ linksResults = main.TRUE
+ hostsResults = main.TRUE
+ devices = main.topo.getAllDevices( main )
+ hosts = main.topo.getAllHosts( main )
+ ports = main.topo.getAllPorts( main )
+ links = main.topo.getAllLinks( main )
+ clusters = main.topo.getAllClusters( main )
+
+ mnSwitches = main.Mininet1.getSwitches()
+ mnLinks = main.Mininet1.getLinks()
+ mnHosts = main.Mininet1.getHosts()
+
+ main.step( "Conmparing MN topology to ONOS topology" )
+ for controller in range( main.numCtrls ):
+ controllerStr = str( controller + 1 )
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
+
+ currentDevicesResult = main.Mininet1.compareSwitches(
+ mnSwitches,
+ json.loads( devices[ controller ] ),
+ json.loads( ports[ controller ] ) )
+ else:
+ currentDevicesResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentDevicesResult,
+ onpass="ONOS" + controllerStr +
+ " Switches view is correct",
+ onfail="ONOS" + controllerStr +
+ " Switches view is incorrect" )
+ if links[ controller ] and "Error" not in links[ controller ]:
+ currentLinksResult = main.Mininet1.compareLinks(
+ mnSwitches, mnLinks,
+ json.loads( links[ controller ] ) )
+ else:
+ currentLinksResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentLinksResult,
+ onpass="ONOS" + controllerStr +
+ " links view is correct",
+ onfail="ONOS" + controllerStr +
+ " links view is incorrect" )
+
+ if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ currentHostsResult = main.Mininet1.compareHosts(
+ mnHosts,
+ json.loads( hosts[ controller ] ) )
+ else:
+ currentHostsResult = main.FALSE
+ utilities.assert_equals( expect=main.TRUE,
+ actual=currentHostsResult,
+ onpass="ONOS" + controllerStr +
+ " hosts exist in Mininet",
+ onfail="ONOS" + controllerStr +
+ " hosts don't match Mininet" )
def CASE9( self, main ):
'''
@@ -214,7 +285,7 @@
"flow",
"ERROR",
"Except" ],
- "s" )
+ "s" )
def CASE10( self, main ):
'''
@@ -243,7 +314,18 @@
onpass="Controller assignment successfull",
onfail="Controller assignment failed" )
- caseResult = stepResult1 and stepResult2
+ time.sleep(5)
+
+ main.step( "Pingall hosts for discovery" )
+ stepResult3 = main.Mininet1.pingall()
+ if not stepResult3:
+ stepResult3 = main.Mininet1.pingall()
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult3,
+ onpass="Pingall successfull",
+ onfail="Pingall unsuccessfull" )
+
+ caseResult = stepResult1 and stepResult2 and stepResult3
if not caseResult:
main.cleanup()
main.exit()