Run codecheck script on FUNCbgpls
Change-Id: I17d73cf6f556768f0f020904e8e2b2054cd853be
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
old mode 100755
new mode 100644
index 9d049fc..571e457
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
@@ -14,8 +14,6 @@
"""
-
-
class FUNCbgpls:
def __init__( self ):
@@ -39,7 +37,6 @@
start BGPLS apps
"""
-
import os
main.log.info( "ONOS Single node start " +
@@ -48,21 +45,20 @@
main.caseExplanation = "Setup the test environment including " +\
"installing ONOS, start ONOS."
-
PULLCODE = False
if main.params[ 'GIT' ][ 'pull' ] == 'True':
PULLCODE = True
gitBranch = main.params[ 'GIT' ][ 'branch' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
- scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
+ scapy_ip = os.getenv( main.params[ 'SCAPY' ][ 'HOSTNAMES' ] )
main.log.info( "Removing raft logs" )
main.ONOSbench.onosRemoveRaftLogs()
main.CLIs = []
main.nodes = []
- main.numCtrls= 1
+ main.numCtrls = 1
for i in range( 1, main.numCtrls + 1 ):
try:
@@ -141,7 +137,7 @@
onfail="Test step FAIL" )
main.step( "Checking if ONOS is up yet" )
- print main.nodes[0].ip_address
+ print main.nodes[ 0 ].ip_address
for i in range( 2 ):
onos1Isup = main.ONOSbench.isup( main.nodes[ 0 ].ip_address )
if onos1Isup:
@@ -160,12 +156,12 @@
main.step( "App Ids check" )
appCheck = main.ONOScli1.appToIDCheck()
- if appCheck !=main.TRUE:
+ if appCheck != main.TRUE:
main.log.warn( main.CLIs[ 0 ].apps() )
main.log.warn( main.CLIs[ 0 ].appIDs() )
utilities.assert_equals( expect=main.TRUE, actual=appCheck,
- onpass="App Ids seem to be correct",
- onfail="Something is wrong with app Ids" )
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
if cliResults == main.FALSE:
main.log.error( "Failed to start ONOS,stopping test" )
main.cleanup()
@@ -175,7 +171,8 @@
"""
Discovery the topology using BGPLS
"""
- import os , sys
+ import os
+ import sys
import re
import time
@@ -195,14 +192,13 @@
app = bgplsConfig.apps()
main.CLIs = []
main.nodes = []
- main.numCtrls= 1
-
+ main.numCtrls = 1
ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
- scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
- httpport = main.params['HTTP']['port']
- path = main.params['HTTP']['path']
- bgplsConfig.ipValue(ipList,scapy_ip)
+ scapy_ip = os.getenv( main.params[ 'SCAPY' ][ 'HOSTNAMES' ] )
+ httpport = main.params[ 'HTTP' ][ 'port' ]
+ path = main.params[ 'HTTP' ][ 'path' ]
+ bgplsConfig.ipValue( ipList, scapy_ip )
for i in range( 1, main.numCtrls + 1 ):
try:
@@ -219,21 +215,19 @@
main.log.info( "Sending BGPLS information" )
bgplsConfig.Comments()
-
main.Scapy1.handle.sendline( "sudo python OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/\
dependencies/Scapyfiles/Topo_discovery.py" )
bgplsConfig.Comments()
main.log.info( "Enable BGPlS plugin in ONOS" )
bgplsConfig.Comments()
-
- cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address)
+ cliResults = main.ONOScli1.startOnosCli( main.nodes[ 0 ].ip_address )
main.step( "Getting connected to ONOS" )
utilities.assert_equals( expect=main.TRUE, actual=cliResults,
onpass="ONOS cli startup successful",
onfail="ONOS cli startup failed" )
- installResults = main.ONOScli1.activateApp( app[0])
+ installResults = main.ONOScli1.activateApp( app[ 0 ] )
main.step( "Install onos-app-bgp" )
utilities.assert_equals( expect=main.TRUE, actual=installResults,
@@ -246,10 +240,10 @@
main.log.info( "BGPLS RestConf input" )
bgplsConfig.Comments()
- print (bgpls_post)
+ print ( bgpls_post )
main.ONOSrest.user_name = "onos"
main.ONOSrest.pwd = "rocks"
- Poststatus, result = main.ONOSrest.send( '/network/configuration/', method="POST", data=bgpls_post)
+ Poststatus, result = main.ONOSrest.send( '/network/configuration/', method="POST", data=bgpls_post )
main.step( "Configure BGP through RESTCONF" )
utilities.assert_equals( expect='200',
@@ -257,11 +251,10 @@
onpass="Post Port Success",
onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
-
bgplsConfig.Comments()
main.step( "Check Network devices are Updated in ONOS " )
bgplsConfig.Comments()
- time.sleep(15)
+ time.sleep( 15 )
response = main.ONOScli1.devices()
responseCheck = main.FALSE
if response:
@@ -272,21 +265,21 @@
onfail="Network Devices update in ONOS failed" )
main.step( "Check the nodes are discovered" )
- if response.find( Ne_id[1][0]) and response.find(Ne_id[1][1]) and response.find(Ne_id[1][2]) != -1:
+ if response.find( Ne_id[ 1 ][ 0 ] ) and response.find( Ne_id[ 1 ][ 1 ] ) and response.find( Ne_id[ 1 ][ 2 ] ) != -1:
stepResult = main.TRUE
else:
stepResult = main.FALSE
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
- onpass="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " sucess",
- onfail="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " failed" )
+ onpass="Node " + str( Ne_id[ 1 ][ 0 ] ) + ( Ne_id[ 1 ][ 1 ] ) + ( Ne_id[ 1 ][ 2 ] ) + " sucess",
+ onfail="Node " + str( Ne_id[ 1 ][ 0 ] ) + ( Ne_id[ 1 ][ 1 ] ) + ( Ne_id[ 1 ][ 2 ] ) + " failed" )
main.ONOScli1.log( "\"testcase2 end\"" )
main.step( "Check for Errors or Exception in testcase2" )
startStr = "testcase2 start"
endStr = "testcase2 end"
- errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
- ["ERROR","EXCEPT"], "s",
+ errorLog = main.ONOSbench.logReport( main.nodes[ 0 ].ip_address,
+ [ "ERROR", "EXCEPT" ], "s",
startStr, endStr )
utilities.assert_equals( expect=0, actual=errorLog,
onpass="No Exception or Error occured in testcase2",
@@ -296,13 +289,14 @@
bgplsConfig.Comments()
main.Scapy1.handle.sendline( "\x03" )
- time.sleep( 90 ) #This Sleep time gives time for the socket to close.
+ time.sleep( 90 ) # This Sleep time gives time for the socket to close.
def CASE3( self, main ):
"""
Addition of new Node to existing topology
"""
- import os , sys
+ import os
+ import sys
import re
import time
@@ -321,17 +315,16 @@
app = bgplsConfig.apps()
main.CLIs = []
main.nodes = []
- main.numCtrls= 1
-
+ main.numCtrls = 1
ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
- scapy_ip = os.getenv( main.params ['SCAPY'] ['HOSTNAMES'] )
+ scapy_ip = os.getenv( main.params[ 'SCAPY' ][ 'HOSTNAMES' ] )
cellName = main.params[ 'ENV' ][ 'cellName' ]
- cellAppString= main.params[ 'ENV' ][ 'cellApps' ]
- httpport = main.params['HTTP']['port']
- path = main.params['HTTP']['path']
+ cellAppString = main.params[ 'ENV' ][ 'cellApps' ]
+ httpport = main.params[ 'HTTP' ][ 'port' ]
+ path = main.params[ 'HTTP' ][ 'path' ]
- bgplsConfig.ipValue(ipList,scapy_ip)
+ bgplsConfig.ipValue( ipList, scapy_ip )
for i in range( 1, main.numCtrls + 1 ):
try:
@@ -352,18 +345,17 @@
bgplsConfig.Comments()
main.step( "UnInstall onos-app-bgp" )
- installResults = main.ONOScli1.deactivateApp( app[0] )
+ installResults = main.ONOScli1.deactivateApp( app[ 0 ] )
utilities.assert_equals( expect=main.TRUE, actual=installResults,
onpass="Uninstall onos-app-bgp successful",
onfail="Uninstall onos-app-bgp failed" )
- installResults = main.ONOScli1.activateApp( app[0])
+ installResults = main.ONOScli1.activateApp( app[ 0 ] )
main.step( "Install onos-app-bgp" )
utilities.assert_equals( expect=main.TRUE, actual=installResults,
onpass="Install onos-app-bgp successful",
onfail="Install onos-app-bgp failed" )
-
bgpls_post = bgplsConfig.DictoJson()
bgplsConfig.Comments()
@@ -373,7 +365,7 @@
bgplsConfig.Comments()
main.step( "Check Network devices are Updated in ONOS" )
bgplsConfig.Comments()
- time.sleep(120)
+ time.sleep( 120 )
response = main.ONOScli1.devices()
responseCheck = main.FALSE
if response:
@@ -384,7 +376,7 @@
onfail="Network Devices update in ONOS failed" )
main.step( "Check Newly added Node is getting updated" )
- if response.find( Ne_id[1][3]) != -1:
+ if response.find( Ne_id[ 1 ][ 3 ] ) != -1:
stepResult = main.TRUE
else:
stepResult = main.FALSE
@@ -397,8 +389,8 @@
main.step( "Check for Errors or Exception in testcase3" )
startStr = "testcase3 start"
endStr = "testcase3 end"
- errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
- ["ERROR","EXCEPT"], "s",
+ errorLog = main.ONOSbench.logReport( main.nodes[ 0 ].ip_address,
+ [ "ERROR", "EXCEPT" ], "s",
startStr, endStr )
utilities.assert_equals( expect=0, actual=errorLog,
onpass="No Exception or Error occured in testcase3",
@@ -407,7 +399,7 @@
main.log.info( "Kill Scapy process" )
bgplsConfig.Comments()
main.Scapy1.handle.sendline( "\x03" )
- time.sleep( 90 ) #This Sleep time gives time for the socket to close.
+ time.sleep( 90 ) # This Sleep time gives time for the socket to close.
def CASE4( self, main ):
"""
@@ -430,10 +422,10 @@
app = bgplsConfig.apps()
main.CLIs = []
main.nodes = []
- main.numCtrls= 1
+ main.numCtrls = 1
ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
- scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
- bgplsConfig.ipValue(ipList,scapy_ip)
+ scapy_ip = os.getenv( main.params[ 'SCAPY' ][ 'HOSTNAMES' ] )
+ bgplsConfig.ipValue( ipList, scapy_ip )
for i in range( 1, main.numCtrls + 1 ):
try:
@@ -458,7 +450,7 @@
onpass="Uninstall onos-app-bgp successful",
onfail="Uninstall onos-app-bgp failed" )
- installResults = main.ONOScli1.activateApp( app[ 0 ])
+ installResults = main.ONOScli1.activateApp( app[ 0 ] )
main.step( "Install onos-app-bgp" )
utilities.assert_equals( expect=main.TRUE, actual=installResults,
onpass="Install onos-app-bgp successful",
@@ -471,9 +463,9 @@
linksResp = json.loads( response )
check_link = bgplsConfig.checkLinks( linksResp )
- if check_link == True:
+ if check_link:
reply_Check_Link = main.TRUE
- utilities.assert_equals( expect= main.TRUE, actual=reply_Check_Link,
+ utilities.assert_equals( expect=main.TRUE, actual=reply_Check_Link,
onpass="Link Discovery Success.",
onfail="Link Discovery Failed." )
main.ONOScli1.log( "\"testcase4 end\"" )
@@ -481,10 +473,10 @@
main.step( "Check for Errors or Exception in testcase4 " )
startStr = "testcase4 start"
endStr = "testcase4 end"
- errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
- ["ERROR","EXCEPT"], "s",
+ errorLog = main.ONOSbench.logReport( main.nodes[ 0 ].ip_address,
+ [ "ERROR", "EXCEPT" ], "s",
startStr, endStr )
- utilities.assert_equals( expect= 0, actual=errorLog,
+ utilities.assert_equals( expect=0, actual=errorLog,
onpass="No Exception or Error occured in testcase4",
onfail="Exception or Error occured in testcase4" )
bgplsConfig.Comments()
@@ -515,10 +507,10 @@
app = bgplsConfig.apps()
main.CLIs = []
main.nodes = []
- main.numCtrls= 1
+ main.numCtrls = 1
ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
- scapy_ip = os.getenv(main.params [ 'SCAPY' ] [ 'HOSTNAMES' ] )
- bgplsConfig.ipValue(ipList,scapy_ip)
+ scapy_ip = os.getenv( main.params[ 'SCAPY' ][ 'HOSTNAMES' ] )
+ bgplsConfig.ipValue( ipList, scapy_ip )
for i in range( 1, main.numCtrls + 1 ):
try:
@@ -543,7 +535,7 @@
onpass="Uninstall onos-app-bgp successful",
onfail="Uninstall onos-app-bgp failed" )
- installResults = main.ONOScli1.activateApp( app[ 0 ])
+ installResults = main.ONOScli1.activateApp( app[ 0 ] )
main.step( "Install onos-app-bgp" )
utilities.assert_equals( expect=main.TRUE, actual=installResults,
onpass="Install onos-app-bgp successful",
@@ -555,9 +547,9 @@
response = main.ONOScli1.links()
linksResp = json.loads( response )
check_link = bgplsConfig.checkLinks( linksResp )
- if check_link == False:
+ if not check_link:
reply_Check_Link = main.TRUE
- utilities.assert_equals( expect= main.TRUE, actual=reply_Check_Link,
+ utilities.assert_equals( expect=main.TRUE, actual=reply_Check_Link,
onpass="Link is Deleted Successfully.",
onfail="Link is Deletion Failed." )
main.ONOScli1.log( "\"testcase5 end\"" )
@@ -565,8 +557,8 @@
main.step( "Check for Errors or Exception in testcase5" )
startStr = "testcase5 start"
endStr = "testcase5 end"
- errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
- ["ERROR","EXCEPT"], "s",
+ errorLog = main.ONOSbench.logReport( main.nodes[ 0 ].ip_address,
+ [ "ERROR", "EXCEPT" ], "s",
startStr, endStr )
utilities.assert_equals( expect=0, actual=errorLog,
onpass="No Exception or Error occured in testcase5",
@@ -581,7 +573,8 @@
"""
Uninstalling the app
"""
- import os,sys
+ import os
+ import sys
import re
import time
@@ -599,16 +592,15 @@
app = bgplsConfig.apps()
main.CLIs = []
main.nodes = []
- main.numCtrls= 1
-
+ main.numCtrls = 1
ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
- scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
+ scapy_ip = os.getenv( main.params[ 'SCAPY' ][ 'HOSTNAMES' ] )
cellName = main.params[ 'ENV' ][ 'cellName' ]
- cellAppString= main.params[ 'ENV' ][ 'cellApps' ]
+ cellAppString = main.params[ 'ENV' ][ 'cellApps' ]
bgplsConfig = BgpLs()
- bgplsConfig.ipValue(ipList,scapy_ip)
+ bgplsConfig.ipValue( ipList, scapy_ip )
main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
scapy_ip,
cellAppString, ipList )
@@ -629,7 +621,7 @@
main.step( "Logging into ONOS CLI " )
bgplsConfig.Comments()
- cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
+ cliResults = main.ONOScli1.startOnosCli( main.nodes[ 0 ].ip_address )
utilities.assert_equals( expect=main.TRUE, actual=cliResults,
onpass="ONOS cli startup successful",
onfail="ONOS cli startup failed" )
@@ -638,7 +630,7 @@
main.log.info( "Uninstall onos-app-bgp" )
bgplsConfig.Comments()
main.step( "UnInstall onos-app-bgp" )
- installResults = main.ONOScli1.deactivateApp( app[0] )
+ installResults = main.ONOScli1.deactivateApp( app[ 0 ] )
utilities.assert_equals( expect=main.TRUE, actual=installResults,
onpass="Uninstall onos-app-bgp successful",
onfail="Uninstall onos-app-bgp failed" )
@@ -647,16 +639,16 @@
main.step( "Check for Errors or Exception in testcase6" )
startStr = "testcase6 start"
endStr = "testcase6 end"
- errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
- ["ERROR","EXCEPT"], "s",
+ errorLog = main.ONOSbench.logReport( main.nodes[ 0 ].ip_address,
+ [ "ERROR", "EXCEPT" ], "s",
startStr, endStr )
utilities.assert_equals( expect=0, actual=errorLog,
onpass="No Exception or Error occured in testcase6",
onfail="Exception or Error occured in testcase6" )
main.step( "Check for Errors or Exception End of the Script" )
- errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
- ["ERROR","EXCEPT"] )
+ errorLog = main.ONOSbench.logReport( main.nodes[ 0 ].ip_address,
+ [ "ERROR", "EXCEPT" ] )
utilities.assert_equals( expect=0, actual=errorLog,
onpass="No Exception or Error occured",
onfail="Exception or Error occured" )
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py
old mode 100755
new mode 100644
index 5661cb8..14f1500
--- a/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py
@@ -1,4 +1,4 @@
-"""**** Scripted by Antony Silvester ****** """
+"**** Scripted by Antony Silvester ****** "
import json
from urllib import addbase
import os
@@ -10,7 +10,7 @@
class BgpLs:
- def __init__(self):
+ def __init__( self ):
self.localAs = 100
self.maxSession = 20
self.lsCapability = True
@@ -26,99 +26,98 @@
self.peerIp = ''
#self.org_bgp = []
- def ipValue(self,localip,remoteip):
+ def ipValue( self, localip, remoteip ):
self.routerId = localip
self.peerIp = remoteip
- return self.routerId , self.peerIp
+ return self.routerId, self.peerIp
- def DictoJson(self):
+ def DictoJson( self ):
Dicdata = {}
- org_bgp =[]
- org_bgp.append({'peerIp': self.peerIp , 'remoteAs':self.remoteAs,
- 'peerHoldTime':self.peerHoldTime , 'connectMode':self.connectMode })
+ org_bgp = []
+ org_bgp.append( { 'peerIp': self.peerIp, 'remoteAs': self.remoteAs,
+ 'peerHoldTime': self.peerHoldTime, 'connectMode': self.connectMode } )
if self.routerId != '':
- Dicdata['routerId'] = self.routerId
+ Dicdata[ 'routerId' ] = self.routerId
if self.localAs != '':
- Dicdata['localAs'] = self.localAs
+ Dicdata[ 'localAs' ] = self.localAs
if self.maxSession != '':
- Dicdata['maxSession'] = self.maxSession
+ Dicdata[ 'maxSession' ] = self.maxSession
if self.lsCapability != '':
- Dicdata['lsCapability'] = self.lsCapability
+ Dicdata[ 'lsCapability' ] = self.lsCapability
if self.holdTime != '':
- Dicdata['holdTime'] = self.holdTime
+ Dicdata[ 'holdTime' ] = self.holdTime
if self.largeAsCapability != '':
- Dicdata['largeAsCapability'] = self.largeAsCapability
+ Dicdata[ 'largeAsCapability' ] = self.largeAsCapability
if self.flowSpecCapability != '':
- Dicdata['flowSpecCapability'] = self.flowSpecCapability
+ Dicdata[ 'flowSpecCapability' ] = self.flowSpecCapability
if self.flowSpecRpdCapability != '':
- Dicdata['flowSpecRpdCapability'] = self.flowSpecRpdCapability
+ Dicdata[ 'flowSpecRpdCapability' ] = self.flowSpecRpdCapability
if self.bgpPeer != '':
- Dicdata['bgpPeer'] = org_bgp
+ Dicdata[ 'bgpPeer' ] = org_bgp
- Dicdata = {'bgpapp':Dicdata}
- Dicdata = {'org.onosproject.provider.bgp.cfg':Dicdata}
- Dicdata = {'apps':Dicdata}
- return json.dumps(Dicdata,indent=4)
+ Dicdata = { 'bgpapp': Dicdata }
+ Dicdata = { 'org.onosproject.provider.bgp.cfg': Dicdata }
+ Dicdata = { 'apps': Dicdata }
+ return json.dumps( Dicdata, indent=4 )
+ def Comments( self ):
+ print( "**********************************************************************************\n" )
- def Comments(self):
- print("**********************************************************************************\n")
-
- def Constants(self):
- self.Ne_id_1 = '1111.1111.0011'
+ def Constants( self ):
+ self.Ne_id_1 = '1111.1111.0011'
self.Ne_id_2 = '2222.2222.0022'
self.Ne_id_3 = '3333.3333.0033'
self.Ne_id_4 = '4444.4444.0044'
- listnum = [self.Ne_id_1,self.Ne_id_2,self.Ne_id_3,self.Ne_id_4,]
- var = [self.peerIp]
- return var,listnum
+ listnum = [ self.Ne_id_1, self.Ne_id_2, self.Ne_id_3, self.Ne_id_4, ]
+ var = [ self.peerIp ]
+ return var, listnum
- def apps(self):
+ def apps( self ):
self.app_bgp = 'org.onosproject.bgp'
self.app_bgpflow = 'org.onosproject.bgpflow'
- self.list1 = [self.app_bgp,self.app_bgpflow]
+ self.list1 = [ self.app_bgp, self.app_bgpflow ]
return self.list1
- def checkLinks(self,linksResp):
+ def checkLinks( self, linksResp ):
#Declaring the links values
- links = {'link1_src' : "1650.5555.0055", 'link1_dst' : "1660.6666.0066",
- 'link2_src' : "1630.3333.0033", 'link2_dst' : "1620.2222.0022",
- 'link3_src' : "1660.6666.0066", 'link3_dst' : "1650.5555.0055",
- 'link4_src' : "1630.3333.0033", 'link4_dst' : "1650.5555.0055",
- 'link5_src' : "1640.4444.0044", 'link5_dst' : "1610.1111.0011",
- 'link6_src' : "1650.5555.0055", 'link4_dst' : "1630.3333.0033",
- 'link7_src' : "1620.2222.0022", 'link4_dst' : "1630.3333.0033",
- 'link8_src' : "1620.2222.0022", 'link4_dst' : "1610.1111.0011",
- 'link9_src' : "1630.3333.0033", 'link4_dst' : "1640.4444.0044",
- 'link10_src' : "1650.5555.0055", 'link4_dst' : "1640.4444.0044",
- 'link11_src' : "1610.1111.0011", 'link4_dst' : "1640.4444.0044",
- 'link12_src' : "1640.4444.0044", 'link4_dst' : "1620.2222.0022",
- 'link13_src' : "1660.6666.0066", 'link4_dst' : "1630.3333.0033",
- 'link14_src' : "1640.4444.0044", 'link4_dst' : "1660.6666.0066",
- 'link15_src' : "1640.4444.0044", 'link4_dst' : "1630.3333.0033",
- 'link16_src' : "1610.1111.0011", 'link4_dst' : "1630.3333.0033",
- 'link17_src' : "1630.3333.0033", 'link4_dst' : "1610.1111.0011",
- 'link18_src' : "1610.1111.0011", 'link4_dst' : "1620.2222.0022",
- 'link19_src' : "1620.2222.0022", 'link4_dst' : "1640.4444.0044",
- 'link20_src' : "1630.3333.0033", 'link4_dst' : "1660.6666.0066",
- 'link21_src' : "1640.4444.0044", 'link4_dst' : "1650.5555.0055",
- 'link22_src' : "1660.6666.0066", 'link4_dst' : "1640.4444.0044"
- }
+ links = { 'link1_src': "1650.5555.0055", 'link1_dst': "1660.6666.0066",
+ 'link2_src': "1630.3333.0033", 'link2_dst': "1620.2222.0022",
+ 'link3_src': "1660.6666.0066", 'link3_dst': "1650.5555.0055",
+ 'link4_src': "1630.3333.0033", 'link4_dst': "1650.5555.0055",
+ 'link5_src': "1640.4444.0044", 'link5_dst': "1610.1111.0011",
+ 'link6_src': "1650.5555.0055", 'link4_dst': "1630.3333.0033",
+ 'link7_src': "1620.2222.0022", 'link4_dst': "1630.3333.0033",
+ 'link8_src': "1620.2222.0022", 'link4_dst': "1610.1111.0011",
+ 'link9_src': "1630.3333.0033", 'link4_dst': "1640.4444.0044",
+ 'link10_src': "1650.5555.0055", 'link4_dst': "1640.4444.0044",
+ 'link11_src': "1610.1111.0011", 'link4_dst': "1640.4444.0044",
+ 'link12_src': "1640.4444.0044", 'link4_dst': "1620.2222.0022",
+ 'link13_src': "1660.6666.0066", 'link4_dst': "1630.3333.0033",
+ 'link14_src': "1640.4444.0044", 'link4_dst': "1660.6666.0066",
+ 'link15_src': "1640.4444.0044", 'link4_dst': "1630.3333.0033",
+ 'link16_src': "1610.1111.0011", 'link4_dst': "1630.3333.0033",
+ 'link17_src': "1630.3333.0033", 'link4_dst': "1610.1111.0011",
+ 'link18_src': "1610.1111.0011", 'link4_dst': "1620.2222.0022",
+ 'link19_src': "1620.2222.0022", 'link4_dst': "1640.4444.0044",
+ 'link20_src': "1630.3333.0033", 'link4_dst': "1660.6666.0066",
+ 'link21_src': "1640.4444.0044", 'link4_dst': "1650.5555.0055",
+ 'link22_src': "1660.6666.0066", 'link4_dst': "1640.4444.0044"
+ }
#Comparing the Links
- for x in xrange(22):
- link_src_info = linksResp[x]['src']['device']
- link_dst_info = linksResp[x]['dst']['device']
- link_src_split = link_src_info.split("=")
- link_src = link_src_split[4]
- link_dst_split = link_dst_info.split("=")
- link_dst = link_dst_split[4]
- y = x+1
- link_src_ref = links['link'+str(y)+'_src']
- link_dst_ref = links['link'+str(y)+'_dst']
- if (link_src == link_src_ref) and (link_dst == (link_dst_ref) and \
- linksResp[x]['type'] == 'DIRECT' and linksResp[x]['state'] == \
- 'ACTIVE'):
+ for x in xrange( 22 ):
+ link_src_info = linksResp[ x ][ 'src' ][ 'device' ]
+ link_dst_info = linksResp[ x ][ 'dst' ][ 'device' ]
+ link_src_split = link_src_info.split( "=" )
+ link_src = link_src_split[ 4 ]
+ link_dst_split = link_dst_info.split( "=" )
+ link_dst = link_dst_split[ 4 ]
+ y = x + 1
+ link_src_ref = links[ 'link' + str( y ) + '_src' ]
+ link_dst_ref = links[ 'link' + str( y ) + '_dst' ]
+ if ( link_src == link_src_ref ) and ( link_dst == ( link_dst_ref ) and
+ linksResp[ x ][ 'type' ] == 'DIRECT' and linksResp[ x ][ 'state' ] ==
+ 'ACTIVE' ):
return True
else:
return False