Pinging ng40 with a host for 2x2 SRBridging

Change-Id: Id31aab3c31f7f2981046ac5c3e45794f4886b6c4
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py
index 3586b0b..dfd9dc0 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py
@@ -70,7 +70,7 @@
             main.funcs = SRBridgingTest()
         main.funcs.runTest( main,
                             test_idx=3,
-                            topology='2x2',
+                            topology='2x2 dual-linked',
                             onosNodes=1,
                             description="Bridging test between two untagged hosts on vlan-untagged port" )
 
@@ -193,6 +193,29 @@
                             topology='2x4',
                             onosNodes=3,
                             description="Bridging test between two untagged hosts on vlan-untagged port" )
+    def CASE9( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-untagged)
+
+        Sets up 3 ONOS instances
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        try:
+            from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+        except ImportError:
+            main.log.error( "SRBridgingTest not found. Exiting the test" )
+            main.cleanAndExit()
+        try:
+            main.funcs
+        except ( NameError, AttributeError ):
+            main.funcs = SRBridgingTest()
+        main.funcs.runTest( main,
+                            test_idx=7,
+                            topology='2x2 dual-linked',
+                            onosNodes=3,
+                            description="Bridging test between two untagged hosts on vlan-untagged port" )
 
     def CASE11( self, main ):
         """
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.2x2.physical b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.2x2.physical
index a236f9f..74b8689 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.2x2.physical
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.2x2.physical
@@ -141,19 +141,19 @@
             <type>HostDriver</type>
             <connect_order>8</connect_order>
             <COMPONENTS>
-                <mac>52:54:00:e3:88:36</mac>
+                <mac>52:54:00:71:b5:96</mac>
                 <inband>false</inband>
-                <ip>192.168.101.101</ip>
+                <ip>192.168.102.101</ip>
                 <shortName>ng40</shortName>
                 <port1></port1>
                 <link1></link1>
-                <interfaceName>ens8</interfaceName>
+                <interfaceName>ens9</interfaceName>
                 <routes>
                     <route1>
                         <network>192.168.101.1</network>
                         <netmask>24</netmask>
                         <gw>192.168.103.1</gw>
-                        <interface>ens8</interface>
+                        <interface>ens9</interface>
                     </route1>
                 </routes>
             </COMPONENTS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
index be98329..1ffa9c2 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
@@ -26,15 +26,9 @@
 
     def __init__( self ):
         self.default = ''
-        self.topo = dict()
-        # TODO: Check minFlowCount of leaf for BMv2 switch
-        # (number of spine switch, number of leaf switch, dual-homed, description, minFlowCount - leaf (OvS), minFlowCount - leaf (BMv2))
-        self.topo[ '0x1' ] = ( 0, 1, False, 'single ToR', 28, 20 )
-        self.topo[ '0x2' ] = ( 0, 2, True, 'dual-homed ToR', 37, 37 )
-        self.topo[ '2x2' ] = ( 2, 2, False, '2x2 leaf-spine topology', 37, 32 )
+        self.topo = run.getTopo()
         # TODO: Implement 2x3 topology
         # topo[ '2x3' ] = ( 2, 3, True, '2x3 leaf-spine topology with dual ToR and single ToR', 28 )
-        self.topo[ '2x4' ] = ( 2, 4, True, '2x4 dual-homed leaf-spine topology', 53, 53 )
         self.switchNames = {}
         self.switchNames[ '0x1' ] = [ "leaf1" ]
         self.switchNames[ '2x2' ] = [ "leaf1", "leaf2", "spine101", "spine102" ]
@@ -51,14 +45,14 @@
             if not init and onosNodes == main.Cluster.numCtrls:
                 skipPackage = True
 
-            main.case( '%s, with %s, %s switches and %d ONOS instance%s' %
-                       ( description, self.topo[ topology ][ 3 ], main.switchType, onosNodes, 's' if onosNodes > 1 else '' ) )
-            spines = self.topo[ topology ][ 0 ]
-            leaves = self.topo[ topology ][ 1 ]
+            main.case( '%s, with %s, %s switches and %d ONOS instance%s' %( description, self.topo[ topology ][ 'description' ], main.switchType, onosNodes, 's' if onosNodes > 1 else '' ) )
+            spines = self.topo[ topology ][ 'spines' ]
+            leaves = self.topo[ topology ][ 'leaves' ]
             switches = spines + leaves
             links = ( spines * leaves ) * 2
-            if self.topo[ topology ][ 2 ]:
+            if self.topo[ topology ][ 'dual-linked' ]:
                 links += links
+            if self.topo[ topology ][ 'dual-homed' ]:
                 links += ( leaves - 1 ) * 2
 
             main.cfgName = 'CASE%01d%01d' % ( test_idx / 10, ( ( test_idx - 1 ) % 10 ) % 4 + 1 )
@@ -84,8 +78,8 @@
                 run.mnDockerSetup( main )  # optionally create and setup docker image
 
                 # Run the test with Mininet
-                mininet_args = ' --spine=%d --leaf=%d' % ( self.topo[ topology ][ 0 ], self.topo[ topology ][ 1 ] )
-                if self.topo[ topology ][ 2 ]:
+                mininet_args = ' --spine=%d --leaf=%d' % ( self.topo[ topology ][ 'spines' ], self.topo[ topology ][ 'leaves' ] )
+                if self.topo[ topology ][ 'dual-homed' ]:
                     mininet_args += ' --dual-homed'
                 if len( vlan ) > 0 :
                     mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
@@ -99,18 +93,18 @@
                 # Run the test with physical devices
                 run.connectToPhysicalNetwork( main, hostDiscovery=False )  # We don't want to do host discovery in the pod
 
-            run.checkFlows( main, minFlowCount=self.topo[ topology ][ 5 if main.useBmv2 else 4 ] * self.topo[ topology ][ 1 ], sleep=5 )
+            run.checkFlows( main, minFlowCount=self.topo[ topology ][ 'minFlow-Stratum' if main.useBmv2 else 'minFlow-OvS' ] * self.topo[ topology ][ 'leaves' ], sleep=5 )
             if main.useBmv2:
                 switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', '' )
                 if switchPrefix is None or "None":
                     switchPrefix = ''
                 if switchPrefix is not '' and switchPrefix is not None:
                     switchPrefix += ':'
-                leaf_dpid = [ "device:%sleaf%d" % ( switchPrefix, ls + 1 ) for ls in range( self.topo[ topology ][ 1 ]) ]
+                leaf_dpid = [ "device:%sleaf%d" % ( switchPrefix, ls + 1 ) for ls in range( self.topo[ topology ][ 'leaves' ]) ]
             else:
-                leaf_dpid = [ "of:%016d" % ( ls + 1 ) for ls in range( self.topo[ topology ][ 1 ] ) ]
+                leaf_dpid = [ "of:%016d" % ( ls + 1 ) for ls in range( self.topo[ topology ][ 'leaves' ] ) ]
             for dpid in leaf_dpid:
-                run.checkFlowsByDpid( main, dpid, self.topo[ topology ][ 5 if main.useBmv2 else 4 ], sleep=5 )
+                run.checkFlowsByDpid( main, dpid, self.topo[ topology ][ 'minFlow-Stratum' if main.useBmv2 else 'minFlow-OvS' ], sleep=5 )
             run.verifyTopology( main, switches, links, onosNodes )
             run.pingAll( main )
         except Exception as e:
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE03.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE03.chart
index 0102621..38f0a1b 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE03.chart
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE03.chart
@@ -3,4 +3,4 @@
     "hosts":["h1", "h2"]},
   "leaf2": {"expect": "True",
     "hosts":["h3", "h4"]}
-}
\ No newline at end of file
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE09.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE09.chart
new file mode 100644
index 0000000..f52bad8
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/chart/CASE09.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "ng40"]}
+}