Merge pull request #96 from opennetworkinglab/devl/newOnosCHO
Devl/new onos cho
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index f8ec9e5..dd4f05e 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -427,14 +427,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 b030231..b08054b 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1099,39 +1099,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" )
@@ -1173,8 +1150,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 955d996..93dc11b 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -163,7 +163,7 @@
utilities.assert_equals( expect=main.TRUE, actual=case1Result,
onpass="Set up test environment PASS",
onfail="Set up test environment FAIL" )
-
+ time.sleep(30)
def CASE2( self, main ):
"""
This test loads a Topology (ATT) on Mininet and balances all switches.
@@ -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()
@@ -940,6 +943,208 @@
onpass="Ping all test after Point intents addition successful",
onfail="Ping all test after Point intents addition failed" )
+ def CASE90( self ):
+ """
+ Install single-multi point intents and verify Ping all works
+ for att topology
+ """
+ import copy
+ main.log.report( "Install single-multi point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install single-multi point intents and Ping all" )
+ deviceLinksCopy = copy.copy( main.deviceLinks )
+ main.step( "Install single-multi point intents" )
+ for i in range( len( deviceLinksCopy ) ):
+ pointLink = str(
+ deviceLinksCopy[ i ] ).replace(
+ "src=",
+ "" ).replace(
+ "dst=",
+ "" ).split( ',' )
+ point1 = pointLink[ 0 ].split( '/' )
+ point2 = pointLink[ 1 ].split( '/' )
+ installResult = main.ONOScli1.addPointIntent(
+ point1[ 0 ], point2[ 0 ], int(
+ point1[ 1 ] ), int(
+ point2[ 1 ] ) )
+ if installResult == main.TRUE:
+ print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] )
+
+ main.step( "Obtain the intent id's" )
+ intentsList = main.ONOScli1.getAllIntentIds()
+ ansi_escape = re.compile( r'\x1b[^m]*m' )
+ intentsList = ansi_escape.sub( '', intentsList )
+ intentsList = intentsList.replace(
+ " onos:intents | grep id=",
+ "" ).replace(
+ "id=",
+ "" ).replace(
+ "\r\r",
+ "" )
+ intentsList = intentsList.splitlines()
+ intentsList = intentsList[ 1: ]
+ intentIdList = []
+ for i in range( len( intentsList ) ):
+ intentsTemp = intentsList[ i ].split( ',' )
+ intentIdList.append( intentsTemp[ 0 ] )
+ print "Intent IDs: ", intentIdList
+ print "Total Intents installed: ", len( intentIdList )
+
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case8_result = installResult and pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case8_result,
+ onpass="Ping all test after Point intents addition successful",
+ onfail="Ping all test after Point intents addition failed" )
+
+ def CASE91( self ):
+ """
+ Install single-multi point intents and verify Ping all works
+ """
+ import copy
+ main.log.report( "Install single-multi point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install single-multi point intents and Ping all" )
+ deviceLinksCopy = copy.copy( main.deviceLinks )
+ main.step( "Install single-multi point intents" )
+ for i in range( len( deviceLinksCopy ) ):
+ pointLink = str(
+ deviceLinksCopy[ i ] ).replace(
+ "src=",
+ "" ).replace(
+ "dst=",
+ "" ).split( ',' )
+ point1 = pointLink[ 0 ].split( '/' )
+ point2 = pointLink[ 1 ].split( '/' )
+ installResult = main.ONOScli1.addPointIntent(
+ point1[ 0 ], point2[ 0 ], int(
+ point1[ 1 ] ), int(
+ point2[ 1 ] ) )
+ if installResult == main.TRUE:
+ print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] )
+
+ main.step( "Obtain the intent id's" )
+ intentsList = main.ONOScli1.getAllIntentIds()
+ ansi_escape = re.compile( r'\x1b[^m]*m' )
+ intentsList = ansi_escape.sub( '', intentsList )
+ intentsList = intentsList.replace(
+ " onos:intents | grep id=",
+ "" ).replace(
+ "id=",
+ "" ).replace(
+ "\r\r",
+ "" )
+ intentsList = intentsList.splitlines()
+ intentsList = intentsList[ 1: ]
+ intentIdList = []
+ for i in range( len( intentsList ) ):
+ intentsTemp = intentsList[ i ].split( ',' )
+ intentIdList.append( intentsTemp[ 0 ] )
+ print "Intent IDs: ", intentIdList
+ print "Total Intents installed: ", len( intentIdList )
+
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case8_result = installResult and pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case8_result,
+ onpass="Ping all test after Point intents addition successful",
+ onfail="Ping all test after Point intents addition failed" )
+
+ def CASE92( self ):
+ """
+ Install 114 point intents and verify Ping all works
+ """
+ import copy
+ main.log.report( "Install 114 point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install 114 point intents and Ping all" )
+ deviceLinksCopy = copy.copy( main.deviceLinks )
+ main.step( "Install 114 point intents" )
+ for i in range( len( deviceLinksCopy ) ):
+ pointLink = str(
+ deviceLinksCopy[ i ] ).replace(
+ "src=",
+ "" ).replace(
+ "dst=",
+ "" ).split( ',' )
+ point1 = pointLink[ 0 ].split( '/' )
+ point2 = pointLink[ 1 ].split( '/' )
+ installResult = main.ONOScli1.addPointIntent(
+ point1[ 0 ], point2[ 0 ], int(
+ point1[ 1 ] ), int(
+ point2[ 1 ] ) )
+ if installResult == main.TRUE:
+ print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] )
+
+ main.step( "Obtain the intent id's" )
+ intentsList = main.ONOScli1.getAllIntentIds()
+ ansi_escape = re.compile( r'\x1b[^m]*m' )
+ intentsList = ansi_escape.sub( '', intentsList )
+ intentsList = intentsList.replace(
+ " onos:intents | grep id=",
+ "" ).replace(
+ "id=",
+ "" ).replace(
+ "\r\r",
+ "" )
+ intentsList = intentsList.splitlines()
+ intentsList = intentsList[ 1: ]
+ intentIdList = []
+ for i in range( len( intentsList ) ):
+ intentsTemp = intentsList[ i ].split( ',' )
+ intentIdList.append( intentsTemp[ 0 ] )
+ print "Intent IDs: ", intentIdList
+ print "Total Intents installed: ", len( intentIdList )
+
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+ utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case8_result = installResult and pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case8_result,
+ onpass="Ping all test after Point intents addition successful",
+ onfail="Ping all test after Point intents addition failed" )
+
def CASE10( self ):
import time
"""
@@ -964,84 +1169,57 @@
intentsList = intentsList[ 1: ]
intentIdList = []
step1Result = main.TRUE
+ moreIntents = main.TRUE
+ removeIntentCount = 0
+ print "Current number of intents" , len(intentsList)
if ( len( intentsList ) > 1 ):
- for i in range( len( intentsList ) ):
- intentsTemp = intentsList[ i ].split( ',' )
- intentIdList.append( intentsTemp[ 0 ] )
- print "Intent IDs: ", intentIdList
-
results = main.TRUE
- time1 = time.time()
-
- for i in xrange(0,len( intentIdList ), int(main.numCtrls)):
- pool = []
- for cli in main.CLIs:
- if i >= len(intentIdList):
- break
- print "Removing intent id (round 1) :", intentIdList[ i ]
- t = main.Thread(target=cli.removeIntent,
- threadID=main.threadID,
- name="removeIntent",
- args=[intentIdList[i],'org.onosproject.cli',False,False])
- pool.append(t)
- t.start()
- i = i + 1
- main.threadID = main.threadID + 1
- for t in pool:
- t.join()
- results = results and t.result
-
- time2 = time.time()
- main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1))
+ main.log.info("Removing intent...")
+ while moreIntents:
+ removeIntentCount = removeIntentCount + 1
+ intentsList1 = main.ONOScli1.getAllIntentIds()
+ if len( intentsList1 ) == 0:
+ break
+ ansi_escape = re.compile( r'\x1b[^m]*m' )
+ intentsList1 = ansi_escape.sub( '', intentsList1 )
+ intentsList1 = intentsList1.replace(
+ " onos:intents | grep id=",
+ "" ).replace(
+ " state=",
+ "" ).replace(
+ "\r\r",
+ "" )
+ intentsList1 = intentsList1.splitlines()
+ intentsList1 = intentsList1[ 1: ]
+ print "Round %d intents to remove: " %(removeIntentCount)
+ print intentsList1
+ intentIdList1 = []
+ if ( len( intentsList1 ) > 1 ):
+ moreIntents = main.TRUE
+ for i in range( len( intentsList1 ) ):
+ intentsTemp1 = intentsList1[ i ].split( ',' )
+ intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
+ print "Leftover Intent IDs: ", intentIdList1
+ print len(intentIdList1)
+ 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
- main.log.info(
- "Verify all intents are removed and if any leftovers try remove one more time" )
- intentsList1 = main.ONOScli1.getAllIntentIds()
- ansi_escape = re.compile( r'\x1b[^m]*m' )
- intentsList1 = ansi_escape.sub( '', intentsList1 )
- intentsList1 = intentsList1.replace(
- " onos:intents | grep id=",
- "" ).replace(
- " state=",
- "" ).replace(
- "\r\r",
- "" )
- intentsList1 = intentsList1.splitlines()
- intentsList1 = intentsList1[ 1: ]
-
- print "Round 2 (leftover) intents to remove: ", intentsList1
- intentIdList1 = []
- if ( len( intentsList1 ) > 1 ):
- for i in range( len( intentsList1 ) ):
- intentsTemp1 = intentsList1[ i ].split( ',' )
- intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
- print "Leftover Intent IDs: ", intentIdList1
- for i in xrange(0, len( intentIdList1 ), int(main.numCtrls)):
- pool = []
- for cli in main.CLIs:
- if i >= len(intentIdList1):
- break
- print "Removing intent id (round 2) :", intentIdList1[ i ]
- t = main.Thread(target=cli.removeIntent,threadID=main.threadID,
- name="removeIntent",
- args=[intentIdList1[i],'org.onosproject.cli',True,False])
- pool.append(t)
- t.start()
- i = i + 1
- main.threadID = main.threadID + 1
-
- for t in pool:
- t.join()
- results = results and t.result
- step1Result = results
else:
print "There are no more intents that need to be removed"
step1Result = main.TRUE
else:
print "No Intent IDs found in Intents list: ", intentsList
step1Result = main.FALSE
-
+
print main.ONOScli1.intents()
+ # time.sleep(300)
caseResult10 = step1Result
utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
onpass="Intent removal test successful",
@@ -1147,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']
@@ -1155,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(
@@ -1279,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(
@@ -1518,3 +1699,4 @@
onpass="Install 300 Host Intents and Ping All test PASS",
onfail="Install 300 Host Intents and Ping All test FAIL" )
+
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>