Run codestyle script for FUNCintent
Change-Id: Ia74ea4bde4fc06839138486870c2b9b83294abea
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 228f9f9..9d76b24 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -1,5 +1,6 @@
# Testing the basic intent functionality of ONOS
+
class FUNCintent:
def __init__( self ):
@@ -18,7 +19,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 " +\
@@ -56,20 +56,20 @@
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 = []
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()
main.log.debug( "Found ONOS ips: {}".format( 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 -- #
@@ -78,7 +78,7 @@
wrapperFile1 +
".py" )
- main.intentFunction = imp.load_source( wrapperFile2,
+ main.intents = imp.load_source( wrapperFile2,
main.dependencyPath +
wrapperFile2 +
".py" )
@@ -99,7 +99,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()
@@ -170,7 +170,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,
@@ -182,7 +182,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 " )
@@ -208,7 +208,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" )
@@ -231,7 +231,7 @@
stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
if not startResult or stopResult:
- main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1) )
+ main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1 ) )
stepResult = onosIsUp and stopResult and startResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -254,7 +254,7 @@
# Remove the first element in main.scale list
main.scale.remove( main.scale[ 0 ] )
- main.intentFunction.report( main )
+ main.intents.report( main )
def CASE8( self, main ):
"""
@@ -282,7 +282,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 ):
main.log.info( "Sleeping {} seconds".format( 2 ) )
time.sleep( 2 )
if not devicesResults:
@@ -304,8 +304,8 @@
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 ] )
@@ -315,7 +315,7 @@
currentDevicesResult = main.FALSE
else:
currentDevicesResult = main.Mininet1.compareSwitches(
- mnSwitches,deviceData,portData )
+ mnSwitches, deviceData, portData )
else:
currentDevicesResult = main.FALSE
if not currentDevicesResult:
@@ -330,7 +330,7 @@
currentLinksResult = main.FALSE
else:
currentLinksResult = main.Mininet1.compareLinks(
- mnSwitches, mnLinks,linkData )
+ mnSwitches, mnLinks, linkData )
else:
currentLinksResult = main.FALSE
if not currentLinksResult:
@@ -345,7 +345,7 @@
currentHostsResult = main.FALSE
else:
currentHostsResult = main.Mininet1.compareHosts(
- mnHosts,hostData )
+ mnHosts, hostData )
else:
currentHostsResult = main.FALSE
if not currentHostsResult:
@@ -354,7 +354,6 @@
# Decrement Attempts Remaining
attempts -= 1
-
utilities.assert_equals( expect=[],
actual=deviceFails,
onpass="ONOS correctly discovered all devices",
@@ -483,7 +482,7 @@
if not stepResult:
main.initialized = main.FALSE
- def CASE13( self,main ):
+ def CASE13( self, main ):
"""
Create Scapy components
"""
@@ -506,7 +505,6 @@
main.log.debug( host.hostIp )
main.log.debug( host.hostMac )
-
utilities.assert_equals( expect=main.TRUE,
actual=scapyResult,
onpass="Successfully created Scapy Components",
@@ -523,10 +521,10 @@
main.skipCase()
main.case( "Discover all hosts" )
main.step( "Pingall hosts and confirm ONOS discovery" )
- utilities.retry( f=main.intentFunction.fwdPingall, retValue=main.FALSE, args=[ main ] )
+ utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
- utilities.retry( f=main.intentFunction.confirmHostDiscovery, retValue=main.FALSE,
- args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
+ stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
+ args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully discovered hosts",
@@ -536,7 +534,7 @@
main.skipCase()
main.step( "Populate hostsData" )
- stepResult = main.intentFunction.populateHostData( main )
+ stepResult = main.intents.populateHostData( main )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully populated hostsData",
@@ -560,9 +558,9 @@
main.skipCase()
# Send ARP packets from each scapy host component
- main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
+ main.intents.sendDiscoveryArp( main, main.scapyHosts )
- stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
+ stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
retValue=main.FALSE, args=[ main ],
attempts=main.checkTopoAttempts, sleep=2 )
@@ -575,7 +573,7 @@
main.skipCase()
main.step( "Populate hostsData" )
- stepResult = main.intentFunction.populateHostData( main )
+ stepResult = main.intents.populateHostData( main )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully populated hostsData",
@@ -621,7 +619,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,
@@ -684,14 +682,14 @@
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,
@@ -739,7 +737,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()
@@ -763,21 +761,21 @@
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 )
+ installResult = main.intents.installHostIntent( main,
+ 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 )
+ testResult = main.intents.testHostIntent( main,
+ name="IPV4",
+ intentId=installResult,
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -789,24 +787,24 @@
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 "}
+ host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
testResult = main.FALSE
- installResult = main.intentFunction.installHostIntent( main,
- name="DUALSTACK",
- onosNode=0,
- host1=host1,
- host2=host2 )
+ installResult = main.intents.installHostIntent( main,
+ name="DUALSTACK",
+ onosNode=0,
+ host1=host1,
+ host2=host2 )
if installResult:
- testResult = main.intentFunction.testHostIntent( main,
- name="DUALSTACK",
- intentId=installResult,
- onosNode=0,
- host1=host1,
- host2=host2,
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
+ testResult = main.intents.testHostIntent( main,
+ name="DUALSTACK",
+ intentId=installResult,
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -818,22 +816,22 @@
host1 = { "name": "h1" }
host2 = { "name": "h11" }
testResult = main.FALSE
- installResult = main.intentFunction.installHostIntent( main,
- name="DUALSTACK2",
- onosNode=0,
- host1=host1,
- host2=host2 )
+ installResult = main.intents.installHostIntent( main,
+ 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 )
+ testResult = main.intents.testHostIntent( main,
+ name="DUALSTACK2",
+ intentId=installResult,
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -847,22 +845,22 @@
host1 = { "name": "h1" }
host2 = { "name": "h3" }
testResult = main.FALSE
- installResult = main.intentFunction.installHostIntent( main,
- name="1HOP",
- onosNode=0,
- host1=host1,
- host2=host2 )
+ installResult = main.intents.installHostIntent( main,
+ 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 )
+ testResult = main.intents.testHostIntent( main,
+ name="1HOP",
+ intentId=installResult,
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -876,22 +874,21 @@
host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
testResult = main.FALSE
- installResult = main.intentFunction.installHostIntent( main,
- name="VLAN1",
- onosNode=0,
- host1=host1,
- host2=host2 )
-
+ installResult = main.intents.installHostIntent( main,
+ 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 )
+ testResult = main.intents.testHostIntent( main,
+ name="VLAN1",
+ intentId=installResult,
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -905,22 +902,22 @@
host1 = { "name": "h5", "vlan": "200" }
host2 = { "name": "h12", "vlan": "100" }
testResult = main.FALSE
- installResult = main.intentFunction.installHostIntent( main,
- name="VLAN2",
- onosNode=0,
- host1=host1,
- host2=host2 )
+ installResult = main.intents.installHostIntent( main,
+ name="VLAN2",
+ onosNode=0,
+ host1=host1,
+ host2=host2 )
if installResult:
- testResult = main.intentFunction.testHostIntent( main,
- name="VLAN2",
- intentId=installResult,
- onosNode=0,
- host1=host1,
- host2=host2,
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
+ testResult = main.intents.testHostIntent( main,
+ name="VLAN2",
+ intentId=installResult,
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -934,22 +931,22 @@
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="ENCAPSULATION",
- onosNode=0,
- host1=host1,
- host2=host2,
- encap="VLAN" )
+ installResult = main.intents.installHostIntent( main,
+ name="ENCAPSULATION",
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ encap="VLAN" )
if installResult:
- testResult = main.intentFunction.testHostIntent( main,
- name="ENCAPSULATION",
- intentId=installResult,
- onosNode=0,
- host1=host1,
- host2=host2,
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
+ testResult = main.intents.testHostIntent( main,
+ name="ENCAPSULATION",
+ intentId=installResult,
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -958,28 +955,28 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- # Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
+ # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
# main.step( "Encapsulation: Add host intents between h1 and h9" )
# main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
# 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="ENCAPSULATION",
- # onosNode=0,
- # host1=host1,
- # host2=host2,
- # encap="MPLS" )
+ # installResult = main.intents.installHostIntent( main,
+ # name="ENCAPSULATION",
+ # onosNode=0,
+ # host1=host1,
+ # host2=host2,
+ # encap="MPLS" )
# if installResult:
- # testResult = main.intentFunction.testHostIntent( main,
- # name="ENCAPSULATION",
- # intentId=installResult,
- # onosNode=0,
- # host1=host1,
- # host2=host2,
- # sw1="s5",
- # sw2="s2",
- # expectedLink=18 )
+ # testResult = main.intents.testHostIntent( main,
+ # name="ENCAPSULATION",
+ # intentId=installResult,
+ # onosNode=0,
+ # host1=host1,
+ # host2=host2,
+ # sw1="s5",
+ # sw2="s2",
+ # expectedLink=18 )
# else:
# main.CLIs[ 0 ].removeAllIntents( purge=True )
#
@@ -990,15 +987,15 @@
main.step( "Confirm that ONOS leadership is unchanged" )
intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
- testResult = main.intentFunction.checkLeaderChange( intentLeadersOld,
- intentLeadersNew )
+ testResult = main.intents.checkLeaderChange( intentLeadersOld,
+ intentLeadersNew )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
onpass="ONOS Leaders Unchanged",
onfail="ONOS Leader Mismatch" )
- main.intentFunction.report( main )
+ main.intents.report( main )
def CASE2000( self, main ):
"""
@@ -1040,7 +1037,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()
@@ -1057,6 +1054,7 @@
" OVS running in Mininet and compile intents" +\
" using " + main.flowCompiler
+ """
# No option point intents
main.step( "NOOPTION: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
@@ -1067,14 +1065,14 @@
{ "name": "h9", "device": "of:0000000000000006/1" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="NOOPTION",
senders=senders,
recipients=recipients )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="NOOPTION",
@@ -1100,7 +1098,7 @@
{ "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="IPV4",
senders=senders,
@@ -1108,7 +1106,7 @@
ethType="IPV4" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="IPV4",
@@ -1125,16 +1123,16 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- main.step("Protected: Add point intents between h1 and h9")
+ main.step( "Protected: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for protected point intent\n"
senders = [
- {"name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01"}
+ { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
]
recipients = [
- {"name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09"}
+ { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="Protected",
senders=senders,
@@ -1142,7 +1140,7 @@
protected=True )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
name="Protected",
intentId=installResult,
@@ -1169,7 +1167,7 @@
{ "name": "h9", "device": "of:0000000000000006/1" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="IPV4_2",
senders=senders,
@@ -1177,7 +1175,7 @@
ethType="IPV4" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="IPV4_2",
@@ -1209,7 +1207,7 @@
tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="SDNIP-ICMP",
senders=senders,
@@ -1220,7 +1218,7 @@
tcpDst=tcpDst )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="SDNIP_ICMP",
@@ -1248,7 +1246,7 @@
tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
- stepResult = main.intentFunction.pointIntentTcp(
+ stepResult = main.intents.pointIntentTcp(
main,
name="SDNIP-TCP",
host1="h1",
@@ -1278,7 +1276,7 @@
{ "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="DUALSTACK1",
senders=senders,
@@ -1286,7 +1284,7 @@
ethType="IPV4" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="DUALSTACK1",
@@ -1312,14 +1310,14 @@
{ "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="VLAN",
senders=senders,
recipients=recipients )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="VLAN",
@@ -1343,7 +1341,7 @@
{ "name": "h21", "vlan": "200" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="VLAN2",
senders=senders,
@@ -1351,7 +1349,7 @@
setVlan=200 )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="VLAN2",
@@ -1375,7 +1373,7 @@
{ "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="1HOP IPV4",
senders=senders,
@@ -1383,7 +1381,7 @@
ethType="IPV4" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="1HOP IPV4",
@@ -1409,7 +1407,7 @@
{ "name": "h9", "device": "of:0000000000000006/1" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="ENCAPSULATION",
senders=senders,
@@ -1417,7 +1415,7 @@
encap="VLAN" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="ENCAPSULATION",
@@ -1434,6 +1432,7 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
+ """
main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
senders = [
@@ -1443,7 +1442,7 @@
{ "name": "h9", "device": "of:0000000000000006/1" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installPointIntent(
+ installResult = main.intents.installPointIntent(
main,
name="NOOPTION",
senders=senders,
@@ -1451,7 +1450,7 @@
bandwidth=100 )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="NOOPTION",
@@ -1468,7 +1467,7 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- # Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
+ # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
# main.step( "Add point to point intents using MPLS Encapsulation" )
# main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
# senders = [
@@ -1478,7 +1477,7 @@
# { "name": "h9", "device": "of:0000000000000006/1" }
# ]
# testResult = main.FALSE
- # installResult = main.intentFunction.installPointIntent(
+ # installResult = main.intents.installPointIntent(
# main,
# name="ENCAPSULATION",
# senders=senders,
@@ -1486,7 +1485,7 @@
# encap="MPLS" )
#
# if installResult:
- # testResult = main.intentFunction.testPointIntent(
+ # testResult = main.intents.testPointIntent(
# main,
# intentId=installResult,
# name="ENCAPSULATION",
@@ -1503,7 +1502,7 @@
# onpass=main.assertReturnString,
# onfail=main.assertReturnString )
- main.intentFunction.report( main )
+ main.intents.report( main )
def CASE3000( self, main ):
"""
@@ -1543,7 +1542,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()
@@ -1572,7 +1571,7 @@
badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
+ installResult = main.intents.installSingleToMultiIntent(
main,
name="NOOPTION",
senders=senders,
@@ -1581,7 +1580,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="NOOPTION",
@@ -1612,7 +1611,7 @@
badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
+ installResult = main.intents.installSingleToMultiIntent(
main,
name="IPV4",
senders=senders,
@@ -1622,7 +1621,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="IPV4",
@@ -1653,7 +1652,7 @@
badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
+ installResult = main.intents.installSingleToMultiIntent(
main,
name="IPV4_2",
senders=senders,
@@ -1663,7 +1662,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="IPV4_2",
@@ -1694,7 +1693,7 @@
badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
+ installResult = main.intents.installSingleToMultiIntent(
main,
name="VLAN",
senders=senders,
@@ -1703,7 +1702,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="VLAN",
@@ -1734,7 +1733,7 @@
badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
+ installResult = main.intents.installSingleToMultiIntent(
main,
name="VLAN2",
senders=senders,
@@ -1744,7 +1743,7 @@
setVlan=100 )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="VLAN2",
@@ -1776,7 +1775,7 @@
# badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
# badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
# testResult = main.FALSE
- # installResult = main.intentFunction.installSingleToMultiIntent(
+ # installResult = main.intents.installSingleToMultiIntent(
# main,
# name="ENCAPSULATION",
# senders=senders,
@@ -1786,7 +1785,7 @@
# encap="VLAN" )
#
# if installResult:
- # testResult = main.intentFunction.testPointIntent(
+ # testResult = main.intents.testPointIntent(
# main,
# intentId=installResult,
# name="ENCAPSULATION",
@@ -1805,7 +1804,7 @@
# onpass=main.assertReturnString,
# onfail=main.assertReturnString )
- main.intentFunction.report( main )
+ main.intents.report( main )
def CASE4000( self, main ):
"""
@@ -1845,7 +1844,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()
@@ -1874,7 +1873,7 @@
badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
+ installResult = main.intents.installMultiToSingleIntent(
main,
name="NOOPTION",
senders=senders,
@@ -1883,7 +1882,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="NOOPTION",
@@ -1914,7 +1913,7 @@
badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
+ installResult = main.intents.installMultiToSingleIntent(
main,
name="IPV4",
senders=senders,
@@ -1924,7 +1923,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="IPV4",
@@ -1955,7 +1954,7 @@
badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
+ installResult = main.intents.installMultiToSingleIntent(
main,
name="IPV4_2",
senders=senders,
@@ -1965,7 +1964,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="IPV4_2",
@@ -1996,7 +1995,7 @@
badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
+ installResult = main.intents.installMultiToSingleIntent(
main,
name="VLAN",
senders=senders,
@@ -2005,7 +2004,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="VLAN",
@@ -2037,7 +2036,7 @@
badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
+ installResult = main.intents.installMultiToSingleIntent(
main,
name="VLAN2",
senders=senders,
@@ -2047,7 +2046,7 @@
setVlan=100 )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="VLAN2",
@@ -2078,7 +2077,7 @@
badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
+ installResult = main.intents.installMultiToSingleIntent(
main,
name="ENCAPSULATION",
senders=senders,
@@ -2088,7 +2087,7 @@
encap="VLAN" )
if installResult:
- testResult = main.intentFunction.testPointIntent(
+ testResult = main.intents.testPointIntent(
main,
intentId=installResult,
name="ENCAPSULATION",
@@ -2107,20 +2106,20 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- #Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
+ #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
#main.step( "ENCAPSULATION: Add multi point to single point intents" )
#main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
#senders = [
# { "name": "h16", "device": "of:0000000000000006/8" },
# { "name": "h24", "device": "of:0000000000000007/8" }
- #]
+ # ]
#recipients = [
# { "name": "h8", "device": "of:0000000000000005/8" }
- #]
+ # ]
#badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
- #badRecipients = [ {"name": "h9" } ] # Recipients that are not in the intent
+ #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
#testResult = main.FALSE
- #installResult = main.intentFunction.installMultiToSingleIntent(
+ #installResult = main.intents.installMultiToSingleIntent(
# main,
# name="ENCAPSULATION",
# senders=senders,
@@ -2130,7 +2129,7 @@
# encap="MPLS" )
#
#if installResult:
- # testResult = main.intentFunction.testPointIntent(
+ # testResult = main.intents.testPointIntent(
# main,
# intentId=installResult,
# name="ENCAPSULATION",
@@ -2149,7 +2148,7 @@
# onpass=main.assertReturnString,
# onfail=main.assertReturnString )
- main.intentFunction.report( main )
+ main.intents.report( main )
def CASE5000( self, main ):
"""
@@ -2175,7 +2174,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()
@@ -2194,8 +2193,8 @@
# Discover new host location in ONOS and populate host data.
# Host 1 IP and MAC should be unchanged
- main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
- main.intentFunction.populateHostData( main )
+ main.intents.sendDiscoveryArp( main, [ main.h1 ] )
+ main.intents.populateHostData( main )
h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
@@ -2212,21 +2211,21 @@
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 Mobility IPV4",
- onosNode=0,
- host1=host1,
- host2=host2 )
+ installResult = main.intents.installHostIntent( main,
+ 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 )
+ testResult = main.intents.testHostIntent( main,
+ name="Host Mobility IPV4",
+ intentId=installResult,
+ onosNode=0,
+ host1=host1,
+ host2=host2,
+ sw1="s6",
+ sw2="s2",
+ expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -2235,7 +2234,7 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- main.intentFunction.report( main )
+ main.intents.report( main )
def CASE6000( self, main ):
"""
@@ -2283,7 +2282,7 @@
]
isolatedRecipients = []
testResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
+ installResult = main.intents.installMultiToSingleIntent(
main,
name="NOOPTION",
senders=senders,
@@ -2292,7 +2291,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testEndPointFail(
+ testResult = main.intents.testEndPointFail(
main,
intentId=installResult,
name="NOOPTION",
@@ -2331,7 +2330,7 @@
]
isolatedRecipients = []
testResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
+ installResult = main.intents.installMultiToSingleIntent(
main,
name="NOOPTION",
senders=senders,
@@ -2341,7 +2340,7 @@
partial=True )
if installResult:
- testResult = main.intentFunction.testEndPointFail(
+ testResult = main.intents.testEndPointFail(
main,
intentId=installResult,
name="NOOPTION",
@@ -2380,7 +2379,7 @@
{ "name": "h24" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
+ installResult = main.intents.installSingleToMultiIntent(
main,
name="NOOPTION",
senders=senders,
@@ -2389,7 +2388,7 @@
sw2="s2" )
if installResult:
- testResult = main.intentFunction.testEndPointFail(
+ testResult = main.intents.testEndPointFail(
main,
intentId=installResult,
name="NOOPTION",
@@ -2412,7 +2411,7 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
# Right now this functionality doesn't work properly in SPMP intents
- main.step( "NOOPTION: Install and test single point to multi point " +\
+ main.step( "NOOPTION: Install and test single point to multi point " +
"intents with partial failures allowed" )
main.assertReturnString = "Assertion results for IPV4 single to multi " +\
"point intent with partial failures allowed\n"
@@ -2428,7 +2427,7 @@
{ "name": "h24" }
]
testResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
+ installResult = main.intents.installSingleToMultiIntent(
main,
name="NOOPTION",
senders=senders,
@@ -2438,7 +2437,7 @@
partial=True )
if installResult:
- testResult = main.intentFunction.testEndPointFail(
+ testResult = main.intents.testEndPointFail(
main,
intentId=installResult,
name="NOOPTION",
@@ -2462,4 +2461,4 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- main.intentFunction.report( main )
+ main.intents.report( main )
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
old mode 100755
new mode 100644
index 3051658..f295b11
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -4,10 +4,10 @@
Author: kelvin@onlab.us
"""
import time
-import copy
import json
import os
+
def __init__( self ):
self.default = ''
@@ -16,6 +16,7 @@
singleToMultiFailFlag = False
multiToSingleFailFlag = False
+
def installHostIntent( main,
name,
host1,
@@ -62,7 +63,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"
@@ -106,7 +106,7 @@
attempts=50 ):
main.assertReturnString += 'Install Intent State Passed\n'
- #Check VLAN if test encapsulation
+ # Check VLAN if test encapsulation
if encap != "":
if EncapsulatedIntentCheck( main, tag=encap ):
main.assertReturnString += 'Encapsulation intents check Passed\n'
@@ -123,7 +123,6 @@
main.assertReturnString += 'Bandwidth Allocation check Failed\n'
return main.FALSE
-
if flowDuration( main ):
main.assertReturnString += 'Flow duration check Passed\n'
return intentId
@@ -137,6 +136,7 @@
main.assertReturnString += 'Install Intent State Failed\n'
return main.FALSE
+
def testHostIntent( main,
name,
intentId,
@@ -189,7 +189,6 @@
switches are down
"""
-
# Parameter Validity Check
assert main, "There is no main variable"
assert host1, "You must specify host1"
@@ -390,6 +389,7 @@
return testResult
+
def installPointIntent( main,
name,
senders,
@@ -441,7 +441,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"
@@ -466,7 +465,6 @@
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" )
-
ingressDevice = senders[ 0 ].get( "device" )
egressDevice = recipients[ 0 ].get( "device" )
@@ -543,6 +541,7 @@
pointIntentFailFlag = True
return main.FALSE
+
def pointIntentTcp( main,
name,
host1,
@@ -565,7 +564,6 @@
sw1="",
sw2="",
expectedLink=0 ):
-
"""
Description:
Verify add-point-intent only for TCP
@@ -615,7 +613,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"
@@ -722,7 +719,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'
@@ -838,6 +835,7 @@
return stepResult
+
def installSingleToMultiIntent( main,
name,
senders,
@@ -890,7 +888,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"
@@ -915,7 +912,6 @@
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" )
-
ingressDevice = senders[ 0 ].get( "device" )
egressDeviceList = [ x.get( "device" ) for x in recipients if x.get( "device" ) ]
@@ -988,6 +984,7 @@
singleToMultiFailFlag = True
return main.FALSE
+
def installMultiToSingleIntent( main,
name,
senders,
@@ -1040,7 +1037,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"
@@ -1137,6 +1133,7 @@
multiToSingleFailFlag = True
return main.FALSE
+
def testPointIntent( main,
name,
intentId,
@@ -1204,7 +1201,6 @@
switches are down
"""
-
# Parameter Validity Check
assert main, "There is no main variable"
assert senders, "You must specify a sender"
@@ -1265,11 +1261,11 @@
retValue=main.FALSE,
args=[ main ],
sleep=main.checkFlowCountSleep,
- attempts=3 ) and utilities.retry( f=checkFlowsState,
- retValue=main.FALSE,
- args=[ main ],
- sleep=main.checkFlowCountSleep,
- attempts=3 ):
+ attempts=attempts ) and utilities.retry( f=checkFlowsState,
+ retValue=main.FALSE,
+ args=[ main ],
+ sleep=main.checkFlowCountSleep,
+ attempts=attempts ):
main.assertReturnString += 'Initial Flow State Passed\n'
else:
main.assertReturnString += 'Intial Flow State Failed\n'
@@ -1292,7 +1288,7 @@
if utilities.retry( f=scapyCheckConnection,
retValue=main.FALSE,
args=( main, badSenderNames, recipientNames ),
- kwargs={ "expectFailure":True } ):
+ kwargs={ "expectFailure": True } ):
main.assertReturnString += 'Bad Sender Ping Passed\n'
else:
main.assertReturnString += 'Bad Sender Ping Failed\n'
@@ -1303,7 +1299,7 @@
if utilities.retry( f=scapyCheckConnection,
retValue=main.FALSE,
args=( main, senderNames, badRecipientNames ),
- kwargs={ "expectFailure":True } ):
+ kwargs={ "expectFailure": True } ):
main.assertReturnString += 'Bad Recipient Ping Passed\n'
else:
main.assertReturnString += 'Bad Recipient Ping Failed\n'
@@ -1352,11 +1348,11 @@
retValue=main.FALSE,
args=[ main ],
sleep=main.checkFlowCountSleep,
- attempts=attempts * 2 ) and utilities.retry( f=checkFlowsState,
+ attempts=attempts ) and utilities.retry( f=checkFlowsState,
retValue=main.FALSE,
args=[ main ],
sleep=main.checkFlowCountSleep,
- attempts=attempts * 2 ):
+ attempts=attempts ):
main.assertReturnString += 'Link Down Flow State Passed\n'
else:
main.assertReturnString += 'Link Down Flow State Failed\n'
@@ -1411,11 +1407,11 @@
retValue=main.FALSE,
args=[ main ],
sleep=main.checkFlowCountSleep,
- attempts=3 ) and utilities.retry( f=checkFlowsState,
- retValue=main.FALSE,
- args=[ main ],
- sleep=main.checkFlowCountSleep,
- attempts=3 ):
+ attempts=attempts ) and utilities.retry( f=checkFlowsState,
+ retValue=main.FALSE,
+ args=[ main ],
+ sleep=main.checkFlowCountSleep,
+ attempts=attempts ):
main.assertReturnString += 'Link Up Flow State Passed\n'
else:
main.assertReturnString += 'Link Up Flow State Failed\n'
@@ -1434,7 +1430,7 @@
if utilities.retry( f=scapyCheckConnection,
retValue=main.FALSE,
sleep=main.checkConnectionSleep,
- attempts=100,
+ attempts=attempts,
args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
main.assertReturnString += 'Link Up Scapy Packet Received Passed\n'
else:
@@ -1453,6 +1449,7 @@
return testResult
+
def testEndPointFail( main,
name,
intentId,
@@ -1478,7 +1475,6 @@
"""
Test Multi point to single point intent Topology for Endpoint failures
"""
-
# Parameter Validity Check
assert main, "There is no main variable"
assert senders, "You must specify a sender"
@@ -1498,8 +1494,8 @@
recipientNames = [ x.get( "name" ) for x in recipients ]
isolatedSenderNames = [ x.get( "name" ) for x in isolatedSenders ]
isolatedRecipientNames = [ x.get( "name" ) for x in isolatedRecipients ]
- connectedSenderNames = [x.get("name") for x in senders if x.get("name") not in isolatedSenderNames]
- connectedRecipientNames = [x.get("name") for x in recipients if x.get("name") not in isolatedRecipientNames]
+ connectedSenderNames = [ x.get( "name" ) for x in senders if x.get( "name" ) not in isolatedSenderNames ]
+ connectedRecipientNames = [ x.get( "name" ) for x in recipients if x.get( "name" ) not in isolatedRecipientNames ]
for sender in senders:
if not sender.get( "device" ):
@@ -1508,7 +1504,7 @@
for recipient in recipients:
if not recipient.get( "device" ):
- main.log.warn( "Device not given for recipient {0}. Loading from " +\
+ 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 ):
@@ -1698,7 +1694,7 @@
if utilities.retry( f=scapyCheckConnection,
retValue=main.FALSE,
attempts=attempts,
- args=( main, connectedSenderNames , connectedRecipientNames ) ):
+ args=( main, connectedSenderNames, connectedRecipientNames ) ):
main.assertReturnString += 'Partial failure isolation link Down Connectivity Check Passed\n'
else:
main.assertReturnString += 'Partial failure isolation link Down Connectivity Check Failed\n'
@@ -1826,10 +1822,10 @@
args=[ main ],
sleep=main.checkFlowCountSleep,
attempts=attempts ) and utilities.retry( f=checkFlowsState,
- retValue=main.FALSE,
- args=[ main ],
- sleep=main.checkFlowCountSleep,
- attempts=attempts ):
+ retValue=main.FALSE,
+ args=[ main ],
+ sleep=main.checkFlowCountSleep,
+ attempts=attempts ):
main.assertReturnString += 'Link Up Flow State Passed\n'
else:
main.assertReturnString += 'Link Up Flow State Failed\n'
@@ -1875,6 +1871,7 @@
main.log.info( "Pinging: " + str( hostList ) )
return main.Mininet1.pingallHosts( hostList )
+
def fwdPingall( main ):
"""
Use fwd app and pingall to discover all the hosts
@@ -1896,7 +1893,7 @@
# Send pingall in mininet
main.log.info( "Run Pingall" )
- pingResult = main.Mininet1.pingall( timeout = 600 )
+ pingResult = main.Mininet1.pingall( timeout=600 )
main.log.info( "Deactivating reactive forwarding app " )
deactivateResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
@@ -1908,6 +1905,7 @@
getDataResult = main.FALSE
return getDataResult
+
def confirmHostDiscovery( main ):
"""
Confirms that all ONOS nodes have discovered all scapy hosts
@@ -1937,7 +1935,8 @@
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:
@@ -1953,6 +1952,7 @@
else:
return main.TRUE
+
def sendDiscoveryArp( main, hosts=None ):
"""
Sends Discovery ARP packets from each host provided
@@ -1973,6 +1973,7 @@
host.sendPacket( packet=pkt, iface=iface )
main.log.info( "Sending ARP packet from {0}".format( host.name ) )
+
def populateHostData( main ):
"""
Populates hostsData
@@ -2008,6 +2009,7 @@
main.log.error( "TypeError while populating hostsData" )
return main.FALSE
+
def checkTopology( main, expectedLink ):
statusResult = main.TRUE
# Check onos topology
@@ -2022,6 +2024,7 @@
main.log.info( itemName + ": Topology match" )
return statusResult
+
def checkIntentState( main, intentsId ):
"""
This function will check intent state to make sure all the intents
@@ -2040,6 +2043,7 @@
intentResult = main.FALSE
return intentResult
+
def checkBandwidthAllocations( main, bandwidth ):
"""
Compare the given bandwith allocation output to the cli output on each node
@@ -2057,12 +2061,14 @@
bandwidthResult = main.FALSE
return bandwidthResult
+
def checkFlowsState( main ):
main.log.info( itemName + ": Check flows state" )
checkFlowsResult = main.CLIs[ 0 ].checkFlowsState( isPENDING=False )
return checkFlowsResult
+
def link( main, sw1, sw2, option ):
# link down
@@ -2071,6 +2077,7 @@
linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
return linkResult
+
def scapyCheckConnection( main,
senders,
recipients,
@@ -2093,7 +2100,7 @@
if not packetFilter:
packetFilter = 'ether host {}'
if useTCP:
- packetFilter += ' ip proto \\tcp tcp port {}'.format(main.params[ 'SDNIP' ][ 'dstPort' ])
+ packetFilter += ' ip proto \\tcp tcp port {}'.format( main.params[ 'SDNIP' ][ 'dstPort' ] )
if expectFailure:
timeout = 1
else:
@@ -2119,9 +2126,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:
@@ -2142,21 +2149,21 @@
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 ) )
connectionsFunctional = main.TRUE
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
@@ -2166,7 +2173,6 @@
"""
Remove all intents in the intentsId
"""
-
onosSummary = []
removeIntentResult = main.TRUE
# Remove intents
@@ -2195,6 +2201,7 @@
return removeIntentResult
+
def checkFlowsCount( main ):
"""
Check flows count in each node
@@ -2212,7 +2219,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:
@@ -2225,6 +2232,7 @@
return main.TRUE
+
def checkLeaderChange( leaders1, leaders2 ):
"""
Checks for a change in intent partition leadership.
@@ -2250,18 +2258,19 @@
for dict1 in leaders1:
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 ):
+ if dict1.get( "topic", 0 ) == dict2.get( "topic", 0 ) and\
+ 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( "%s changed leader from %s to %s",
+ 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
@@ -2278,26 +2287,26 @@
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 ):
"""
Check age of flows to see if flows are being overwritten
"""
- import time
main.log.info( "Getting current flow durations" )
flowsJson1 = main.CLIs[ 0 ].flows( noCore=True )
try:
@@ -2337,7 +2346,7 @@
def EncapsulatedIntentCheck( main, tag="" ):
"""
Check encapsulated intents
- tag: encapsulation tag (e.g. VLAN, MPLS)
+ tag: encapsulation tag ( e.g. VLAN, MPLS )
Getting added flows
Check tags on each flows
@@ -2345,7 +2354,6 @@
else failed
"""
- import json
HostJson = []
Jflows = main.CLIs[ 0 ].flows( noCore=True )
try:
@@ -2355,10 +2363,10 @@
return main.FALSE
for flow in Jflows:
- if len(flow[ "flows" ]) != 0:
+ if len( flow[ "flows" ] ) != 0:
HostJson.append( flow[ "flows" ] )
- totalflows = len( HostJson[ 0 ])
+ totalflows = len( HostJson[ 0 ] )
pop = 0
push = 0
@@ -2378,8 +2386,8 @@
else:
return main.FALSE
+
def ProtectedIntentCheck( main ):
- import json
intent = main.CLIs[ 0 ].intents( jsonFormat=False )
if "Protection" in intent:
return main.TRUE
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/startUp.py b/TestON/tests/FUNC/FUNCintent/dependencies/startUp.py
index bf2a2b6..8122586 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/startUp.py
+++ b/TestON/tests/FUNC/FUNCintent/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/FUNCintent/dependencies/topo.py b/TestON/tests/FUNC/FUNCintent/dependencies/topo.py
index b44e3fc..7217d4d 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/topo.py
+++ b/TestON/tests/FUNC/FUNCintent/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
-
-