Add Network Configuration subsytem test
Includes get/set/delete drivers for the netCfg REST API
Change-Id: Ic9a3b7187367ff83af2fa6979602631a920bbb83
diff --git a/TestON/tests/FUNCnetCfg/Dependency/netCfg.py b/TestON/tests/FUNCnetCfg/Dependency/netCfg.py
new file mode 100644
index 0000000..eb2ab73
--- /dev/null
+++ b/TestON/tests/FUNCnetCfg/Dependency/netCfg.py
@@ -0,0 +1,32 @@
+"""
+These functions are for use with the Network config system
+"""
+import time
+
+def compareCfg( main, gossipTime=None ):
+ """
+ Compare the network configurations across all nodes in the network
+ gossipTime is the number of seconds each gossip round take for the netCfg maps
+ """
+ main.step( "Check net config" )
+ if gossipTime:
+ time.sleep( gossipTime * len( main.nodes ) )
+ responses = []
+ failMsg = "Net Cfg is different on some nodes."
+ failed = False
+ for node in main.nodes:
+ response = node.getNetCfg( )
+ responses.append( node.pprint( response ) )
+ if response == main.FALSE:
+ failed = True
+ compare = [ i == responses[0] for i in responses ]
+ if failed:
+ failMsg += " Some nodes failed to GET netCfg."
+ utilities.assert_equals( expect=True,
+ actual=all( compare ),
+ onpass="Net Cfg is the same on all nodes",
+ onfail=failMsg )
+ if not all( compare ):
+ main.log.debug( "Net Config results:" )
+ for i in responses:
+ main.log.debug( i )
diff --git a/TestON/tests/FUNCnetCfg/Dependency/startUp.py b/TestON/tests/FUNCnetCfg/Dependency/startUp.py
new file mode 100644
index 0000000..cfaf589
--- /dev/null
+++ b/TestON/tests/FUNCnetCfg/Dependency/startUp.py
@@ -0,0 +1,32 @@
+"""
+ This wrapper function is use for starting up onos instance
+"""
+
+import time
+
+def onosBuild( main, gitBranch ):
+ """
+ This includes pulling ONOS and building it using maven install
+ """
+
+ buildResult = main.FALSE
+
+ # Git checkout a branch of ONOS
+ checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
+ # Does the git pull on the branch that was checked out
+ if not checkOutResult:
+ main.log.warn( "Failed to checked out " + gitBranch +
+ " branch")
+ else:
+ main.log.info( "Successfully checked out " + gitBranch +
+ " branch")
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == main.ERROR:
+ main.log.error( "Error pulling git branch" )
+ else:
+ main.log.info( "Successfully pulled " + gitBranch + " branch" )
+
+ # Maven clean install
+ buildResult = main.ONOSbench.cleanInstall()
+
+ return buildResult
diff --git a/TestON/tests/FUNCnetCfg/Dependency/topo.py b/TestON/tests/FUNCnetCfg/Dependency/topo.py
new file mode 100644
index 0000000..d834a09
--- /dev/null
+++ b/TestON/tests/FUNCnetCfg/Dependency/topo.py
@@ -0,0 +1,98 @@
+"""
+ 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
+ """
+ devices = []
+ threads = []
+ for i in range( main.numCtrls ):
+ t = main.Thread( target=main.CLIs[i].devices,
+ name="devices-" + str( i ),
+ args=[ ] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ devices.append( t.result )
+ return devices
+
+def getAllHosts( main ):
+ """
+ Return a list containing the hosts output from each ONOS node
+ """
+ hosts = []
+ ipResult = main.TRUE
+ threads = []
+ for i in range( main.numCtrls ):
+ t = main.Thread( target=main.CLIs[i].hosts,
+ name="hosts-" + str( i ),
+ args=[ ] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ hosts.append( t.result )
+ return hosts
+
+def getAllPorts( main ):
+ """
+ Return a list containing the ports output from each ONOS node
+ """
+ ports = []
+ threads = []
+ for i in range( main.numCtrls ):
+ t = main.Thread( target=main.CLIs[i].ports,
+ name="ports-" + str( i ),
+ args=[ ] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ ports.append( t.result )
+ return ports
+
+def getAllLinks( main ):
+ """
+ Return a list containing the links output from each ONOS node
+ """
+ links = []
+ threads = []
+ for i in range( main.numCtrls ):
+ t = main.Thread( target=main.CLIs[i].links,
+ name="links-" + str( i ),
+ args=[ ] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ links.append( t.result )
+ return links
+
+def getAllClusters( main ):
+ """
+ Return a list containing the clusters output from each ONOS node
+ """
+ clusters = []
+ threads = []
+ for i in range( main.numCtrls ):
+ t = main.Thread( target=main.CLIs[i].clusters,
+ name="clusters-" + str( i ),
+ args=[ ] )
+ threads.append( t )
+ t.start()
+
+ for t in threads:
+ t.join()
+ clusters.append( t.result )
+ return clusters