SRBridging test (CASE-6) Paired-leaf pod

Change-Id: I452cb1619e9d433142626c95c95ed0794b4b749a
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params.tofino b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params.tofino
new file mode 100644
index 0000000..48d8d67
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params.tofino
@@ -0,0 +1,128 @@
+<PARAMS>
+    <testcases>13,23</testcases>
+
+    <GRAPH>
+        <nodeCluster>QA-Pod</nodeCluster>
+        <builds>20</builds>
+        <jobName>SRDynamicConf-tofino</jobName>
+        <branch>master</branch>
+    </GRAPH>
+
+    <SCALE>
+        <size>3</size>
+        <max>3</max>
+    </SCALE>
+
+    <DEPENDENCY>
+        <useCommonConf>False</useCommonConf>
+        <useCommonTopo>True</useCommonTopo>
+        <useBmv2>True</useBmv2>
+        <bmv2SwitchType>stratum</bmv2SwitchType>
+        <switchPrefix></switchPrefix>
+        <stratumRoot>~/stratum</stratumRoot>
+        <topology>trellis_fabric.py</topology>
+        <lib>routinglib.py,trellislib.py,stratum.py</lib>
+    </DEPENDENCY>
+
+    <jsonFileSuffix>.hw</jsonFileSuffix>
+
+    <persistent_setup>True</persistent_setup>
+
+    <kubernetes>
+        <appName>onos-classic</appName>
+        <namespace>tost</namespace>
+    </kubernetes>
+
+    <PERF>
+        <traffic_host>Host1</traffic_host>
+        <pcap_host>ng40vm</pcap_host>
+        <pcap_cmd_arguments>-t e -F pcap -s 100 </pcap_cmd_arguments>
+        <iterations>1</iterations>
+        <topo>
+            <leaf1>
+                <ports>260 268 276 284</ports>
+                <note>eNB</note>
+            </leaf1>
+            <leaf2>
+                <ports>132 140 148 156</ports>
+                <note>upstream</note>
+            </leaf2>
+            <spine1>
+                <ports>132 140 148 156</ports>
+                <note>spine</note>
+            </spine1>
+            <spine2>
+                <ports>132 140 148 156</ports>
+                <note>spine</note>
+            </spine2>
+        </topo>
+    </PERF>
+
+
+
+
+
+    <ENV>
+        <cellName>productionCell</cellName>
+        <cellApps>drivers,fpm,lldpprovider,hostprovider,netcfghostprovider,drivers.bmv2,pipelines.fabric,org.stratumproject.fabric-tna,drivers.barefoot,segmentrouting,t3</cellApps>
+    </ENV>
+
+    <EXTERNAL_APPS>
+    </EXTERNAL_APPS>
+
+    <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.barefoot>DEBUG</org.onosproject.drivers.barefoot>
+        <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>
+        <TrafficDiscovery>10</TrafficDiscovery>
+    </timers>
+
+    <SLEEP>
+        <startup>10</startup>
+    </SLEEP>
+
+    <TOPO>
+        <switchNum>4</switchNum>
+        <linkNum>16</linkNum>
+    </TOPO>
+
+    <ALARM>
+        <minPassPercent>100</minPassPercent>
+    </ALARM>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.py b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.py
index 78e25c2..d36c9bb 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.py
@@ -76,11 +76,15 @@
         Pingall
         """
         from tests.USECASE.SegmentRouting.SRDynamicConf.dependencies.SRDynamicConfTest import SRDynamicConfTest
-        SRDynamicConfTest.runTest( main,
+        try:
+            test=SRDynamicConfTest()
+            test.runTest( main,
                                    testIndex=13,
                                    topology='2x2',
                                    onosNodes=3,
                                    description='Changing port configuration from untagged 10 to tagged 10' )
+        except Exception:
+            main.log.exception("debug")
 
     def CASE14( self, main ):
         """
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.topo.2x2.physical b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.topo.2x2.physical
new file mode 100644
index 0000000..8353070
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.topo.2x2.physical
@@ -0,0 +1,177 @@
+<TOPOLOGY>
+    <COMPONENT>
+        <ONOScell>
+            <host>localhost</host>  # ONOS "bench" machine
+            <user>sid</user>
+            <password>sid</password>
+            <type>OnosClusterDriver</type>
+            <connect_order>1</connect_order>
+            <home></home>   # defines where onos home is on the build machine. Defaults to "~/onos/" if empty.
+            <COMPONENTS>
+                <kubeConfig>~/.kube/qa-ace-menlo</kubeConfig>  # If set, will attempt to use this file for setting up port-forwarding
+                <useDocker>True</useDocker>  # Whether to use docker for ONOS nodes
+                <docker_prompt>\$</docker_prompt>
+                <cluster_name></cluster_name>  # Used as a prefix for cluster components. Defaults to 'ONOS'
+                <diff_clihost>True</diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+                <karaf_username>karaf</karaf_username>
+                <karaf_password>karaf</karaf_password>
+                <node_username>sid</node_username>
+                <node_password>sid</node_password>
+                <karafPrompt_username>karaf</karafPrompt_username>
+                <karafPrompt_password>karaf</karafPrompt_password>
+                <web_user>karaf</web_user>
+                <web_pass>karaf</web_pass>
+                <rest_port></rest_port>
+                <prompt></prompt>  # TODO: we technically need a few of these, one per component
+                <onos_home></onos_home>  # defines where onos home is on the target cell machine. Defaults to entry in "home" if empty.
+                <nodes> 3 </nodes>  # number of nodes in the cluster
+            </COMPONENTS>
+        </ONOScell>
+
+        <Leaf1>
+            <host>10.128.13.209</host>
+            <user>root</user>
+            <password>onl</password>
+            <type>StratumOSSwitchDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+                <prompt>#</prompt>
+                <shortName>leaf1</shortName>
+                <port1>1</port1>
+                <link1>Host1</link1>
+                <onosConfigPath></onosConfigPath>
+                <onosConfigFile></onosConfigFile>
+            </COMPONENTS>
+        </Leaf1>
+
+        <Leaf2>
+            <host>10.128.13.211</host>
+            <user>root</user>
+            <password>onl</password>
+            <type>StratumOSSwitchDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+                <prompt>#</prompt>
+                <shortName>leaf2</shortName>
+                <port1>2</port1>
+                <link1>Host2</link1>
+                <onosConfigPath></onosConfigPath>
+                <onosConfigFile></onosConfigFile>
+            </COMPONENTS>
+        </Leaf2>
+
+        <Spine1>
+            <host>10.128.13.213</host>
+            <user>root</user>
+            <password>onl</password>
+            <type>StratumOSSwitchDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+                <prompt>#</prompt>
+                <shortName>spine1</shortName>
+                <onosConfigPath></onosConfigPath>
+                <onosConfigFile></onosConfigFile>
+            </COMPONENTS>
+        </Spine1>
+
+        <Spine2>
+            <host>10.128.13.215</host>
+            <user>root</user>
+            <password>onl</password>
+            <type>StratumOSSwitchDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+                <prompt>#</prompt>
+                <shortName>spine2</shortName>
+                <onosConfigPath></onosConfigPath>
+                <onosConfigFile></onosConfigFile>
+            </COMPONENTS>
+        </Spine2>
+
+        <Host1>
+            <host>10.128.13.253</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>HostDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+                <mac>3c:fd:fe:a8:ea:30</mac>
+                <inband>false</inband>
+                <ip>192.168.102.3</ip>
+                <shortName>h1</shortName>
+                <port1>0</port1>
+                <link1>Leaf1</link1>
+                <interfaceName>ens6f0</interfaceName>
+                <routes>
+                    <route1>
+                        <network>192.168.103.1</network>
+                        <netmask>24</netmask>
+                        <gw>192.168.102.1</gw>
+                        <interface></interface>
+                    </route1>
+                </routes>
+            </COMPONENTS>
+        </Host1>
+
+        <Host2>
+            <host>10.128.13.253</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>HostDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+                <mac>3c:fd:fe:a8:ea:31</mac>
+                <inband>false</inband>
+                <ip>192.168.103.3</ip>
+                <shortName>h2</shortName>
+                <port1>0</port1>
+                <link1>Leaf1</link1>
+                <interfaceName>ens6f1</interfaceName>
+                <routes>
+                    <route1>
+                        <network>192.168.102.1</network>
+                        <netmask>24</netmask>
+                        <gw>192.168.103.1</gw>
+                        <interface></interface>
+                    </route1>
+                </routes>
+            </COMPONENTS>
+        </Host2>
+
+        <ng40vm>
+            <host>10.92.1.71</host>
+            <user>ng40</user>
+            <password>ng40</password>
+            <type>HostDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+                <mac>52:54:00:71:b5:96</mac>
+                <inband>false</inband>
+                <ip>192.168.102.101</ip>
+                <shortName>ng40</shortName>
+                <port1></port1>
+                <link1></link1>
+                <interfaceName>ens9</interfaceName>
+                <routes>
+                    <route1>
+                        <network>192.168.101.1</network>
+                        <netmask>24</netmask>
+                        <gw>192.168.103.1</gw>
+                        <interface>ens9</interface>
+                    </route1>
+                </routes>
+            </COMPONENTS>
+        </ng40vm>
+
+        <NetworkBench>
+            <host>10.128.13.253</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>NetworkDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </NetworkBench>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
index f58e4f8..7388172 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
@@ -18,6 +18,7 @@
     You should have received a copy of the GNU General Public License
     along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 """
+from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
 
 import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator
 
@@ -26,8 +27,7 @@
         self.default = ''
         self.topo = run.getTopo()
 
-    @staticmethod
-    def runTest( main, testIndex, topology, onosNodes, description, vlan=( 0, 0, 0, 0 ) ):
+    def runTest( self, main, testIndex, topology, onosNodes, description, vlan=( 0, 0, 0, 0 ) ):
         '''
         Tests connectivity for each test case.
         Configuration files:
@@ -51,7 +51,6 @@
             portNum = self.topo[ topology ][ 'description' ]
             defaultIntf = 'bond0' if dualHomed else 'eth0'
 
-            from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
             if not hasattr( main, 'apps' ):
                 init = True
                 run.initTest( main )
@@ -78,38 +77,41 @@
                 translator.bmv2ToOfdpa( main )
             if not main.persistentSetup:
                 run.loadJson( main )
-            run.loadChart( main )
 
             # Provide topology-specific interface configuration
             import json
-            try:
-                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, intfCfg )  # Try to cleanup if switching between switch types
-                    switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
-                    translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=intfCfg )
-                else:
-                    translator.bmv2ToOfdpa( main, intfCfg )
-                with open( intfCfg ) as cfg:
-                    main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
-            except IOError:
-                # Load default interface configuration
-                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, defaultIntfCfg )  # Try to cleanup if switching between switch types
-                    switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
-                    translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=defaultIntfCfg )
-                else:
-                    translator.bmv2ToOfdpa( main, defaultIntfCfg )
-                with open( defaultIntfCfg ) as cfg:
-                    main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
+            if not main.persistentSetup:
+                try:
+                    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, intfCfg )  # Try to cleanup if switching between switch types
+                        switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+                        translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=intfCfg )
+                    else:
+                        translator.bmv2ToOfdpa( main, intfCfg )
+                    with open( intfCfg ) as cfg:
+                        main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
+                except IOError:
+                    # Load default interface configuration
+                    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, defaultIntfCfg )  # Try to cleanup if switching between switch types
+                        switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+                        translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=defaultIntfCfg )
+                    else:
+                        translator.bmv2ToOfdpa( main, defaultIntfCfg )
+                    with open( defaultIntfCfg ) as cfg:
+                        main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
 
             try:
-                with open( "%s%sCASE%d.chart" % (main.configPath, main.forChart, testIndex / 10 * 10) ) as chart:
+                suffix='qa'
+                main.log.debug("%s%sCASE%d.chart%s" % (main.configPath, main.forChart, testIndex / 10 * 10, suffix ))
+                with open( "%s%sCASE%d.chart.%s" % (main.configPath, main.forChart, testIndex / 10 * 10, suffix ) ) as chart:
                     main.pingChart = json.load( chart )
             except IOError:
+                main.log.debug("default_chart")
                 # Load default chart
                 with open( "%s%sdefault.chart" % (main.configPath, main.forChart) ) as chart:
                     main.pingChart = json.load( chart )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/chart/CASE10.chart.qa b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/chart/CASE10.chart.qa
new file mode 100644
index 0000000..f1fe795
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/chart/CASE10.chart.qa
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}