Run codecheck script on FUNCintentRest
Change-Id: I742ce07a01a541ecaab5edadbf59553f51b0d78c
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index 8f8f677..7d220dc 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -9,6 +9,7 @@
import time
import json
+
class FUNCintentRest:
def __init__( self ):
@@ -28,7 +29,6 @@
- Install ONOS package
- Build ONOS package
"""
-
main.case( "Constructing test variables and building ONOS package" )
main.step( "Constructing test variables" )
main.caseExplanation = "This test case is mainly for loading " +\
@@ -63,7 +63,7 @@
gitPull = main.params[ 'GIT' ][ 'pull' ]
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
- main.cellData = {} # for creating cell file
+ main.cellData = {} # for creating cell file
main.hostsData = {}
main.RESTs = []
main.CLIs = []
@@ -71,14 +71,14 @@
main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
main.scapyHosts = [] # List of scapy hosts for iterating
main.assertReturnString = '' # Assembled assert return string
- main.cycle = 0 # How many times FUNCintent has run through its tests
+ main.cycle = 0 # How many times FUNCintent has run through its tests
main.ONOSip = main.ONOSbench.getOnosIps()
print main.ONOSip
# Assigning ONOS cli handles to a list
try:
- for i in range( 1, main.maxNodes + 1 ):
+ for i in range( 1, main.maxNodes + 1 ):
main.RESTs.append( getattr( main, 'ONOSrest' + str( i ) ) )
main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
except AttributeError:
@@ -96,9 +96,9 @@
".py" )
main.intentFunction = imp.load_source( wrapperFile2,
- main.dependencyPath +
- wrapperFile2 +
- ".py" )
+ main.dependencyPath +
+ wrapperFile2 +
+ ".py" )
main.topo = imp.load_source( wrapperFile3,
main.dependencyPath +
@@ -153,7 +153,6 @@
- Install ONOS cluster
- Connect to cli
"""
-
main.cycle += 1
# main.scale[ 0 ] determines the current number of ONOS controller
@@ -166,8 +165,6 @@
main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
" node(s) ONOS cluster"
-
-
#kill off all onos processes
main.log.info( "Safety check, killing all ONOS processes" +
" before initiating environment setup" )
@@ -194,7 +191,7 @@
tempOnosIp = []
for i in range( main.numCtrls ):
- tempOnosIp.append( main.ONOSip[i] )
+ tempOnosIp.append( main.ONOSip[ i ] )
main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
"temp", main.Mininet1.ip_address,
@@ -206,7 +203,7 @@
stepResult = cellResult and verifyResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
- onpass="Successfully applied cell to " + \
+ onpass="Successfully applied cell to " +
"environment",
onfail="Failed to apply cell to environment " )
@@ -233,7 +230,7 @@
main.step( "Set up ONOS secure SSH" )
secureSshResult = main.TRUE
for i in range( int( main.numCtrls ) ):
- secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+ secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
onpass="Test step PASS",
onfail="Test step FAIL" )
@@ -385,7 +382,7 @@
main.step( "Comparing Mininet topology to ONOS topology" )
while ( attempts >= 0 ) and\
- ( not devicesResults or not linksResults or not hostsResults ):
+ ( not devicesResults or not linksResults or not hostsResults ):
time.sleep( 2 )
if not devicesResults:
devices = main.topo.getAllDevices( main )
@@ -406,19 +403,19 @@
controllerStr = str( controller + 1 ) # ONOS node number
# Compare Devices
if devices[ controller ] and ports[ controller ] and\
- "Error" not in devices[ controller ] and\
- "Error" not in ports[ controller ]:
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
try:
deviceData = json.loads( devices[ controller ] )
portData = json.loads( ports[ controller ] )
- except (TypeError,ValueError):
+ except ( TypeError, ValueError ):
main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ),
str( ports[ controller ] ) ) )
currentDevicesResult = main.FALSE
else:
currentDevicesResult = main.Mininet1.compareSwitches(
- mnSwitches,deviceData,portData )
+ mnSwitches, deviceData, portData )
else:
currentDevicesResult = main.FALSE
if not currentDevicesResult:
@@ -428,12 +425,12 @@
if links[ controller ] and "Error" not in links[ controller ]:
try:
linkData = json.loads( links[ controller ] )
- except (TypeError,ValueError):
- main.log.error("Could not load json:" + str( links[ controller ] ) )
+ except ( TypeError, ValueError ):
+ main.log.error( "Could not load json:" + str( links[ controller ] ) )
currentLinksResult = main.FALSE
else:
currentLinksResult = main.Mininet1.compareLinks(
- mnSwitches, mnLinks,linkData )
+ mnSwitches, mnLinks, linkData )
else:
currentLinksResult = main.FALSE
if not currentLinksResult:
@@ -443,12 +440,12 @@
if hosts[ controller ] and "Error" not in hosts[ controller ]:
try:
hostData = json.loads( hosts[ controller ] )
- except (TypeError,ValueError):
- main.log.error("Could not load json:" + str( hosts[ controller ] ) )
+ except ( TypeError, ValueError ):
+ main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
currentHostsResult = main.FALSE
else:
currentHostsResult = main.Mininet1.compareHosts(
- mnHosts,hostData )
+ mnHosts, hostData )
else:
currentHostsResult = main.FALSE
if not currentHostsResult:
@@ -457,7 +454,6 @@
# Decrement Attempts Remaining
attempts -= 1
-
utilities.assert_equals( expect=[],
actual=deviceFails,
onpass="ONOS correctly discovered all devices",
@@ -480,14 +476,14 @@
onfail="ONOS incorrectly discovered the topology" )
def CASE9( self, main ):
- '''
+ """
Report errors/warnings/exceptions
- '''
+ """
main.log.info( "Error report: \n" )
main.ONOSbench.logReport( globalONOSip[ 0 ],
- [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ],
- "s" )
- #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
+ [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR", "Except" ],
+ "s" )
+ #main.ONOSbench.logReport( globalONOSip[ 1 ], [ "INFO" ], "d" )
def CASE10( self, main ):
"""
@@ -595,7 +591,7 @@
if not stepResult:
main.initialized = main.FALSE
- def CASE13( self,main ):
+ def CASE13( self, main ):
"""
Create Scapy components
"""
@@ -619,7 +615,6 @@
main.log.debug( host.hostIp )
main.log.debug( host.hostMac )
-
utilities.assert_equals( expect=main.TRUE,
actual=scapyResult,
onpass="Successfully created Scapy Components",
@@ -738,7 +733,7 @@
propName="useFlowObjectives", value="true" )
stepResult &= main.CLIs[ 0 ].setCfg( component=cmd,
propName="defaultFlowObjectiveCompiler",
- value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
+ value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -775,14 +770,14 @@
onfail="Failed to stop mininet and scapy" )
main.step( "Stopping Mininet Topology" )
- mininetResult = main.Mininet1.stopNet( )
+ mininetResult = main.Mininet1.stopNet()
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully stop mininet",
onfail="Failed to stop mininet" )
# Exit if topology did not load properly
- if not (mininetResult and scapyResult ):
+ if not ( mininetResult and scapyResult ):
main.cleanup()
main.exit()
@@ -802,15 +797,15 @@
main.node = main.CLIs[ i ]
ip = main.ONOSip[ i ]
main.node.ip_address = ip
- scpResult = scpResult and main.ONOSbench.scp( main.node ,
- "/opt/onos/log/karaf.log",
- "/tmp/karaf.log",
- direction="from" )
+ scpResult = scpResult and main.ONOSbench.scp( main.node,
+ "/opt/onos/log/karaf.log",
+ "/tmp/karaf.log",
+ direction="from" )
copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
copyFileName=( "karaf.log.node{0}.cycle{1}".format(
str( i + 1 ), str( main.cycle ) ) ) )
if scpResult and copyResult:
- stepResult = main.TRUE and stepResult
+ stepResult = main.TRUE and stepResult
else:
stepResult = main.FALSE and stepResult
utilities.assert_equals( expect=main.TRUE,
@@ -861,7 +856,7 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in "+\
+ main.log.error( "Place the total number of switch topology in " +
main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
@@ -881,25 +876,25 @@
main.step( "IPV4: Add and test host intents between h1 and h9" )
main.assertReturnString = "Assertion result for IPV4 host intent with mac addresses\n"
- host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
- host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
+ host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
+ host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
testResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='IPV4',
- onosNode='0',
- host1=host1,
- host2=host2 )
+ name='IPV4',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='IPV4',
- intentId = installResult,
- onosNode='0',
- host1=host1,
- host2=host2,
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ name='IPV4',
+ intentId=installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -908,25 +903,25 @@
main.step( "DUALSTACK1: Add host intents between h3 and h11" )
main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
- host1 = { "name":"h3", "id":"00:00:00:00:00:03/-1" }
- host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1" }
+ host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
+ host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1" }
testResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='DUALSTACK1',
- onosNode='0',
- host1=host1,
- host2=host2 )
+ name='DUALSTACK1',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='DUALSTACK1',
- intentId = installResult,
- onosNode='0',
- host1=host1,
- host2=host2,
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ name='DUALSTACK1',
+ intentId=installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -935,25 +930,25 @@
main.step( "DUALSTACK2: Add host intents between h1 and h11" )
main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
- host1 = { "name":"h1" }
- host2 = { "name":"h11" }
+ host1 = { "name": "h1" }
+ host2 = { "name": "h11" }
testResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='DUALSTACK2',
- onosNode='0',
- host1=host1,
- host2=host2 )
+ name='DUALSTACK2',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='DUALSTACK2',
- intentId = installResult,
- onosNode='0',
- host1=host1,
- host2=host2,
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ name='DUALSTACK2',
+ intentId=installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -962,25 +957,25 @@
main.step( "1HOP: Add host intents between h1 and h3" )
main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
- host1 = { "name":"h1" }
- host2 = { "name":"h3" }
+ host1 = { "name": "h1" }
+ host2 = { "name": "h3" }
testResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='1HOP',
- onosNode='0',
- host1=host1,
- host2=host2 )
+ name='1HOP',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='1HOP',
- intentId = installResult,
- onosNode='0',
- host1=host1,
- host2=host2,
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ name='1HOP',
+ intentId=installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -989,25 +984,25 @@
main.step( "VLAN1: Add vlan host intents between h4 and h12" )
main.assertReturnString = "Assertion Result vlan IPV4\n"
- host1 = { "name":"h4","id":"00:00:00:00:00:04/100", "vlanId":"100" }
- host2 = { "name":"h12","id":"00:00:00:00:00:0C/100", "vlanId":"100" }
+ host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlanId": "100" }
+ host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlanId": "100" }
testResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='VLAN1',
- onosNode='0',
- host1=host1,
- host2=host2 )
+ name='VLAN1',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='VLAN1',
- intentId = installResult,
- onosNode='0',
- host1=host1,
- host2=host2,
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ name='VLAN1',
+ intentId=installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -1029,7 +1024,7 @@
# if installResult:
# testResult = main.intentFunction.testHostIntent( main,
# name='VLAN2',
- # intentId = installResult,
+ # intentId=installResult,
# onosNode='0',
# host1=host1,
# host2=host2,
@@ -1053,7 +1048,7 @@
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass="ONOS Leaders Unchanged",
- onfail="ONOS Leader Mismatch")
+ onfail="ONOS Leader Mismatch" )
main.intentFunction.report( main )
@@ -1097,13 +1092,13 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in "+\
+ main.log.error( "Place the total number of switch topology in " +
main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
main.case( "Point Intents Test - " + str( main.numCtrls ) +
- " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
+ " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
main.caseExplanation = "This test case will test point to point" + \
" intents using " + str( main.numCtrls ) + \
" node(s) cluster;\n" + \
@@ -1191,7 +1186,7 @@
# senders=senders,
# recipients=recipients,
# protected=True )
- #
+ #
# if installResult:
# testResult = main.intentFunction.testPointIntent(
# main,
@@ -1250,11 +1245,11 @@
{ "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
"ip": ( main.h9.hostIp + "/24" ) }
]
- # ipProto = main.params['SDNIP']['icmpProto']
+ # ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
# Uneccessary, not including this in the selectors
- tcpSrc = main.params['SDNIP']['srcPort']
- tcpDst = main.params['SDNIP']['dstPort']
+ tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
+ tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
installResult = main.intentFunction.installPointIntent(
main,
@@ -1285,13 +1280,13 @@
main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
- mac1 = main.hostsData['h1']['mac']
- mac2 = main.hostsData['h9']['mac']
- ip1 = str(main.hostsData['h1']['ipAddresses'][0]) + "/32"
- ip2 = str(main.hostsData['h9']['ipAddresses'][0]) + "/32"
- ipProto = main.params['SDNIP']['tcpProto']
- tcp1 = main.params['SDNIP']['srcPort']
- tcp2 = main.params['SDNIP']['dstPort']
+ mac1 = main.hostsData[ 'h1' ][ 'mac' ]
+ mac2 = main.hostsData[ 'h9' ][ 'mac' ]
+ ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
+ ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
+ ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
+ tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
+ tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
stepResult = main.intentFunction.pointIntentTcp(
main,
@@ -1410,7 +1405,6 @@
main.intentFunction.report( main )
-
def CASE3000( self, main ):
"""
Add single point to multi point intents
@@ -1445,7 +1439,7 @@
main.testName = "Single to Multi Point Intents"
main.case( main.testName + " Test - " + str( main.numCtrls ) +
- " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
+ " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
main.caseExplanation = "This test case will test single point to" + \
" multi point intents using " + \
str( main.numCtrls ) + " node(s) cluster;\n" + \
@@ -1493,24 +1487,24 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- main.step("IPV4: Install and test single point to multi point intents")
+ main.step( "IPV4: Install and test single point to multi point intents" )
main.assertReturnString = "Assertion results for IPV4 single to multi point intent " \
"with IPV4 type and MAC addresses\n"
senders = [
- {"name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08"}
+ { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
]
recipients = [
- {"name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10"},
- {"name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18"}
+ { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
+ { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
]
- badSenders = [{"name": "h9"}] # Senders that are not in the intent
- badRecipients = [{"name": "h17"}] # Recipients that are not in the intent
+ badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
+ badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
installResult = main.intentFunction.installSingleToMultiIntent(
main,
name="IPV4",
senders=senders,
recipients=recipients,
- ethType="IPV4")
+ ethType="IPV4" )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1630,7 +1624,7 @@
recipients=recipients,
sw1="s5",
sw2="s2" )
- #setVlan=100 )
+ #setVlan=100 )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1693,7 +1687,7 @@
main.step( "NOOPTION: Add multi point to single point intents" )
stepResult = main.TRUE
hostNames = [ 'h8', 'h16', 'h24' ]
- devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8',
'of:0000000000000007/8' ]
macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
stepResult = main.intentFunction.multiToSingleIntent(
@@ -1764,7 +1758,7 @@
main.step( "VLAN: Add multi point to single point intents" )
stepResult = main.TRUE
hostNames = [ 'h5', 'h13', 'h21' ]
- devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
+ devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5',
'of:0000000000000007/5' ]
macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
stepResult = main.intentFunction.multiToSingleIntent(
@@ -1819,7 +1813,7 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in " +\
+ main.log.error( "Place the total number of switch topology in " +
main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
@@ -1853,24 +1847,24 @@
main.step( "IPV4: Add host intents between h1 and h9" )
main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
- host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
- host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
+ host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
+ host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
installResult = main.intentFunction.installHostIntent( main,
- name='IPV4 Mobility IPV4',
- onosNode='0',
- host1=host1,
- host2=host2 )
+ name='IPV4 Mobility IPV4',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='Host Mobility IPV4',
- intentId = installResult,
- onosNode='0',
- host1=host1,
- host2=host2,
- sw1="s6",
- sw2="s2",
- expectedLink=18 )
+ name='Host Mobility IPV4',
+ intentId=installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1="s6",
+ sw2="s2",
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
old mode 100755
new mode 100644
index 8fa65f2..4bbbd9f
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -8,9 +8,11 @@
import json
import types
+
def __init__( self ):
self.default = ''
+
def installHostIntent( main,
name,
host1,
@@ -55,7 +57,6 @@
ipProto - IP protocol
tcp - TCP ports in the same order as the hosts in hostNames
"""
-
assert main, "There is no main variable"
assert host1, "You must specify host1"
assert host2, "You must specify host2"
@@ -81,8 +82,8 @@
main.log.info( itemName + ": Adding host intents" )
intent1 = main.RESTs[ onosNode ].addHostIntent( hostIdOne=host1.get( "id" ),
- hostIdTwo=host2.get( "id" ),
- vlanId=vlanId )
+ hostIdTwo=host2.get( "id" ),
+ vlanId=vlanId )
# Get all intents ID in the system, time delay right after intents are added
time.sleep( main.addIntentSleep )
@@ -108,6 +109,7 @@
main.assertReturnString += 'Install Intent State Failed\n'
return main.FALSE
+
def testHostIntent( main,
name,
intentId,
@@ -160,7 +162,6 @@
switches are down
"""
-
# Parameter Validity Check
assert main, "There is no main variable"
assert host1, "You must specify host1"
@@ -297,6 +298,7 @@
return testResult
+
def installPointIntent( main,
name,
senders,
@@ -346,7 +348,6 @@
be two links lower than the links before the two
switches are down
"""
-
assert main, "There is no main variable"
assert senders, "You must specify a sender"
assert recipients, "You must specify a recipient"
@@ -370,7 +371,6 @@
recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
vlanId = senders[ 0 ].get( "vlanId" )
-
ingressDevice = senders[ 0 ].get( "device" )
egressDevice = recipients[ 0 ].get( "device" )
@@ -427,6 +427,7 @@
main.assertReturnString += 'Install Intent State Failed\n'
return main.FALSE
+
def testPointIntent( main,
name,
intentId,
@@ -494,7 +495,6 @@
switches are down
"""
-
# Parameter Validity Check
assert main, "There is no main variable"
assert senders, "You must specify a sender"
@@ -523,7 +523,7 @@
if not recipient.get( "device" ):
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" )
- vlanId=senders[ 0 ].get( "vlanId" )
+ vlanId = senders[ 0 ].get( "vlanId" )
except( KeyError, TypeError ):
main.log.error( "There was a problem loading the hosts data." )
return main.FALSE
@@ -546,7 +546,7 @@
testResult = main.FALSE
# Check Connectivity
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
main.assertReturnString += 'Initial Ping Passed\n'
else:
main.assertReturnString += 'Initial Ping Failed\n'
@@ -555,7 +555,7 @@
# Check connections that shouldn't work
if badSenderNames:
main.log.info( "Checking that packets from incorrect sender do not go through" )
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, badSenderNames, recipientNames ), kwargs={ "expectFailure":True } ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, badSenderNames, recipientNames ), kwargs={ "expectFailure": True } ):
main.assertReturnString += 'Bad Sender Ping Passed\n'
else:
main.assertReturnString += 'Bad Sender Ping Failed\n'
@@ -563,7 +563,7 @@
if badRecipientNames:
main.log.info( "Checking that packets to incorrect recipients do not go through" )
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, badRecipientNames ), kwargs={ "expectFailure":True } ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, badRecipientNames ), kwargs={ "expectFailure": True } ):
main.assertReturnString += 'Bad Recipient Ping Passed\n'
else:
main.assertReturnString += 'Bad Recipient Ping Failed\n'
@@ -580,14 +580,14 @@
if protected:
# Check Connection
- if utilities.retry(f=scapyCheckConnection, retValue=main.FALSE,
- args=(main, senderNames, recipientNames, vlanId, useTCP)):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE,
+ args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
main.assertReturnString += 'Link down Scapy Packet Received Passed\n'
else:
main.assertReturnString += 'Link down Scapy Packet Recieved Failed\n'
testResult = main.FALSE
- if ProtectedIntentCheck(main):
+ if ProtectedIntentCheck( main ):
main.assertReturnString += 'Protected Intent Check Passed\n'
else:
main.assertReturnString += 'Protected Intent Check Failed\n'
@@ -615,7 +615,7 @@
testResult = main.FALSE
# Check Connection
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
main.assertReturnString += 'Link Down Pingall Passed\n'
else:
main.assertReturnString += 'Link Down Pingall Failed\n'
@@ -653,7 +653,7 @@
testResult = main.FALSE
# Check Connection
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
main.assertReturnString += 'Link Up Scapy Packet Received Passed\n'
else:
main.assertReturnString += 'Link Up Scapy Packet Recieved Failed\n'
@@ -668,6 +668,7 @@
return testResult
+
def pointIntentTcp( main,
name,
host1,
@@ -690,7 +691,6 @@
sw1="",
sw2="",
expectedLink=0 ):
-
"""
Description:
Verify add-point-intent only for TCP
@@ -740,7 +740,6 @@
be two links lower than the links before the two
switches are down
"""
-
assert main, "There is no main variable"
assert name, "variable name is empty"
assert host1 and host2, "You must specify hosts"
@@ -764,64 +763,64 @@
# Adding bidirectional point intents
main.log.info( itemName + ": Adding point intents" )
intent1 = main.RESTs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
- egressDevice=deviceId2,
- ingressPort=port1,
- egressPort=port2,
- ethType=ethType,
- ethSrc=mac1,
- ethDst=mac2,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ip1,
- ipDst=ip2,
- tcpSrc=tcp1,
- tcpDst="" )
+ egressDevice=deviceId2,
+ ingressPort=port1,
+ egressPort=port2,
+ ethType=ethType,
+ ethSrc=mac1,
+ ethDst=mac2,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip1,
+ ipDst=ip2,
+ tcpSrc=tcp1,
+ tcpDst="" )
intent2 = main.RESTs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
- egressDevice=deviceId1,
- ingressPort=port2,
- egressPort=port1,
- ethType=ethType,
- ethSrc=mac2,
- ethDst=mac1,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ip2,
- ipDst=ip1,
- tcpSrc=tcp2,
- tcpDst="" )
+ egressDevice=deviceId1,
+ ingressPort=port2,
+ egressPort=port1,
+ ethType=ethType,
+ ethSrc=mac2,
+ ethDst=mac1,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip2,
+ ipDst=ip1,
+ tcpSrc=tcp2,
+ tcpDst="" )
intent3 = main.RESTs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
- egressDevice=deviceId2,
- ingressPort=port1,
- egressPort=port2,
- ethType=ethType,
- ethSrc=mac1,
- ethDst=mac2,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ip1,
- ipDst=ip2,
- tcpSrc="",
- tcpDst=tcp2 )
+ egressDevice=deviceId2,
+ ingressPort=port1,
+ egressPort=port2,
+ ethType=ethType,
+ ethSrc=mac1,
+ ethDst=mac2,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip1,
+ ipDst=ip2,
+ tcpSrc="",
+ tcpDst=tcp2 )
intent4 = main.RESTs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
- egressDevice=deviceId1,
- ingressPort=port2,
- egressPort=port1,
- ethType=ethType,
- ethSrc=mac2,
- ethDst=mac1,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ip2,
- ipDst=ip1,
- tcpSrc="",
- tcpDst=tcp1 )
+ egressDevice=deviceId1,
+ ingressPort=port2,
+ egressPort=port1,
+ ethType=ethType,
+ ethSrc=mac2,
+ ethDst=mac1,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip2,
+ ipDst=ip1,
+ tcpSrc="",
+ tcpDst=tcp1 )
# Get all intents ID in the system, time delay right after intents are added
time.sleep( main.addIntentSleep )
@@ -925,8 +924,8 @@
in the same order index wise. All devices in the list should have the
same format, either all the devices have its port or it doesn't.
eg. hostName = [ 'h1', 'h2' ,.. ]
- devices = [ 'of:0000000000000001', 'of:0000000000000002', ...]
- ports = [ '1', '1', ..]
+ devices = [ 'of:0000000000000001', 'of:0000000000000002', ... ]
+ ports = [ '1', '1', .. ]
...
Description:
Verify add-single-to-multi-intent iterates through the list of given
@@ -973,7 +972,6 @@
be two links lower than the links before the two
switches are down
"""
-
assert main, "There is no main variable"
assert senders, "You must specify a sender"
assert recipients, "You must specify a recipient"
@@ -1055,6 +1053,7 @@
main.log.error( "Single to Multi Intent did not install correctly" )
return main.FALSE
+
def multiToSingleIntent( main,
name,
hostNames,
@@ -1077,8 +1076,8 @@
same order index wise. All devices in the list should have the same
format, either all the devices have its port or it doesn't.
eg. hostName = [ 'h1', 'h2' ,.. ]
- devices = [ 'of:0000000000000001', 'of:0000000000000002', ...]
- ports = [ '1', '1', ..]
+ devices = [ 'of:0000000000000001', 'of:0000000000000002', ... ]
+ ports = [ '1', '1', .. ]
...
Description:
Verify add-multi-to-single-intent
@@ -1124,7 +1123,6 @@
be two links lower than the links before the two
switches are down
"""
-
assert main, "There is no main variable"
assert hostNames, "You must specify hosts"
assert devices or main.hostsData, "You must specify devices"
@@ -1159,11 +1157,11 @@
devices = []
main.log.info( "multiToSingleIntent function is using main.hostsData" )
for host in hostNames:
- devices.append( main.hostsData.get( host ).get( 'location' ) )
- macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
- main.hostsData.get( host ).get( 'mac' )
- ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
- main.hostsData.get( host ).get( 'ipAddresses' )
+ devices.append( main.hostsData.get( host ).get( 'location' ) )
+ macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
+ main.hostsData.get( host ).get( 'mac' )
+ ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
+ main.hostsData.get( host ).get( 'ipAddresses' )
#print main.hostsData
#print 'host names = ', hostNames
@@ -1202,7 +1200,7 @@
dstMac = ""
else:
dstMac = macsDict[ egressDevice ]
- if dstMac == None:
+ if dstMac is None:
main.log.debug( "There is no MAC in device - " + egressDevice )
dstMac = ""
@@ -1298,6 +1296,7 @@
return stepResult
+
def pingallHosts( main, hostList ):
# Ping all host in the hosts list variable
print "Pinging : ", hostList
@@ -1305,11 +1304,11 @@
pingResult = main.Mininet1.pingallHosts( hostList )
return pingResult
+
def getHostsData( main, hostList ):
"""
Use fwd app and pingall to discover all the hosts
"""
-
activateResult = main.TRUE
appCheck = main.TRUE
getDataResult = main.TRUE
@@ -1353,6 +1352,7 @@
return getDataResult
+
def checkTopology( main, expectedLink ):
statusResult = main.TRUE
# Check onos topology
@@ -1360,7 +1360,7 @@
for i in range( main.numCtrls ):
statusResult = main.RESTs[ i ].checkStatus( main.numSwitch,
- expectedLink )\
+ expectedLink )\
and statusResult
if not statusResult:
main.log.error( itemName + ": Topology mismatch" )
@@ -1368,12 +1368,12 @@
main.log.info( itemName + ": Topology match" )
return statusResult
+
def checkIntentState( main, intentsId ):
"""
This function will check intent state to make sure all the intents
are in INSTALLED state
"""
-
intentResult = main.TRUE
results = []
@@ -1406,13 +1406,15 @@
return intentResult
+
def checkFlowsState( main ):
main.log.info( itemName + ": Check flows state" )
checkFlowsResult = main.RESTs[ 0 ].checkFlowsState()
return checkFlowsResult
-def link( main, sw1, sw2, option):
+
+def link( main, sw1, sw2, option ):
# link down
main.log.info( itemName + ": Bring link " + option + "between " +
@@ -1420,15 +1422,15 @@
linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
return linkResult
+
def removeAllIntents( main ):
"""
Remove all intents in the intentsId
"""
-
onosSummary = []
removeIntentResult = main.TRUE
# Remove intents
- removeIntentResult = main.RESTs[ 0 ].removeAllIntents( )
+ removeIntentResult = main.RESTs[ 0 ].removeAllIntents()
if removeIntentResult:
main.log.info( itemName + ": There are no more intents remaining, " +
@@ -1436,18 +1438,18 @@
return removeIntentResult
+
def checkFlowsCount( main ):
"""
Check flows count in each node
"""
-
flowsCount = []
main.log.info( itemName + ": Checking flows count in each ONOS node" )
for i in range( main.numCtrls ):
flowsCount.append( len( json.loads( main.RESTs[ i ].flows() ) ) )
if flowsCount:
- if all( flows==flowsCount[ 0 ] for flows in flowsCount ):
+ if all( flows == flowsCount[ 0 ] for flows in flowsCount ):
main.log.info( itemName + ": There are " + str( flowsCount[ 0 ] ) +
" flows in all ONOS node" )
else:
@@ -1460,6 +1462,7 @@
return main.TRUE
+
def sendDiscoveryArp( main, hosts=None ):
"""
Sends Discovery ARP packets from each host provided
@@ -1469,7 +1472,7 @@
if not hosts:
hosts = main.scapyHosts
for host in hosts:
- pkt = 'Ether( src="{0}")/ARP( psrc="{1}")'.format( host.hostMac ,host.hostIp )
+ pkt = 'Ether( src="{0}")/ARP( psrc="{1}")'.format( host.hostMac, host.hostIp )
# Send from the VLAN interface if there is one so ONOS discovers the VLAN correctly
iface = None
for interface in host.getIfList():
@@ -1480,6 +1483,7 @@
host.sendPacket( packet=pkt, iface=iface )
main.log.info( "Sending ARP packet from {0}".format( host.name ) )
+
def confirmHostDiscovery( main ):
"""
Confirms that all ONOS nodes have discovered all scapy hosts
@@ -1510,7 +1514,7 @@
onosHostIPs = [ x.get( "ipAddresses" )[ 0 ]
for x in hostData
if len( x.get( "ipAddresses" ) ) > 0 ]
- if not set( collections.Counter( scapyHostIPs ) ).issubset( set ( collections.Counter( onosHostIPs ) ) ):
+ if not set( collections.Counter( scapyHostIPs ) ).issubset( set( collections.Counter( onosHostIPs ) ) ):
main.log.warn( "Controller {0} only sees nodes with {1} IPs. It should see all of the following: {2}".format( controllerStr, onosHostIPs, scapyHostIPs ) )
hostFails.append( controllerStr )
else:
@@ -1526,6 +1530,7 @@
else:
return main.TRUE
+
def populateHostData( main ):
"""
Populates hostsData
@@ -1552,7 +1557,7 @@
main.log.error( "ValueError while populating hostsData" )
return main.FALSE
except KeyError:
- main.log.error( "KeyError while populating hostsData")
+ main.log.error( "KeyError while populating hostsData" )
return main.FALSE
except IndexError:
main.log.error( "IndexError while populating hostsData" )
@@ -1561,6 +1566,7 @@
main.log.error( "TypeError while populating hostsData" )
return main.FALSE
+
def scapyCheckConnection( main, senders, recipients, vlanId=None, useTCP=False, packet=None, packetFilter=None, expectFailure=False ):
"""
Checks the connectivity between all given sender hosts and all given recipient hosts
@@ -1602,9 +1608,9 @@
continue
if vlanId:
- recipientComp.startFilter( pktFilter = ( "vlan {}".format( vlanId ) + " && " + packetFilter.format( senderComp.hostMac ) ) )
+ recipientComp.startFilter( pktFilter=( "vlan {}".format( vlanId ) + " && " + packetFilter.format( senderComp.hostMac ) ) )
else:
- recipientComp.startFilter( pktFilter = packetFilter.format( senderComp.hostMac ) )
+ recipientComp.startFilter( pktFilter=packetFilter.format( senderComp.hostMac ) )
if not packet:
if vlanId:
@@ -1625,24 +1631,25 @@
if vlanId:
senderComp.sendPacket( iface=( "{0}-eth0.{1}".format( sender, vlanId ) ), packet = pkt )
else:
- senderComp.sendPacket( packet = pkt )
+ senderComp.sendPacket( packet=pkt )
if recipientComp.checkFilter( timeout ):
if expectFailure:
- main.log.error( "Packet from {0} successfully received by {1} when it should not have been".format( sender , recipient ) )
+ main.log.error( "Packet from {0} successfully received by {1} when it should not have been".format( sender, recipient ) )
connectionsFunctional = main.FALSE
else:
- main.log.info( "Packet from {0} successfully received by {1}".format( sender , recipient ) )
+ main.log.info( "Packet from {0} successfully received by {1}".format( sender, recipient ) )
else:
recipientComp.killFilter()
if expectFailure:
- main.log.info( "As expected, packet from {0} was not received by {1}".format( sender , recipient ) )
+ main.log.info( "As expected, packet from {0} was not received by {1}".format( sender, recipient ) )
else:
- main.log.error( "Packet from {0} was not received by {1}".format( sender , recipient ) )
+ main.log.error( "Packet from {0} was not received by {1}".format( sender, recipient ) )
connectionsFunctional = main.FALSE
return connectionsFunctional
+
def checkLeaderChange( leaders1, leaders2 ):
"""
Checks for a change in intent partition leadership.
@@ -1656,7 +1663,7 @@
try:
leaders1 = json.loads( leaders1 )
leaders2 = json.loads( leaders2 )
- except ( AttributeError, TypeError):
+ except ( AttributeError, TypeError ):
main.log.exception( self.name + ": Object not as expected" )
return main.FALSE
except Exception:
@@ -1669,12 +1676,12 @@
if "intent" in dict1.get( "topic", [] ):
for dict2 in leaders2:
if dict1.get( "topic", 0 ) == dict2.get( "topic", 0 ) and \
- dict1.get( "leader", 0 ) != dict2.get( "leader", 0 ):
+ dict1.get( "leader", 0 ) != dict2.get( "leader", 0 ):
mismatch = True
- main.log.error( "{0} changed leader from {1} to {2}".\
- format( dict1.get( "topic", "no-topic" ),\
- dict1.get( "leader", "no-leader" ),\
- dict2.get( "leader", "no-leader" ) ) )
+ main.log.error( "{0} changed leader from {1} to {2}".
+ format( dict1.get( "topic", "no-topic" ),
+ dict1.get( "leader", "no-leader" ),
+ dict2.get( "leader", "no-leader" ) ) )
if mismatch:
return main.FALSE
else:
@@ -1697,20 +1704,21 @@
main.log.info( "ERROR report: \n" )
for i in range( main.numCtrls ):
main.ONOSbench.logReport( main.ONOSip[ i ],
- [ "ERROR" ],
- "d" )
+ [ "ERROR" ],
+ "d" )
main.log.info( "EXCEPTIONS report: \n" )
for i in range( main.numCtrls ):
main.ONOSbench.logReport( main.ONOSip[ i ],
- [ "Except" ],
- "d" )
+ [ "Except" ],
+ "d" )
main.log.info( "WARNING report: \n" )
for i in range( main.numCtrls ):
main.ONOSbench.logReport( main.ONOSip[ i ],
- [ "WARN" ],
- "d" )
+ [ "WARN" ],
+ "d" )
+
def flowDuration( main ):
"""
@@ -1750,9 +1758,10 @@
return main.FALSE
return main.TRUE
+
def ProtectedIntentCheck( main ):
intent = main.RESTs[ 0 ].intents()
- main.log.debug(intent)
+ main.log.debug( intent )
main.stop()
if "Protection" in intent:
return main.TRUE
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/startUp.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/startUp.py
index bf2a2b6..8122586 100644
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/startUp.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/startUp.py
@@ -1,16 +1,15 @@
"""
This wrapper function is use for starting up onos instance
"""
-
import time
import os
import json
+
def onosBuild( main, gitBranch ):
"""
This includes pulling ONOS and building it using maven install
"""
-
buildResult = main.FALSE
# Git checkout a branch of ONOS
@@ -18,10 +17,10 @@
# Does the git pull on the branch that was checked out
if not checkOutResult:
main.log.warn( "Failed to checked out " + gitBranch +
- " branch")
+ " branch" )
else:
main.log.info( "Successfully checked out " + gitBranch +
- " branch")
+ " branch" )
gitPullResult = main.ONOSbench.gitPull()
if gitPullResult == main.ERROR:
main.log.error( "Error pulling git branch" )
@@ -32,7 +31,3 @@
buildResult = main.ONOSbench.cleanInstall()
return buildResult
-
-
-
-
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/topo.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/topo.py
index b44e3fc..7217d4d 100644
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/topo.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/topo.py
@@ -1,11 +1,11 @@
"""
These functions can be used for topology comparisons
"""
-
import time
import os
import json
+
def getAllDevices( main ):
"""
Return a list containing the devices output from each ONOS node
@@ -13,9 +13,9 @@
devices = []
threads = []
for i in range( main.numCtrls ):
- t = main.Thread( target=main.CLIs[i].devices,
+ t = main.Thread( target=main.CLIs[ i ].devices,
name="devices-" + str( i ),
- args=[ ] )
+ args=[] )
threads.append( t )
t.start()
@@ -24,6 +24,7 @@
devices.append( t.result )
return devices
+
def getAllHosts( main ):
"""
Return a list containing the hosts output from each ONOS node
@@ -32,9 +33,9 @@
ipResult = main.TRUE
threads = []
for i in range( main.numCtrls ):
- t = main.Thread( target=main.CLIs[i].hosts,
+ t = main.Thread( target=main.CLIs[ i ].hosts,
name="hosts-" + str( i ),
- args=[ ] )
+ args=[] )
threads.append( t )
t.start()
@@ -43,6 +44,7 @@
hosts.append( t.result )
return hosts
+
def getAllPorts( main ):
"""
Return a list containing the ports output from each ONOS node
@@ -50,9 +52,9 @@
ports = []
threads = []
for i in range( main.numCtrls ):
- t = main.Thread( target=main.CLIs[i].ports,
+ t = main.Thread( target=main.CLIs[ i ].ports,
name="ports-" + str( i ),
- args=[ ] )
+ args=[] )
threads.append( t )
t.start()
@@ -61,6 +63,7 @@
ports.append( t.result )
return ports
+
def getAllLinks( main ):
"""
Return a list containing the links output from each ONOS node
@@ -68,9 +71,9 @@
links = []
threads = []
for i in range( main.numCtrls ):
- t = main.Thread( target=main.CLIs[i].links,
+ t = main.Thread( target=main.CLIs[ i ].links,
name="links-" + str( i ),
- args=[ ] )
+ args=[] )
threads.append( t )
t.start()
@@ -79,6 +82,7 @@
links.append( t.result )
return links
+
def getAllClusters( main ):
"""
Return a list containing the clusters output from each ONOS node
@@ -86,9 +90,9 @@
clusters = []
threads = []
for i in range( main.numCtrls ):
- t = main.Thread( target=main.CLIs[i].clusters,
+ t = main.Thread( target=main.CLIs[ i ].clusters,
name="clusters-" + str( i ),
- args=[ ] )
+ args=[] )
threads.append( t )
t.start()
@@ -96,5 +100,3 @@
t.join()
clusters.append( t.result )
return clusters
-
-