Update OnosCHO and fixed onos driver topology function formatting issue
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 2d1ab22..997e48c 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -417,14 +417,17 @@
def topology( self ):
"""
- Shows the current state of the topology
- by issuing command: 'onos> onos:topology'
+ Definition:
+ Returns the ouput of topology command.
+ Return:
+ topology = current ONOS topology
"""
+ import json
try:
# either onos:topology or 'topology' will work in CLI
- cmdStr = "onos:topology"
+ cmdStr = "topology -j"
handle = self.sendline( cmdStr )
- main.log.info( "onos:topology returned: " + str( handle ) )
+ main.log.info( "topology -j returned: " + str( handle ) )
return handle
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 04ef1f8..81a2b4d 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1097,39 +1097,16 @@
def getTopology( self, topologyOutput ):
"""
- parses the onos:topology output
- Returns: a topology dict populated by the key values found in
- the cli command.
+ Definition:
+ Loads a json topology output
+ Return:
+ topology = current ONOS topology
"""
+ import json
try:
- # call the cli to get the topology summary
- # cmdstr = "onos:topology"
- # cliResult = self.onosCli( ip, cmdstr )
- # print "cli_result = ", cliResult
-
- # Parse the output
- topology = {}
- # for line in cliResult.split( "\n" ):
- for line in topologyOutput.splitlines():
- if not line.startswith( "time=" ):
- continue
- # else
- # print line
- for var in line.split( "," ):
- # print "'"+var+"'"
- # print "'"+var.strip()+"'"
- key, value = var.strip().split( "=" )
- topology[ key ] = value
- # print "topology = ", topology
- # devices = topology.get( 'devices', False )
- # print "devices = ", devices
- # links = topology.get( 'links', False )
- # print "links = ", links
- # SCCs = topology.get( 'SCC(s)', False )
- # print "SCCs = ", SCCs
- # paths = topology.get( 'paths', False )
- # print "paths = ", paths
-
+ # either onos:topology or 'topology' will work in CLI
+ topology = json.loads(topologyOutput)
+ print topology
return topology
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
@@ -1171,8 +1148,8 @@
return main.ERROR
output = ""
# Is the number of switches is what we expected
- devices = topology.get( 'devices', False )
- links = topology.get( 'links', False )
+ devices = topology.get( 'deviceCount', False )
+ links = topology.get( 'linkCount', False )
if not devices or not links:
return main.ERROR
switchCheck = ( int( devices ) == int( numoswitch ) )
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index edc7540..02a016c 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -13,9 +13,9 @@
# 1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100
# 1,2,3,4,5,6,10,12,3,4,5,6,10,13,3,4,5,6,10
- <testcases>1,2,3,4,5,6,10</testcases>
+ <testcases>1,[2,3,4,5,6,70,80,10,12,3,4,5,14,10,13,3,4,5,15,10]*3</testcases>
<ENV>
- <cellName>fiveNodes</cellName>
+ <cellName>choTest5New</cellName>
</ENV>
<GIT>
#autoPull 'on' or 'off'
@@ -45,15 +45,15 @@
</TOPO3>
<CTRL>
<numCtrl>5</numCtrl>
- <ip1>10.128.10.21</ip1>
+ <ip1>10.128.40.41</ip1>
<port1>6633</port1>
- <ip2>10.128.10.22</ip2>
+ <ip2>10.128.40.42</ip2>
<port2>6633</port2>
- <ip3>10.128.10.23</ip3>
+ <ip3>10.128.40.43</ip3>
<port3>6633</port3>
- <ip4>10.128.10.24</ip4>
+ <ip4>10.128.40.44</ip4>
<port4>6633</port4>
- <ip5>10.128.10.25</ip5>
+ <ip5>10.128.40.45</ip5>
<port5>6633</port5>
</CTRL>
<HOSTS>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index dc5e5ce..93dc11b 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -249,8 +249,10 @@
main.step( "Collect and store current number of switches and links" )
topology_output = main.ONOScli1.topology()
topology_result = main.ONOSbench.getTopology( topology_output )
- numOnosDevices = topology_result[ 'devices' ]
- numOnosLinks = topology_result[ 'links' ]
+ numOnosDevices = topology_result[ 'deviceCount' ]
+ numOnosLinks = topology_result[ 'linkCount' ]
+ print numOnosDevices
+ print numOnosLinks
if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ):
main.step( "Store Device DPIDs" )
@@ -529,7 +531,7 @@
main.log.report( "Add 300 host intents and verify pingall" )
main.log.report( "_______________________________________" )
import itertools
-
+ import time
main.case( "Install 300 host intents" )
main.step( "Add host Intents" )
intentResult = main.TRUE
@@ -547,6 +549,7 @@
name="addHostIntent",
args=[hostCombos[i][0],hostCombos[i][1]])
pool.append(t)
+ time.sleep(1)
t.start()
i = i + 1
main.threadID = main.threadID + 1
@@ -560,7 +563,7 @@
getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
intentsJson = intentsJson)
print getIntentStateResult
-
+ time.sleep(30)
main.step( "Verify Ping across all hosts" )
pingResult = main.FALSE
time1 = time.time()
@@ -1201,6 +1204,9 @@
for intent in intentIdList1:
main.CLIs[0].removeIntent(intent,'org.onosproject.cli',True,False)
else:
+ time.sleep(15)
+ if len(main.ONOScli1.intents()):
+ continue
break
if removeIntentCount == 5:
break
@@ -1319,7 +1325,6 @@
import re
import time
import copy
-
Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
newTopo = main.params['TOPO2']['topo']
@@ -1327,6 +1332,8 @@
main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
main.pingTimeout = 60
+
+ time.sleep(60)
main.log.report(
"Load Chordal topology and Balance all Mininet switches across controllers" )
main.log.report(
@@ -1451,6 +1458,8 @@
main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
main.pingTimeout = 600
+
+ time.sleep(60)
main.log.report(
"Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
main.log.report(
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/OnosCHO/OnosCHO.topo
index 53de6dc..040e3c5 100644
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/OnosCHO/OnosCHO.topo
@@ -2,18 +2,16 @@
<COMPONENT>
<ONOSbench>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
- <COMPONENTS>
- <home>~/onos</home>
- </COMPONENTS>
+ <COMPONENTS> </COMPONENTS>
</ONOSbench>
<ONOScli1>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -22,7 +20,7 @@
</ONOScli1>
<ONOScli2>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -31,7 +29,7 @@
</ONOScli2>
<ONOScli3>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -40,7 +38,7 @@
</ONOScli3>
<ONOScli4>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -49,7 +47,7 @@
</ONOScli4>
<ONOScli5>
- <host>10.128.10.20</host>
+ <host>10.128.40.40</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -58,7 +56,7 @@
</ONOScli5>
<ONOS1>
- <host>10.128.10.21</host>
+ <host>10.128.40.41</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -67,7 +65,7 @@
</ONOS1>
<ONOS2>
- <host>10.128.10.22</host>
+ <host>10.128.40.42</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -76,7 +74,7 @@
</ONOS2>
<ONOS3>
- <host>10.128.10.23</host>
+ <host>10.128.40.43</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -85,7 +83,7 @@
</ONOS3>
<ONOS4>
- <host>10.128.10.24</host>
+ <host>10.128.40.44</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -94,7 +92,7 @@
</ONOS4>
<ONOS5>
- <host>10.128.10.25</host>
+ <host>10.128.40.45</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
@@ -103,7 +101,7 @@
</ONOS5>
<Mininet1>
- <host>10.128.10.20</host>
+ <host>10.128.40.50</host>
<user>admin</user>
<password>onos_test</password>
<type>MininetCliDriver</type>
@@ -118,7 +116,7 @@
</Mininet1>
<Mininet2>
- <host>10.128.10.20</host>
+ <host>10.128.40.50</host>
<user>admin</user>
<password>onos_test</password>
<type>RemoteMininetDriver</type>