Merge "Add VLAN Encapsulation test for point to point intents to FUNCintent"
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 033353b..979b0b6 100755
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -1031,7 +1031,7 @@
main.cleanup()
main.exit()
- def flows( self, ip="DEFAULT", port="DEFAULT" ):
+ def flows( self, ip="DEFAULT", port="DEFAULT", subjectClass=None, subjectKey=None ):
"""
Description:
Get flows currently added to the system
@@ -1043,6 +1043,7 @@
"""
try:
output = None
+ url = "/flows"
if ip == "DEFAULT":
main.log.warn( "No ip given, reverting to ip from topo file" )
ip = self.ip_address
@@ -1050,7 +1051,13 @@
main.log.warn( "No port given, reverting to port " +
"from topo file" )
port = self.port
- response = self.send( url="/flows", ip = ip, port = port )
+ if subjectKey and not subjectClass:
+ main.log.warning( "Subject Key provided without Subject Class. Ignoring Subject Key" )
+ if subjectClass:
+ url += "/" + subjectClass
+ if subjectKey:
+ url += "/" + subjectKey
+ response = self.send( url=url, ip=ip, port=port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 31b02aa..306680e 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2301,10 +2301,11 @@
main.log.error( self.name + ": ONOS timeout" )
return None
- def flows( self, state="", jsonFormat=True, timeout=60, noExit=False ):
+ def flows( self, state="", jsonFormat=True, timeout=60, noExit=False, noCore=False ):
"""
Optional:
* jsonFormat: enable output formatting in json
+ * noCore: suppress core flows
Description:
Obtain flows currently installed
"""
@@ -2312,6 +2313,8 @@
cmdStr = "flows"
if jsonFormat:
cmdStr += " -j "
+ if noCore:
+ cmdStr += " -n "
cmdStr += state
handle = self.sendline( cmdStr, timeout=timeout, noExit=noExit )
assert "Command not found:" not in handle, handle
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.params b/TestON/tests/FUNC/FUNCintent/FUNCintent.params
index c201411..7af98ee 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.params
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.params
@@ -50,6 +50,7 @@
<checkintent>5</checkintent>
<fwd>10</fwd>
<topoAttempts>3</topoAttempts>
+ <flowDuration>10</flowDuration>
</SLEEP>
<MININET>
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 22fcf3c..5ee3f70 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -49,6 +49,7 @@
main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
+ main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
gitPull = main.params[ 'GIT' ][ 'pull' ]
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index cbf783f..89695a2 100755
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -93,9 +93,16 @@
# Check intents state
if utilities.retry( f=checkIntentState, retValue=main.FALSE,
args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
- return intentId
+ main.assertReturnString += 'Install Intent State Passed\n'
+ if flowDuration( main ):
+ main.assertReturnString += 'Flow duration check Passed\n'
+ return intentId
+ else:
+ main.assertReturnString += 'Flow duration check failed\n'
+ return main.FALSE
else:
main.log.error( "Host Intent did not install correctly" )
+ main.assertReturnString += 'Install Intent State Failed\n'
return main.FALSE
def testHostIntent( main,
@@ -401,8 +408,15 @@
return main.FALSE
# Check intents state
- if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
- return intentId
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE,
+ args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Install Intent State Passed\n'
+ if flowDuration( main ):
+ main.assertReturnString += 'Flow duration check Passed\n'
+ return intentId
+ else:
+ main.assertReturnString += 'Flow duration check failed\n'
+ return main.FALSE
else:
main.log.error( "Point Intent did not install correctly" )
return main.FALSE
@@ -804,8 +818,15 @@
return main.FALSE
# Check intents state
- if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
- return intentId
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE,
+ args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Install Intent State Passed\n'
+ if flowDuration( main ):
+ main.assertReturnString += 'Flow duration check Passed\n'
+ return intentId
+ else:
+ main.assertReturnString += 'Flow duration check failed\n'
+ return main.FALSE
else:
main.log.error( "Single to Multi Intent did not install correctly" )
return main.FALSE
@@ -923,8 +944,15 @@
return main.FALSE
# Check intents state
- if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
- return intentId
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE,
+ args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Install Intent State Passed\n'
+ if flowDuration( main ):
+ main.assertReturnString += 'Flow duration check Passed\n'
+ return intentId
+ else:
+ main.assertReturnString += 'Flow duration check failed\n'
+ return main.FALSE
else:
main.log.error( "Multi to Single Intent did not install correctly" )
return main.FALSE
@@ -1208,8 +1236,8 @@
for recipient in recipients:
if not recipient.get( "device" ):
- main.log.warn( "Device not given for recipient {0}. Loading from\
- main.hostData".format( recipient.get( "name" ) ) )
+ main.log.warn( "Device not given for recipient {0}. Loading from " +\
+ main.hostData.format( recipient.get( "name" ) ) )
recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
except (KeyError, TypeError):
main.log.error( "There was a problem loading the hosts data." )
@@ -1887,3 +1915,43 @@
main.ONOSbench.logReport( main.ONOSip[ i ],
[ "WARN" ],
"d" )
+
+def flowDuration( main ):
+ """
+ Check age of flows to see if flows are being overwritten
+ """
+ import time
+ main.log.info( "Getting current flow durations" )
+ flowsJson1 = main.CLIs[ 0 ].flows( noCore=True )
+ try:
+ flowsJson1 = json.loads( flowsJson1 )
+ except ValueError:
+ main.log.error( "Unable to read flows" )
+ return main.FALSE
+ flowLife = []
+ waitFlowLife = []
+ for device in flowsJson1:
+ if device.get( 'flowcount', 0 ) > 0:
+ for i in range( device[ 'flowCount' ] ):
+ flowLife.append( device[ 'flows' ][ i ][ 'life' ] )
+ main.log.info( "Sleeping for {} seconds".format( main.flowDurationSleep ) )
+ time.sleep( main.flowDurationSleep )
+ main.log.info( "Getting new flow durations" )
+ flowsJson2 = main.CLIs[ 0 ].flows( noCore=True )
+ try:
+ flowsJson2 = json.loads( flowsJson2 )
+ except ValueError:
+ main.log.error( "Unable to read flows" )
+ return main.FALSE
+ for device in flowsJson2:
+ if device.get( 'flowcount', 0 ) > 0:
+ for i in range( device[ 'flowCount' ] ):
+ waitFlowLife.append( device[ 'flows' ][ i ][ 'life' ] )
+ main.log.info( "Determining whether flows where overwritten" )
+ if len( flowLife ) == len( waitFlowLife ):
+ for i in range( len( flowLife) ):
+ if waitFlowLife[ i ] - flowLife[ i ] < main.flowDurationSleep:
+ return main.FALSE
+ else:
+ return main.FALSE
+ return main.TRUE
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.params b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.params
index d91559d..4b3af6a 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.params
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.params
@@ -50,6 +50,7 @@
<fwd>10</fwd>
<addIntent>10</addIntent>
<topoAttempts>3</topoAttempts>
+ <flowDuration>10</flowDuration>
</SLEEP>
<MININET>
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index 3824ea3..26dabed 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -59,6 +59,7 @@
main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
main.addIntentSleep = int( main.params[ 'SLEEP' ][ 'addIntent' ] )
main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
+ main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
gitPull = main.params[ 'GIT' ][ 'pull' ]
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 5d526de..92d100f 100755
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -94,11 +94,18 @@
main.log.error( errorMsg )
return main.FALSE
- if utilities.retry ( f=checkIntentState, retValue=main.FALSE,
- args = (main, intentsId ), sleep=main.checkIntentSleep ):
- return intentsId
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE,
+ args=( main, intentsId ), sleep=main.checkIntentSleep, attempts=5 ):
+ main.assertReturnString += 'Install Intent State Passed\n'
+ if flowDuration( main ):
+ main.assertReturnString += 'Flow duration check Passed\n'
+ return intentsId
+ else:
+ main.assertReturnString += 'Flow duration check failed\n'
+ return main.FALSE
else:
main.log.error( "Host Intent did not install correctly" )
+ main.assertReturnString += 'Install Intent State Failed\n'
return main.FALSE
def testHostIntent( main,
@@ -398,17 +405,24 @@
intentsId = main.CLIs[ 0 ].getIntentsId()
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
- if intentId:
+ if intentsId:
errorMsg += " There was a problem installing Point to Point intent."
main.log.error( errorMsg )
return main.FALSE
# Check intent state
- if utilities.retry ( f=checkIntentState, retValue=main.FALSE,
- args = (main, intentsId ), sleep=main.checkIntentSleep ):
- return intentsId
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE,
+ args=( main, intentsId ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Install Intent State Passed\n'
+ if flowDuration( main ):
+ main.assertReturnString += 'Flow duration check Passed\n'
+ return intentsId
+ else:
+ main.assertReturnString += 'Flow duration check failed\n'
+ return main.FALSE
else:
- main.log.error( "Single to Single point intent did not install correctly" )
+ main.log.error( "Host Intent did not install correctly" )
+ main.assertReturnString += 'Install Intent State Failed\n'
return main.FALSE
def testPointIntent( main,
@@ -1771,3 +1785,41 @@
main.ONOSbench.logReport( main.ONOSip[ i ],
[ "WARN" ],
"d" )
+
+def flowDuration( main ):
+ """
+ Check age of flows to see if flows are being overwritten
+ """
+ import time
+ main.log.info( "Getting current flow durations" )
+ flowsJson1 = main.CLIs[ 0 ].flows()
+ try:
+ flowsJson1 = json.loads( flowsJson1 )
+ except ValueError:
+ main.log.error( "Unable to read flows" )
+ return main.FALSE
+ flowLife = []
+ waitFlowLife = []
+ for flow in flowsJson1:
+ if flow[ 'appId' ] == "org.onosproject.net.intent":
+ flowLife.append( flow[ 'life' ] )
+ main.log.info( "Sleeping for {} seconds".format( main.flowDurationSleep ) )
+ time.sleep( main.flowDurationSleep )
+ main.log.info( "Getting new flow durations" )
+ flowsJson2 = main.CLIs[ 0 ].flows()
+ try:
+ flowsJson2 = json.loads( flowsJson2 )
+ except ValueError:
+ main.log.error( "Unable to read flows" )
+ return main.FALSE
+ for flow in flowsJson2:
+ if flow[ 'appId' ] == "org.onosproject.net.intent":
+ waitFlowLife.append( flow[ 'life' ] )
+ main.log.info( "Determining whether flows where overwritten" )
+ if len( flowLife ) == len( waitFlowLife ):
+ for i in range( len( flowLife) ):
+ if waitFlowLife[ i ] - flowLife[ i ] < main.flowDurationSleep:
+ return main.FALSE
+ else:
+ return main.FALSE
+ return main.TRUE
\ No newline at end of file
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
index 79e8620..0abc6b7 100755
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
@@ -7,8 +7,8 @@
# 100 - balance master and bring onos node down
# 200 - bring onos node up and balance masters
# 1000 - report logs
-
- <testcases>1,[2,10,300,11,100,300,11,200,300,11,1000]*3</testcases>
+ # 1,[2,10,300,11,100,300,11,200,300,11,1000]*3
+ <testcases>1,[2,10,300,11,1000]*10</testcases>
<DEPENDENCY>
<path>/tests/SCPF/SCPFscaleTopo/dependencies/</path>
@@ -19,7 +19,7 @@
</DEPENDENCY>
<ENV>
- <cellApps>drivers,openflow,fwd</cellApps>
+ <cellApps>drivers,openflow</cellApps>
</ENV>
<GIT>
@@ -38,6 +38,7 @@
<nodeSleep>10</nodeSleep>
<pingall>15</pingall>
<MNsleep>60</MNsleep>
+ <host>0</host>
</SLEEP>
<TIMEOUT>
@@ -52,7 +53,8 @@
<TOPOLOGY>
<topology>torus</topology>
- <scale>10,15,20</scale>
+ <scale>20,25,30,35,40,45,50,55,60</scale>
+ <host>True</host>
</TOPOLOGY>
</PARAMS>
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 71c7d3a..e8e5b94 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -8,10 +8,8 @@
self.default = ''
def CASE1( self, main ):
- import time
import os
import imp
- import re
"""
- Construct tests variables
@@ -48,6 +46,12 @@
main.pingallSleep = int( main.params[ 'SLEEP' ][ 'pingall' ] )
main.MNSleep = int( main.params[ 'SLEEP' ][ 'MNsleep' ] )
main.pingTimeout = float( main.params[ 'TIMEOUT' ][ 'pingall' ] )
+ main.hostDiscover = main.params[ 'TOPOLOGY' ][ 'host' ]
+ main.hostDiscoverSleep = float( main.params['SLEEP']['host'] )
+ if main.hostDiscover == 'True':
+ main.hostDiscover = True
+ else:
+ main.hostDiscover = False
gitPull = main.params[ 'GIT' ][ 'pull' ]
main.homeDir = os.path.expanduser('~')
main.cellData = {} # for creating cell file
@@ -118,6 +122,7 @@
- Install ONOS cluster
- Connect to cli
"""
+ import time
main.log.info( "Checking if mininet is already running" )
if len( main.topoScale ) < main.topoScaleSize:
main.log.info( "Mininet is already running. Stopping mininet." )
@@ -234,7 +239,6 @@
"""
Starting up torus topology
"""
- import json
main.case( "Starting up Mininet and verifying topology" )
main.caseExplanation = "Starting Mininet with a scalling topology and " +\
@@ -245,9 +249,8 @@
main.step( "Starting up TORUS %sx%s topology" % (main.currScale, main.currScale) )
main.log.info( "Constructing Mininet command" )
- mnCmd = " mn --custom " + main.Mininet1.home + main.multiovs +\
- " --switch ovsm --topo " + main.topoName + ","+ main.currScale + "," + main.currScale
-
+ mnCmd = " mn --custom " + main.Mininet1.home + main.multiovs + \
+ " --switch ovsm --topo " + main.topoName + "," + main.currScale + "," + main.currScale
for i in range( main.numCtrls ):
mnCmd += " --controller remote,ip=" + main.ONOSip[ i ]
@@ -263,11 +266,11 @@
def CASE11( self, main ):
"""
- Pingall, and compare topo
- We don't care the pingall result,
+ Compare topo, and sending Arping package
if the topology is same, then Pass.
"""
import json
+ import time
main.case( "Verifying topology: TORUS %sx%s" % (main.currScale, main.currScale) )
main.caseExplanation = "Pinging all hosts and comparing topology " +\
@@ -275,10 +278,6 @@
main.log.info( "Gathering topology information" )
time.sleep( main.MNSleep )
-
- devicesResults = main.TRUE
- linksResults = main.TRUE
- hostsResults = main.TRUE
stepResult = main.TRUE
main.step( "Comparing MN topology to ONOS topology" )
@@ -288,17 +287,14 @@
devices = main.topo.getAllDevices( main )
ports = main.topo.getAllPorts( main )
links = main.topo.getAllLinks( main)
- clusters = main.topo.getAllClusters( main )
mnSwitches = main.Mininet1.getSwitches()
mnLinks = main.Mininet1.getLinks(timeout=180)
- mnHosts = main.Mininet1.getHosts()
for controller in range(len(main.activeNodes)):
- controllerStr = str( main.activeNodes[controller] + 1 )
- if devices[ controller ] and ports[ controller ] and\
- "Error" not in devices[ controller ] and\
- "Error" not in ports[ controller ]:
-
+ # controllerStr = str( main.activeNodes[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 ] ),
@@ -313,40 +309,52 @@
else:
currentLinksResult = main.FALSE
- stepResult = currentDevicesResult and currentLinksResult
+ stepResult = stepResult and currentDevicesResult and currentLinksResult
if stepResult:
break
compareRetry += 1
+ utilities.assert_equals(expect=main.TRUE,
+ actual=stepResult,
+ onpass=" Topology match Mininet",
+ onfail="ONOS Topology doesn't match Mininet")
- # host discover
- hostList=[]
- for i in range( 1, int(main.currScale)+1 ):
- for j in range( 1, int(main.currScale)+1 ):
- hoststr = "h" + str(i)+ "x" + str(j)
- hostList.append(hoststr)
- totalNum = main.topo.sendArpPackage(main, hostList)
- # check host number
- main.log.info("{} hosts has been discovered".format( totalNum ))
- if int(totalNum) == ( int(main.currScale) * int(main.currScale) ):
- main.log.info("All hosts has been discovered")
- stepResult = stepResult and main.TRUE
+ if stepResult:
+ if main.hostDiscover:
+ hostList = []
+ for i in range( 1, int( main.currScale ) + 1 ):
+ for j in range( 1, int( main.currScale ) + 1) :
+ # Generate host list
+ hoststr = "h" + str(i) + "x" + str(j)
+ hostList.append(hoststr)
+ for i in range( len(hostList) ):
+ totalHost = main.topo.sendArpPackage( main, hostList[i] )
+ time.sleep( main.hostDiscoverSleep )
+ if totalHost < 0:
+ # if totalHost less than 0 which means dependence function has exception.
+ main.log.info( "Error when discover host!" )
+ break
+ if totalHost == int( main.currScale ) * int( main.currScale ):
+ main.log.info( "Discovered all hosts" )
+ stepResult = stepResult and main.TRUE
+ else:
+ main.log.warn( "Some hosts ware not discovered by ONOS... Topology doesn't match!" )
+ stepResult = main.FALSE
+ utilities.assert_equals(expect=main.TRUE,
+ actual=stepResult,
+ onpass=" Topology match Mininet",
+ onfail="ONOS Topology doesn't match Mininet")
+ main.log.info( "Finished this iteration, continue to scale next topology." )
else:
- main.log.warn("Hosts number is not correct!")
- stepResult = stepResult and main.FALSE
-
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass=" Topology match Mininet",
- onfail="ONOS" + controllerStr +
- " Topology doesn't match Mininet" )
-
+ main.log.info( "Clean up and exit TestON. Finished this test." )
+ main.cleanup()
+ main.exit()
def CASE100( self, main ):
'''
Bring Down node 3
'''
- main.case("Balancing Masters and bring ONOS node 3 down: TORUS %sx%s" % (main.currScale, main.currScale))
+ main.case("Bring ONOS node 3 down: TORUS %sx%s" % (main.currScale, main.currScale))
main.caseExplanation = "Balance masters to make sure " +\
"each controller has some devices and " +\
"stop ONOS node 3 service. "
@@ -369,10 +377,10 @@
def CASE200( self, main ):
'''
- Bring up onos node and balance masters
+ Bring up onos node
'''
- main.case("Bring ONOS node 3 up and balance masters: TORUS %sx%s" % (main.currScale, main.currScale))
+ main.case("Bring ONOS node 3 up: TORUS %sx%s" % (main.currScale, main.currScale))
main.caseExplanation = "Bring node 3 back up and balance the masters"
node = main.deadNode + 1
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/topo.py b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/topo.py
index 4f7bfb7..22505ff 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/topo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/topo.py
@@ -104,14 +104,23 @@
send arping package from host
return the total hosts number from Onos
"""
- main.log.info("Sending Arping package...")
+ main.log.info( "Sending Arping package..." )
if isinstance(hostList, list):
- threads = []
for h in hostList:
main.Mininet1.arping( srcHost=h, dstHost="10.0.0.1", output=main.FALSE, noResult=True )
time.sleep(0.5)
else:
- main.Mininet1.arping(srcHost=hostList)
- summaryStr = json.loads( main.CLIs[0].summary().encode() )
- hostNum = summaryStr.get('hosts')
+ main.Mininet1.arping( srcHost=hostList, dstHost="10.0.0.1", output=main.FALSE, noResult=True )
+ try:
+ summaryStr = ""
+ summaryStr = json.loads( main.CLIs[0].summary().encode() )
+ hostNum = summaryStr.get( 'hosts' )
+
+ except (TypeError, ValueError):
+ main.log.exception( " Object not as expected: {!r}".format( summaryStr) )
+ return -1
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ return -1
+
return hostNum