Fix Codestyle in Functionality tests
Change-Id: Iecb38eee560da85e02212e42cdf0f5f6b4634172
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 5ee3f70..989fd56 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -301,7 +301,7 @@
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:
@@ -316,8 +316,8 @@
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(
@@ -331,8 +331,8 @@
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(
@@ -583,6 +583,7 @@
"""
if main.initialized == main.FALSE:
main.log.error( "Test components did not start correctly, skipping further tests" )
+ main.stop()
main.skipCase()
main.case( "Balance mastership of switches" )
main.step( "Balancing mastership of switches" )
@@ -648,7 +649,7 @@
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=mininetResult,
@@ -733,8 +734,8 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in \
- main.numSwitch" )
+ main.log.error( "Place the total number of switch topology in " +\
+ main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
@@ -750,7 +751,7 @@
"each step such as IPV4, Dual stack, VLAN " +\
"etc;\nThe test will use OF " + main.OFProtocol +\
" OVS running in Mininet and compile intents" +\
- " using " + main.flowCompiler
+ " using " + main.flowCompiler
main.step( "IPV4: Add host intents between h1 and h9" )
main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
@@ -762,7 +763,7 @@
name='IPV4',
onosNode='0',
host1=host1,
- host2=host2)
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
name='IPV4',
@@ -772,14 +773,14 @@
host2=host2,
sw1='s5',
sw2='s2',
- expectedLink = 18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass=main.assertReturnString,
- onfail=main.assertReturnString)
+ onfail=main.assertReturnString )
main.step( "DUALSTACK1: Add host intents between h3 and h11" )
main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
@@ -791,7 +792,7 @@
name='DUALSTACK',
onosNode='0',
host1=host1,
- host2=host2)
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
@@ -802,12 +803,12 @@
host2=host2,
sw1='s5',
sw2='s2',
- expectedLink = 18)
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass=main.assertReturnString,
- onfail=main.assertReturnString)
+ onfail=main.assertReturnString )
main.step( "DUALSTACK2: Add host intents between h1 and h11" )
main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
@@ -819,7 +820,7 @@
name='DUALSTACK2',
onosNode='0',
host1=host1,
- host2=host2)
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
@@ -830,14 +831,14 @@
host2=host2,
sw1='s5',
sw2='s2',
- expectedLink = 18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass=main.assertReturnString,
- onfail=main.assertReturnString)
+ onfail=main.assertReturnString )
main.step( "1HOP: Add host intents between h1 and h3" )
main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
@@ -849,7 +850,7 @@
name='1HOP',
onosNode='0',
host1=host1,
- host2=host2)
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
@@ -860,14 +861,14 @@
host2=host2,
sw1='s5',
sw2='s2',
- expectedLink = 18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass=main.assertReturnString,
- onfail=main.assertReturnString)
+ onfail=main.assertReturnString )
main.step( "VLAN1: Add vlan host intents between h4 and h12" )
main.assertReturnString = "Assertion Result vlan IPV4\n"
@@ -879,7 +880,7 @@
name='VLAN1',
onosNode='0',
host1=host1,
- host2=host2)
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
@@ -890,14 +891,14 @@
host2=host2,
sw1='s5',
sw2='s2',
- expectedLink = 18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass=main.assertReturnString,
- onfail=main.assertReturnString)
+ onfail=main.assertReturnString )
main.step( "VLAN2: Add vlan host intents between h4 and h13" )
main.assertReturnString = "Assertion Result vlan IPV4\n"
@@ -909,7 +910,7 @@
name='VLAN2',
onosNode='0',
host1=host1,
- host2=host2)
+ host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
@@ -920,14 +921,14 @@
host2=host2,
sw1='s5',
sw2='s2',
- expectedLink = 18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass=main.assertReturnString,
- onfail=main.assertReturnString)
+ onfail=main.assertReturnString )
main.step( "Encapsulation: Add host intents between h1 and h9" )
main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
@@ -950,16 +951,16 @@
host2=host2,
sw1='s5',
sw2='s2',
- expectedLink = 18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass=main.assertReturnString,
- onfail=main.assertReturnString)
+ onfail=main.assertReturnString )
- main.step( "Confirm that ONOS leadership is unchanged")
+ main.step( "Confirm that ONOS leadership is unchanged" )
intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
main.intentFunction.checkLeaderChange( intentLeadersOld,
intentLeadersNew )
@@ -967,7 +968,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 )
@@ -1014,8 +1015,8 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in \
- main.numSwitch" )
+ main.log.error( "Place the total number of switch topology in " +\
+ main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
@@ -1057,7 +1058,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1093,7 +1094,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1127,7 +1128,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1172,7 +1173,7 @@
sw1="s5",
sw2="s2",
expectedLink=18,
- useTCP=True)
+ useTCP=True )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1238,7 +1239,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1261,7 +1262,7 @@
main,
name="VLAN",
senders=senders,
- recipients=recipients)
+ recipients=recipients )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1272,7 +1273,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -1294,7 +1295,7 @@
name="VLAN2",
senders=senders,
recipients=recipients,
- setVlan=200)
+ setVlan=200 )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1305,7 +1306,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -1338,7 +1339,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1373,7 +1374,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1422,8 +1423,8 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in \
- main.numSwitch" )
+ main.log.error( "Place the total number of switch topology in "+ \
+ main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
@@ -1458,7 +1459,7 @@
senders=senders,
recipients=recipients,
sw1="s5",
- sw2="s2")
+ sw2="s2" )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1471,7 +1472,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1500,7 +1501,7 @@
recipients=recipients,
ethType="IPV4",
sw1="s5",
- sw2="s2")
+ sw2="s2" )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1513,7 +1514,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1542,7 +1543,7 @@
recipients=recipients,
ethType="IPV4",
sw1="s5",
- sw2="s2")
+ sw2="s2" )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1555,7 +1556,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1583,7 +1584,7 @@
senders=senders,
recipients=recipients,
sw1="s5",
- sw2="s2")
+ sw2="s2" )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1596,7 +1597,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1625,7 +1626,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- setVlan=100)
+ setVlan=100 )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1638,7 +1639,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1680,7 +1681,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1729,8 +1730,8 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in \
- main.numSwitch" )
+ main.log.error( "Place the total number of switch topology in "+\
+ main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
@@ -1807,7 +1808,7 @@
recipients=recipients,
ethType="IPV4",
sw1="s5",
- sw2="s2")
+ sw2="s2" )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1820,7 +1821,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1849,7 +1850,7 @@
recipients=recipients,
ethType="IPV4",
sw1="s5",
- sw2="s2")
+ sw2="s2" )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1862,7 +1863,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1890,7 +1891,7 @@
senders=senders,
recipients=recipients,
sw1="s5",
- sw2="s2")
+ sw2="s2" )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1903,7 +1904,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -1933,7 +1934,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- setVlan=100)
+ setVlan=100 )
if installResult:
testResult = main.intentFunction.testPointIntent(
@@ -1946,7 +1947,7 @@
badRecipients=badRecipients,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -2023,15 +2024,15 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in \
- main.numSwitch" )
+ main.log.error( "Place the total number of switch topology in "+\
+ main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
main.case( "Test host mobility with host intents " )
main.step( "Testing host mobility by moving h1 from s5 to s6" )
h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
- main.log.info( "Moving h1 from s5 to s6")
+ main.log.info( "Moving h1 from s5 to s6" )
main.Mininet1.moveHost( "h1","s5","s6" )
# Send discovery ping from moved host
@@ -2112,8 +2113,8 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in \
- main.numSwitch" )
+ main.log.error( "Place the total number of switch topology in "+\
+ main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
main.case( "Test Multi to Single End Point Failure" )
@@ -2238,7 +2239,7 @@
senders=senders,
recipients=recipients,
sw1="s5",
- sw2="s2")
+ sw2="s2" )
if installResult:
testResult = main.intentFunction.testEndPointFail(
@@ -2288,7 +2289,7 @@
recipients=recipients,
sw1="s5",
sw2="s2",
- partial=True)
+ partial=True )
if installResult:
testResult = main.intentFunction.testEndPointFail(
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 89695a2..0e563be 100755
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -83,7 +83,7 @@
vlanId=vlanId,
setVlan=setVlan,
encap=encap )
- except (KeyError, TypeError):
+ except( KeyError, TypeError ):
errorMsg = "There was a problem loading the hosts data."
if intentId:
errorMsg += " There was a problem installing host to host intent."
@@ -113,7 +113,7 @@
onosNode=0,
sw1="s5",
sw2="s2",
- expectedLink=0):
+ expectedLink=0 ):
"""
Test a Host Intent
@@ -184,7 +184,7 @@
vlanId = host1.get( "vlan" )
testResult = main.TRUE
- except (KeyError, TypeError):
+ except( KeyError, TypeError ):
main.log.error( "There was a problem loading the hosts data." )
return main.FALSE
@@ -400,7 +400,7 @@
vlanId=vlanId,
setVlan=setVlan,
encap=encap )
- except (KeyError, TypeError):
+ except( KeyError, TypeError ):
errorMsg = "There was a problem loading the hosts data."
if intentId:
errorMsg += " There was a problem installing Point to Point intent."
@@ -597,7 +597,7 @@
checkFlowsState( main )
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
+ iperfTemp = main.Mininet1.iperftcp( host1, host2 ,10 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Initial Iperf Passed\n'
@@ -627,7 +627,7 @@
main.assertReturnString += 'Link Down Topology State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
+ iperfTemp = main.Mininet1.iperftcp( host1, host2, 10 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Link Down Iperf Passed\n'
@@ -671,7 +671,7 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
+ iperfTemp = main.Mininet1.iperftcp( host1, host2, 10 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Link Up Iperf Passed\n'
@@ -810,7 +810,7 @@
setVlan=setVlan,
partial=partial,
encap=encap )
- except (KeyError, TypeError):
+ except( KeyError, TypeError ):
errorMsg = "There was a problem loading the hosts data."
if intentId:
errorMsg += " There was a problem installing Singlepoint to Multipoint intent."
@@ -936,7 +936,7 @@
setVlan=setVlan,
partial=partial,
encap=encap )
- except (KeyError, TypeError):
+ except( KeyError, TypeError ):
errorMsg = "There was a problem loading the hosts data."
if intentId:
errorMsg += " There was a problem installing Multipoint to Singlepoint intent."
@@ -974,7 +974,7 @@
sw1="s5",
sw2="s2",
expectedLink=0,
- useTCP=False):
+ useTCP=False ):
"""
Test a Point Intent
@@ -1053,7 +1053,7 @@
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( "vlan" )
- except (KeyError, TypeError):
+ except( KeyError, TypeError ):
main.log.error( "There was a problem loading the hosts data." )
return main.FALSE
@@ -1239,7 +1239,7 @@
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):
+ except( KeyError, TypeError ):
main.log.error( "There was a problem loading the hosts data." )
return main.FALSE
@@ -1577,7 +1577,7 @@
return main.FALSE
if hostFails:
- main.log.error( "List of failed ONOS Nodes:" + ', '.join(map(str, hostFails )) )
+ main.log.error( "List of failed ONOS Nodes:" + ', '.join( map( str, hostFails ) ) )
return main.FALSE
else:
return main.TRUE
@@ -1591,7 +1591,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():
@@ -1628,7 +1628,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" )
@@ -1696,7 +1696,7 @@
checkFlowsResult = main.CLIs[ 0 ].checkFlowsState( isPENDING=False )
return checkFlowsResult
-def link( main, sw1, sw2, option):
+def link( main, sw1, sw2, option ):
# link down
main.log.info( itemName + ": Bring link " + option + "between " +
@@ -1861,7 +1861,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: