Updating test for TOST QA Pod
Add more robust topology check to Segment routing tests
Fix Typos
Include minimum flow count # in the comparision (>= vs > )
Add option for username and password in onos-app function
Don't add app prefix if it looks like it is already the full name
Change-Id: Ib4af0f72df8e7dcc5c179fafea1fd9c61d931246
(cherry picked from commit cda0902ee85041b22da8ad7638a8518914d07322)
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/dependencies/SRSwitchFailureFuncs.py b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/dependencies/SRSwitchFailureFuncs.py
index 908c359..b25ace4 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/dependencies/SRSwitchFailureFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/dependencies/SRSwitchFailureFuncs.py
@@ -20,6 +20,7 @@
"""
from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
+import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator
class SRSwitchFailureFuncs():
@@ -29,28 +30,59 @@
self.topo[ '0x1' ] = ( 0, 1, '--leaf=1 --spine=0', 'single switch' )
self.topo[ '2x2' ] = ( 2, 2, '', '2x2 Leaf-spine' )
self.topo[ '4x4' ] = ( 4, 4, '--leaf=4 --spine=4', '4x4 Leaf-spine' )
+ main.switchType = "ovs"
def runTest( self, main, caseNum, numNodes, Topo, minFlow ):
try:
- if not hasattr( main, 'apps' ):
- run.initTest( main )
-
description = "Switch Failure test with " + self.topo[ Topo ][ 3 ] + " and {} Onos".format( numNodes )
main.case( description )
-
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
main.cfgName = Topo
main.Cluster.setRunningNode( numNodes )
run.installOnos( main )
- run.loadJson( main )
+ suf = main.params.get( 'jsonFileSuffix', '')
+ xconnectFile = "%s%s-xconnects.json%s" % ( main.configPath + main.forJson,
+ main.cfgName, suf )
+ if main.useBmv2:
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ # Translate configuration file from OVS-OFDPA to BMv2 driver
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
+ # translate xconnects
+ translator.bmv2ToOfdpa( main, cfgFile=xconnectFile )
+ translator.ofdpaToBmv2( main, cfgFile=xconnectFile, switchPrefix=switchPrefix )
+ else:
+ translator.bmv2ToOfdpa( main )
+ translator.bmv2ToOfdpa( main, cfgFile=xconnectFile )
+ if suf:
+ run.loadJson( main, suffix=suf )
+ else:
+ run.loadJson( main )
run.loadChart( main )
- run.startMininet( main, 'cord_fabric.py', args=self.topo[ Topo ][ 2 ] )
- # pre-configured routing and bridging test
- run.checkFlows( main, minFlowCount=minFlow )
- run.pingAll( main )
- # switch failure\
+ if hasattr( main, 'Mininet1' ):
+ run.mnDockerSetup( main ) # optionally create and setup docker image
+
+ # Run the test with Mininet
+ mininet_args = self.topo[ Topo ][ 2 ]
+ if main.useBmv2:
+ mininet_args += ' --switch %s' % main.switchType
+ main.log.info( "Using %s switch" % main.switchType )
+
+ run.startMininet( main, 'cord_fabric.py', args=mininet_args )
+ else:
+ # Run the test with physical devices
+ # TODO: connect TestON to the physical network
+ pass
+ # xconnects need to be loaded after topology
+ run.loadXconnects( main )
+ # switch failure
switch = main.params[ 'kill' ][ 'switch' ]
switchNum = self.topo[ Topo ][ 0 ] + self.topo[ Topo ][ 1 ]
linkNum = ( self.topo[ Topo ][ 0 ] + self.topo[ Topo ][ 1 ] ) * self.topo[ Topo ][ 0 ]
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=minFlow )
+ run.pingAll( main )
run.killSwitch( main, switch, switches='{}'.format( switchNum - 1 ), links='{}'.format( linkNum - switchNum ) )
run.pingAll( main, "CASE{}_Failure".format( caseNum ) )
run.recoverSwitch( main, switch, switches='{}'.format( switchNum ), links='{}'.format( linkNum ) )