Add Stratum support for SRDynamicConf

- Add bmv2 switch support to cord_fabric topo file
- Fix some error handling for SR tests
- Updating testcases to run for SR Stratum tests
- Fix Tost-ONOS docker image tag for onos-2.2
- Update make command for changed variable names
- Fix expected hosts files for SRDhcprelay
    - Fix case 12 config
    - Add config for cases 3 and 4
    - Create generic files

Change-Id: I39d499baaf69eb047e261fd2d6b6f2e846707719
(cherry picked from commit c15b8dfb3093c1b693ea05227ada9a9f1c6d4afb)
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index d3f843d..941f6e7 100755
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -116,6 +116,8 @@
                 auth = None
             main.log.info( self.name + ": Sending request " + path + " using " +
                            method.upper() + " method." )
+            if debug:
+                main.log.debug( self.name + ": request data: " + str( data ) )
             response = requests.request( method.upper(),
                                          path,
                                          params=query,
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 72ed62c..158c706 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -301,7 +301,7 @@
                 startCliCommand = "onos " + str( ONOSIp )
             self.handle.sendline( startCliCommand )
             tries = 0
-            setTimeout = False
+            timeoutSet = False
             while tries < 5:
                 i = self.handle.expect( [
                     self.karafPrompt,
@@ -309,7 +309,7 @@
                     pexpect.TIMEOUT ], onosStartTimeout )
 
                 if i == 0:
-                    if setTimeout:
+                    if not karafTimeout or timeoutSet:
                         main.log.info( str( ONOSIp ) + " CLI Started successfully" )
                         return main.TRUE
                     if karafTimeout:
@@ -318,8 +318,9 @@
                                      sshIdleTimeout " +
                             str( karafTimeout ) )
                         self.handle.expect( "closed by remote host" )
+                        self.handle.expect( self.Prompt() )
                         self.handle.sendline( startCliCommand )
-                        setTimeout = True
+                        timeoutSet = True
                 elif i == 1:
                     main.log.info( str( ONOSIp ) + " CLI asking for password" )
                     main.log.debug( "Sending %s" % self.karafPass )
@@ -327,6 +328,7 @@
                 else:
                     # If failed, send ctrl+c to process and try again
                     main.log.info( "Starting CLI failed. Retrying..." )
+                    time.sleep( 5 )
                     self.handle.send( "\x03" )
                     self.handle.sendline( startCliCommand )
                 tries += 1
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
index 460b769..52770f7 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
@@ -16,7 +16,7 @@
         <useCommonConf>False</useCommonConf>
         <useCommonTopo>True</useCommonTopo>
         <useBmv2>False</useBmv2>
-        <bmv2SwitchType>bmv2</bmv2SwitchType>
+        <bmv2SwitchType>stratum</bmv2SwitchType>
         <stratumRoot>~/stratum</stratumRoot>
         <topology>trellis_fabric.py</topology>
         <lib>routinglib.py,trellislib.py,stratum.py</lib>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.stratum b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.stratum
index fdbf848..64878d1 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.stratum
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.stratum
@@ -34,7 +34,7 @@
     <CLUSTER>
         # Params for onos docker
         <dockerSkipBuild>True</dockerSkipBuild>
-        <dockerBuildCmd>make ONOS_BRANCH=master DOCKER_TAG=TestON-master onos-build trellis-control-build trellis-t3-build tost-build</dockerBuildCmd> # If using another cmd like make
+        <dockerBuildCmd>make ONOS_VERSION=master DOCKER_TAG=TestON-master onos-build trellis-control-build trellis-t3-build tost-build</dockerBuildCmd> # If using another cmd like make
         <dockerBuildTimeout>1200</dockerBuildTimeout>
         <dockerFilePath>~/tost-onos</dockerFilePath>
         <dockerImageTag>tost:TestON-master</dockerImageTag>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
index a617716..c3d93be 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
@@ -100,5 +100,5 @@
         except Exception as e:
             main.log.exception( "Error in runTest" )
             main.skipCase( result="FAIL", msg=e )
-
-        run.cleanup( main )
+        finally:
+            run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/dependencies/SRClusterRestartFuncs.py b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/dependencies/SRClusterRestartFuncs.py
index 7ddd2aa..c11e4a0 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/dependencies/SRClusterRestartFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/dependencies/SRClusterRestartFuncs.py
@@ -67,8 +67,5 @@
         except Exception as e:
             main.log.exception( "Error in runTest" )
             main.skipCase( result="FAIL", msg=e )
-        if hasattr( main, 'Mininet1' ):
+        finally:
             run.cleanup( main )
-        else:
-            # TODO: disconnect TestON from the physical network
-            pass
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params.stratum b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params.stratum
index 15abde5..9ee4b09 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params.stratum
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params.stratum
@@ -1,5 +1,5 @@
 <PARAMS>
-    <testcases>1,2,11,12,21,22,31,41,51,61,71</testcases>
+    <testcases>1,2,21,22,41,61</testcases>
 
     <GRAPH>
         <nodeCluster>Fabric</nodeCluster>
@@ -33,7 +33,7 @@
     <CLUSTER>
         # Params for onos docker
         <dockerSkipBuild>True</dockerSkipBuild>
-        <dockerBuildCmd>make ONOS_BRANCH=master DOCKER_TAG=TestON-master onos-build trellis-control-build trellis-t3-build tost-build</dockerBuildCmd> # If using another cmd like make
+        <dockerBuildCmd>make ONOS_VERSION=master DOCKER_TAG=TestON-master onos-build trellis-control-build trellis-t3-build tost-build</dockerBuildCmd> # If using another cmd like make
         <dockerBuildTimeout>1200</dockerBuildTimeout>
         <dockerFilePath>~/tost-onos</dockerFilePath>
         <dockerImageTag>tost:TestON-master</dockerImageTag>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/SRDhcprelayTest.py b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/SRDhcprelayTest.py
index 15e33a3..d5f89a6 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/SRDhcprelayTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/SRDhcprelayTest.py
@@ -87,5 +87,5 @@
         except Exception as e:
             main.log.exception( "Error in runTest" )
             main.skipCase( result="FAIL", msg=e )
-
-        run.cleanup( main )
+        finally:
+            run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE03.host b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE03.host
new file mode 100644
index 0000000..9428e54
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE03.host
@@ -0,0 +1,16 @@
+{
+    "onos":
+    {
+        "00:AA:00:00:00:01/None": "10.0.2.1",
+        "00:AA:00:00:00:02/None": "10.0.2.2",
+        "00:AA:00:00:00:03/None": "10.0.3.1",
+        "00:AA:00:00:00:04/None": "10.0.3.2"
+    },
+    "network":
+    {
+        "h1": "10.0.2.1",
+        "h2": "10.0.2.2",
+        "h3": "10.0.3.1",
+        "h4": "10.0.3.2"
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE04.host b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE04.host
new file mode 100644
index 0000000..9428e54
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE04.host
@@ -0,0 +1,16 @@
+{
+    "onos":
+    {
+        "00:AA:00:00:00:01/None": "10.0.2.1",
+        "00:AA:00:00:00:02/None": "10.0.2.2",
+        "00:AA:00:00:00:03/None": "10.0.3.1",
+        "00:AA:00:00:00:04/None": "10.0.3.2"
+    },
+    "network":
+    {
+        "h1": "10.0.2.1",
+        "h2": "10.0.2.2",
+        "h3": "10.0.3.1",
+        "h4": "10.0.3.2"
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE12.host b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE12.host
index d99eef6..7241b17 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE12.host
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/CASE12.host
@@ -1,10 +1,10 @@
 {
     "onos":
     {
-        "00:AA:00:00:00:01/None": "2000::201",
-        "00:AA:00:00:00:02/None": "2000::202",
-        "00:AA:00:00:00:03/None": "2000::301",
-        "00:AA:00:00:00:04/None": "2000::302"
+        "00:BB:00:00:00:01/None": "2000::201",
+        "00:BB:00:00:00:02/None": "2000::202",
+        "00:BB:00:00:00:03/None": "2000::301",
+        "00:BB:00:00:00:04/None": "2000::302"
     },
     "network":
     {
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v4.host b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v4.host
new file mode 100644
index 0000000..9428e54
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v4.host
@@ -0,0 +1,16 @@
+{
+    "onos":
+    {
+        "00:AA:00:00:00:01/None": "10.0.2.1",
+        "00:AA:00:00:00:02/None": "10.0.2.2",
+        "00:AA:00:00:00:03/None": "10.0.3.1",
+        "00:AA:00:00:00:04/None": "10.0.3.2"
+    },
+    "network":
+    {
+        "h1": "10.0.2.1",
+        "h2": "10.0.2.2",
+        "h3": "10.0.3.1",
+        "h4": "10.0.3.2"
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v4tagged.host b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v4tagged.host
new file mode 100644
index 0000000..5927f93
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v4tagged.host
@@ -0,0 +1,16 @@
+{
+    "onos":
+    {
+        "00:AA:00:00:00:01/20": "10.0.2.1",
+        "00:AA:00:00:00:02/20": "10.0.2.2",
+        "00:AA:00:00:00:03/30": "10.0.3.1",
+        "00:AA:00:00:00:04/30": "10.0.3.2"
+    },
+    "network":
+    {
+        "h1": "10.0.2.1",
+        "h2": "10.0.2.2",
+        "h3": "10.0.3.1",
+        "h4": "10.0.3.2"
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v6.host b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v6.host
new file mode 100644
index 0000000..7241b17
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v6.host
@@ -0,0 +1,16 @@
+{
+    "onos":
+    {
+        "00:BB:00:00:00:01/None": "2000::201",
+        "00:BB:00:00:00:02/None": "2000::202",
+        "00:BB:00:00:00:03/None": "2000::301",
+        "00:BB:00:00:00:04/None": "2000::302"
+    },
+    "network":
+    {
+        "h1v6": "2000::201",
+        "h2v6": "2000::202",
+        "h3v6": "2000::301",
+        "h4v6": "2000::302"
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v6tagged.host b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v6tagged.host
new file mode 100644
index 0000000..411e2f4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/host/v6tagged.host
@@ -0,0 +1,16 @@
+{
+    "onos":
+    {
+        "00:BB:00:00:00:01/40": "2000::201",
+        "00:BB:00:00:00:02/40": "2000::202",
+        "00:BB:00:00:00:03/50": "2000::301",
+        "00:BB:00:00:00:04/50": "2000::302"
+    },
+    "network":
+    {
+        "h1v6": "2000::201",
+        "h2v6": "2000::202",
+        "h3v6": "2000::301",
+        "h4v6": "2000::302"
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamic/dependencies/SRDynamicFuncs.py b/TestON/tests/USECASE/SegmentRouting/SRDynamic/dependencies/SRDynamicFuncs.py
index 3071651..0ca4c91 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamic/dependencies/SRDynamicFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamic/dependencies/SRDynamicFuncs.py
@@ -66,14 +66,11 @@
             # TODO Dynamic config of vlan xconnect
             # TODO Vrouter integration
             # TODO Mcast integration
-            if hasattr( main, 'Mininet1' ):
-                run.cleanup( main )
-            else:
-                # TODO: disconnect TestON from the physical network
-                pass
         except Exception as e:
             main.log.exception( "Error in runTest" )
             main.skipCase( result="FAIL", msg=e )
+        finally:
+            run.cleanup( main )
 
     def killAndDelete( self, main, caseNum, numNodes, minBeforeFlow, switch, link ):
         run.killOnos( main, [ 0 ], '{}'.format( switch ), '{}'.format( link ), '{}'.format( numNodes - 1 ) )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params
index 7a04891..1de0c98 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params
@@ -17,6 +17,7 @@
         <useBmv2>False</useBmv2>
         <topology>trellis_fabric.py</topology>
         <lib>routinglib.py,trellislib.py,stratum.py</lib>
+        <conf>dhcpd.conf,dhcpd6.conf,bgpdr1.conf,bgpdr2.conf,bgpdbgp1.conf,zebradbgp1.conf,bgpdbgp2.conf,zebradbgp2.conf</conf>
         <trellisOar>/home/sdn/segmentrouting-oar-3.0.0-SNAPSHOT.oar</trellisOar>
         <t3Oar>/home/sdn/t3-app-3.0.0-SNAPSHOT.oar</t3Oar>
     </DEPENDENCY>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params.stratum b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params.stratum
new file mode 100644
index 0000000..857cd4c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params.stratum
@@ -0,0 +1,100 @@
+<PARAMS>
+    <testcases>range(13, 251, 10)</testcases>
+
+    <GRAPH>
+        <nodeCluster>Fabric</nodeCluster>
+        <builds>20</builds>
+        <jobName>SRDynamicConf-stratum</jobName>
+    </GRAPH>
+
+    <SCALE>
+        <size>3</size>
+        <max>3</max>
+    </SCALE>
+
+    <DEPENDENCY>
+        <useCommonConf>False</useCommonConf>
+        <useCommonTopo>True</useCommonTopo>
+        <useBmv2>True</useBmv2>
+        <bmv2SwitchType>stratum</bmv2SwitchType>
+        <switchPrefix>bmv2</switchPrefix>
+        <stratumRoot>~/stratum</stratumRoot>
+        <topology>trellis_fabric.py</topology>
+        <lib>routinglib.py,trellislib.py,stratum.py</lib>
+        <conf>dhcpd.conf,dhcpd6.conf,bgpdr1.conf,bgpdr2.conf,bgpdbgp1.conf,zebradbgp1.conf,bgpdbgp2.conf,zebradbgp2.conf</conf>
+    </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/config/ -v /etc/network/interfaces:/etc/network/interfaces -v /lib/modules/:/lib/modules/ -it -d --hostname mn-stratum  </args>
+        <name>trellis_mininet</name>
+        <home>/home/root/</home>
+    </MN_DOCKER>
+
+    <CLUSTER>
+        # Params for onos docker
+        <dockerSkipBuild>True</dockerSkipBuild>
+        <dockerBuildCmd>make ONOS_VERSION=master DOCKER_TAG=TestON-master onos-build trellis-control-build trellis-t3-build tost-build</dockerBuildCmd> # If using another cmd like make
+        <dockerBuildTimeout>1200</dockerBuildTimeout>
+        <dockerFilePath>~/tost-onos</dockerFilePath>
+        <dockerImageTag>tost:TestON-master</dockerImageTag>
+        <dockerOptions>-d --rm --network host -v ~/.ssh/authorized_keys:/root/.ssh/authorized_keys -v /tmp/cluster.json:/root/onos/config/cluster.json </dockerOptions> # We start the container detached, so the docker component can connect to cli instead of logs
+        <atomixImageTag>atomix/atomix:3.1.5</atomixImageTag>
+        <atomixOptions>-d --rm --network host -v ~/.ssh/authorized_keys:/root/.ssh/authorized_keys -v /tmp/atomix.json:/opt/atomix/conf/atomix.json </atomixOptions>
+    </CLUSTER>
+
+    <ENV>
+        <cellName>productionCell</cellName>
+        <cellApps>drivers,lldpprovider,hostprovider,fpm,netcfghostprovider,drivers.bmv2,pipelines.fabric,segmentrouting</cellApps>
+    </ENV>
+
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+
+    <ONOS_Configuration>
+        <org.onosproject.grpc.ctl.GrpcChannelControllerImpl>
+            <enableMessageLog>true</enableMessageLog>
+        </org.onosproject.grpc.ctl.GrpcChannelControllerImpl>
+    </ONOS_Configuration>
+
+    <ONOS_Logging>
+        <org.onosproject.events>TRACE</org.onosproject.events>
+        <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+        <org.onosproject.driver>DEBUG</org.onosproject.driver>
+        <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+        <org.onosproject.routeservice.impl>DEBUG</org.onosproject.routeservice.impl>
+        <org.onosproject.routeservice.store>DEBUG</org.onosproject.routeservice.store>
+        <org.onosproject.routing.fpm>DEBUG</org.onosproject.routing.fpm>
+        <org.onosproject.fpm>DEBUG</org.onosproject.fpm>
+        <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+        <org.onosproject.p4runtime>DEBUG</org.onosproject.p4runtime>
+        <org.onosproject.protocols.p4runtime>DEBUG</org.onosproject.protocols.p4runtime>
+        <org.onosproject.drivers.p4runtime>DEBUG</org.onosproject.drivers.p4runtime>
+        <org.onosproject.protocols.grpc>DEBUG</org.onosproject.protocols.grpc>
+        <org.onosproject.protocols.gnmi>DEBUG</org.onosproject.protocols.gnmi>
+        <org.onosproject.protocols.gnoi>DEBUG</org.onosproject.protocols.gnoi>
+        <org.onosproject.drivers.gnoi>DEBUG</org.onosproject.drivers.gnoi>
+        <org.onosproject.drivers.gmni>DEBUG</org.onosproject.drivers.gmni>
+        <org.onosproject.drivers.stratum>DEBUG</org.onosproject.drivers.stratum>
+        <org.onosproject.bmv2>DEBUG</org.onosproject.bmv2>
+    </ONOS_Logging>
+
+
+    <CTRL>
+        <port>6653</port>
+    </CTRL>
+
+    <timers>
+        <LinkDiscovery>12</LinkDiscovery>
+        <SwitchDiscovery>12</SwitchDiscovery>
+    </timers>
+
+    <SLEEP>
+        <startup>10</startup>
+    </SLEEP>
+
+    <ALARM>
+        <minPassPercent>70</minPassPercent>
+    </ALARM>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
index a959e71..5c8d277 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
@@ -88,7 +88,7 @@
                 intfCfg = "%s%s%s.json" % ( main.configPath, main.forJson, TAG )
                 if main.useBmv2:
                     # Translate configuration file from OVS-OFDPA to BMv2 driver
-                    translator.bmv2ToOfdpa( main )  # Try to cleanup if switching between switch types
+                    translator.bmv2ToOfdpa( main, intfCfg )  # Try to cleanup if switching between switch types
                     switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
                     translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=intfCfg )
                 else:
@@ -100,7 +100,7 @@
                 defaultIntfCfg = "%s%s%s_ports.json" % ( main.configPath, main.forJson, topology )
                 if main.useBmv2:
                     # Translate configuration file from OVS-OFDPA to BMv2 driver
-                    translator.bmv2ToOfdpa( main )  # Try to cleanup if switching between switch types
+                    translator.bmv2ToOfdpa( main, defaultIntfCfg )  # Try to cleanup if switching between switch types
                     switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
                     translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=defaultIntfCfg )
                 else:
@@ -118,6 +118,7 @@
 
             # Set up topology
             if hasattr( main, 'Mininet1' ):
+                run.mnDockerSetup( main )
                 # Run the test with mininet topology
                 mininet_args = ' --spine=%d --leaf=%d --fanout=%d' \
                                % ( topo[ topology ][ 0 ], topo[ topology ][ 1 ], fanout )
@@ -128,8 +129,8 @@
                 if dualHomed:
                     mininet_args += ' --dual-homed'
                 if main.useBmv2:
-                    mininet_args += ' --switch bmv2'
-                    main.log.info( "Using BMv2 switch" )
+                    mininet_args += ' --switch %s' % main.switchType
+                    main.log.info( "Using %s switch" % main.switchType )
 
                 run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
             else:
@@ -374,10 +375,11 @@
             run.checkFlows( main, minFlowCount=minFlowCountPerLeaf * topo[ topology ][ 1 ], sleep=5, dumpflows=False )
             run.pingAll( main, '%s_After' % TAG, retryAttempts=2 )
 
-            run.cleanup( main )
         except Exception as e:
             main.log.exception( "Error in runTest" )
             main.skipCase( result="FAIL", msg=e )
+        finally:
+            run.cleanup( main )
 
     @staticmethod
     def updateIntfCfg( main, portNum, dualHomed, ips=[], untagged=0, tagged=[], native=0 ):
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdbgp1.conf b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdbgp1.conf
new file mode 100644
index 0000000..8870fb4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdbgp1.conf
@@ -0,0 +1,81 @@
+log file /var/log/quagga/bgpdbgp1.log
+hostname bgp1
+password quagga
+!
+! Different next hop for IPv4
+!
+ip prefix-list 1 seq 10 permit 10.0.2.0/24
+ip prefix-list 1 seq 20 permit 10.1.2.0/24
+ip prefix-list 1 seq 30 permit 10.0.3.0/24
+ip prefix-list 1 seq 40 permit 10.0.4.0/24
+!
+route-map NEXTHOP41 permit 10
+match ip address prefix-list 1
+set ip next-hop 10.0.1.254
+!
+!
+route-map NEXTHOP47 permit 10
+match ip address prefix-list 1
+set ip next-hop 10.0.7.254
+!
+! Different next hop for IPv6
+!
+ipv6 prefix-list 2 seq 10 permit 2000::200/120
+ipv6 prefix-list 2 seq 20 permit 2000::300/120
+!
+route-map NEXTHOP61 permit 10
+match ipv6 address prefix-list 2
+set ipv6 next-hop global 2000::1ff
+set ipv6 next-hop local 2000::1ff
+!
+!
+route-map NEXTHOP67 permit 10
+match ipv6 address prefix-list 2
+set ipv6 next-hop global 2000::7ff
+set ipv6 next-hop local 2000::7ff
+!
+! Basic router config
+!
+router bgp 65003
+bgp router-id 172.16.0.3
+timers bgp 3 9
+!
+! IPv4
+!
+neighbor 10.0.1.1 remote-as 65001
+neighbor 10.0.1.1 ebgp-multihop
+neighbor 10.0.1.1 timers connect 5
+neighbor 10.0.1.1 advertisement-interval 5
+neighbor 10.0.1.1 route-map NEXTHOP41 out
+!
+neighbor 2000::101 remote-as 65001
+neighbor 2000::101 timers connect 5
+neighbor 2000::101 advertisement-interval 1
+no neighbor 2000::101 activate
+!
+neighbor 10.0.7.1 remote-as 65002
+neighbor 10.0.7.1 ebgp-multihop
+neighbor 10.0.7.1 timers connect 5
+neighbor 10.0.7.1 advertisement-interval 5
+neighbor 10.0.7.1 route-map NEXTHOP47 out
+!
+neighbor 2000::701 remote-as 65002
+neighbor 2000::701 timers connect 5
+neighbor 2000::701 advertisement-interval 1
+no neighbor 2000::701 activate
+!
+network 10.0.2.0/24
+network 10.1.2.0/24
+network 10.0.3.0/24
+network 10.0.4.0/24
+!
+! IPv6
+!
+address-family ipv6
+network 2000::200/120
+network 2000::300/120
+neighbor 2000::101 activate
+neighbor 2000::101 route-map NEXTHOP61 out
+neighbor 2000::701 activate
+neighbor 2000::701 route-map NEXTHOP67 out
+exit-address-family
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdbgp2.conf b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdbgp2.conf
new file mode 100644
index 0000000..e554de4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdbgp2.conf
@@ -0,0 +1,81 @@
+log file /var/log/quagga/bgpdbgp2.log
+hostname bgp2
+password quagga
+!
+! Different next hop for IPv4
+!
+ip prefix-list 1 seq 10 permit 10.0.2.0/24
+ip prefix-list 1 seq 20 permit 10.1.2.0/24
+ip prefix-list 1 seq 30 permit 10.0.3.0/24
+ip prefix-list 1 seq 40 permit 10.0.4.0/24
+!
+route-map NEXTHOP45 permit 10
+match ip address prefix-list 1
+set ip next-hop 10.0.5.254
+!
+!
+route-map NEXTHOP46 permit 10
+match ip address prefix-list 1
+set ip next-hop 10.0.6.254
+!
+! Different next hop for IPv6
+!
+ipv6 prefix-list 2 seq 10 permit 2000::200/120
+ipv6 prefix-list 2 seq 20 permit 2000::300/120
+!
+route-map NEXTHOP65 permit 10
+match ipv6 address prefix-list 2
+set ipv6 next-hop global 2000::5ff
+set ipv6 next-hop local 2000::5ff
+!
+!
+route-map NEXTHOP66 permit 10
+match ipv6 address prefix-list 2
+set ipv6 next-hop global 2000::6ff
+set ipv6 next-hop local 2000::6ff
+!
+! Basic router config
+!
+router bgp 65003
+bgp router-id 172.16.0.4
+timers bgp 3 9
+!
+! IPv4
+!
+neighbor 10.0.5.1 remote-as 65001
+neighbor 10.0.5.1 ebgp-multihop
+neighbor 10.0.5.1 timers connect 5
+neighbor 10.0.5.1 advertisement-interval 5
+neighbor 10.0.5.1 route-map NEXTHOP45 out
+!
+neighbor 2000::501 remote-as 65001
+neighbor 2000::501 timers connect 5
+neighbor 2000::501 advertisement-interval 1
+no neighbor 2000::501 activate
+!
+neighbor 10.0.6.1 remote-as 65002
+neighbor 10.0.6.1 ebgp-multihop
+neighbor 10.0.6.1 timers connect 5
+neighbor 10.0.6.1 advertisement-interval 5
+neighbor 10.0.6.1 route-map NEXTHOP46 out
+!
+neighbor 2000::601 remote-as 65002
+neighbor 2000::601 timers connect 5
+neighbor 2000::601 advertisement-interval 1
+no neighbor 2000::601 activate
+!
+network 10.0.2.0/24
+network 10.1.2.0/24
+network 10.0.3.0/24
+network 10.0.4.0/24
+!
+! IPv6
+!
+address-family ipv6
+network 2000::200/120
+network 2000::300/120
+neighbor 2000::501 activate
+neighbor 2000::501 route-map NEXTHOP65 out
+neighbor 2000::601 activate
+neighbor 2000::601 route-map NEXTHOP66 out
+exit-address-family
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdr1.conf b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdr1.conf
new file mode 100644
index 0000000..9e526b8
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdr1.conf
@@ -0,0 +1,42 @@
+log file /var/log/quagga/bgpdr1.log
+hostname r1
+password quagga
+!
+! Basic router config
+!
+router bgp 65001
+bgp router-id 10.0.1.1
+timers bgp 3 9
+!
+! IPv4
+!
+neighbor 10.0.1.2 remote-as 65003
+neighbor 10.0.1.2 ebgp-multihop
+neighbor 10.0.1.2 timers connect 5
+neighbor 10.0.1.2 advertisement-interval 5
+!
+neighbor 2000::102 remote-as 65003
+neighbor 2000::102 timers connect 5
+neighbor 2000::102 advertisement-interval 1
+no neighbor 2000::102 activate
+!
+neighbor 10.0.5.2 remote-as 65003
+neighbor 10.0.5.2 ebgp-multihop
+neighbor 10.0.5.2 timers connect 5
+neighbor 10.0.5.2 advertisement-interval 5
+!
+neighbor 2000::502 remote-as 65003
+neighbor 2000::502 timers connect 5
+neighbor 2000::502 advertisement-interval 1
+no neighbor 2000::502 activate
+!
+network 10.0.99.0/24
+!
+! IPv6
+!
+address-family ipv6
+network 2000::7700/120
+network 2000::9900/120
+neighbor 2000::102 activate
+neighbor 2000::502 activate
+exit-address-family
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdr2.conf b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdr2.conf
new file mode 100644
index 0000000..49553e2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/bgpdr2.conf
@@ -0,0 +1,42 @@
+log file /var/log/quagga/bgpdr2.log
+hostname r2
+password quagga
+!
+! Basic router config
+!
+router bgp 65002
+bgp router-id 10.0.6.1
+timers bgp 3 9
+!
+! IPv4
+!
+neighbor 10.0.6.2 remote-as 65003
+neighbor 10.0.6.2 ebgp-multihop
+neighbor 10.0.6.2 timers connect 5
+neighbor 10.0.6.2 advertisement-interval 5
+!
+neighbor 2000::602 remote-as 65003
+neighbor 2000::602 timers connect 5
+neighbor 2000::602 advertisement-interval 1
+no neighbor 2000::602 activate
+!
+neighbor 10.0.7.2 remote-as 65003
+neighbor 10.0.7.2 ebgp-multihop
+neighbor 10.0.7.2 timers connect 5
+neighbor 10.0.7.2 advertisement-interval 5
+!
+neighbor 2000::702 remote-as 65003
+neighbor 2000::702 timers connect 5
+neighbor 2000::702 advertisement-interval 1
+no neighbor 2000::702 activate
+!
+network 10.0.99.0/24
+!
+! IPv6
+!
+address-family ipv6
+network 2000::8800/120
+network 2000::9900/120
+neighbor 2000::602 activate
+neighbor 2000::702 activate
+exit-address-family
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/dhcpd.conf b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/dhcpd.conf
new file mode 100644
index 0000000..aa559d2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/dhcpd.conf
@@ -0,0 +1,55 @@
+ddns-update-style none;
+
+default-lease-time 600;
+max-lease-time 7200;
+
+option domain-name-servers 8.8.8.8, 8.8.4.4;
+option domain-name "trellis.local";
+
+subnet 10.0.2.0 netmask 255.255.255.0 {
+  range 10.0.2.100 10.0.2.240;
+  option routers 10.0.2.254;
+}
+
+subnet 10.1.2.0 netmask 255.255.255.0 {
+  range 10.1.2.100 10.1.2.240;
+  option routers 10.1.2.254;
+}
+
+subnet 10.0.3.0 netmask 255.255.255.0 {
+  range 10.0.3.100 10.0.3.240;
+  option routers 10.0.3.254;
+}
+
+subnet 10.0.4.0 netmask 255.255.255.0 {
+  range 10.0.4.100 10.0.4.240;
+  option routers 10.0.4.254;
+}
+
+subnet 10.0.99.3 netmask 255.255.255.255 {
+}
+
+host h1 {
+  hardware ethernet 00:aa:00:00:00:01;
+  fixed-address 10.0.2.1;
+}
+
+host h2 {
+  hardware ethernet 00:aa:00:00:00:02;
+  fixed-address 10.0.2.2;
+}
+
+host h3 {
+  hardware ethernet 00:aa:00:00:00:03;
+  fixed-address 10.0.3.1;
+}
+
+host h4 {
+  hardware ethernet 00:aa:00:00:00:04;
+  fixed-address 10.0.3.2;
+}
+
+host dh1 {
+  hardware ethernet 00:cc:00:00:00:01;
+  fixed-address 10.1.2.1;
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/dhcpd6.conf b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/dhcpd6.conf
new file mode 100644
index 0000000..526de85
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/dhcpd6.conf
@@ -0,0 +1,37 @@
+default-lease-time 600;
+max-lease-time 7200;
+
+option dhcp6.next-hop code 242 = ip6-address;
+
+subnet6 2000::200/120 {
+  range6 2000::260 2000::2fe;
+  option dhcp6.next-hop 2000::02ff;
+}
+
+subnet6 2000::300/120 {
+  range6 2000::360 2000::3fe;
+  option dhcp6.next-hop 2000::03ff;
+}
+
+subnet6 2000::9903/128 {
+}
+
+host h1v6 {
+  hardware ethernet 00:bb:00:00:00:01;
+  fixed-address6 2000::201;
+}
+
+host h2v6 {
+  hardware ethernet 00:bb:00:00:00:02;
+  fixed-address6 2000::202;
+}
+
+host h3v6 {
+  hardware ethernet 00:bb:00:00:00:03;
+  fixed-address6 2000::301;
+}
+
+host h4v6 {
+  hardware ethernet 00:bb:00:00:00:04;
+  fixed-address6 2000::302;
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/zebradbgp1.conf b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/zebradbgp1.conf
new file mode 100644
index 0000000..82f5da4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/zebradbgp1.conf
@@ -0,0 +1,9 @@
+log file /var/log/quagga/zebradbgp1.log
+hostname zebra-bgp1
+password quagga
+!
+! Default route via virtual management switch
+!
+ip route 0.0.0.0/0 172.16.0.1
+!
+fpm connection ip 10.192.21.209 port 2620
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/zebradbgp2.conf b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/zebradbgp2.conf
new file mode 100644
index 0000000..faced7f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/conf/zebradbgp2.conf
@@ -0,0 +1,9 @@
+log file /var/log/quagga/zebradbgp2.log
+hostname zebra-bgp2
+password quagga
+!
+! Default route via virtual management switch
+!
+ip route 0.0.0.0/0 172.16.0.1
+!
+fpm connection ip 10.192.21.210 port 2620
diff --git a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/dependencies/SRHAFuncs.py b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/dependencies/SRHAFuncs.py
index 9169573..0c4bc07 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/dependencies/SRHAFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/dependencies/SRHAFuncs.py
@@ -72,14 +72,11 @@
             # TODO Dynamic config of vlan xconnect
             # TODO Vrouter integration
             # TODO Mcast integration
-            if hasattr( main, 'Mininet1' ):
-                run.cleanup( main )
-            else:
-                # TODO: disconnect TestON from the physical network
-                pass
         except Exception as e:
             main.log.exception( "Error in runTest" )
             main.skipCase( result="FAIL", msg=e )
+        finally:
+            run.cleanup( main )
 
     def generateDescription( self, isRandom, isKillingSwitch ):
         return "ONOS " + ( "random " if isRandom else "" ) + "failures" +\
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/dependencies/SRLinkFailFuncs.py b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/dependencies/SRLinkFailFuncs.py
index c83d1e7..6a8dd7e 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/dependencies/SRLinkFailFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/dependencies/SRLinkFailFuncs.py
@@ -66,11 +66,8 @@
             # TODO Dynamic config of vlan xconnect
             # TODO Vrouter integration
             # TODO Mcast integration
-            if hasattr( main, 'Mininet1' ):
-                run.cleanup( main )
-            else:
-                # TODO: disconnect TestON from the physical network
-                pass
         except Exception as e:
             main.log.exception( "Error in runTest" )
             main.skipCase( result="FAIL", msg=e )
+        finally:
+            run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
index c6d52fd..af9250c 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
@@ -58,8 +58,8 @@
             # 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" )
+                mininet_args += ' --switch %s' % main.switchType
+                main.log.info( "Using %s switch" % main.switchType )
             lib.startMininet( main, main.params[ "DEPENDENCY" ][ "topology" ], args=mininet_args )
             time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
         else:
diff --git a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
index 99993f4..171f0d1 100755
--- a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
+++ b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
@@ -1,5 +1,4 @@
 <PARAMS>
-
     <testcases>1,2,3</testcases>
 
     <GRAPH>
diff --git a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params.stratum b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params.stratum
new file mode 100644
index 0000000..df9ac3c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params.stratum
@@ -0,0 +1,103 @@
+<PARAMS>
+    <testcases>1,2,3</testcases>
+
+    <GRAPH>
+        <nodeCluster>Fabric</nodeCluster>
+        <builds>20</builds>
+        <jobName>SROnosFailure-stratum</jobName>
+    </GRAPH>
+
+    <SCALE>
+        <size>3</size>
+        <max>3</max>
+    </SCALE>
+
+    <DEPENDENCY>
+        <useCommonConf>True</useCommonConf>
+        <useCommonTopo>True</useCommonTopo>
+        <useBmv2>True</useBmv2>
+        <bmv2SwitchType>stratum</bmv2SwitchType>
+        <switchPrefix>bmv2</switchPrefix>
+        <stratumRoot>~/stratum</stratumRoot>
+        <topology>cord_fabric.py</topology>
+        <lib>routinglib.py,trellislib.py,stratum.py</lib>
+        <conf>bgpdbgp1.conf,bgpdbgp2.conf,bgpdr1.conf,bgpdr2.conf,dhcpd6.conf,dhcpd.conf,zebradbgp1.conf,zebradbgp2.conf</conf>
+    </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/config --hostname mn-stratum -v /etc/network/interfaces:/etc/network/interfaces -it -d</args>
+        <name>trellis_mininet</name>
+        <home>/home/root/</home>
+    </MN_DOCKER>
+
+    <CLUSTER>
+        # Params for onos docker
+        <dockerSkipBuild>True</dockerSkipBuild>
+        <dockerBuildCmd>make ONOS_VERSION=master DOCKER_TAG=TestON-master onos-build trellis-control-build trellis-t3-build tost-build</dockerBuildCmd> # If using another cmd like make
+        <dockerBuildTimeout>1200</dockerBuildTimeout>
+        <dockerFilePath>~/tost-onos</dockerFilePath>
+        <dockerImageTag>tost:TestON-master</dockerImageTag>
+        <dockerOptions>-d --rm --network host -v ~/.ssh/authorized_keys:/root/.ssh/authorized_keys -v /tmp/cluster.json:/root/onos/config/cluster.json </dockerOptions> # We start the container detached, so the docker component can connect to cli instead of logs
+        <atomixImageTag>atomix/atomix:3.1.5</atomixImageTag>
+        <atomixOptions>-d --rm --network host -v ~/.ssh/authorized_keys:/root/.ssh/authorized_keys -v /tmp/atomix.json:/opt/atomix/conf/atomix.json </atomixOptions>
+    </CLUSTER>
+
+    <ENV>
+        <cellName>productionCell</cellName>
+        <cellApps>drivers,lldpprovider,hostprovider,netcfghostprovider,drivers.bmv2,pipelines.fabric,segmentrouting,t3 </cellApps>
+    </ENV>
+
+    <ONOS_Configuration>
+        <org.onosproject.grpc.ctl.GrpcChannelControllerImpl>
+            <enableMessageLog>true</enableMessageLog>
+        </org.onosproject.grpc.ctl.GrpcChannelControllerImpl>
+    </ONOS_Configuration>
+
+    <ONOS_Logging>
+        <org.onosproject.events>TRACE</org.onosproject.events>
+        <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+        <org.onosproject.driver>DEBUG</org.onosproject.driver>
+        <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+        <org.onosproject.routeservice.impl>DEBUG</org.onosproject.routeservice.impl>
+        <org.onosproject.routeservice.store>DEBUG</org.onosproject.routeservice.store>
+        <org.onosproject.routing.fpm>DEBUG</org.onosproject.routing.fpm>
+        <org.onosproject.fpm>DEBUG</org.onosproject.fpm>
+        <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+        <org.onosproject.p4runtime>DEBUG</org.onosproject.p4runtime>
+        <org.onosproject.protocols.p4runtime>DEBUG</org.onosproject.protocols.p4runtime>
+        <org.onosproject.drivers.p4runtime>DEBUG</org.onosproject.drivers.p4runtime>
+        <org.onosproject.protocols.grpc>DEBUG</org.onosproject.protocols.grpc>
+        <org.onosproject.protocols.gnmi>DEBUG</org.onosproject.protocols.gnmi>
+        <org.onosproject.protocols.gnoi>DEBUG</org.onosproject.protocols.gnoi>
+        <org.onosproject.drivers.gnoi>DEBUG</org.onosproject.drivers.gnoi>
+        <org.onosproject.drivers.gmni>DEBUG</org.onosproject.drivers.gmni>
+        <org.onosproject.drivers.stratum>DEBUG</org.onosproject.drivers.stratum>
+        <org.onosproject.bmv2>DEBUG</org.onosproject.bmv2>
+    </ONOS_Logging>
+
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+
+    <CTRL>
+        <port>6653</port>
+    </CTRL>
+
+    <timers>
+        <LinkDiscovery>12</LinkDiscovery>
+        <SwitchDiscovery>12</SwitchDiscovery>
+        <OnosDiscovery>12</OnosDiscovery>
+    </timers>
+
+    <kill>
+        <switch> spine101 </switch>
+        <dpid> 000000000101 </dpid>
+        <links> leaf1 leaf2 </links>
+    </kill>
+
+    <SLEEP>
+        <startup>10</startup>
+    </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/dependencies/SROnosFailureFuncs.py b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/dependencies/SROnosFailureFuncs.py
index 7233000..624745d 100644
--- a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/dependencies/SROnosFailureFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/dependencies/SROnosFailureFuncs.py
@@ -42,7 +42,15 @@
             run.loadJson( main )
             run.loadChart( main )
             if hasattr( main, 'Mininet1' ):
-                run.startMininet( main, 'cord_fabric.py', args=self.topo[ Topo ][ 2 ] )
+                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
@@ -62,11 +70,8 @@
             # TODO Dynamic config of vlan xconnect
             # TODO Vrouter integration
             # TODO Mcast integration
-            if hasattr( main, 'Mininet1' ):
-                run.cleanup( main )
-            else:
-                # TODO: disconnect TestON from the physical network
-                pass
         except Exception as e:
             main.log.exception( "Error in runTest" )
             main.skipCase( result="FAIL", msg=e )
+        finally:
+            run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum
index 29d1415..bf17af8 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum
@@ -1,5 +1,5 @@
 <PARAMS>
-    <testcases>101,102,103,104,105,106,107,108,109,201,202,203,204,205,206,207,208,209,301,302,303,304,305,306,307,308,309,601,602,603,604,605,606,620,621,622,630,640,641,642,643,651,652,653,660,661,662,663,664,665</testcases>
+    <testcases>101,104,107,201,204,207,301,304,307,601,602,603,604,605,606,620,621,622,630,640,641,642,643,651,652,653,660,661,662,663,664,665</testcases>
 
     <GRAPH>
         <nodeCluster>Fabric</nodeCluster>
@@ -33,7 +33,7 @@
     <CLUSTER>
         # Params for onos docker
         <dockerSkipBuild>True</dockerSkipBuild>
-        <dockerBuildCmd>make ONOS_BRANCH=master DOCKER_TAG=TestON-master onos-build trellis-control-build trellis-t3-build tost-build</dockerBuildCmd> # If using another cmd like make
+        <dockerBuildCmd>make ONOS_VERSION=master DOCKER_TAG=TestON-master onos-build trellis-control-build trellis-t3-build tost-build</dockerBuildCmd> # If using another cmd like make
         <dockerBuildTimeout>1200</dockerBuildTimeout>
         <dockerFilePath>~/tost-onos</dockerFilePath>
         <dockerImageTag>tost:TestON-master</dockerImageTag>
@@ -44,7 +44,7 @@
 
     <ENV>
         <cellName>productionCell</cellName>
-        <cellApps>drivers,fpm,dhcprelay,hostprovider,netcfghostprovider,lldpprovider,routeradvertisement,hostprobingprovider,drivers.bmv2,pipelines.fabric,segmentrouting,t3</cellApps>
+        <cellApps>drivers,fpm,dhcprelay,lldpprovider,hostprovider,netcfghostprovider,routeradvertisement,hostprobingprovider,drivers.bmv2,pipelines.fabric,segmentrouting,t3</cellApps>
     </ENV>
 
     <GIT>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSanity/dependencies/SRSanityFuncs.py b/TestON/tests/USECASE/SegmentRouting/SRSanity/dependencies/SRSanityFuncs.py
index d182e37..70bb065 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRSanity/dependencies/SRSanityFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRSanity/dependencies/SRSanityFuncs.py
@@ -52,11 +52,12 @@
             # TODO Dynamic config of vlan xconnect
             # TODO Vrouter integration
             # TODO Mcast integration
+        except Exception as e:
+            main.log.exception( "Error in runTest" )
+            main.skipCase( result="FAIL", msg=e )
+        finally:
             if hasattr( main, 'Mininet1' ):
                 run.cleanup( main )
             else:
                 # TODO: disconnect TestON from the physical network
                 pass
-        except Exception as e:
-            main.log.exception( "Error in runTest" )
-            main.skipCase( result="FAIL", msg=e )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/dependencies/SRSwitchFailureFuncs.py b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/dependencies/SRSwitchFailureFuncs.py
index 4cd8a19..908c359 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/dependencies/SRSwitchFailureFuncs.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/dependencies/SRSwitchFailureFuncs.py
@@ -61,11 +61,12 @@
             # TODO Dynamic config of vlan xconnect
             # TODO Vrouter integration
             # TODO Mcast integration
+        except Exception as e:
+            main.log.exception( "Error in runTest" )
+            main.skipCase( result="FAIL", msg=e )
+        finally:
             if hasattr( main, 'Mininet1' ):
                 run.cleanup( main )
             else:
                 # TODO: disconnect TestON from the physical network
                 pass
-        except Exception as e:
-            main.log.exception( "Error in runTest" )
-            main.skipCase( result="FAIL", msg=e )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
index 0c15cdc..d56e0b2 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
@@ -27,11 +27,13 @@
 from ipaddress import IPv6Network, IPv4Network
 from mininet.net import Mininet
 from mininet.topo import Topo
-from mininet.node import RemoteController, Host, OVSBridge
+from mininet.node import RemoteController, Host, OVSBridge, OVSSwitch
 from mininet.link import TCLink
 from mininet.log import setLogLevel
 from mininet.cli import CLI
 
+from bmv2 import ONOSBmv2Switch
+from stratum import StratumBmv2Switch
 
 # Parse command line options and dump results
 def parseOptions():
@@ -49,16 +51,28 @@
                        help='vid of cross connect, default=-1, -1 means utilize default value' )
     parser.add_option( '--ipv6', action="store_true", dest='ipv6',
                        help='hosts are capable to use also ipv6' )
+    parser.add_option( '--switch', dest='switch', type='str', default='ovs',
+                       help='Switch type: ovs, bmv2 (with fabric.p4), stratum' )
     ( options, args ) = parser.parse_args()
     return options, args
 
 
 opts, args = parseOptions()
 
+FABRIC_PIPECONF = "org.onosproject.pipelines.fabric"
+
+SWITCH_TO_PARAMS_DICT = {
+    "ovs": dict(cls=OVSSwitch),
+    "bmv2": dict(cls=ONOSBmv2Switch, pipeconf=FABRIC_PIPECONF),
+    "stratum": dict(cls=StratumBmv2Switch, pipeconf=FABRIC_PIPECONF, loglevel='debug')
+}
+if opts.switch not in SWITCH_TO_PARAMS_DICT:
+    raise Exception("Unknown switch type '%s'" % opts.switch)
+SWITCH_PARAMS = SWITCH_TO_PARAMS_DICT[opts.switch]
+
 IP6_SUBNET_CLASS = 120
 IP4_SUBNET_CLASS = 24
 
-
 class LeafAndSpine6( Topo ):
 
     """
@@ -132,13 +146,15 @@
         leafs = {}
         for s in range( spine ):
             spines[ s ] = self.addSwitch( 'spine10%s' % ( s + 1 ),
-                                          dpid="00000000010%s" % ( s + 1 ) )
+                                          dpid="00000000010%s" % ( s + 1 ),
+                                          **SWITCH_PARAMS )
         # Set link speeds to 100Mb/s
         linkopts = dict( bw=100 )
         # Add Leaf switches
         for ls in range( leaf ):
             leafs[ ls ] = self.addSwitch( 'leaf%s' % ( ls + 1 ),
-                                          dpid="00000000000%s" % ( 1 + ls ) )
+                                          dpid="00000000000%s" % ( 1 + ls ),
+                                          **SWITCH_PARAMS )
             # Add hosts under a leaf, fanout hosts per leaf switch
             for f in range( fanout ):
                 host = self.addHost( 'h%s' % ( ls * fanout + f + 1 ),