Add HA tests
If no OC vars are found, set onosdriver.maxNodes to None
Change-Id: I74ff5762a8399a93084e0d8a2acd11acb8a5f4e5
diff --git a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index 45bb3bf..dad6099 100644
--- a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -65,15 +65,28 @@
# set global variables
global numControllers
numControllers = int( main.params[ 'num_controllers' ] )
+ if main.ONOSbench.maxNodes:
+ if main.ONOSbench.maxNodes < numControllers:
+ numControllers = int( main.ONOSbench.maxNodes )
global CLIs
CLIs = []
global nodes
nodes = []
- for i in range( 1, numControllers + 1 ):
- CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
- nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+ ipList = []
+ for i in range( 1, int( main.ONOSbench.maxNodes ) + 1 ):
+ try:
+ CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+ nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+ ipList.append( nodes[ -1 ].ip_address )
+ except AttributeError:
+ break
+ main.step( "Create cell file" )
+ cellAppString = main.params[ 'ENV' ][ 'appString' ]
+ main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
+ main.Mininet1.ip_address,
+ cellAppString, ipList )
main.step( "Applying cell variable to environment" )
cellResult = main.ONOSbench.setCell( cellName )
verifyResult = main.ONOSbench.verifyCell()
@@ -135,7 +148,7 @@
# job = name of Jenkins job
# Plot Name = Plot-HA, only can be used if multiple plots
# index = The number of the graph under plot name
- job = "HASingleInstanceRestart"
+ job = "HAsingleInstanceRestart"
plotName = "Plot-HA"
graphs = '<ac:structured-macro ac:name="html">\n'
graphs += '<ac:plain-text-body><![CDATA[\n'
@@ -148,6 +161,17 @@
graphs += '</ac:structured-macro>\n'
main.log.wiki(graphs)
+ CLIs = []
+ nodes = []
+ ipList = []
+ for i in range( 1, numControllers + 1 ):
+ CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+ nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+ ipList.append( nodes[ -1 ].ip_address )
+
+ main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "SingleHA",
+ main.Mininet1.ip_address,
+ cellAppString, ipList[ 0 ] )
cellResult = main.ONOSbench.setCell( "SingleHA" )
verifyResult = main.ONOSbench.verifyCell()
main.step( "Creating ONOS package" )
@@ -1777,7 +1801,6 @@
main.step( "Packing and rotating pcap archives" )
os.system( "~/TestON/dependencies/rotate.sh " + str( testname ) )
-
main.step( "Stopping Mininet" )
mnResult = main.Mininet1.stopNet()
utilities.assert_equals( expect=main.TRUE, actual=mnResult,
@@ -2095,7 +2118,12 @@
main.step( "Counters we added have the correct values" )
correctResults = main.TRUE
for i in range( numControllers ):
- current = json.loads( onosCounters[i] )
+ try:
+ current = json.loads( onosCounters[i] )
+ except ( ValueError, TypeError ):
+ main.log.error( "Could not parse counters response from ONOS" +
+ str( i + 1 ) )
+ main.log.warn( repr( onosCounters[ i ] ) )
pValue = None
iValue = None
try: