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/SRMulticast/dependencies/SRMulticastTest.py b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
index 1802221..c6d52fd 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
@@ -25,51 +25,55 @@
     from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
     import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator
 
-    skipPackage = False
-    init = False
-    if not hasattr( main, "apps" ):
-        init = True
-        lib.initTest( main )
-    # 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 )
+        # Skip onos packaging if the cluster size stays the same
+        if not init and onosNodes == main.Cluster.numCtrls:
+            skipPackage = True
 
-    main.resultFileName = "CASE%03d" % test_idx
-    main.Cluster.setRunningNode( onosNodes )
-    lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
-    # Load configuration files
-    main.step( "Load configurations" )
-    main.cfgName = "TEST_CONFIG_ipv4=1_ipv6=1" if hasattr( main, "Mininet1" ) else 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 )
-    time.sleep( float( main.params[ "timers" ][ "loadNetcfgSleep" ] ) )
-    main.cfgName = "common" if hasattr( main, "Mininet1" ) else main.params[ "DEPENDENCY" ][ "confName" ]
-    lib.loadMulticastConfig( main )
-    lib.loadHost( main )
-
-    if hasattr( main, "Mininet1" ):
-        # Run the test with Mininet
-        mininet_args = " --dhcp=1 --routers=1 --ipv6=1 --ipv4=1"
+        main.resultFileName = "CASE%03d" % test_idx
+        main.Cluster.setRunningNode( onosNodes )
+        lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
+        # Load configuration files
+        main.step( "Load configurations" )
+        main.cfgName = "TEST_CONFIG_ipv4=1_ipv6=1" if hasattr( main, "Mininet1" ) else main.params[ "DEPENDENCY" ][ "confName" ]
         if main.useBmv2:
-            mininet_args += ' --switch bmv2'
-            main.log.info( "Using BMv2 switch" )
-        lib.startMininet( main, main.params[ "DEPENDENCY" ][ "topology" ], args=mininet_args )
-        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 )
+        time.sleep( float( main.params[ "timers" ][ "loadNetcfgSleep" ] ) )
+        main.cfgName = "common" if hasattr( main, "Mininet1" ) else main.params[ "DEPENDENCY" ][ "confName" ]
+        lib.loadMulticastConfig( main )
+        lib.loadHost( main )
 
-    # Create scapy components
-    lib.startScapyHosts( main )
-    # Verify host IP assignment
-    lib.verifyOnosHostIp( main )
-    lib.verifyNetworkHostIp( main )
+        if hasattr( main, "Mininet1" ):
+            # Run the test with Mininet
+            mininet_args = " --dhcp=1 --routers=1 --ipv6=1 --ipv4=1"
+            if main.useBmv2:
+                mininet_args += ' --switch bmv2'
+                main.log.info( "Using BMv2 switch" )
+            lib.startMininet( main, main.params[ "DEPENDENCY" ][ "topology" ], args=mininet_args )
+            time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
+        else:
+            # Run the test with physical devices
+            lib.connectToPhysicalNetwork( main )
+
+        # Create scapy components
+        lib.startScapyHosts( main )
+        # Verify host IP assignment
+        lib.verifyOnosHostIp( main )
+        lib.verifyNetworkHostIp( main )
+    except Exception as e:
+        main.log.exception( "Error in setupTest" )
+        main.skipCase( result="FAIL", msg=e )
 
 def verifyMcastRoutes( main ):
     """