Run codecheck script on FUNCnetconf
Change-Id: If73187519cd3a6548b0714547e90c6c7a0b9cb31
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
index 27ead3e..4b0ce12 100644
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
@@ -7,24 +7,25 @@
import json
import os
+
def __init__( self ):
self.default = ''
+
def startApp( main ):
"""
This function starts the netconf app in all onos nodes and ensures that
the OF-Config server is running on the node to be configured
"""
-
startResult = main.FALSE
startResult = main.CLIs[ 0 ].activateApp( appName="org.onosproject.netconf" )
return startResult
+
def startOFC( main ):
"""
This function uses pexpect pxssh class to activate the ofc-server daemon on OC2
"""
-
startResult = main.FALSE
try:
main.ONOSbench.handle.sendline( "" )
@@ -46,6 +47,7 @@
main.cleanup()
main.exit()
+
def createConfig( main ):
"""
This function writes a configuration file that can later be sent to the
@@ -55,8 +57,8 @@
"""
createCfgResult = main.FALSE
# TODO, add ability to set Manufacturer, Hardware and Software versions
- main.cfgJson = '{ "devices":{ "netconf:'+ main.configDeviceIp + ":" +\
- main.configDevicePort + '":' + '{ "basic":{ "driver":"'+\
+ main.cfgJson = '{ "devices":{ "netconf:' + main.configDeviceIp + ":" +\
+ main.configDevicePort + '":' + '{ "basic":{ "driver":"' +\
main.configDriver + '" } } }, "apps": { "' +\
main.configApps + '":{ "devices":[ { "username":' +\
main.configName + ', "password":' + main.configPass +\
@@ -70,7 +72,7 @@
# configured.
# main.cfgJson = json.loads( main.cfgJson )
# main.cfgJson = json.dumps( main.cfgJson, sort_keys=True,
- # indent=4, separators=(',', ': '))
+ # indent=4, separators=( ',', ': ' ) )
print main.cfgJson
file.write( main.cfgJson )
if file:
@@ -78,12 +80,13 @@
file.close()
return createCfgResult
else:
- main.log.error( "There was an error opening the file")
+ main.log.error( "There was an error opening the file" )
return createCfgResult
except:
- main.log.exception( "There was an error opening the file")
+ main.log.exception( "There was an error opening the file" )
return createCfgResult
+
def sendConfig( main ):
"""
This function prepares the command needed to upload the configuration
@@ -95,13 +98,14 @@
configResult = main.FALSE
sendResult = main.CLIs[ 0 ].send( url=url, method=method, data=data )
main.log.info( "Device configuration request response code: " + str( sendResult[ 0 ] ) )
- if ( 200 <= sendResult[ 0 ] <= 299):
+ if ( 200 <= sendResult[ 0 ] <= 299 ):
configResult = main.TRUE
else:
configResult = main.FALSE
return configResult
+
def devices( main ):
"""
This function get the list of devices from the REST API, the ONOS CLI, and
@@ -123,7 +127,7 @@
main.log.info( "API device availability result: " + str( apiDict[ 0 ].get( "available" ) ) )
main.log.info( "CLI device availability result: " + str( cliDict[ 0 ].get( "available" ) ) )
- if apiDict[ 0 ].get( "available" ) == True and cliDict[ 0 ].get( "available" ) == True:
+ if apiDict[ 0 ].get( "available" ) and cliDict[ 0 ].get( "available" ):
availResult = main.TRUE
main.log.info( "API device type result: " + apiDict[ 0 ].get( "type" ) )
main.log.info( "CLI device type result: " + cliDict[ 0 ].get( "type" ) )
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/startUp.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/startUp.py
index bf2a2b6..8122586 100644
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/startUp.py
+++ b/TestON/tests/FUNC/FUNCnetconf/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/FUNCnetconf/dependencies/topo.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/topo.py
index b44e3fc..7217d4d 100644
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/topo.py
+++ b/TestON/tests/FUNC/FUNCnetconf/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
-
-