Run codecheck script on FUNCipv6Intent
Change-Id: Id6b306f6ee3ce464335ef4286200474f875c175e
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
old mode 100755
new mode 100644
index d13762e..4cc4bc9
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
@@ -1,5 +1,6 @@
# Testing the basic intent for ipv6 functionality of ONOS
+
class FUNCipv6Intent:
def __init__( self ):
@@ -49,7 +50,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.CLIs = []
main.ONOSip = []
@@ -59,7 +60,7 @@
print main.ONOSip
# Assigning ONOS cli handles to a list
- for i in range( 1, main.maxNodes + 1 ):
+ for i in range( 1, main.maxNodes + 1 ):
main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
# -- INIT SECTION, ONLY RUNS ONCE -- #
@@ -69,9 +70,9 @@
".py" )
main.intentFunction = imp.load_source( wrapperFile2,
- main.dependencyPath +
- wrapperFile2 +
- ".py" )
+ main.dependencyPath +
+ wrapperFile2 +
+ ".py" )
main.topo = imp.load_source( wrapperFile3,
main.dependencyPath +
@@ -89,7 +90,7 @@
main.log.error( "Did not properly created list of ONOS CLI handle" )
stepResult = main.FALSE
except Exception as e:
- main.log.exception(e)
+ main.log.exception( e )
main.cleanup()
main.exit()
@@ -135,8 +136,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" )
@@ -148,7 +147,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,
@@ -160,7 +159,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 " )
@@ -199,7 +198,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" )
@@ -257,12 +256,12 @@
main.exit()
main.step( "setup the ipv6NeighbourDiscovery" )
- cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.incubator.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" )
- cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "useIpv6ND", "true" )
+ cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.incubator.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" )
+ cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "useIpv6ND", "true" )
cfgResult = cfgResult1 and cfgResult2
utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
- onpass="ipv6NeighborDiscovery cfg is set to true",
- onfail="Failed to cfg set ipv6NeighborDiscovery" )
+ onpass="ipv6NeighborDiscovery cfg is set to true",
+ onfail="Failed to cfg set ipv6NeighborDiscovery" )
# Remove the first element in main.scale list
main.scale.remove( main.scale[ 0 ] )
@@ -348,9 +347,9 @@
main.step( "Discover all hosts using pingall " )
stepResult = main.intentFunction.getHostsData( main )
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully discovered hosts",
- onfail="Failed to discover hosts" )
+ actual=stepResult,
+ onpass="Successfully discovered hosts",
+ onfail="Failed to discover hosts" )
def CASE16( self, main ):
"""
@@ -377,7 +376,7 @@
"to start up fresh"
main.step( "Stopping Mininet Topology" )
- topoResult = main.Mininet1.stopNet( )
+ topoResult = main.Mininet1.stopNet()
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -434,33 +433,33 @@
main.step( "IPV6: Add host intents between h1 and h9" )
stepResult = main.TRUE
stepResult = main.intentFunction.hostIntent( main,
- name='IPV6',
- host1='h1',
- host2='h9',
- host1Id='00:00:00:00:00:01/-1',
- host2Id='00:00:00:00:00:09/-1',
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ name='IPV6',
+ host1='h1',
+ host2='h9',
+ host1Id='00:00:00:00:00:01/-1',
+ host2Id='00:00:00:00:00:09/-1',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="IPV6: Host intent test successful " +
"between two IPV6 hosts",
onfail="IPV6: Host intent test failed " +
- "between two IPV6 hosts")
+ "between two IPV6 hosts" )
main.step( "DUALSTACK1: Add host intents between h3 and h11" )
stepResult = main.TRUE
stepResult = main.intentFunction.hostIntent( main,
- name='DUALSTACK',
- host1='h3',
- host2='h11',
- host1Id='00:00:00:00:00:03/-1',
- host2Id='00:00:00:00:00:0B/-1',
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ name='DUALSTACK',
+ host1='h3',
+ host2='h11',
+ host1Id='00:00:00:00:00:03/-1',
+ host2Id='00:00:00:00:00:0B/-1',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -474,11 +473,11 @@
main.step( "1HOP: Add host intents between h1 and h3" )
stepResult = main.TRUE
stepResult = main.intentFunction.hostIntent( main,
- name='1HOP',
- host1='h1',
- host2='h9',
- host1Id='00:00:00:00:00:01/-1',
- host2Id='00:00:00:00:00:09/-1')
+ name='1HOP',
+ host1='h1',
+ host2='h9',
+ host1Id='00:00:00:00:00:01/-1',
+ host2Id='00:00:00:00:00:09/-1' )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -492,14 +491,14 @@
main.step( "VLAN: Add vlan host intents between h5 and h24" )
stepResult = main.TRUE
stepResult = main.intentFunction.hostIntent( main,
- name='VLAN1',
- host1='h5',
- host2='h24',
- host1Id='00:00:00:00:00:05/100',
- host2Id='00:00:00:00:00:18/100',
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ name='VLAN1',
+ host1='h5',
+ host2='h24',
+ host1Id='00:00:00:00:00:05/100',
+ host2Id='00:00:00:00:00:18/100',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -563,7 +562,7 @@
host1="h1",
host2="h9",
deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1")
+ deviceId2="of:0000000000000006/1" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -612,7 +611,7 @@
ip2="",
tcp1="",
tcp2="",
- expectedLink="")
+ expectedLink="" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
@@ -621,7 +620,7 @@
main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV6 using ICMP point intents\n"
mac1 = main.hostsData[ 'h1' ][ 'mac' ]
mac2 = main.hostsData[ 'h9' ][ 'mac' ]
- main.log.debug(mac2)
+ main.log.debug( mac2 )
ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
@@ -732,11 +731,11 @@
main.step( "1HOP: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n"
stepResult = main.intentFunction.pointIntent( main,
- name='1HOP',
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1")
+ name='1HOP',
+ host1="h1",
+ host2="h9",
+ deviceId1="of:0000000000000005/1",
+ deviceId2="of:0000000000000006/1" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
@@ -781,7 +780,7 @@
" OVS running in Mininet "
main.step( "NOOPTION: Add single point to multi point intents" )
hostNames = [ 'h1', 'h9', 'h17' ]
- devices = [ 'of:0000000000000005/1','of:0000000000000006/1', 'of:0000000000000007/1' ]
+ devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
main.assertReturnString = "Assertion results for IPV6 single to multi point intent with no options set\n"
stepResult = main.TRUE
stepResult = main.intentFunction.singleToMultiIntent(
@@ -791,7 +790,7 @@
devices=devices,
sw1="s5",
sw2="s2",
- expectedLink=18)
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
@@ -800,7 +799,7 @@
main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses\n"
hostNames = [ 'h1', 'h9', 'h17' ]
devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
- macs = [ '00:00:00:00:00:01','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
+ macs = [ '00:00:00:00:00:01', '00:00:00:00:00:09', '00:00:00:00:00:11' ]
stepResult = main.TRUE
stepResult = main.intentFunction.singleToMultiIntent(
main,
@@ -810,7 +809,7 @@
macs=macs,
ethType="IPV6",
sw1="",
- sw2="")
+ sw2="" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
@@ -827,7 +826,7 @@
devices=devices,
ethType="IPV6",
sw1="",
- sw2="")
+ sw2="" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
@@ -836,7 +835,7 @@
main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses in the same VLAN\n"
hostNames = [ 'h5', 'h24' ]
devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
- macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
+ macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
stepResult = main.TRUE
stepResult = main.intentFunction.singleToMultiIntent(
main,
@@ -846,13 +845,13 @@
macs=macs,
ethType="IPV6",
sw1="",
- sw2="")
+ sw2="" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
onfail=main.assertReturnString )
main.intentFunction.report( main )
-
+
def CASE4000( self, main ):
"""
Add multi point to single point intents
@@ -893,7 +892,7 @@
main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
stepResult = main.TRUE
hostNames = [ 'h17', 'h9' ]
- devices = ['of:0000000000000007/1', 'of:0000000000000006/1' ]
+ devices = [ 'of:0000000000000007/1', 'of:0000000000000006/1' ]
stepResult = main.intentFunction.multiToSingleIntent(
main,
name="NOOPTION",
@@ -910,7 +909,7 @@
main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and MAC addresses\n"
hostNames = [ 'h1', 'h9', 'h17' ]
devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
- macs = [ '00:00:00:00:00:01','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
+ macs = [ '00:00:00:00:00:01', '00:00:00:00:00:09', '00:00:00:00:00:11' ]
stepResult = main.TRUE
installResult = main.intentFunction.multiToSingleIntent(
main,
@@ -939,7 +938,7 @@
ethType="IPV6",
sw1="",
sw2="",
- expectedLink="")
+ expectedLink="" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
@@ -949,7 +948,7 @@
main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses in the same VLAN\n"
hostNames = [ 'h5', 'h24' ]
devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
- macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
+ macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
stepResult = main.TRUE
stepResult = main.intentFunction.multiToSingleIntent(
main,
@@ -960,7 +959,7 @@
ethType="IPV6",
sw1="",
sw2="",
- expectedLink="")
+ expectedLink="" )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
@@ -981,8 +980,8 @@
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.Mininet1.moveHostv6( "h1","s5","s6" )
+ main.log.info( "Moving h1 from s5 to s6" )
+ main.Mininet1.moveHostv6( "h1", "s5", "s6" )
main.intentFunction.getHostsData( main )
h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
@@ -997,11 +996,11 @@
main.assertReturnString = "Assert result for IPV6 host intent between h1, moved, and h9\n"
stepResult = main.TRUE
stepResult = main.intentFunction.hostIntent( main,
- name='IPV6 Mobility IPV6',
- host1='h1',
- host2='h9',
- host1Id='00:00:00:00:00:01/-1',
- host2Id='00:00:00:00:00:09/-1')
+ name='IPV6 Mobility IPV6',
+ host1='h1',
+ host2='h9',
+ host1Id='00:00:00:00:00:01/-1',
+ host2Id='00:00:00:00:00:09/-1' )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -1048,7 +1047,7 @@
point intent end point failure with IPV6 type and MAC addresses\n"
hostNames = [ 'h8', 'h9', 'h17' ]
devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
- macs = [ '00:00:00:00:00:08','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
+ macs = [ '00:00:00:00:00:08', '00:00:00:00:00:09', '00:00:00:00:00:11' ]
testResult = main.TRUE
testResult = main.intentFunction.testEndPointFail(
main,
@@ -1101,7 +1100,7 @@
point intent end point failure with IPV6 type and no MAC addresses in the same VLAN\n"
hostNames = [ 'h5', 'h24' ]
devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
- macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
+ macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
testResult = main.TRUE
testResult = main.intentFunction.testEndPointFail(
main,
@@ -1151,7 +1150,7 @@
point intent end point failure with IPV6 type and MAC addresses\n"
hostNames = [ 'h8', 'h9', 'h17' ]
devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
- macs = [ '00:00:00:00:00:08','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
+ macs = [ '00:00:00:00:00:08', '00:00:00:00:00:09', '00:00:00:00:00:11' ]
testResult = main.TRUE
testResult = main.intentFunction.testEndPointFail(
main,
@@ -1203,7 +1202,7 @@
intent endpoint failure with IPV6 type and MAC addresses in the same VLAN\n"
hostNames = [ 'h5', 'h24' ]
devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
- macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
+ macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
testResult = main.TRUE
testResult = main.intentFunction.testEndPointFail(
main,
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
old mode 100755
new mode 100644
index 863d406..511eb32
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
@@ -7,9 +7,11 @@
import copy
import json
+
def __init__( self ):
self.default = ''
+
def hostIntent( main,
name,
host1,
@@ -66,7 +68,6 @@
Returns main.TRUE if all verification passed, otherwise return
main.FALSE; returns main.FALSE if there is a key error
"""
-
# Assert variables
assert main, "There is no main variable"
assert name, "variable name is empty"
@@ -80,7 +81,7 @@
h2Mac = mac2
vlan1 = vlan1
vlan2 = vlan2
- hostNames = [ host1 , host2 ]
+ hostNames = [ host1, host2 ]
intentsId = []
stepResult = main.TRUE
pingResult = main.TRUE
@@ -152,10 +153,10 @@
main.assertReturnString += 'Initial Flow State Failed\n'
# Ping hosts
- firstPingResult = main.Mininet1.ping6pair(SRC=hostNames[0], TARGET=main.hostsData[ host2 ][ 'ipAddresses' ][ 0 ])
+ firstPingResult = main.Mininet1.ping6pair( SRC=hostNames[ 0 ], TARGET=main.hostsData[ host2 ][ 'ipAddresses' ][ 0 ] )
if not firstPingResult:
main.log.debug( "First ping failed, there must be" +
- " something wrong with ONOS performance" )
+ " something wrong with ONOS performance" )
# Ping hosts again...
pingTemp = ping6allHosts( main, hostNames )
@@ -267,6 +268,7 @@
return stepResult
+
def pointIntent( main,
name,
host1,
@@ -289,7 +291,6 @@
sw1="",
sw2="",
expectedLink=0 ):
-
"""
Description:
Verify add-point-intent
@@ -339,7 +340,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"
@@ -363,35 +363,35 @@
# Adding bidirectional point intents
main.log.info( itemName + ": Adding point intents" )
intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
- egressDevice=deviceId2,
- portIngress=port1,
- portEgress=port2,
- ethType=ethType,
- ethSrc=mac1,
- ethDst=mac2,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ip1,
- ipDst=ip2,
- tcpSrc=tcp1,
- tcpDst=tcp2 )
+ egressDevice=deviceId2,
+ portIngress=port1,
+ portEgress=port2,
+ ethType=ethType,
+ ethSrc=mac1,
+ ethDst=mac2,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip1,
+ ipDst=ip2,
+ tcpSrc=tcp1,
+ tcpDst=tcp2 )
intentsId.append( intent1 )
intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
- egressDevice=deviceId1,
- portIngress=port2,
- portEgress=port1,
- ethType=ethType,
- ethSrc=mac2,
- ethDst=mac1,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ip2,
- ipDst=ip1,
- tcpSrc=tcp2,
- tcpDst=tcp1 )
+ egressDevice=deviceId1,
+ portIngress=port2,
+ portEgress=port1,
+ ethType=ethType,
+ ethSrc=mac2,
+ ethDst=mac1,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip2,
+ ipDst=ip1,
+ tcpSrc=tcp2,
+ tcpDst=tcp1 )
intentsId.append( intent2 )
# Check intents state
@@ -527,6 +527,7 @@
return stepResult
+
def pointIntentTcp( main,
name,
host1,
@@ -549,7 +550,6 @@
sw1="",
sw2="",
expectedLink=0 ):
-
"""
Description:
Verify add-point-intent only for TCP
@@ -599,7 +599,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"
@@ -714,7 +713,7 @@
main.assertReturnString += 'Initial Flow State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcpipv6( host1,host2 )
+ iperfTemp = main.Mininet1.iperftcpipv6( host1, host2 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Initial Iperf6 Passed\n'
@@ -744,7 +743,7 @@
main.assertReturnString += 'Link Down Topology State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcpipv6( host1,host2 )
+ iperfTemp = main.Mininet1.iperftcpipv6( host1, host2 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Link Down Iperf6 Passed\n'
@@ -788,7 +787,7 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcpipv6( host1,host2,timeout=10 )
+ iperfTemp = main.Mininet1.iperftcpipv6( host1, host2, timeout=10 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Link Up Iperf6 Passed\n'
@@ -821,6 +820,7 @@
return stepResult
+
def singleToMultiIntent( main,
name,
hostNames="",
@@ -843,8 +843,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
@@ -891,7 +891,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"
@@ -923,11 +922,11 @@
devices = []
main.log.info( "singleToMultiIntent 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' )
pingResult = main.TRUE
intentResult = main.TRUE
@@ -961,7 +960,7 @@
srcMac = ""
else:
srcMac = macsDict[ ingressDevice ]
- if srcMac == None:
+ if srcMac is None:
main.log.debug( "There is no MAC in device - " + ingressDevice )
srcMac = ""
@@ -981,7 +980,6 @@
tcpSrc="",
tcpDst="" ) )
-
# Check intents state
time.sleep( main.checkIntentSleep )
intentResult = checkIntentState( main, intentsId )
@@ -1007,10 +1005,10 @@
else:
main.assertReturnString += 'Initial Flow State Failed\n'
- firstPingResult = main.Mininet1.ping6pair(SRC=hostNames[0], TARGET=main.hostsData[ hostNames[1] ][ 'ipAddresses' ][0])
+ firstPingResult = main.Mininet1.ping6pair( SRC=hostNames[ 0 ], TARGET=main.hostsData[ hostNames[ 1 ] ][ 'ipAddresses' ][ 0 ] )
if not firstPingResult:
main.log.debug( "First ping failed, there must be" +
- " something wrong with ONOS performance" )
+ " something wrong with ONOS performance" )
# Ping hosts again...
pingTemp = ping6allHosts( main, hostNames )
@@ -1119,6 +1117,7 @@
return stepResult
+
def multiToSingleIntent( main,
name,
hostNames="",
@@ -1141,8 +1140,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
@@ -1189,7 +1188,6 @@
switches are down
Note - Don't use more than 2 hosts for MultiToSingle Intent with no mac address option.
"""
-
assert main, "There is no main variable"
assert hostNames, "You must specify hosts"
assert devices or main.hostsData, "You must specify devices"
@@ -1220,11 +1218,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' )
pingResult = main.TRUE
intentResult = main.TRUE
@@ -1258,7 +1256,7 @@
dstMac = ""
else:
dstMac = macsDict[ egressDevice ]
- if dstMac == None:
+ if dstMac is None:
main.log.debug( "There is no MAC in device - " + egressDevice )
dstMac = ""
@@ -1409,6 +1407,7 @@
return stepResult
+
def testEndPointFail( main,
name,
test="",
@@ -1433,7 +1432,6 @@
"""
Test Multipoint Topology for Endpoint failures
"""
-
assert main, "There is no main variable"
assert hostNames, "You must specify hosts"
assert devices or main.hostsData, "You must specify devices"
@@ -1464,11 +1462,11 @@
devices = []
main.log.info( "multiIntent 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' )
pingResult = main.TRUE
intentResult = main.TRUE
@@ -1486,7 +1484,7 @@
# Check flows count in each node
checkFlowsCount( main )
- if test=="MultipletoSingle":
+ if test == "MultipletoSingle":
for i in range( len( devices ) ):
egressDevice = devicesCopy[ i ]
ingressDeviceList = copy.copy( devicesCopy )
@@ -1502,7 +1500,7 @@
dstMac = ""
else:
dstMac = macsDict[ egressDevice ]
- if dstMac == None:
+ if dstMac is None:
main.log.debug( "There is no MAC in device - " + egressDevice )
dstMac = ""
@@ -1522,8 +1520,7 @@
tcpSrc="",
tcpDst="" ) )
-
- elif test=="SingletoMultiple":
+ elif test == "SingletoMultiple":
for i in range( len( devices ) ):
ingressDevice = devicesCopy[ i ]
egressDeviceList = copy.copy( devicesCopy )
@@ -1539,7 +1536,7 @@
srcMac = ""
else:
srcMac = macsDict[ ingressDevice ]
- if srcMac == None:
+ if srcMac is None:
main.log.debug( "There is no MAC in device - " + ingressDevice )
srcMac = ""
@@ -1560,7 +1557,7 @@
tcpDst="" ) )
else:
- main.log.info("Invalid test Name - Type either SingletoMultiple or MultipletoSingle")
+ main.log.info( "Invalid test Name - Type either SingletoMultiple or MultipletoSingle" )
return main.FALSE
# Check intents state
@@ -1598,7 +1595,7 @@
# Test rerouting if these variables exist
if sw1 and sw2 and sw3 and sw4 and sw5 and expectedLink1 and expectedLink2:
- # Take two links down
+ # Take two links down
# Take first link down
linkDownResult1 = link( main, sw1, sw2, "down" )
if linkDownResult1:
@@ -1678,7 +1675,7 @@
main.assertReturnString += 'Isolation Link Down Topology State Failed\n'
# Ping hosts after isolation
- main.log.info("Ping will fail if the node is isolated correctly.It will ping only after bringing up the isolation link")
+ main.log.info( "Ping will fail if the node is isolated correctly.It will ping only after bringing up the isolation link" )
pingIsolation = ping6allHosts( main, hostNames )
if pingIsolation:
main.assertReturnString += 'Isolation Link Down Ping6all Passed\n'
@@ -1686,7 +1683,7 @@
main.assertReturnString += 'Isolation Link Down Ping6all Failed\n'
# Check intent state after isolation
- main.log.info("Intent will be in FAILED state if the node is isolated correctly.It will be in INSTALLED state only after bringing up isolation link")
+ main.log.info( "Intent will be in FAILED state if the node is isolated correctly.It will be in INSTALLED state only after bringing up isolation link" )
intentIsolation = checkIntentState( main, intentsId )
if intentIsolation:
main.assertReturnString += 'Isolation Link Down Intent State Passed\n'
@@ -1779,25 +1776,26 @@
return testResult
+
def ping6allHosts( main, hostList ):
# Ping all host in the hosts list variable
main.log.info( "Pinging: " + str( hostList ) )
return main.Mininet1.pingIpv6Hosts( hostList )
+
def getHostsData( main ):
"""
Use fwd app and pingall to discover all the hosts
"""
-
activateResult = main.TRUE
appCheck = main.TRUE
getDataResult = main.TRUE
main.log.info( "Activating reactive forwarding app " )
activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
- main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "useIpv6ND", "true")
+ main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "useIpv6ND", "true" )
main.CLIs[ 0 ].setCfg( "org.onosproject.incubator.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" )
- main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true")
- main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true")
+ main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
+ main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
time.sleep( main.fwdSleep )
for i in range( main.numCtrls ):
@@ -1806,7 +1804,7 @@
main.log.warn( main.CLIs[ i ].apps() )
main.log.warn( main.CLIs[ i ].appIDs() )
- pingResult = main.Mininet1.pingall( protocol="IPv6", timeout = 600 )
+ pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=600 )
hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
hosts = main.Mininet1.getHosts().keys()
for host in hosts:
@@ -1833,11 +1831,12 @@
main.log.info( "Removing the automatically configured ipv6 link-local addresses in hostsData to avoid unnecessary ping with these addresses during initial ping test - link-local starts with 'fe' " )
for host in main.hostsData.keys():
- if main.hostsData[ host ].get( 'ipAddresses' ) != None:
- main.hostsData[ host ][ 'ipAddresses' ] = [ v for v in main.hostsData[ host ][ 'ipAddresses' ] if not v.startswith('fe') ]
+ if main.hostsData[ host ].get( 'ipAddresses' ) is not None:
+ main.hostsData[ host ][ 'ipAddresses' ] = [ v for v in main.hostsData[ host ][ 'ipAddresses' ] if not v.startswith( 'fe' ) ]
print main.hostsData
return getDataResult
+
def checkTopology( main, expectedLink ):
statusResult = main.TRUE
# Check onos topology
@@ -1853,12 +1852,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 = []
@@ -1892,13 +1891,15 @@
return intentResult
+
def checkFlowsState( main ):
main.log.info( itemName + ": Check flows state" )
checkFlowsResult = main.CLIs[ 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 " +
@@ -1906,11 +1907,11 @@
linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
return linkResult
+
def removeAllIntents( main, intentsId ):
"""
Remove all intents in the intentsId
"""
-
onosSummary = []
removeIntentResult = main.TRUE
# Remove intents
@@ -1938,11 +1939,11 @@
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 ):
@@ -1956,7 +1957,7 @@
flowsCount.append( summaryJson.get( '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:
@@ -1969,6 +1970,7 @@
return main.TRUE
+
def checkLeaderChange( leaders1, leaders2 ):
"""
Checks for a change in intent partition leadership.
@@ -1982,7 +1984,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:
@@ -1995,22 +1997,22 @@
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:
return main.TRUE
+
def report( main ):
"""
Report errors/warnings/exceptions
"""
-
main.ONOSbench.logReport( main.ONOSip[ 0 ],
[ "INFO",
"FOLLOWER",
@@ -2023,17 +2025,17 @@
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" )
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/startUp.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/startUp.py
index 2ec1ae4..8122586 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/startUp.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/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" )
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/topo.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/topo.py
index d834a09..7217d4d 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/topo.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/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()