Stability fixes for SR Tests and small fixes for running ONOS in docker
- move checkOptions to component driver
- use karafTimeout for SR tests
- Fix some docker options
- Make sure mn docker can resolve own hostname
- Fix config file ip format for DHCP relay app
Change-Id: I85e8c52384e0fb478462fa9bbaf0b31a599b632b
(cherry picked from commit 521ecde3f8d28288303ea11129faa0cfd86b9bcd)
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum
index 835baff..29d1415 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum
@@ -25,7 +25,7 @@
</DEPENDENCY>
<MN_DOCKER>
- <args>--privileged --net host --rm -v topo:/topo -v ~/mininet/custom:/home/root/mininet/custom -v /var/run/openvswitch/:/var/run/openvswitch/ -v /tmp/mn-stratum:/tmp -v /tmp/mn_conf/:/home/root --hostname mn-stratum -v /etc/network/interfaces:/etc/network/interfaces -v /lib/modules:/lib/modules -it -d</args>
+ <args>--privileged --net host --rm -v topo:/topo -v ~/mininet/custom:/home/root/mininet/custom -v /var/run/openvswitch/:/var/run/openvswitch/ -v /tmp/mn-stratum:/tmp -v /tmp/mn_conf/:/home/root/config --hostname mn-stratum -v /etc/network/interfaces:/etc/network/interfaces -v /lib/modules:/lib/modules -it -d</args>
<name>trellis_mininet</name>
<home>/home/root/</home>
</MN_DOCKER>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
index 2868b57..24864e5 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -28,82 +28,87 @@
import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator
import time
- skipPackage = False
- init = False
- if not hasattr( main, 'apps' ):
- init = True
- lib.initTest( main )
- if onosNodes < 0:
- onosNodes = main.Cluster.numCtrls
- # Skip onos packaging if the cluster size stays the same
- if not init and onosNodes == main.Cluster.numCtrls:
- skipPackage = True
+ try:
+ skipPackage = False
+ init = False
+ if not hasattr( main, 'apps' ):
+ init = True
+ lib.initTest( main )
+ if onosNodes < 0:
+ onosNodes = main.Cluster.numCtrls
+ # Skip onos packaging if the cluster size stays the same
+ if not init and onosNodes == main.Cluster.numCtrls:
+ skipPackage = True
- main.internalIpv4Hosts = main.params[ 'TOPO' ][ 'internalIpv4Hosts' ].split( ',' )
- main.internalIpv6Hosts = main.params[ 'TOPO' ][ 'internalIpv6Hosts' ].split( ',' )
- main.externalIpv4Hosts = main.params[ 'TOPO' ][ 'externalIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv4Hosts') else []
- main.externalIpv6Hosts = main.params[ 'TOPO' ][ 'externalIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv6Hosts') else []
- main.staticIpv4Hosts = main.params[ 'TOPO' ][ 'staticIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv4Hosts') else []
- main.staticIpv6Hosts = main.params[ 'TOPO' ][ 'staticIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv6Hosts') else []
- main.disconnectedIpv4Hosts = []
- main.disconnectedIpv6Hosts = []
- main.disconnectedExternalIpv4Hosts = []
- main.disconnectedExternalIpv6Hosts = []
- main.disconnectedStaticIpv4Hosts = []
- main.disconnectedStaticIpv6Hosts = []
- main.resultFileName = 'CASE%03d' % test_idx
- main.Cluster.setRunningNode( onosNodes )
+ main.internalIpv4Hosts = main.params[ 'TOPO' ][ 'internalIpv4Hosts' ].split( ',' )
+ main.internalIpv6Hosts = main.params[ 'TOPO' ][ 'internalIpv6Hosts' ].split( ',' )
+ main.externalIpv4Hosts = main.params[ 'TOPO' ][ 'externalIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv4Hosts') else []
+ main.externalIpv6Hosts = main.params[ 'TOPO' ][ 'externalIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv6Hosts') else []
+ main.staticIpv4Hosts = main.params[ 'TOPO' ][ 'staticIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv4Hosts') else []
+ main.staticIpv6Hosts = main.params[ 'TOPO' ][ 'staticIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv6Hosts') else []
+ main.disconnectedIpv4Hosts = []
+ main.disconnectedIpv6Hosts = []
+ main.disconnectedExternalIpv4Hosts = []
+ main.disconnectedExternalIpv6Hosts = []
+ main.disconnectedStaticIpv4Hosts = []
+ main.disconnectedStaticIpv6Hosts = []
+ main.resultFileName = 'CASE%03d' % test_idx
+ main.Cluster.setRunningNode( onosNodes )
- lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
+ lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
- # Load configuration files
- if hasattr( main, "Mininet1" ):
- main.cfgName = 'TEST_CONFIG_ipv4={}_ipv6={}'.format( 1 if ipv4 else 0,
- 1 if ipv6 else 0)
- else:
- main.cfgName = main.params[ "DEPENDENCY" ][ "confName" ]
- if main.useBmv2:
- # Translate configuration file from OVS-OFDPA to BMv2 driver
- translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
- switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
- translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
- else:
- translator.bmv2ToOfdpa( main )
- lib.loadJson( main )
- main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
- time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
- lib.loadHost( main )
-
- # if static route flag add routes
- # these routes are topology specific
- if static:
- if ipv4:
- lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1")
- lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.5.1")
- if ipv6:
- lib.addStaticOnosRoute( main, "2000::8700/120", "2000::101")
- lib.addStaticOnosRoute( main, "2000::8700/120", "2000::501")
- if countFlowsGroups:
- lib.loadCount( main )
-
- if hasattr( main, 'Mininet1' ):
- lib.mnDockerSetup( main )
- # Run the test with Mininet
- mininet_args = ' --dhcp=1 --routers=1 --ipv6={} --ipv4={}'.format( 1 if ipv6 else 0,
- 1 if ipv4 else 0 )
+ # Load configuration files
+ if hasattr( main, "Mininet1" ):
+ main.cfgName = 'TEST_CONFIG_ipv4={}_ipv6={}'.format( 1 if ipv4 else 0,
+ 1 if ipv6 else 0)
+ else:
+ main.cfgName = main.params[ "DEPENDENCY" ][ "confName" ]
if main.useBmv2:
- mininet_args += ' --switch %s' % main.switchType
- main.log.info( "Using %s switch" % main.switchType )
- lib.startMininet( main, main.params[ 'DEPENDENCY' ][ 'topology' ], args=mininet_args )
- main.log.debug( "Waiting %i seconds for ONOS to discover dataplane" % float( main.params[ "timers" ][ "startMininetSleep" ] ))
- time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
- else:
- # Run the test with physical devices
- lib.connectToPhysicalNetwork( main )
+ # Translate configuration file from OVS-OFDPA to BMv2 driver
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
+ else:
+ translator.bmv2ToOfdpa( main )
+ lib.loadJson( main )
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
+ time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
+ lib.loadHost( main )
- # wait some time for onos to install the rules!
- main.log.info( "Waiting %i seconds for ONOS to program the dataplane" % float( main.params[ "timers" ][ "dhcpSleep" ] ))
- time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) )
+ # if static route flag add routes
+ # these routes are topology specific
+ if static:
+ if ipv4:
+ lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1")
+ lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.5.1")
+ if ipv6:
+ lib.addStaticOnosRoute( main, "2000::8700/120", "2000::101")
+ lib.addStaticOnosRoute( main, "2000::8700/120", "2000::501")
+ if countFlowsGroups:
+ lib.loadCount( main )
+
+ if hasattr( main, 'Mininet1' ):
+ lib.mnDockerSetup( main )
+ # Run the test with Mininet
+ mininet_args = ' --dhcp=1 --routers=1 --ipv6={} --ipv4={}'.format( 1 if ipv6 else 0,
+ 1 if ipv4 else 0 )
+ if main.useBmv2:
+ mininet_args += ' --switch %s' % main.switchType
+ main.log.info( "Using %s switch" % main.switchType )
+ lib.startMininet( main, main.params[ 'DEPENDENCY' ][ 'topology' ], args=mininet_args )
+ main.log.debug( "Waiting %i seconds for ONOS to discover dataplane" % float( main.params[ "timers" ][ "startMininetSleep" ] ))
+ time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
+ else:
+ # Run the test with physical devices
+ lib.connectToPhysicalNetwork( main )
+
+ lib.saveOnosDiagnostics( main )
+ # wait some time for onos to install the rules!
+ main.log.info( "Waiting %i seconds for ONOS to program the dataplane" % float( main.params[ "timers" ][ "dhcpSleep" ] ))
+ time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) )
+ except Exception as e:
+ main.log.exception( "Error in setupTest" )
+ main.skipCase( result="FAIL", msg=e )
def verifyPingInternal( main, ipv4=True, ipv6=True, disconnected=True ):
"""