Pinging ng40 with a host for 2x2 SRBridging

Change-Id: Id31aab3c31f7f2981046ac5c3e45794f4886b6c4
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
index fb44e2e..70b4e6b 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
@@ -24,6 +24,7 @@
 class SRDynamicConfTest:
     def __init__( self ):
         self.default = ''
+        self.topo = run.getTopo()
 
     @staticmethod
     def runTest( main, testIndex, topology, onosNodes, description, vlan=( 0, 0, 0, 0 ) ):
@@ -39,12 +40,6 @@
                         Only used when ping chart is updated.
         '''
         try:
-            topo = dict()
-            # (number of spine switch, number of leaf switch, dual-homed, description, port number of h1)
-            topo[ '0x1' ] = ( 0, 1, False, 'single ToR', 1 )
-            topo[ '0x2' ] = ( 0, 2, True, 'dual-homed ToR', 2 )
-            topo[ '2x2' ] = ( 2, 2, False, '2x2 leaf-spine topology', 3 )
-            topo[ '2x4' ] = ( 2, 4, True, '2x4 dual-homed leaf-spine topology', 6 )
             fanout = 4
             switchNames = {}
             switchNames[ '2x2' ] = [ "leaf1", "leaf2", "spine101", "spine102" ]
@@ -52,8 +47,8 @@
             TAG = 'CASE%d' % testIndex
             skipPackage = False
             init = False
-            dualHomed = topo[ topology ][ 2 ]
-            portNum = topo[ topology ][ 4 ]
+            dualHomed = self.topo[ topology ][ 'dual-homed' ]
+            portNum = self.topo[ topology ][ 'description' ]
             defaultIntf = 'bond0' if dualHomed else 'eth0'
 
             from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
@@ -65,7 +60,7 @@
                 skipPackage = True
 
             main.case( '%s, with %s and %d ONOS instance%s' %
-                       ( description, topo[ topology ][ 3 ], onosNodes, 's' if onosNodes > 1 else '' ) )
+                       ( description, self.topo[ topology ][ 'description' ], onosNodes, 's' if onosNodes > 1 else '' ) )
             main.cfgName = topology
             main.Cluster.setRunningNode( onosNodes )
             run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
@@ -124,10 +119,10 @@
                 run.mnDockerSetup( main )
                 # Run the test with mininet topology
                 mininet_args = ' --spine=%d --leaf=%d --fanout=%d' \
-                               % ( topo[ topology ][ 0 ], topo[ topology ][ 1 ], fanout )
+                               % ( self.topo[ topology ][ 'spines' ], self.topo[ topology ][ 'leaves' ], fanout )
                 if len( vlan ) > 0 :
                     mininet_args += ' --vlan=%s' % ( ','.join( [ '%d' % vlanId for vlanId in vlan ] ) )
-                    if topo[ topology ][ 0 ] > 0:
+                    if self.topo[ topology ][ 'spines' ] > 0:
                         mininet_args += ',0,0,0,0'
                 if dualHomed:
                     mininet_args += ' --dual-homed'
@@ -141,15 +136,15 @@
                 run.connectToPhysicalNetwork( main, switchNames[ topology ] )
 
             # minFlowCountPerLeaf = 13 +  [# of ports] * 5 + [# of hosts] * 2 + [# of vlan ids]
-            minFlowCountPerLeaf = 13 + ( fanout + topo[ topology ][ 0 ]) * 5 + fanout * 2 + len( set( vlan ) )
-            run.checkFlows( main, minFlowCount=minFlowCountPerLeaf * topo[ topology ][ 1 ], sleep=5, dumpflows=False )
+            minFlowCountPerLeaf = 13 + ( fanout + self.topo[ topology ][ 'spines' ]) * 5 + fanout * 2 + len( set( vlan ) )
+            run.checkFlows( main, minFlowCount=minFlowCountPerLeaf * self.topo[ topology ][ 'leaves' ], sleep=5, dumpflows=False )
             # Check connectivity before changing interface configuration
             run.pingAll( main, '%s_Before' % TAG, retryAttempts=2 )
 
             if main.useBmv2:
-                leaf_dpid = [ "device:bmv2:leaf%d" % ( ls + 1 ) for ls in range( topo[ topology ][ 1 ] ) ]
+                leaf_dpid = [ "device:bmv2:leaf%d" % ( ls + 1 ) for ls in range( self.topo[ topology ][ 'leaves' ] ) ]
             else:
-                leaf_dpid = [ "of:%016d" % ( ls + 1 ) for ls in range( 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, minFlowCountPerLeaf, sleep=5 )
 
@@ -375,7 +370,7 @@
                 main.log.debug( "Ping chart is not changed" )
 
             # Check connectivity after changing interface configuration
-            run.checkFlows( main, minFlowCount=minFlowCountPerLeaf * topo[ topology ][ 1 ], sleep=5, dumpflows=False )
+            run.checkFlows( main, minFlowCount=minFlowCountPerLeaf * self.topo[ topology ][ 'leaves' ], sleep=5, dumpflows=False )
             run.pingAll( main, '%s_After' % TAG, retryAttempts=2 )
 
         except Exception as e: