Add tests on SegmentRouting - SRBridging (+ fix some bugs)

Change-Id: I8aa7dfedb65c5c508881c7ef7bf68b37c1764e54
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/README.md b/TestON/tests/USECASE/SegmentRouting/SRBridging/README.md
new file mode 100644
index 0000000..7409f58
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/README.md
@@ -0,0 +1,19 @@
+This test verifies basic L2 connectivity using SegmentRouting via pingall
+
+It consists of
+
+1) Configure and install ONOS cluster
+2) Start Mininet and check flow state
+3) Pingall
+
+<h3>Requirements</h3>
+ - Trellis leaf-spine fabric: please visit following URL to set up Trellis leaf-spine fabric
+ https://github.com/opennetworkinglab/routing/tree/master/trellis
+ - ONOS_APPS=drivers,openflow,segmentrouting,fpm,netcfghostprovider
+
+<h3>Topologies</h3>
+- 0x1 single ToR
+- 0x2 dual-homed ToR
+- 2x2 leaf-spine
+- 2x4 leaf-spine with dual-homed ToR and dual links to spines
+- 2x3 leaf-spine with dual-homed ToR (Not implemented yet)
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
new file mode 100644
index 0000000..70d903a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
@@ -0,0 +1,45 @@
+<PARAMS>
+    <testcases>1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,21,22,23,24,25,26,27,28,31,32,33,34,35,36,37,38,41,42,43,44,45,46,47,48,51,52,53,54,55,56,57,58,61,62,63,64,65,66,67,68,71,72,73,74,75,76,77,78</testcases>
+
+    <GRAPH>
+        <nodeCluster>BM</nodeCluster>
+        <builds>20</builds>
+    </GRAPH>
+
+    <SCALE>
+        <size>3</size>
+        <max>3</max>
+    </SCALE>
+
+    <DEPENDENCY>
+        <wrapper1>startUp</wrapper1>
+        <topology>trellis_fabric.py</topology>
+        <lib1>routinglib.py</lib1>
+        <lib2>trellislib.py</lib2>
+    </DEPENDENCY>
+
+    <ENV>
+        <cellName>productionCell</cellName>
+        <cellApps>drivers,segmentrouting,openflow,fpm</cellApps>
+        <diffApps>netcfghostprovider</diffApps>
+        <cellUser>sdn</cellUser>
+    </ENV>
+
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+
+    <CTRL>
+        <port>6653</port>
+    </CTRL>
+
+    <timers>
+        <LinkDiscovery>12</LinkDiscovery>
+        <SwitchDiscovery>12</SwitchDiscovery>
+    </timers>
+
+    <SLEEP>
+        <startup>10</startup>
+    </SLEEP>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py
new file mode 100644
index 0000000..6811fd5
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py
@@ -0,0 +1,1083 @@
+class SRBridging:
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-untagged)
+
+        Sets up 1 ONOS instance
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 1,
+                                topology = '0x1',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE2( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-untagged)
+
+        Sets up 1 ONOS instance
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 2,
+                                topology = '0x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE3( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-untagged)
+
+        Sets up 1 ONOS instance
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 3,
+                                topology = '2x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE4( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-untagged)
+
+        Sets up 1 ONOS instance
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 4,
+                                topology = '2x4',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE5( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-untagged)
+
+        Sets up 3 ONOS instances
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 5,
+                                topology = '0x1',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE6( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-untagged)
+
+        Sets up 3 ONOS instances
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 6,
+                                topology = '0x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE7( 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
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 7,
+                                topology = '2x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE8( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-untagged)
+
+        Sets up 3 ONOS instances
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 8,
+                                topology = '2x4',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE11( self, main ):
+        """
+        Tests connectivity between two tagged hosts
+        (Ports are configured as vlan-tagged)
+
+        Sets up 1 ONOS instance
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 11,
+                                topology = '0x1',
+                                onosNodes = 1,
+                                description = "Bridging test between two tagged hosts",
+                                vlan = [ 10, 10 ] )
+
+    def CASE12( self, main ):
+        """
+        Tests connectivity between two tagged hosts
+        (Ports are configured as vlan-tagged)
+
+        Sets up 1 ONOS instance
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 12,
+                                topology = '0x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two tagged hosts",
+                                vlan = [ 10, 10 ] )
+
+    def CASE13( self, main ):
+        """
+        Tests connectivity between two tagged hosts
+        (Ports are configured as vlan-tagged)
+
+        Sets up 1 ONOS instance
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 13,
+                                topology = '2x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two tagged hosts",
+                                vlan = [ 10, 10, 20, 20 ] )
+
+    def CASE14( self, main ):
+        """
+        Tests connectivity between two tagged hosts
+        (Ports are configured as vlan-tagged)
+
+        Sets up 1 ONOS instance
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 14,
+                                topology = '2x4',
+                                onosNodes = 1,
+                                description = "Bridging test between two tagged hosts",
+                                vlan = [ 10, 10, 20, 20 ] )
+
+    def CASE15( self, main ):
+        """
+        Tests connectivity between two tagged hosts
+        (Ports are configured as vlan-tagged)
+
+        Sets up 3 ONOS instances
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 15,
+                                topology = '0x1',
+                                onosNodes = 3,
+                                description = "Bridging test between two tagged hosts",
+                                vlan = [ 10, 10 ] )
+
+    def CASE16( self, main ):
+        """
+        Tests connectivity between two tagged hosts
+        (Ports are configured as vlan-tagged)
+
+        Sets up 3 ONOS instances
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 16,
+                                topology = '0x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two tagged hosts",
+                                vlan = [ 10, 10 ] )
+
+    def CASE17( self, main ):
+        """
+        Tests connectivity between two tagged hosts
+        (Ports are configured as vlan-tagged)
+
+        Sets up 3 ONOS instances
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 17,
+                                topology = '2x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two tagged hosts",
+                                vlan = [ 10, 10, 20, 20 ] )
+
+    def CASE18( self, main ):
+        """
+        Tests connectivity between two tagged hosts
+        (Ports are configured as vlan-tagged)
+
+        Sets up 3 ONOS instances
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 18,
+                                topology = '2x4',
+                                onosNodes = 3,
+                                description = "Bridging test between two tagged hosts",
+                                vlan = [ 10, 10, 20, 20 ] )
+
+    def CASE21( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-native with vlan-tagged)
+
+        Sets up 1 ONOS instance
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 21,
+                                topology = '0x1',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE22( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-native with vlan-tagged)
+
+        Sets up 1 ONOS instance
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 22,
+                                topology = '0x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE23( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-native with vlan-tagged)
+
+        Sets up 1 ONOS instance
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 23,
+                                topology = '2x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE24( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-native with vlan-tagged)
+
+        Sets up 1 ONOS instance
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 24,
+                                topology = '2x4',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE25( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-native with vlan-tagged)
+
+        Sets up 3 ONOS instances
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 25,
+                                topology = '0x1',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE26( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-native with vlan-tagged)
+
+        Sets up 3 ONOS instances
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 26,
+                                topology = '0x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE27( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-native with vlan-tagged)
+
+        Sets up 3 ONOS instances
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 27,
+                                topology = '2x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE28( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (Ports are configured as vlan-native with vlan-tagged)
+
+        Sets up 3 ONOS instances
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 28,
+                                topology = '2x4',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts" )
+
+    def CASE31( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (One port is configured as vlan-native with vlan-tagged,
+        another with vlan-untagged)
+
+        Sets up 1 ONOS instance
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 31,
+                                topology = '0x1',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts, "
+                                "one on vlan-untagged port and the other on vlan-native port" )
+
+    def CASE32( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (One port is configured as vlan-native with vlan-tagged,
+        another with vlan-untagged)
+
+        Sets up 1 ONOS instance
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 32,
+                                topology = '0x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts, "
+                                "one on vlan-untagged port and the other on vlan-native port" )
+
+    def CASE33( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (One port is configured as vlan-native with vlan-tagged,
+        another with vlan-untagged)
+
+        Sets up 1 ONOS instance
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 33,
+                                topology = '2x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts, "
+                                "one on vlan-untagged port and the other on vlan-native port" )
+
+    def CASE34( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (One port is configured as vlan-native with vlan-tagged,
+        another with vlan-untagged)
+
+        Sets up 1 ONOS instance
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 34,
+                                topology = '2x4',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts, "
+                                "one on vlan-untagged port and the other on vlan-native port" )
+
+    def CASE35( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (One port is configured as vlan-native with vlan-tagged,
+        another with vlan-untagged)
+
+        Sets up 3 ONOS instances
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 35,
+                                topology = '0x1',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts, "
+                                "one on vlan-untagged port and the other on vlan-native port" )
+
+    def CASE36( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (One port is configured as vlan-native with vlan-tagged,
+        another with vlan-untagged)
+
+        Sets up 3 ONOS instances
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 36,
+                                topology = '0x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts, "
+                                "one on vlan-untagged port and the other on vlan-native port" )
+
+    def CASE37( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (One port is configured as vlan-native with vlan-tagged,
+        another with vlan-untagged)
+
+        Sets up 3 ONOS instances
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 37,
+                                topology = '2x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts, "
+                                "one on vlan-untagged port and the other on vlan-native port" )
+
+    def CASE38( self, main ):
+        """
+        Tests connectivity between two untagged hosts
+        (One port is configured as vlan-native with vlan-tagged,
+        another with vlan-untagged)
+
+        Sets up 3 ONOS instances
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest(main,
+                               test_idx = 38,
+                               topology = '2x4',
+                               onosNodes = 3,
+                               description = "Bridging test between two untagged hosts, "
+                                           "one on vlan-untagged port and the other on vlan-native port" )
+
+    def CASE41( self, main ):
+        """
+        Tests connectivity between untagged host and tagged host
+        (Ports are configured as vlan-untagged and
+        vlan-tagged with same vlan id, respectively)
+
+        Sets up 1 ONOS instance
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 41,
+                                topology = '0x1',
+                                onosNodes = 1,
+                                description = "Bridging test between untagged host and tagged host",
+                                vlan = [ 0, 10 ] )
+
+    def CASE42( self, main ):
+        """
+        Tests connectivity between untagged host and tagged host
+        (Ports are configured as vlan-untagged and
+        vlan-tagged with same vlan id, respectively)
+
+        Sets up 1 ONOS instance
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 42,
+                                topology = '0x2',
+                                onosNodes = 1,
+                                description = "Bridging test between untagged host and tagged host",
+                                vlan = [ 0, 10 ] )
+
+    def CASE43( self, main ):
+        """
+        Tests connectivity between untagged host and tagged host
+        (Ports are configured as vlan-untagged and
+        vlan-tagged with same vlan id, respectively)
+
+        Sets up 1 ONOS instance
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 43,
+                                topology = '2x2',
+                                onosNodes = 1,
+                                description = "Bridging test between untagged host and tagged host",
+                                vlan = [ 0, 10, 0, 20 ] )
+
+    def CASE44( self, main ):
+        """
+        Tests connectivity between untagged host and tagged host
+        (Ports are configured as vlan-untagged and
+        vlan-tagged with same vlan id, respectively)
+
+        Sets up 1 ONOS instance
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 44,
+                                topology = '2x4',
+                                onosNodes = 1,
+                                description = "Bridging test between untagged host and tagged host",
+                                vlan = [ 0, 10, 0, 20 ] )
+
+    def CASE45( self, main ):
+        """
+        Tests connectivity between untagged host and tagged host
+        (Ports are configured as vlan-untagged and
+        vlan-tagged with same vlan id, respectively)
+
+        Sets up 3 ONOS instances
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 45,
+                                topology = '0x1',
+                                onosNodes = 3,
+                                description = "Bridging test between untagged host and tagged host",
+                                vlan = [ 0, 10 ] )
+
+    def CASE46( self, main ):
+        """
+        Tests connectivity between untagged host and tagged host
+        (Ports are configured as vlan-untagged and
+        vlan-tagged with same vlan id, respectively)
+
+        Sets up 3 ONOS instances
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 46,
+                                topology = '0x2',
+                                onosNodes = 3,
+                                description = "Bridging test between untagged host and tagged host",
+                                vlan = [ 0, 10 ] )
+
+    def CASE47( self, main ):
+        """
+        Tests connectivity between untagged host and tagged host
+        (Ports are configured as vlan-untagged and
+        vlan-tagged with same vlan id, respectively)
+
+        Sets up 3 ONOS instances
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 47,
+                                topology = '2x2',
+                                onosNodes = 3,
+                                description = "Bridging test between untagged host and tagged host",
+                                vlan = [ 0, 10, 0, 20 ] )
+
+    def CASE48( self, main ):
+        """
+        Tests connectivity between untagged host and tagged host
+        (Ports are configured as vlan-untagged and
+        vlan-tagged with same vlan id, respectively)
+
+        Sets up 3 ONOS instances
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 48,
+                                topology = '2x4',
+                                onosNodes = 3,
+                                description = "Bridging test between untagged host and tagged host",
+                                vlan = [ 0, 10, 0, 20 ] )
+
+    def CASE51( self, main ):
+        """
+        Tests connectivity between two untagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 51,
+                                topology = '0x1',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts with different vlan id" )
+
+    def CASE52( self, main ):
+        """
+        Tests connectivity between two untagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 52,
+                                topology = '0x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts with different vlan id" )
+
+    def CASE53( self, main ):
+        """
+        Tests connectivity between two untagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 53,
+                                topology = '2x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts with different vlan id" )
+
+    def CASE54( self, main ):
+        """
+        Tests connectivity between two untagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 54,
+                                topology = '2x4',
+                                onosNodes = 1,
+                                description = "Bridging test between two untagged hosts with different vlan id" )
+
+    def CASE55( self, main ):
+        """
+        Tests connectivity between two untagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 55,
+                                topology = '0x1',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts with different vlan id" )
+
+    def CASE56( self, main ):
+        """
+        Tests connectivity between two untagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 56,
+                                topology = '0x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts with different vlan id" )
+
+    def CASE57( self, main ):
+        """
+        Tests connectivity between two untagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 57,
+                                topology = '2x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts with different vlan id" )
+
+    def CASE58( self, main ):
+        """
+        Tests connectivity between two untagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 58,
+                                topology = '2x4',
+                                onosNodes = 3,
+                                description = "Bridging test between two untagged hosts with different vlan id" )
+
+    def CASE61( self, main ):
+        """
+        Tests connectivity between two tagged hosts with different vlan id
+        (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 61,
+                                topology = '0x1',
+                                onosNodes = 1,
+                                description = "Bridging test between two tagged hosts with different vlan id",
+                                vlan = [ 10, 20 ] )
+
+    def CASE62( self, main ):
+        """
+        Tests connectivity between two tagged hosts with different vlan id
+        (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 62,
+                                topology = '0x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two tagged hosts with different vlan id",
+                                vlan = [ 10, 20 ] )
+
+    def CASE63( self, main ):
+        """
+        Tests connectivity between two tagged hosts with different vlan id
+        (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 63,
+                                topology = '2x2',
+                                onosNodes = 1,
+                                description = "Bridging test between two tagged hosts with different vlan id",
+                                vlan = [ 10, 20, 30, 40 ] )
+
+    def CASE64( self, main ):
+        """
+        Tests connectivity between two tagged hosts with different vlan id
+        (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 64,
+                                topology = '2x4',
+                                onosNodes = 1,
+                                description = "Bridging test between two tagged hosts with different vlan id",
+                                vlan = [ 10, 20, 30, 40 ] )
+
+    def CASE65( self, main ):
+        """
+        Tests connectivity between two tagged hosts with different vlan id
+        (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 65,
+                                topology = '0x1',
+                                onosNodes = 3,
+                                description = "Bridging test between two tagged hosts with different vlan id",
+                                vlan = [ 10, 20 ] )
+
+    def CASE66( self, main ):
+        """
+        Tests connectivity between two tagged hosts with different vlan id
+        (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 66,
+                                topology = '0x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two tagged hosts with different vlan id",
+                                vlan = [ 10, 20 ] )
+
+    def CASE67( self, main ):
+        """
+        Tests connectivity between two tagged hosts with different vlan id
+        (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 67,
+                                topology = '2x2',
+                                onosNodes = 3,
+                                description = "Bridging test between two tagged hosts with different vlan id",
+                                vlan = [ 10, 20, 30, 40 ] )
+
+    def CASE68( self, main ):
+        """
+        Tests connectivity between two tagged hosts with different vlan id
+        (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 2x4 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 68,
+                                topology = '2x4',
+                                onosNodes = 3,
+                                description = "Bridging test between two tagged hosts with different vlan id",
+                                vlan = [ 10, 20, 30, 40 ] )
+
+    def CASE71( self, main ):
+        """
+        Tests connectivity between untagged and tagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 71,
+                                topology = '0x1',
+                                onosNodes = 1,
+                                description = "Bridging test between untagged and tagged hosts with different vlan id",
+                                vlan = [ 0, 20 ] )
+
+    def CASE72( self, main ):
+        """
+        Tests connectivity between untagged and tagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 72,
+                                topology = '0x2',
+                                onosNodes = 1,
+                                description = "Bridging test between untagged and tagged hosts with different vlan id",
+                                vlan = [ 0, 20 ] )
+
+    def CASE73( self, main ):
+        """
+        Tests connectivity between untagged and tagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 73,
+                                topology = '2x2',
+                                onosNodes = 1,
+                                description = "Bridging test between untagged and tagged hosts with different vlan id",
+                                vlan = [ 0, 20, 0, 40 ] )
+
+    def CASE74( self, main ):
+        """
+        Tests connectivity between untagged and tagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+        Sets up 1 ONOS instance
+        Start 2x2 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 74,
+                                topology = '2x4',
+                                onosNodes = 1,
+                                description = "Bridging test between untagged and tagged hosts with different vlan id",
+                                vlan = [ 0, 20, 0, 40 ] )
+
+    def CASE75( self, main ):
+        """
+        Tests connectivity between untagged and tagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 0x1 single ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 75,
+                                topology = '0x1',
+                                onosNodes = 3,
+                                description = "Bridging test between untagged and tagged hosts with different vlan id",
+                                vlan = [ 0, 20 ] )
+
+    def CASE76( self, main ):
+        """
+        Tests connectivity between untagged and tagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 0x2 dual-homed ToR topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 76,
+                                topology = '0x2',
+                                onosNodes = 3,
+                                description = "Bridging test between untagged and tagged hosts with different vlan id",
+                                vlan = [ 0, 20 ] )
+
+    def CASE77( self, main ):
+        """
+        Tests connectivity between untagged and tagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 2x2 leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 77,
+                                topology = '2x2',
+                                onosNodes = 3,
+                                description = "Bridging test between untagged and tagged hosts with different vlan id",
+                                vlan = [ 0, 20, 0, 40 ] )
+
+    def CASE78( self, main ):
+        """
+        Tests connectivity between untagged and tagged hosts with different vlan id
+        (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+        Sets up 3 ONOS instances
+        Start 2x2 dual-homed leaf-spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.SRBridgingTest import SRBridgingTest
+        SRBridgingTest.runTest( main,
+                                test_idx = 78,
+                                topology = '2x4',
+                                onosNodes = 3,
+                                description = "Bridging test between untagged and tagged hosts with different vlan id",
+                                vlan = [ 0, 20, 0, 40 ] )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo
new file mode 100644
index 0000000..a672a8e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo
@@ -0,0 +1,36 @@
+<TOPOLOGY>
+    <COMPONENT>
+        <ONOScell>
+            <host>localhost</host>  # ONOS "bench" machine
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosClusterDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+                <cluster_name></cluster_name>  # Used as a prefix for cluster components. Defaults to 'ONOS'
+                <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+                <karaf_username></karaf_username>
+                <karaf_password></karaf_password>
+                <web_user></web_user>
+                <web_pass></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
+                <nodes>3</nodes>  # number of nodes in the cluster
+            </COMPONENTS>
+        </ONOScell>
+
+        <Mininet1>
+            <host>OCN</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>MininetCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+                <home>~/mininet/custom/</home>
+                <prompt></prompt>
+            </COMPONENTS>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/SRBridgingTest.py b/TestON/tests/USECASE/SegmentRouting/dependencies/SRBridgingTest.py
new file mode 100644
index 0000000..653588e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/SRBridgingTest.py
@@ -0,0 +1,60 @@
+"""
+Copyright 2017 Open Networking Foundation ( ONF )
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+    TestON is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 2 of the License, or
+    ( at your option ) any later version.
+
+    TestON is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with TestON.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from Testcaselib import Testcaselib as run
+
+class SRBridgingTest ():
+
+    def __init__( self ):
+        self.default = ''
+
+    @staticmethod
+    def runTest( main, test_idx, topology, onosNodes, description, vlan = [] ):
+        topo = dict()
+        # (number of spine switch, number of leaf switch, dual-homed, description, minFlowCount)
+        # TODO: Need to check correct number of minFlowCount
+        topo[ '0x1' ] = ( 0, 1, False, 'single ToR', 15 )
+        topo[ '0x2' ] = ( 0, 2, True, 'dual-homed ToR', 15 )
+        topo[ '2x2' ] = ( 2, 2, False, '2x2 leaf-spine topology', 116 )
+        # TODO: Implement 2x3 topology
+        # topo[ '2x3' ] = ( 2, 3, True, '2x3 leaf-spine topology with dual ToR and single ToR' )
+        topo[ '2x4' ] = ( 2, 4, True, '2x4 dual-homed leaf-spine topology', 116 )
+
+        if not hasattr( main, 'apps' ):
+            run.initTest( main )
+
+        main.case( '%s, with %s and %d ONOS instance%s' %
+                   ( description, topo[ topology ][ 3 ], onosNodes, 's' if onosNodes > 1 else '' ) )
+
+        main.cfgName = 'CASE%01d%01d' % ( test_idx / 10, ( ( test_idx - 1 ) % 10 ) % 4 + 1 )
+        main.Cluster.setRunningNode( onosNodes )
+        run.installOnos( main )
+        mininet_args = ' --spine=%d --leaf=%d' % ( topo[ topology ][ 0 ], topo[ topology ][ 1 ] )
+        if topo[ topology ][ 2 ]:
+            mininet_args += ' --dual-homed'
+        if len( vlan ) > 0 :
+            mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
+
+        run.startMininet( main, 'trellis_fabric.py', args = mininet_args )
+        # TODO: Need to check correct number of minFlowCount
+        run.checkFlows( main, minFlowCount = topo[ topology ][ 4 ] )
+        run.pingAll( main, 'CASE%02d' % test_idx )
+        run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index f542554..174e697 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -73,6 +73,24 @@
             stepResult = main.testSetUp.envSetup()
         except Exception as e:
             main.testSetUp.envSetupException( e )
+
+        # Additional files for topology building
+        try:
+            main.topologyLib1 = main.params[ 'DEPENDENCY' ][ 'lib1' ]
+            main.topologyLib2 = main.params[ 'DEPENDENCY' ][ 'lib2' ]
+            copyResult2 = main.ONOSbench.scp(main.Mininet1,
+                                             main.dependencyPath +
+                                             main.topologyLib1,
+                                             main.Mininet1.home,
+                                             direction="to")
+            copyResult3 = main.ONOSbench.scp(main.Mininet1,
+                                             main.dependencyPath +
+                                             main.topologyLib2,
+                                             main.Mininet1.home,
+                                             direction="to")
+        except:
+            pass
+
         main.testSetUp.evnSetupConclusion( stepResult )
 
     @staticmethod
@@ -102,25 +120,20 @@
         # kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
                        " before initiating environment setup" )
-        for ctrl in main.Cluster.runningNodes:
-            main.ONOSbench.onosDie( ctrl.ipAddress )
+        main.testSetUp.killingAllOnos(main.Cluster, True, False)
 
-        main.testSetUp.buildOnos( main.Cluster )
+        main.testSetUp.uninstallOnos(main.Cluster, False)
+        main.testSetUp.buildOnos(main.Cluster)
 
-        main.testSetUp.installOnos( main.Cluster, False )
+        main.testSetUp.installOnos(main.Cluster, False)
 
-        main.testSetUp.setupSsh( main.Cluster )
+        main.testSetUp.setupSsh(main.Cluster)
 
-        main.testSetUp.checkOnosService( main.Cluster )
+        main.testSetUp.checkOnosService(main.Cluster)
 
         cliResult = main.TRUE
-        main.step( "Checking if ONOS CLI is ready" )
-        for ctrl in main.Cluster.runningNodes:
-            ctrl.CLI.startCellCli()
-            cliResult = cliResult and ctrl.CLI.startOnosCli( ctrl.ipAddress,
-                                                             commandlineTimeout=60,
-                                                             onosStartTimeout=100 )
-            ctrl.active = True
+        main.step("Checking if ONOS CLI is ready")
+        cliResult = main.testSetUp.startOnosClis(main.Cluster)
         utilities.assert_equals( expect=main.TRUE,
                                  actual=cliResult,
                                  onpass="ONOS CLI is ready",
@@ -154,7 +167,7 @@
     @staticmethod
     def startMininet( main, topology, args="" ):
         main.step( "Starting Mininet Topology" )
-        arg = "--onos %d %s" % ( main.Cluster.numCtrls, args )
+        arg = "--onos-ip=%s %s" % (",".join([ctrl.ipAddress for ctrl in main.Cluster.runningNodes]), args)
         main.topology = topology
         topoResult = main.Mininet1.startNet(
                 topoFile=main.Mininet1.home + main.topology, args=arg )
@@ -229,7 +242,7 @@
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
                                      main.FALSE,
                                      kwargs={ 'isPENDING': False },
-                                     attempts=2,
+                                     attempts=4,
                                      sleep=10 )
         utilities.assertEquals(
                 expect=main.TRUE,
@@ -253,9 +266,13 @@
         for entry in main.pingChart.itervalues():
             print entry
             hosts, expect = entry[ 'hosts' ], entry[ 'expect' ]
-            expect = main.TRUE if expect else main.FALSE
+            try:
+                expect = main.TRUE if str(expect).lower() == 'true' else main.FALSE
+            except:
+                expect = main.FALSE
             main.step( "Connectivity for %s %s" % ( str( hosts ), tag ) )
             pa = main.Mininet1.pingallHosts( hosts )
+
             utilities.assert_equals( expect=expect, actual=pa,
                                      onpass="IP connectivity successfully tested",
                                      onfail="IP connectivity failed" )
@@ -422,7 +439,7 @@
 
         if len( nodes ) < main.Cluster.numCtrls:
 
-            nodeResults = utilities.retry( Testcaselib.nodesCheck,
+            nodeResults = utilities.retry( main.Cluster.nodesCheck,
                                            False,
                                            attempts=5,
                                            sleep=10 )
@@ -478,9 +495,8 @@
                                      onfail="ONOS CLI is not ready" )
 
         main.step( "Checking ONOS nodes" )
-        nodeResults = utilities.retry( Testcaselib.nodesCheck,
+        nodeResults = utilities.retry( main.Cluster.nodesCheck,
                                        False,
-                                       args=[ nodes ],
                                        attempts=5,
                                        sleep=10 )
         utilities.assert_equals( expect=True, actual=nodeResults,
@@ -587,28 +603,3 @@
         main.Cluster.active( 0 ).REST.removeNetCfg( subjectClass="apps",
                                                     subjectKey="org.onosproject.segmentrouting",
                                                     configKey="xconnect" )
-
-    @staticmethod
-    def nodesCheck( nodes ):
-        results = True
-        nodesOutput = main.Cluster.command( "nodes", specificDriver=2 )
-        ips = sorted( main.Cluster.getIps( activeOnly=True ) )
-        for i in nodesOutput:
-            try:
-                current = json.loads( i )
-                activeIps = []
-                currentResult = False
-                for node in current:
-                    if node[ 'state' ] == 'READY':
-                        activeIps.append( node[ 'ip' ] )
-                currentResult = True
-                for ip in ips:
-                    if ip not in activeIps:
-                        currentResult = False
-                        break
-            except ( ValueError, TypeError ):
-                main.log.error( "Error parsing nodes output" )
-                main.log.warn( repr( i ) )
-                currentResult = False
-            results = results and currentResult
-        return results
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp1.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp1.conf
new file mode 100644
index 0000000..8870fb4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/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/dependencies/conf/bgpdbgp2.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp2.conf
new file mode 100644
index 0000000..e554de4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/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/dependencies/conf/bgpdr1.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdr1.conf
new file mode 100644
index 0000000..9e526b8
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/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/dependencies/conf/bgpdr2.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdr2.conf
new file mode 100644
index 0000000..49553e2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/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/dependencies/conf/dhcpd.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/dhcpd.conf
new file mode 100644
index 0000000..aa559d2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/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/dependencies/conf/dhcpd6.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/dhcpd6.conf
new file mode 100644
index 0000000..526de85
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/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/dependencies/conf/zebradbgp1.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp1.conf
new file mode 100644
index 0000000..51991a4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/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 192.168.56.11 port 2620
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp2.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp2.conf
new file mode 100644
index 0000000..dce218d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/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 192.168.56.11 port 2620
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE01.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE01.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE01.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE01.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE01.json
new file mode 100644
index 0000000..d85f60a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE01.json
@@ -0,0 +1,34 @@
+{
+    "ports" : {
+        "of:0000000000000001/1" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE02.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE02.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE02.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE02.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE02.json
new file mode 100644
index 0000000..9410029
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE02.json
@@ -0,0 +1,80 @@
+{
+    "ports" : {
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        }
+    },
+    "hosts": {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+            }
+        },
+        "00:AA:00:00:00:02/None": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE03.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE03.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE03.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE03.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE03.json
new file mode 100644
index 0000000..713067a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE03.json
@@ -0,0 +1,86 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000002/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE04.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE04.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE04.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE04.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE04.json
new file mode 100644
index 0000000..2df8dd3
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE04.json
@@ -0,0 +1,176 @@
+{
+    "ports" : {
+        "of:0000000000000001/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        }
+    },
+    "hosts": {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+            }
+        },
+        "00:AA:00:00:00:02/None": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+            }
+        },
+        "00:AA:00:00:00:03/None": {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+            }
+        },
+        "00:AA:00:00:00:04/None": {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000004",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE11.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE11.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE11.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE11.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE11.json
new file mode 100644
index 0000000..df3be82
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE11.json
@@ -0,0 +1,46 @@
+{
+    "ports" : {
+        "of:0000000000000001/1" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:01/10" : {
+            "basic": {
+                "locations": ["of:0000000000000001/1"]
+            }
+        },
+        "00:aa:00:00:00:02/10" : {
+            "basic": {
+                "locations": ["of:0000000000000001/2"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE12.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE12.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE12.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE12.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE12.json
new file mode 100644
index 0000000..07a8dc2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE12.json
@@ -0,0 +1,80 @@
+{
+    "ports" : {
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:AA:00:00:00:01/10" : {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+            }
+        },
+        "00:AA:00:00:00:02/10" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE13.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE13.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE13.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE13.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE13.json
new file mode 100644
index 0000000..34e0bb5
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE13.json
@@ -0,0 +1,108 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000002/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:01/10" : {
+            "basic": {
+                "locations": ["of:0000000000000001/3"]
+            }
+        },
+        "00:aa:00:00:00:02/10" : {
+            "basic": {
+                "locations": ["of:0000000000000001/4"]
+            }
+        },
+        "00:aa:00:00:00:03/20" : {
+            "basic": {
+                "locations": ["of:0000000000000002/3"]
+            }
+        },
+        "00:aa:00:00:00:04/20" : {
+            "basic": {
+                "locations": ["of:0000000000000002/4"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE14.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE14.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE14.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE14.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE14.json
new file mode 100644
index 0000000..05762da
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE14.json
@@ -0,0 +1,176 @@
+{
+    "ports" : {
+        "of:0000000000000001/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000001/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:01/10" : {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+            }
+        },
+        "00:aa:00:00:00:02/10" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+            }
+        },
+        "00:aa:00:00:00:03/20" : {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+            }
+        },
+        "00:aa:00:00:00:04/20" : {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000004",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000003",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE21.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE21.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE21.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE21.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE21.json
new file mode 100644
index 0000000..833f2c9
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE21.json
@@ -0,0 +1,36 @@
+{
+    "ports" : {
+        "of:0000000000000001/1" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE22.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE22.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE22.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE22.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE22.json
new file mode 100644
index 0000000..d4c09dd
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE22.json
@@ -0,0 +1,84 @@
+{
+    "ports" : {
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000002/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        }
+    },
+    "hosts": {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+            }
+        },
+        "00:AA:00:00:00:02/None": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE23.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE23.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE23.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE23.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE23.json
new file mode 100644
index 0000000..cbfb189
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE23.json
@@ -0,0 +1,90 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        },
+        "of:0000000000000002/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE24.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE24.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE24.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE24.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE24.json
new file mode 100644
index 0000000..f979115
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE24.json
@@ -0,0 +1,184 @@
+{
+    "ports" : {
+        "of:0000000000000001/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000001/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        },
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        }
+    },
+    "hosts": {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+            }
+        },
+        "00:AA:00:00:00:02/None": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+            }
+        },
+        "00:AA:00:00:00:03/None": {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+            }
+        },
+        "00:AA:00:00:00:04/None": {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000004",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000003",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE31.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE31.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE31.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE31.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE31.json
new file mode 100644
index 0000000..9b389a2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE31.json
@@ -0,0 +1,35 @@
+{
+    "ports" : {
+        "of:0000000000000001/1" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE32.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE32.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE32.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE32.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE32.json
new file mode 100644
index 0000000..6d5161c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE32.json
@@ -0,0 +1,82 @@
+{
+    "ports" : {
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000002/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        }
+    },
+    "hosts": {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+            }
+        },
+        "00:AA:00:00:00:02/None": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE33.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE33.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE33.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE33.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE33.json
new file mode 100644
index 0000000..ee1ab88
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE33.json
@@ -0,0 +1,88 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        },
+        "of:0000000000000002/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 40
+                }
+            ]
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE34.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE34.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE34.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE34.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE34.json
new file mode 100644
index 0000000..49843c5
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE34.json
@@ -0,0 +1,180 @@
+{
+    "ports" : {
+        "of:0000000000000001/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000001/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10],
+                    "vlan-native": 20
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 40
+                }
+            ]
+        },
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30],
+                    "vlan-native": 40
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 40
+                }
+            ]
+        }
+    },
+    "hosts": {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+            }
+        },
+        "00:AA:00:00:00:02/None": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+            }
+        },
+        "00:AA:00:00:00:03/None": {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+            }
+        },
+        "00:AA:00:00:00:04/None": {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+            }
+        }
+    },
+     "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000004",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000003",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE41.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE41.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE41.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE41.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE41.json
new file mode 100644
index 0000000..97d3059
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE41.json
@@ -0,0 +1,41 @@
+{
+    "ports" : {
+        "of:0000000000000001/1" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:02/10" : {
+            "basic": {
+                "locations": ["of:0000000000000001/2"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE42.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE42.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE42.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE42.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE42.json
new file mode 100644
index 0000000..d070409
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE42.json
@@ -0,0 +1,80 @@
+{
+    "ports" : {
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+            }
+        },
+        "00:AA:00:00:00:02/10" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE43.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE43.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE43.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE43.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE43.json
new file mode 100644
index 0000000..3002bc5
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE43.json
@@ -0,0 +1,98 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000002/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:02/10" : {
+            "basic": {
+                "locations": ["of:0000000000000001/4"]
+            }
+        },
+        "00:aa:00:00:00:04/20" : {
+            "basic": {
+                "locations": ["of:0000000000000002/4"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE44.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE44.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE44.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "True",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "True",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE44.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE44.json
new file mode 100644
index 0000000..8adeccd
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE44.json
@@ -0,0 +1,176 @@
+{
+    "ports" : {
+        "of:0000000000000001/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+            }
+        },
+        "00:AA:00:00:00:02/10" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+            }
+        },
+        "00:AA:00:00:00:03/None": {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+            }
+        },
+        "00:AA:00:00:00:04/20" : {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000004",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000003",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE51.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE51.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE51.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE51.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE51.json
new file mode 100644
index 0000000..acb782a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE51.json
@@ -0,0 +1,34 @@
+{
+    "ports" : {
+        "of:0000000000000001/1" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE52.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE52.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE52.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE52.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE52.json
new file mode 100644
index 0000000..915a7ea
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE52.json
@@ -0,0 +1,80 @@
+{
+    "ports" : {
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000002/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        }
+    },
+    "hosts": {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+            }
+        },
+        "00:AA:00:00:00:02/None": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE53.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE53.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE53.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "False",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE53.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE53.json
new file mode 100644
index 0000000..2a3ba1d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE53.json
@@ -0,0 +1,86 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 30
+                }
+            ]
+        },
+        "of:0000000000000002/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 40
+                }
+            ]
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE54.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE54.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE54.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "False",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE54.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE54.json
new file mode 100644
index 0000000..7427516
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE54.json
@@ -0,0 +1,176 @@
+{
+    "ports" : {
+        "of:0000000000000001/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 20
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 30
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 40
+                }
+            ]
+        },
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 30
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 40
+                }
+            ]
+        }
+    },
+    "hosts": {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+            }
+        },
+        "00:AA:00:00:00:02/None": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+            }
+        },
+        "00:AA:00:00:00:03/None": {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+            }
+        },
+        "00:AA:00:00:00:04/None": {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000004",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000003",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE61.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE61.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE61.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE61.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE61.json
new file mode 100644
index 0000000..7f539f9
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE61.json
@@ -0,0 +1,46 @@
+{
+    "ports" : {
+        "of:0000000000000001/1" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:01/10" : {
+            "basic": {
+                "locations": ["of:0000000000000001/1"]
+            }
+        },
+        "00:aa:00:00:00:02/20" : {
+            "basic": {
+                "locations": ["of:0000000000000001/2"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE62.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE62.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE62.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE62.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE62.json
new file mode 100644
index 0000000..17f7592
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE62.json
@@ -0,0 +1,80 @@
+{
+    "ports" : {
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000002/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:AA:00:00:00:01/10" : {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+            }
+        },
+        "00:AA:00:00:00:02/20" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE63.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE63.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE63.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "False",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE63.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE63.json
new file mode 100644
index 0000000..a114681
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE63.json
@@ -0,0 +1,108 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        },
+        "of:0000000000000002/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:01/10": {
+            "basic": {
+                "locations": ["of:0000000000000001/3"]
+            }
+        },
+        "00:aa:00:00:00:02/20": {
+            "basic": {
+                "locations": ["of:0000000000000001/4"]
+            }
+        },
+        "00:aa:00:00:00:03/30": {
+            "basic": {
+                "locations": ["of:0000000000000002/3"]
+            }
+        },
+        "00:aa:00:00:00:04/40": {
+            "basic": {
+                "locations": ["of:0000000000000002/4"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE64.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE64.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE64.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "False",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE64.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE64.json
new file mode 100644
index 0000000..6614b07
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE64.json
@@ -0,0 +1,176 @@
+{
+    "ports" : {
+        "of:0000000000000001/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000001/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [10]
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [30]
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:AA:00:00:00:01/10": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/6","of:0000000000000002/6"]
+            }
+        },
+        "00:AA:00:00:00:02/20": {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+            }
+        },
+        "00:AA:00:00:00:03/30": {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+            }
+        },
+        "00:AA:00:00:00:04/40": {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000004",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000003",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE71.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE71.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE71.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE71.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE71.json
new file mode 100644
index 0000000..cd3115d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE71.json
@@ -0,0 +1,41 @@
+{
+    "ports" : {
+        "of:0000000000000001/1" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:02/20" : {
+            "basic": {
+                "locations": ["of:0000000000000001/2"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE72.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE72.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE72.chart
@@ -0,0 +1,4 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE72.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE72.json
new file mode 100644
index 0000000..a9cc134
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE72.json
@@ -0,0 +1,80 @@
+{
+    "ports" : {
+        "of:0000000000000001/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000002/2" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+            }
+        },
+        "00:AA:00:00:00:02/20" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 1,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE73.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE73.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE73.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "False",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE73.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE73.json
new file mode 100644
index 0000000..b0dfd20
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE73.json
@@ -0,0 +1,98 @@
+{
+    "ports" : {
+        "of:0000000000000001/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000002/3" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 30
+                }
+            ]
+        },
+        "of:0000000000000002/4" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:aa:00:00:00:02/20" : {
+            "basic": {
+                "locations": ["of:0000000000000001/4"]
+            }
+        },
+        "00:aa:00:00:00:04/40" : {
+            "basic": {
+                "locations": ["of:0000000000000002/4"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE74.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE74.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE74.chart
@@ -0,0 +1,6 @@
+{
+  "leaf1": {"expect": "False",
+    "hosts":["h1", "h2"]},
+  "leaf2": {"expect": "False",
+    "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE74.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE74.json
new file mode 100644
index 0000000..9a3de7c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/CASE74.json
@@ -0,0 +1,176 @@
+{
+    "ports" : {
+        "of:0000000000000001/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000001/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000002/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-untagged": 10
+                }
+            ]
+        },
+        "of:0000000000000002/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.1.254/24" ],
+                    "vlan-tagged": [20]
+                }
+            ]
+        },
+        "of:0000000000000003/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 30
+                }
+            ]
+        },
+        "of:0000000000000003/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        },
+        "of:0000000000000004/6" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-untagged": 30
+                }
+            ]
+        },
+        "of:0000000000000004/7" : {
+            "interfaces" : [
+                {
+                    "ips" : [ "10.0.2.254/24" ],
+                    "vlan-tagged": [40]
+                }
+            ]
+        }
+    },
+    "hosts" : {
+        "00:AA:00:00:00:01/None": {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+            }
+        },
+        "00:AA:00:00:00:02/20" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+            }
+        },
+        "00:AA:00:00:00:03/None": {
+            "basic": {
+                "ips": ["10.0.3.1"],
+                "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+            }
+        },
+        "00:AA:00:00:00:04/40" : {
+            "basic": {
+                "ips": ["10.0.3.2"],
+                "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+            }
+        }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000002",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000002" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 1,
+                "ipv4Loopback" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000001",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000003" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.3",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000004",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000004" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 2,
+                "ipv4Loopback" : "192.168.0.4",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000003",
+                "pairLocalPort" : 5,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000101" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 101,
+                "ipv4Loopback" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        },
+        "of:0000000000000102" : {
+            "segmentrouting" : {
+                "ipv4NodeSid" : 102,
+                "ipv4Loopback" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            },
+            "basic" : {
+                "driver" : "ofdpa-ovs"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/routinglib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/routinglib.py
new file mode 100644
index 0000000..81ed5ec
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/routinglib.py
@@ -0,0 +1,677 @@
+#!/usr/bin/python
+
+"""
+Libraries for creating L3 topologies with routing protocols.
+"""
+
+from mininet.node import Host, OVSBridge
+from mininet.nodelib import NAT
+from mininet.log import info, debug, error
+from mininet.cli import CLI
+from ipaddress import ip_network, ip_address, ip_interface
+import os
+
+class RoutedHost(Host):
+    """Host that can be configured with multiple IP addresses."""
+    def __init__(self, name, ips, gateway, *args, **kwargs):
+        super(RoutedHost, self).__init__(name, *args, **kwargs)
+
+        self.ips = ips
+        self.gateway = gateway
+
+    def config(self, **kwargs):
+        Host.config(self, **kwargs)
+
+        self.cmd('ip -4 addr flush dev %s' % self.defaultIntf())
+        for ip in self.ips:
+            self.cmd('ip addr add %s dev %s' % (ip, self.defaultIntf()))
+
+        self.cmd('ip route add default via %s' % self.gateway)
+
+class RoutedHost6(Host):
+    """Host that can be configured with multiple IP addresses."""
+    def __init__(self, name, ips, gateway, *args, **kwargs):
+        super(RoutedHost6, self).__init__(name, *args, **kwargs)
+
+        self.ips = ips
+        self.gateway = gateway
+
+    def config(self, **kwargs):
+        Host.config(self, **kwargs)
+
+        self.cmd('ip -6 addr flush dev %s' % self.defaultIntf())
+        for ip in self.ips:
+            self.cmd('ip -6 addr add %s dev %s' % (ip, self.defaultIntf()))
+
+        self.cmd('ip -6 route add default via %s' % self.gateway)
+
+class Router(Host):
+
+    """An L3 router.
+    Configures the Linux kernel for L3 forwarding and supports rich interface
+    configuration of IP addresses, MAC addresses and VLANs."""
+
+    def __init__(self, name, interfaces, *args, **kwargs):
+        super(Router, self).__init__(name, **kwargs)
+
+        self.interfaces = interfaces
+
+    def config(self, **kwargs):
+        super(Host, self).config(**kwargs)
+
+        self.cmd('sysctl net.ipv4.ip_forward=1')
+        self.cmd('sysctl net.ipv4.conf.all.rp_filter=0')
+        self.cmd('sysctl net.ipv6.conf.all.forwarding=1')
+
+        for intf, configs in self.interfaces.items():
+            self.cmd('ip -4 addr flush dev %s' % intf)
+            self.cmd( 'sysctl net.ipv4.conf.%s.rp_filter=0' % intf )
+
+            if not isinstance(configs, list):
+                configs = [configs]
+
+            for attrs in configs:
+                # Configure the vlan if there is one
+                if 'vlan' in attrs:
+                    vlanName = '%s.%s' % (intf, attrs['vlan'])
+                    self.cmd('ip link add link %s name %s type vlan id %s' %
+                             (intf, vlanName, attrs['vlan']))
+                    self.cmd('ip link set %s up' % vlanName)
+                    addrIntf = vlanName
+                else:
+                    addrIntf = intf
+
+                # Now configure the addresses on the vlan/native interface
+                if 'mac' in attrs:
+                    self.cmd('ip link set %s down' % addrIntf)
+                    self.cmd('ip link set %s address %s' % (addrIntf, attrs['mac']))
+                    self.cmd('ip link set %s up' % addrIntf)
+                for addr in attrs['ipAddrs']:
+                    self.cmd('ip addr add %s dev %s' % (addr, addrIntf))
+
+class QuaggaRouter(Router):
+
+    """Runs Quagga to create a router that can speak routing protocols."""
+
+    binDir = '/usr/lib/quagga'
+    logDir = '/var/log/quagga'
+
+    def __init__(self, name, interfaces,
+                 defaultRoute=None,
+                 zebraConfFile=None,
+                 protocols= [],
+                 fpm=None,
+                 runDir='/var/run/quagga', *args, **kwargs):
+        super(QuaggaRouter, self).__init__(name, interfaces, **kwargs)
+
+        self.protocols = protocols
+        self.fpm = fpm
+
+        for p in self.protocols:
+            p.setQuaggaRouter(self)
+
+        self.runDir = runDir
+        self.defaultRoute = defaultRoute
+
+        # Ensure required directories exist
+        try:
+            original_umask = os.umask(0)
+            if (not os.path.isdir(QuaggaRouter.logDir)):
+                os.makedirs(QuaggaRouter.logDir, 0777)
+            if (not os.path.isdir(self.runDir)):
+                os.makedirs(self.runDir, 0777)
+        finally:
+            os.umask(original_umask)
+
+        self.zebraConfFile = zebraConfFile
+        if (self.zebraConfFile is None):
+            self.zebraConfFile = '%s/zebrad%s.conf' % (self.runDir, self.name)
+            self.generateZebra()
+
+        self.socket = '%s/zebra%s.api' % (self.runDir, self.name)
+
+        self.zebraPidFile = '%s/zebra%s.pid' % (self.runDir, self.name)
+
+    def generateZebra(self):
+        configFile = open(self.zebraConfFile, 'w+')
+        configFile.write('log file %s/zebrad%s.log\n' % (QuaggaRouter.logDir, self.name))
+        configFile.write('hostname zebra-%s\n' % self.name)
+        configFile.write('password %s\n' % 'quagga')
+        if (self.fpm is not None):
+            configFile.write('fpm connection ip %s port 2620' % self.fpm)
+        configFile.close()
+
+    def config(self, **kwargs):
+        super(QuaggaRouter, self).config(**kwargs)
+
+        self.cmd('%s/zebra -d -f %s -z %s -i %s'
+                 % (QuaggaRouter.binDir, self.zebraConfFile, self.socket, self.zebraPidFile))
+
+        for p in self.protocols:
+            p.config(**kwargs)
+
+        if self.defaultRoute:
+            self.cmd('ip route add default via %s' % self.defaultRoute)
+
+    def terminate(self, **kwargs):
+        self.cmd("ps ax | grep '%s' | awk '{print $1}' | xargs kill"
+                 % (self.socket))
+
+        for p in self.protocols:
+            p.terminate(**kwargs)
+
+        super(QuaggaRouter, self).terminate()
+
+class Protocol(object):
+
+    """Base abstraction of a protocol that the QuaggaRouter can run."""
+
+    def setQuaggaRouter(self, qr):
+        self.qr = qr
+
+    def config(self, **kwargs):
+        pass
+
+    def terminate(self, **kwargs):
+        pass
+
+class BgpProtocol(Protocol):
+
+    """Configures and runs the BGP protocol in Quagga."""
+
+    def __init__(self, configFile=None, asNum=None, neighbors=[], routes=[], *args, **kwargs):
+        self.configFile = configFile
+
+        self.asNum = asNum
+        self.neighbors = neighbors
+        self.routes = routes
+
+    def config(self, **kwargs):
+        if self.configFile is None:
+            self.configFile = '%s/bgpd%s.conf' % (self.qr.runDir, self.qr.name)
+            self.generateConfig()
+
+        bgpdPidFile = '%s/bgpd%s.pid' % (self.qr.runDir, self.qr.name)
+
+        self.qr.cmd('%s/bgpd -d -f %s -z %s -i %s'
+                     % (QuaggaRouter.binDir, self.configFile, self.qr.socket, bgpdPidFile))
+
+    def generateConfig(self):
+        conf = ConfigurationWriter(self.configFile)
+
+        def getRouterId(interfaces):
+            intfAttributes = interfaces.itervalues().next()
+            print intfAttributes
+            if isinstance(intfAttributes, list):
+                # Try use the first set of attributes, but if using vlans they might not have addresses
+                intfAttributes = intfAttributes[1] if not intfAttributes[0]['ipAddrs'] else intfAttributes[0]
+            return intfAttributes['ipAddrs'][0].split('/')[0]
+
+        conf.writeLine('log file %s/bgpd%s.log' % (QuaggaRouter.logDir, self.qr.name))
+        conf.writeLine('hostname bgp-%s' % self.qr.name)
+        conf.writeLine('password %s' % 'quagga')
+        conf.writeLine('!')
+        conf.writeLine('router bgp %s' % self.asNum)
+
+        conf.indent()
+
+        conf.writeLine('bgp router-id %s' % getRouterId(self.qr.interfaces))
+        conf.writeLine('timers bgp %s' % '3 9')
+        conf.writeLine('!')
+
+        for neighbor in self.neighbors:
+            conf.writeLine('neighbor %s remote-as %s' % (neighbor['address'], neighbor['as']))
+            conf.writeLine('neighbor %s ebgp-multihop' % neighbor['address'])
+            conf.writeLine('neighbor %s timers connect %s' % (neighbor['address'], '5'))
+            conf.writeLine('neighbor %s advertisement-interval %s' % (neighbor['address'], '5'))
+            if 'port' in neighbor:
+                conf.writeLine('neighbor %s port %s' % (neighbor['address'], neighbor['port']))
+            conf.writeLine('!')
+
+        for route in self.routes:
+            conf.writeLine('network %s' % route)
+
+        conf.close()
+
+class OspfProtocol(Protocol):
+
+    """Configures and runs the OSPF protocol in Quagga."""
+
+    def __init__(self, configFile=None, *args, **kwargs):
+        self.configFile = configFile
+
+    def config(self, **kwargs):
+        if self.configFile is None:
+            self.configFile = '%s/ospfd%s.conf' % (self.qr.runDir, self.qr.name)
+            self.generateConfig()
+
+        ospfPidFile = '%s/ospf%s.pid' % (self.qr.runDir, self.qr.name)
+
+        self.qr.cmd('%s/ospfd -d -f %s -z %s -i %s'
+                     % (QuaggaRouter.binDir, self.configFile, self.qr.socket, ospfPidFile))
+
+    def generateConfig(self):
+        conf = ConfigurationWriter(self.configFile)
+
+        def getRouterId(interfaces):
+            intfAttributes = interfaces.itervalues().next()
+            print intfAttributes
+            if isinstance(intfAttributes, list):
+                # Try use the first set of attributes, but if using vlans they might not have addresses
+                intfAttributes = intfAttributes[1] if not intfAttributes[0]['ipAddrs'] else intfAttributes[0]
+            return intfAttributes['ipAddrs'][0].split('/')[0]
+
+        conf.writeLine('hostname ospf-%s' % self.qr.name)
+        conf.writeLine('password %s' % 'hello')
+        conf.writeLine('!')
+        conf.writeLine('router ospf')
+
+        conf.indent()
+
+        conf.writeLine('ospf router-id %s' % getRouterId(self.qr.interfaces))
+        conf.writeLine('!')
+
+        for name, intf in self.qr.interfaces.items():
+            for ip in intf['ipAddrs']:
+                conf.writeLine('network %s area 0' % ip)
+            # if intf['ipAddrs'][0].startswith('192.168'):
+            #    writeLine(1, 'passive-interface %s' % name)
+
+        conf.close()
+
+class PimProtocol(Protocol):
+
+    """Configures and runs the PIM protcol in Quagga."""
+
+    def __init__(self, configFile=None, *args, **kwargs):
+        self.configFile = configFile
+
+    def config(self, **kwargs):
+        pimPidFile = '%s/pim%s.pid' % (self.qr.runDir, self.qr.name)
+
+        self.qr.cmd('%s/pimd -Z -d -f %s -z %s -i %s'
+                     % (QuaggaRouter.binDir, self.configFile, self.qr.socket, pimPidFile))
+
+class ConfigurationWriter(object):
+
+    """Utility class for writing a configuration file."""
+
+    def __init__(self, filename):
+        self.filename = filename
+        self.indentValue = 0
+
+        self.configFile = open(self.filename, 'w+')
+
+    def indent(self):
+        self.indentValue += 1
+
+    def unindent(self):
+        if (self.indentValue > 0):
+            self.indentValue -= 1
+
+    def write(self, string):
+        self.configFile.write(string)
+
+    def writeLine(self, string):
+        intentStr = ''
+        for _ in range(0, self.indentValue):
+            intentStr += '  '
+        self.write('%s%s\n' % (intentStr, string))
+
+    def close(self):
+        self.configFile.close()
+
+# Backward compatibility for BGP-only use case
+class BgpRouter(QuaggaRouter):
+
+    """Quagga router running the BGP protocol."""
+
+    def __init__(self, name, interfaces,
+                 asNum=0, neighbors=[], routes=[],
+                 defaultRoute=None,
+                 quaggaConfFile=None,
+                 zebraConfFile=None,
+                 *args, **kwargs):
+        bgp = BgpProtocol(configFile=quaggaConfFile, asNum=asNum, neighbors=neighbors, routes=routes)
+
+        super(BgpRouter, self).__init__(name, interfaces,
+                                        zebraConfFile=zebraConfFile,
+                                        defaultRoute=defaultRoute,
+                                        protocols=[bgp],
+                                        *args, **kwargs)
+
+class RouterData(object):
+
+    """Internal data structure storing information about a router."""
+
+    def __init__(self, index):
+        self.index = index
+        self.neighbors = []
+        self.interfaces = {}
+        self.switches = []
+
+    def addNeighbor(self, theirAddress, theirAsNum):
+        self.neighbors.append({'address': theirAddress.ip, 'as': theirAsNum})
+
+    def addInterface(self, intf, vlan, address):
+        if intf not in self.interfaces:
+            self.interfaces[intf] = InterfaceData(intf)
+
+        self.interfaces[intf].addAddress(vlan, address)
+
+    def setSwitch(self, switch):
+        self.switches.append(switch)
+
+class InterfaceData(object):
+
+    """Internal data structure storing information about an interface."""
+
+    def __init__(self, number):
+        self.number = number
+        self.addressesByVlan = {}
+
+    def addAddress(self, vlan, address):
+        if vlan not in self.addressesByVlan:
+            self.addressesByVlan[vlan] = []
+
+        self.addressesByVlan[vlan].append(address.with_prefixlen)
+
+class RoutedNetwork(object):
+
+    """Creates a host behind a router. This is common boilerplate topology
+    segment in routed networks."""
+
+    @staticmethod
+    def build(topology, router, hostName, networks):
+        # There's a convention that the router's addresses are already set up,
+        # and it has the last address in the network.
+
+        def getFirstAddress(network):
+            return '%s/%s' % (network[1], network.prefixlen)
+
+        defaultRoute = AutonomousSystem.getLastAddress(networks[0]).ip
+
+        host = topology.addHost(hostName, cls=RoutedHost,
+                                ips=[getFirstAddress(network) for network in networks],
+                                gateway=defaultRoute)
+
+        topology.addLink(router, host)
+
+class AutonomousSystem(object):
+
+    """Base abstraction of an autonomous system, which implies some internal
+    topology and connections to other topology elements (switches/other ASes)."""
+
+    psIdx = 1
+
+    def __init__(self, asNum, numRouters):
+        self.asNum = asNum
+        self.numRouters = numRouters
+        self.routers = {}
+        for i in range(1, numRouters + 1):
+            self.routers[i] = RouterData(i)
+
+        self.routerNodes = {}
+
+        self.neighbors = []
+        self.vlanAddresses = {}
+
+    def peerWith(self, myRouter, myAddress, theirAddress, theirAsNum, intf=1, vlan=None):
+        router = self.routers[myRouter]
+
+        router.addInterface(intf, vlan, myAddress)
+        router.addNeighbor(theirAddress, theirAsNum)
+
+    def getRouter(self, i):
+        return self.routerNodes[i]
+
+    @staticmethod
+    def generatePeeringAddresses():
+        network = ip_network(u'10.0.%s.0/24' % AutonomousSystem.psIdx)
+        AutonomousSystem.psIdx += 1
+
+        return ip_interface('%s/%s' % (network[1], network.prefixlen)), \
+            ip_interface('%s/%s' % (network[2], network.prefixlen))
+
+    @staticmethod
+    def addPeering(as1, as2, router1=1, router2=1, intf1=1, intf2=1, address1=None, address2=None, useVlans=False):
+        vlan = AutonomousSystem.psIdx if useVlans else None
+
+        if address1 is None or address2 is None:
+            (address1, address2) = AutonomousSystem.generatePeeringAddresses()
+
+        as1.peerWith(router1, address1, address2, as2.asNum, intf=intf1, vlan=vlan)
+        as2.peerWith(router2, address2, address1, as1.asNum, intf=intf2, vlan=vlan)
+
+    @staticmethod
+    def getLastAddress(network):
+        return ip_interface(network.network_address + network.num_addresses - 2)
+
+    @staticmethod
+    def getIthAddress(network, i):
+        return ip_interface('%s/%s' % (network[i], network.prefixlen))
+
+class BasicAutonomousSystem(AutonomousSystem):
+
+    """Basic autonomous system containing one host and one or more routers
+    which peer with other ASes."""
+
+    def __init__(self, num, routes, numRouters=1):
+        super(BasicAutonomousSystem, self).__init__(65000+num, numRouters)
+        self.num = num
+        self.routes = routes
+
+    def addLink(self, switch, router=1):
+        self.routers[router].setSwitch(switch)
+
+    def build(self, topology):
+        self.addRouterAndHost(topology)
+
+    def addRouterAndHost(self, topology):
+
+        # TODO implementation is messy and needs to be cleaned up
+
+        intfs = {}
+
+        router = self.routers[1]
+        for i, router in self.routers.items():
+
+            # routerName = 'r%i%i' % (self.num, i)
+            routerName = 'r%i' % self.num
+            if not i == 1:
+                routerName += ('%i' % i)
+
+            hostName = 'h%i' % self.num
+
+            for j, interface in router.interfaces.items():
+                nativeAddresses = interface.addressesByVlan.pop(None, [])
+                peeringIntf = [{'mac' : '00:00:%02x:00:%02x:%02x' % (self.num, i, j),
+                               'ipAddrs' : nativeAddresses}]
+
+                for vlan, addresses in interface.addressesByVlan.items():
+                    peeringIntf.append({'vlan': vlan,
+                                        'mac': '00:00:%02x:%02x:%02x:%02x' % (self.num, vlan, i, j),
+                                        'ipAddrs': addresses})
+
+                intfs.update({'%s-eth%s' % (routerName, j-1) : peeringIntf})
+
+            # Only add the host to the first router for now
+            if i == 1:
+                internalAddresses = []
+                for route in self.routes:
+                    internalAddresses.append('%s/%s' % (AutonomousSystem.getLastAddress(route).ip, route.prefixlen))
+
+                internalIntf = {'ipAddrs' : internalAddresses}
+
+                # This is the configuration of the next interface after all the peering interfaces
+                intfs.update({'%s-eth%s' % (routerName, len(router.interfaces.keys())) : internalIntf})
+
+            routerNode = topology.addHost(routerName,
+                                          asNum=self.asNum, neighbors=router.neighbors,
+                                          routes=self.routes,
+                                          cls=BgpRouter, interfaces=intfs)
+
+            self.routerNodes[i] = routerNode
+
+            for switch in router.switches:
+                topology.addLink(switch, routerNode)
+
+            # Only add the host to the first router for now
+            if i == 1:
+                defaultRoute = internalAddresses[0].split('/')[0]
+
+                host = topology.addHost(hostName, cls=RoutedHost,
+                                        ips=[self.getFirstAddress(route) for route in self.routes],
+                                        gateway=defaultRoute)
+
+                topology.addLink(routerNode, host)
+
+    # def getLastAddress(self, network):
+    #    return ip_address(network.network_address + network.num_addresses - 2)
+
+    def getFirstAddress(self, network):
+        return '%s/%s' % (network[1], network.prefixlen)
+
+# TODO fix this AS - doesn't currently work
+class RouteServerAutonomousSystem(BasicAutonomousSystem):
+
+    def __init__(self, routerAddress, *args, **kwargs):
+        BasicAutonomousSystem.__init__(self, *args, **kwargs)
+
+        self.routerAddress = routerAddress
+
+    def build(self, topology, connectAtSwitch):
+
+        switch = topology.addSwitch('as%isw' % self.num, cls=OVSBridge)
+
+        self.addRouterAndHost(topology, self.routerAddress, switch)
+
+        rsName = 'rs%i' % self.num
+        routeServer = topology.addHost(rsName,
+                                       self.asnum, self.neighbors,
+                                       cls=BgpRouter,
+                                       interfaces={'%s-eth0' % rsName : {'ipAddrs': [self.peeringAddress]}})
+
+        topology.addLink(routeServer, switch)
+        topology.addLink(switch, connectAtSwitch)
+
+class SdnAutonomousSystem(AutonomousSystem):
+
+    """Runs the internal BGP speakers needed for ONOS routing apps like
+    SDN-IP."""
+
+    routerIdx = 1
+
+    def __init__(self, onosIps, num=1, numBgpSpeakers=1, asNum=65000, externalOnos=True,
+                 peerIntfConfig=None, withFpm=False):
+        super(SdnAutonomousSystem, self).__init__(asNum, numBgpSpeakers)
+        self.onosIps = onosIps
+        self.num = num
+        self.numBgpSpeakers = numBgpSpeakers
+        self.peerIntfConfig = peerIntfConfig
+        self.withFpm = withFpm
+        self.externalOnos = externalOnos
+        self.internalPeeringSubnet = ip_network(u'1.1.1.0/24')
+
+        for router in self.routers.values():
+            # Add iBGP sessions to ONOS nodes
+            for onosIp in onosIps:
+                router.neighbors.append({'address': onosIp, 'as': asNum, 'port': 2000})
+
+            # Add iBGP sessions to other BGP speakers
+            for i, router2 in self.routers.items():
+                if router == router2:
+                    continue
+                cpIpBase = self.num*10
+                ip = AutonomousSystem.getIthAddress(self.internalPeeringSubnet, cpIpBase+i)
+                router.neighbors.append({'address': ip.ip, 'as': asNum})
+
+    def build(self, topology, connectAtSwitch, controlSwitch):
+
+        natIp = AutonomousSystem.getLastAddress(self.internalPeeringSubnet)
+
+        for i, router in self.routers.items():
+            num = SdnAutonomousSystem.routerIdx
+            SdnAutonomousSystem.routerIdx += 1
+            name = 'bgp%s' % num
+
+            cpIpBase = self.num*10
+            ip = AutonomousSystem.getIthAddress(self.internalPeeringSubnet, cpIpBase+i)
+
+            eth0 = { 'ipAddrs' : [ str(ip) ] }
+            if self.peerIntfConfig is not None:
+                eth1 = self.peerIntfConfig
+            else:
+                nativeAddresses = router.interfaces[1].addressesByVlan.pop(None, [])
+                eth1 = [{ 'mac': '00:00:00:00:00:%02x' % num,
+                          'ipAddrs' : nativeAddresses }]
+
+                for vlan, addresses in router.interfaces[1].addressesByVlan.items():
+                    eth1.append({'vlan': vlan,
+                                 'mac': '00:00:00:%02x:%02x:00' % (num, vlan),
+                                 'ipAddrs': addresses})
+
+            intfs = { '%s-eth0' % name : eth0,
+                      '%s-eth1' % name : eth1 }
+
+            bgp = topology.addHost( name, cls=BgpRouter, asNum=self.asNum,
+                                    neighbors=router.neighbors,
+                                    interfaces=intfs,
+                                    defaultRoute=str(natIp.ip),
+                                    fpm=self.onosIps[0] if self.withFpm else None )
+
+            topology.addLink( bgp, controlSwitch )
+            topology.addLink( bgp, connectAtSwitch )
+
+        if self.externalOnos:
+            nat = topology.addHost('nat', cls=NAT,
+                                   ip='%s/%s' % (natIp.ip, self.internalPeeringSubnet.prefixlen),
+                                   subnet=str(self.internalPeeringSubnet), inNamespace=False)
+            topology.addLink(controlSwitch, nat)
+
+def generateRoutes(baseRange, numRoutes, subnetSize=None):
+    baseNetwork = ip_network(baseRange)
+
+    # We need to get at least 2 addresses out of each subnet, so the biggest
+    # prefix length we can have is /30
+    maxPrefixLength = baseNetwork.max_prefixlen - 2
+
+    if subnetSize is not None:
+        return list(baseNetwork.subnets(new_prefix=subnetSize))
+
+    trySubnetSize = baseNetwork.prefixlen + 1
+    while trySubnetSize <= maxPrefixLength and \
+            len(list(baseNetwork.subnets(new_prefix=trySubnetSize))) < numRoutes:
+        trySubnetSize += 1
+
+    if trySubnetSize > maxPrefixLength:
+        raise Exception("Can't get enough routes from input parameters")
+
+    return list(baseNetwork.subnets(new_prefix=trySubnetSize))[:numRoutes]
+
+class RoutingCli( CLI ):
+
+    """CLI command that can bring a host up or down. Useful for simulating router failure."""
+
+    def do_host( self, line ):
+        args = line.split()
+        if len(args) != 2:
+            error( 'invalid number of args: host <host name> {up, down}\n' )
+            return
+
+        host = args[ 0 ]
+        command = args[ 1 ]
+        if host not in self.mn or self.mn.get( host ) not in self.mn.hosts:
+            error( 'invalid host: %s\n' % args[ 1 ] )
+        else:
+            if command == 'up':
+                op = 'up'
+            elif command == 'down':
+                op = 'down'
+            else:
+                error( 'invalid command: host <host name> {up, down}\n' )
+                return
+
+            for intf in self.mn.get( host ).intfList( ):
+                intf.link.intf1.ifconfig( op )
+                intf.link.intf2.ifconfig( op )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
new file mode 100644
index 0000000..98b5316
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
@@ -0,0 +1,351 @@
+#!/usr/bin/python
+import os
+import re
+from optparse import OptionParser
+
+from ipaddress import ip_network
+from mininet.node import RemoteController, OVSBridge, Host
+from mininet.link import TCLink
+from mininet.log import setLogLevel
+from mininet.net import Mininet
+from mininet.topo import Topo
+from mininet.nodelib import NAT
+from mininet.cli import CLI
+
+from routinglib import BgpRouter, RoutedHost
+from trellislib import DhcpServer, TaggedRoutedHost, DualHomedRoutedHost, DualHomedTaggedRoutedHost
+
+# Parse command line options and dump results
+def parseOptions():
+    "Parse command line options"
+    parser = OptionParser()
+    parser.add_option( '--spine', dest='spine', type='int', default=2,
+                       help='number of spine switches, default=2' )
+    parser.add_option( '--leaf', dest='leaf', type='int', default=2,
+                       help='number of leaf switches, default=2' )
+    parser.add_option( '--fanout', dest='fanout', type='int', default=2,
+                       help='number of hosts per leaf switch, default=2' )
+    parser.add_option( '--onos-ip', dest='onosIp', type='str', default='',
+                       help='IP address list of ONOS instances, separated by comma(,). Overrides --onos option' )
+    parser.add_option( '--ipv6', action="store_true", dest='ipv6',
+                       help='hosts are capable to use also ipv6' )
+    parser.add_option( '--dual-homed', action="store_true", dest='dualhomed', default=False,
+                       help='True if the topology is dual-homed, default=False' )
+    parser.add_option( '--vlan', dest='vlan', type='str', default='',
+                       help='list of vlan id for hosts, separated by comma(,).'
+                            'Empty or id with 0 will be unconfigured.' )
+    ( options, args ) = parser.parse_args()
+    return options, args
+
+
+opts, args = parseOptions()
+
+IP6_SUBNET_CLASS = 120
+IP4_SUBNET_CLASS = 24
+
+# TODO: DHCP support
+class IpHost( Host ):
+
+    def __init__( self, name, *args, **kwargs ):
+        super( IpHost, self ).__init__( name, *args, **kwargs )
+        gateway = re.split( '\.|/', kwargs[ 'ip' ] )
+        gateway[ 3 ] = '254'
+        self.gateway = '.'.join( gateway[ 0:4 ] )
+
+    def config( self, **kwargs ):
+        Host.config( self, **kwargs )
+        mtu = "ifconfig " + self.name + "-eth0 mtu 1490"
+        self.cmd( mtu )
+        self.cmd( 'ip route add default via %s' % self.gateway )
+
+class DualHomedIpHost(IpHost):
+    def __init__(self, name, *args, **kwargs):
+        super(DualHomedIpHost, self).__init__(name, **kwargs)
+        self.bond0 = None
+
+    def config(self, **kwargs):
+        super(DualHomedIpHost, self).config(**kwargs)
+        intf0 = self.intfs[0].name
+        intf1 = self.intfs[1].name
+        self.bond0 = "%s-bond0" % self.name
+        self.cmd('modprobe bonding')
+        self.cmd('ip link add %s type bond' % self.bond0)
+        self.cmd('ip link set %s down' % intf0)
+        self.cmd('ip link set %s down' % intf1)
+        self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+        self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+        self.cmd('ip addr flush dev %s' % intf0)
+        self.cmd('ip addr flush dev %s' % intf1)
+        self.cmd('ip link set %s up' % self.bond0)
+
+    def terminate(self, **kwargs):
+        self.cmd('ip link set %s down' % self.bond0)
+        self.cmd('ip link delete %s' % self.bond0)
+        self.cmd('kill -9 `cat %s`' % self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        super(DualHomedIpHost, self).terminate()
+
+
+# TODO: Implement IPv6 support
+class DualHomedLeafSpineFabric (Topo) :
+    def __init__(self, spine = 2, leaf = 4, fanout = 2, vlan_id = [], **opts):
+        Topo.__init__(self, **opts)
+        spines = dict()
+        leafs = dict()
+
+        # leaf should be 2 or 4
+
+        # calculate the subnets to use and set options
+        linkopts = dict( bw=100 )
+        # Create spine switches
+        for s in range(spine):
+            spines[s] = self.addSwitch('spine10%s' % (s + 1), dpid = "00000000010%s" % (s + 1) )
+
+        # Create leaf switches
+        for ls in range(leaf):
+            leafs[ls] = self.addSwitch('leaf%s' % (ls + 1), dpid = "00000000000%s" % ( ls + 1) )
+
+            # Connect leaf to all spines with dual link
+            for s in range( spine ):
+                switch = spines[ s ]
+                self.addLink(leafs[ls], switch, **linkopts)
+                self.addLink(leafs[ls], switch, **linkopts)
+
+            # Add hosts after paired ToR switches are added.
+            if ls % 2 == 0:
+                continue
+
+            # Add leaf-leaf link
+            self.addLink(leafs[ls], leafs[ls-1])
+
+            dual_ls = ls / 2
+            # Add hosts
+            for f in range(fanout):
+                if vlan_id[ dual_ls * fanout + f] != 0:
+                    host = self.addHost(
+                        name='h%s' % ( dual_ls * fanout + f + 1),
+                        cls=DualHomedTaggedRoutedHost,
+                        ips=['10.0.%d.%d/%d' % ( dual_ls + 2, f + 1, IP4_SUBNET_CLASS)],
+                        gateway='10.0.%d.254' % ( dual_ls + 2),
+                        mac='00:aa:00:00:00:%02x' % (dual_ls * fanout + f + 1),
+                        vlan=vlan_id[ dual_ls*fanout + f ]
+                    )
+                else:
+                    host = self.addHost(
+                        name='h%s' % (dual_ls * fanout + f + 1),
+                        cls= DualHomedRoutedHost,
+                        ips=['10.0.%d.%d/%d' % (dual_ls+2, f+1, IP4_SUBNET_CLASS)],
+                        gateway='10.0.%d.254' % (dual_ls+2),
+                        mac='00:aa:00:00:00:%02x' % (dual_ls * fanout + f + 1)
+                    )
+                self.addLink(host, leafs[ls], **linkopts)
+                self.addLink(host, leafs[ls-1], **linkopts)
+
+        last_ls = leafs[leaf-2]
+        last_paired_ls = leafs[leaf-1]
+        # Create common components
+        # DHCP server
+        dhcp = self.addHost('dhcp', cls=DhcpServer, mac='00:99:00:00:00:01', ips=['10.0.3.253/24'],
+                            gateway='10.0.3.254')
+
+        # Control plane switch (for DHCP servers)
+        cs1 = self.addSwitch('cs1', cls=OVSBridge)
+        self.addLink(cs1, last_ls)
+        self.addLink(dhcp, cs1)
+
+        # Control plane switch (for quagga fpm)
+        cs0 = self.addSwitch('cs0', cls=OVSBridge)
+
+        # Control plane NAT (for quagga fpm)
+        nat = self.addHost('nat', cls=NAT,
+                           ip='172.16.0.1/12',
+                           subnet=str(ip_network(u'172.16.0.0/12')), inNamespace=False)
+        self.addLink(cs0, nat)
+
+        # Internal Quagga bgp1
+        intfs = {'bgp1-eth0': {'ipAddrs': ['10.0.1.2/24', '2000::102/120'], 'mac': '00:88:00:00:00:02'},
+                 'bgp1-eth1': {'ipAddrs': ['172.16.0.2/12']}}
+        bgp1 = self.addHost('bgp1', cls=BgpRouter,
+                            interfaces=intfs,
+                            quaggaConfFile='conf/bgpdbgp1.conf',
+                            zebraConfFile='conf/zebradbgp1.conf')
+        self.addLink(bgp1, last_ls)
+        self.addLink(bgp1, cs0)
+
+        # Internal Quagga bgp2
+        intfs = {'bgp2-eth0': [{'ipAddrs': ['10.0.5.2/24', '2000::502/120'], 'mac': '00:88:00:00:00:04', 'vlan': '150'},
+                               {'ipAddrs': ['10.0.6.2/24', '2000::602/120'], 'mac': '00:88:00:00:00:04', 'vlan': '160'}],
+                 'bgp2-eth1': {'ipAddrs': ['172.16.0.4/12']}}
+        bgp2 = self.addHost('bgp2', cls=BgpRouter,
+                            interfaces=intfs,
+                            quaggaConfFile='conf/bgpdbgp2.conf',
+                            zebraConfFile='conf/zebradbgp2.conf')
+        self.addLink(bgp2, last_paired_ls)
+        self.addLink(bgp2, cs0)
+
+        # External Quagga r1
+        intfs = {'r1-eth0': {'ipAddrs': ['10.0.1.1/24', '2000::101/120'], 'mac': '00:88:00:00:00:01'},
+                 'r1-eth1': {'ipAddrs': ['10.0.5.1/24', '2000::501/120'], 'mac': '00:88:00:00:00:11'},
+                 'r1-eth2': {'ipAddrs': ['10.0.99.1/16']}}
+        r1 = self.addHost('r1', cls=BgpRouter,
+                            interfaces=intfs,
+                            quaggaConfFile='conf/bgpdr1.conf')
+        self.addLink(r1, last_ls)
+        self.addLink(r1, last_paired_ls)
+
+        # External IPv4 Host behind r1
+        rh1 = self.addHost('rh1', cls=RoutedHost, ips=['10.0.99.2/24'], gateway='10.0.99.1')
+        self.addLink(r1, rh1)
+
+        # External Quagga r2
+        intfs = {'r2-eth0': {'ipAddrs': ['10.0.6.1/24', '2000::601/120'], 'mac': '00:88:00:00:00:02'},
+                 'r2-eth1': {'ipAddrs': ['10.0.7.1/24', '2000::701/120'], 'mac': '00:88:00:00:00:22'},
+                 'r2-eth2': {'ipAddrs': ['10.0.99.1/16']}}
+        r2 = self.addHost('r2', cls=BgpRouter,
+                            interfaces=intfs,
+                            quaggaConfFile='conf/bgpdr2.conf')
+        self.addLink(r2, last_ls)
+        self.addLink(r2, last_paired_ls)
+
+        # External IPv4 Host behind r2
+        rh2 = self.addHost('rh2', cls=RoutedHost, ips=['10.0.99.2/24'], gateway='10.0.99.1')
+        self.addLink(r2, rh2)
+
+class LeafSpineFabric (Topo) :
+    def __init__(self, spine = 2, leaf = 2, fanout = 2, vlan_id = [], **opts):
+        Topo.__init__(self, **opts)
+        spines = dict()
+        leafs = dict()
+
+        # TODO: support IPv6 hosts
+        linkopts = dict( bw=100 )
+
+        # Create spine switches
+        for s in range(spine):
+            spines[s] = self.addSwitch('spine10%s' % (s + 1), dpid = "00000000010%s" % (s + 1) )
+
+        # Create leaf switches
+        for ls in range(leaf):
+            leafs[ls] = self.addSwitch('leaf%s' % (ls + 1), dpid = "00000000000%s" % ( ls + 1) )
+
+            # Connect leaf to all spines
+            for s in range( spine ):
+                switch = spines[ s ]
+                self.addLink( leafs[ ls ], switch, **linkopts )
+
+            # If dual-homed ToR, add hosts only when adding second switch at each edge-pair
+            # When the number of leaf switches is odd, leave the last switch as a single ToR
+
+            # Add hosts
+            for f in range(fanout):
+                if vlan_id[ls * fanout + f] != 0:
+                    host = self.addHost(
+                        name='h%s' % (ls * fanout + f + 1),
+                        cls=TaggedRoutedHost,
+                        ips=['10.0.%d.%d/%d' % (ls+2, f+1, IP4_SUBNET_CLASS)],
+                        gateway='10.0.%d.254' % (ls+2),
+                        mac='00:aa:00:00:00:%02x' % (ls * fanout + f + 1),
+                        vlan=vlan_id[ ls*fanout + f ]
+                    )
+                else:
+                    host = self.addHost(
+                        name='h%s' % (ls * fanout + f + 1),
+                        cls= RoutedHost,
+                        ips=['10.0.%d.%d/%d' % (ls+2, f+1, IP4_SUBNET_CLASS)],
+                        gateway='10.0.%d.254' % (ls+2),
+                        mac='00:aa:00:00:00:%02x' % (ls * fanout + f + 1)
+                    )
+                self.addLink(host, leafs[ls], **linkopts)
+
+        last_ls = leafs[leaf-1]
+        # Create common components
+        # DHCP server
+        dhcp = self.addHost('dhcp', cls=DhcpServer, mac='00:99:00:00:00:01', ips=['10.0.3.253/24'],
+                            gateway='10.0.3.254')
+
+        # Control plane switch (for DHCP servers)
+        cs1 = self.addSwitch('cs1', cls=OVSBridge)
+        self.addLink(cs1, last_ls)
+        self.addLink(dhcp, cs1)
+
+        # Control plane switch (for quagga fpm)
+        cs0 = self.addSwitch('cs0', cls=OVSBridge)
+
+        # Control plane NAT (for quagga fpm)
+        nat = self.addHost('nat', cls=NAT,
+                           ip='172.16.0.1/12',
+                           subnet=str(ip_network(u'172.16.0.0/12')), inNamespace=False)
+        self.addLink(cs0, nat)
+
+        # Internal Quagga bgp1
+        intfs = {'bgp1-eth0': {'ipAddrs': ['10.0.1.2/24', '2000::102/120'], 'mac': '00:88:00:00:00:02'},
+                 'bgp1-eth1': {'ipAddrs': ['172.16.0.2/12']}}
+        bgp1 = self.addHost('bgp1', cls=BgpRouter,
+                            interfaces=intfs,
+                            quaggaConfFile='conf/bgpdbgp1.conf',
+                            zebraConfFile='conf/zebradbgp1.conf')
+        self.addLink(bgp1, last_ls)
+        self.addLink(bgp1, cs0)
+
+        # External Quagga r1
+        intfs = {'r1-eth0': {'ipAddrs': ['10.0.1.1/24', '2000::101/120'], 'mac': '00:88:00:00:00:01'},
+                 'r1-eth1': {'ipAddrs': ['10.0.99.1/16']},
+                 'r1-eth2': {'ipAddrs': ['2000::9901/120']}}
+        r1 = self.addHost('r1', cls=BgpRouter,
+                            interfaces=intfs,
+                            quaggaConfFile='conf/bgpdr1.conf')
+        self.addLink(r1, last_ls)
+
+        # External IPv4 Host behind r1
+        rh1 = self.addHost('rh1', cls=RoutedHost, ips=['10.0.99.2/24'], gateway='10.0.99.1')
+        self.addLink(r1, rh1)
+
+
+def config( opts ):
+    spine = opts.spine
+    leaf = opts.leaf
+    fanout = opts.fanout
+    ipv6 = opts.ipv6
+    dualhomed = opts.dualhomed
+    if opts.vlan == '':
+        vlan = [0] * (((leaf / 2) if dualhomed else leaf) * fanout)
+    else:
+        vlan = [int(vlan_id) if vlan_id != '' else 0 for vlan_id in opts.vlan.split(',')]
+
+    if opts.onosIp != '':
+        controllers = opts.onosIp.split( ',' )
+    else:
+        controllers = ['127.0.0.1']
+
+    if len(vlan) != ((leaf / 2) if dualhomed else leaf ) * fanout:
+        print "Invalid vlan configuration is given."
+        return
+
+    if not ipv6:
+        if dualhomed:
+            if leaf % 2 == 1 or leaf == 0:
+                print "Even number of leaf switches (at least two) are needed to build dual-homed topology."
+                return
+            else:
+                topo = DualHomedLeafSpineFabric(spine=spine, leaf=leaf, fanout=fanout, vlan_id=vlan)
+        else:
+            topo = LeafSpineFabric(spine=spine, leaf=leaf, fanout=fanout, vlan_id=vlan)
+    else:
+        print "IPv6 hosts are not supported yet."
+        return
+
+    net = Mininet( topo=topo, link=TCLink, build=False,
+                   controller=None, autoSetMacs=True )
+    i = 0
+    for ip in controllers:
+        net.addController( "c%s" % ( i ), controller=RemoteController, ip=ip )
+        i += 1
+    net.build()
+    net.start()
+    CLI( net )
+    net.stop()
+
+if __name__ == '__main__':
+    setLogLevel('info')
+    config(opts)
+    os.system('sudo mn -c')
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py
new file mode 100644
index 0000000..08dcf2f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py
@@ -0,0 +1,271 @@
+#!/usr/bin/python
+
+"""
+Libraries for Trellis hosts.
+"""
+
+import sys
+sys.path.append('..')
+from mininet.node import Host
+from routinglib import RoutedHost, RoutedHost6, Router
+
+class TaggedRoutedHost(RoutedHost):
+    """Host that can be configured with multiple IP addresses."""
+    def __init__(self, name, ips, gateway, vlan, *args, **kwargs):
+        super(RoutedHost, self).__init__(name, *args, **kwargs)
+        self.ips = ips
+        self.gateway = gateway
+        self.vlan = vlan
+        self.vlanIntf = None
+
+    def config(self, **kwargs):
+        Host.config(self, **kwargs)
+        intf = self.defaultIntf()
+        self.vlanIntf = "%s.%s" % (intf, self.vlan)
+        self.cmd('ip -4 addr flush dev %s' % intf)
+        self.cmd('ip link add link %s name %s type vlan id %s' % (intf, self.vlanIntf, self.vlan))
+        self.cmd('ip link set up %s' % self.vlanIntf)
+
+        for ip in self.ips:
+            self.cmd('ip addr add %s dev %s' % (ip, self.vlanIntf))
+
+        self.cmd('ip route add default via %s' % self.gateway)
+        intf.name = self.vlanIntf
+        self.nameToIntf[self.vlanIntf] = intf
+
+    def terminate(self, **kwargs):
+        self.cmd('ip link remove link %s' % self.vlanIntf)
+        super(TaggedRoutedHost, self).terminate()
+
+class DualHomedRoutedHost(Host):
+    def __init__(self, name, ips, gateway, *args, **kwargs):
+        super(DualHomedRoutedHost, self).__init__(name, **kwargs)
+        self.bond0 = None
+        self.ips = ips
+        self.gateway = gateway
+
+    def config(self, **kwargs):
+        super(DualHomedRoutedHost, self).config(**kwargs)
+        intf0 = self.intfs[0].name
+        intf1 = self.intfs[1].name
+        self.bond0 = "%s-bond0" % self.name
+        self.cmd('modprobe bonding')
+        self.cmd('ip link add %s type bond' % self.bond0)
+        self.cmd('ip link set %s down' % intf0)
+        self.cmd('ip link set %s down' % intf1)
+        self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+        self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+        self.cmd('ip addr flush dev %s' % intf0)
+        self.cmd('ip addr flush dev %s' % intf1)
+        self.cmd('ip link set %s up' % self.bond0)
+
+        for ip in self.ips:
+            self.cmd('ip addr add %s dev %s' % (ip, self.bond0))
+
+        self.cmd('ip route add default via %s' % self.gateway)
+        default_intf = self.defaultIntf()
+        default_intf.name = self.bond0
+        self.nameToIntf[self.bond0] = default_intf
+
+    def terminate(self, **kwargs):
+        self.cmd('ip link set %s down' % self.bond0)
+        self.cmd('ip link delete %s' % self.bond0)
+        super(DualHomedRoutedHost, self).terminate()
+
+class DualHomedTaggedRoutedHost(DualHomedRoutedHost):
+    def __init__(self, name, ips, gateway, vlan, *args, **kwargs):
+        super(DualHomedTaggedRoutedHost, self).__init__(name, ips, gateway, *args, **kwargs)
+        self.ips = ips
+        self.gateway = gateway
+        self.vlan = vlan
+        self.vlanIntf = None
+
+    def config(self, **kwargs):
+        super(DualHomedTaggedRoutedHost, self).config(**kwargs)
+        default_intf = self.defaultIntf()
+        self.vlanIntf = "%s.%s" % (default_intf, self.vlan)
+        self.cmd('ip -4 addr flush dev %s' % default_intf)
+        self.cmd('ip link add link %s name %s type vlan id %s' % (default_intf, self.vlanIntf, self.vlan))
+        self.cmd('ip link set up %s' % self.vlanIntf)
+
+        for ip in self.ips:
+            self.cmd('ip addr add %s dev %s' % (ip, self.vlanIntf))
+
+        self.cmd('ip route add default via %s' % self.gateway)
+        default_intf.name = self.vlanIntf
+        self.nameToIntf[self.vlanIntf] = default_intf
+
+    def terminate(self, **kwargs):
+        self.cmd('ip link remove link %s' % self.vlanIntf)
+        super(DualHomedTaggedRoutedHost, self).terminate()
+
+class DhcpClient(Host):
+    def __init__(self, name, *args, **kwargs):
+        super(DhcpClient, self).__init__(name, **kwargs)
+        self.pidFile = '/run/dhclient-%s.pid' % self.name
+        self.leaseFile = '/var/lib/dhcp/dhcpclient-%s.lease' % (self.name, )
+
+    def config(self, **kwargs):
+        super(DhcpClient, self).config(**kwargs)
+        self.cmd('ip addr flush dev %s' % self.defaultIntf())
+        self.cmd('dhclient -q -4 -nw -pf %s -lf %s %s' % (self.pidFile, self.leaseFile, self.defaultIntf()))
+
+    def terminate(self, **kwargs):
+        self.cmd('kill -9 `cat %s`' % self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        super(DhcpClient, self).terminate()
+
+class Dhcp6Client(Host):
+    def __init__(self, name, *args, **kwargs):
+        super(Dhcp6Client, self).__init__(name, **kwargs)
+        self.pidFile = '/run/dhclient-%s.pid' % self.name
+        self.leaseFile = '/var/lib/dhcp/dhcpclient6-%s.lease' % (self.name, )
+
+    def config(self, **kwargs):
+        super(Dhcp6Client, self).config(**kwargs)
+        self.cmd('ip -4 addr flush dev %s' % self.defaultIntf())
+        self.cmd('dhclient -q -6 -nw -pf %s -lf %s %s' % (self.pidFile, self.leaseFile, self.defaultIntf()))
+
+    def terminate(self, **kwargs):
+        self.cmd('kill -9 `cat %s`' % self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        super(Dhcp6Client, self).terminate()
+
+class DhcpServer(RoutedHost):
+    binFile = '/usr/sbin/dhcpd'
+    pidFile = '/run/dhcp-server-dhcpd.pid'
+    configFile = './dhcpd.conf'
+    leasesFile = '/var/lib/dhcp/dhcpd.leases'
+
+    def config(self, **kwargs):
+        super(DhcpServer, self).config(**kwargs)
+        self.cmd('touch %s' % self.leasesFile)
+        self.cmd('%s -q -4 -pf %s -cf %s %s' % (self.binFile, self.pidFile, self.configFile, self.defaultIntf()))
+
+    def terminate(self, **kwargs):
+        self.cmd('kill -9 `cat %s`' % self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        super(DhcpServer, self).terminate()
+
+class Dhcp6Server(RoutedHost6):
+    binFile = '/usr/sbin/dhcpd'
+    pidFile = '/run/dhcp-server-dhcpd6.pid'
+    configFile = './dhcpd6.conf'
+    leasesFile = '/var/lib/dhcp/dhcpd6.leases'
+
+    def config(self, **kwargs):
+        super(Dhcp6Server, self).config(**kwargs)
+        linkLocalAddr = mac_to_ipv6_linklocal(kwargs['mac'])
+        self.cmd('ip -6 addr add dev %s scope link %s' % (self.defaultIntf(), linkLocalAddr))
+        self.cmd('touch %s' % self.leasesFile)
+        self.cmd('%s -q -6 -pf %s -cf %s %s' % (self.binFile, self.pidFile, self.configFile, self.defaultIntf()))
+
+    def terminate(self, **kwargs):
+        self.cmd('kill -9 `cat %s`' % self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        self.cmd('rm -rf  %s' % self.leasesFile)
+        super(Dhcp6Server, self).terminate()
+
+class DhcpRelay(Router):
+    binFile = '/usr/sbin/dhcrelay'
+    pidFile = '/run/dhcp-relay.pid'
+    serverIp = None
+    gateway = None
+
+    def __init__(self, name, serverIp, gateway, *args, **kwargs):
+        super(DhcpRelay, self).__init__(name, **kwargs)
+        self.serverIp = serverIp
+        self.gateway = gateway
+
+    def config(self, **kwargs):
+        super(DhcpRelay, self).config(**kwargs)
+        ifacesStr = ' '.join(["-i " + ifaceName for ifaceName in self.interfaces.keys()])
+        self.cmd('route add default gw %s' % self.gateway)
+        self.cmd('%s -4 -a -pf %s %s %s' % (self.binFile, self.pidFile, ifacesStr, self.serverIp))
+
+    def terminate(self, **kwargs):
+        self.cmd('kill -9 `cat %s`', self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        super(DhcpRelay, self).terminate()
+
+class TaggedDhcpClient(Host):
+    def __init__(self, name, vlan, *args, **kwargs):
+        super(TaggedDhcpClient, self).__init__(name, **kwargs)
+        self.pidFile = '/run/dhclient-%s.pid' % self.name
+        self.vlan = vlan
+        self.vlanIntf = None
+
+    def config(self, **kwargs):
+        super(TaggedDhcpClient, self).config(**kwargs)
+        self.vlanIntf = "%s.%s" % (self.defaultIntf(), self.vlan)
+        self.cmd('ip addr flush dev %s' % self.defaultIntf())
+        self.cmd('ip link add link %s name %s type vlan id %s' % (self.defaultIntf(), self.vlanIntf, self.vlan))
+        self.cmd('ip link set up %s' % self.vlanIntf)
+        self.cmd('dhclient -q -4 -nw -pf %s %s' % (self.pidFile, self.vlanIntf))
+
+    def terminate(self, **kwargs):
+        self.cmd('kill -9 `cat %s`' % self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        self.cmd('ip link remove link %s' % self.vlanIntf)
+        super(TaggedDhcpClient, self).terminate()
+
+class TaggedDhcpServer(TaggedRoutedHost):
+    binFile = '/usr/sbin/dhcpd'
+    pidFile = '/run/dhcp-server/dhcpd.pid'
+    configFile = './dhcpd.conf'
+
+    def config(self, **kwargs):
+        super(TaggedDhcpServer, self).config(**kwargs)
+        self.cmd('%s -q -4 -pf %s -cf %s %s' % (self.binFile, self.pidFile, self.configFile, self.vlanIntf))
+
+    def terminate(self, **kwargs):
+        self.cmd('kill -9 `cat %s`' % self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        super(TaggedDhcpServer, self).terminate()
+
+class DualHomedDhcpClient(Host):
+    def __init__(self, name, *args, **kwargs):
+        super(DualHomedDhcpClient, self).__init__(name, **kwargs)
+        self.pidFile = '/run/dhclient-%s.pid' % self.name
+        self.bond0 = None
+
+    def config(self, **kwargs):
+        super(DualHomedDhcpClient, self).config(**kwargs)
+        intf0 = self.intfs[0].name
+        intf1 = self.intfs[1].name
+        self.bond0 = "%s-bond0" % self.name
+        self.cmd('modprobe bonding')
+        self.cmd('ip link add %s type bond' % self.bond0)
+        self.cmd('ip link set %s down' % intf0)
+        self.cmd('ip link set %s down' % intf1)
+        self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+        self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+        self.cmd('ip addr flush dev %s' % intf0)
+        self.cmd('ip addr flush dev %s' % intf1)
+        self.cmd('ip link set %s up' % self.bond0)
+        self.cmd('dhclient -q -4 -nw -pf %s %s' % (self.pidFile, self.bond0))
+
+    def terminate(self, **kwargs):
+        self.cmd('ip link set %s down' % self.bond0)
+        self.cmd('ip link delete %s' % self.bond0)
+        self.cmd('kill -9 `cat %s`' % self.pidFile)
+        self.cmd('rm -rf %s' % self.pidFile)
+        super(DualHomedDhcpClient, self).terminate()
+
+# Utility for IPv6
+def mac_to_ipv6_linklocal(mac):
+    '''
+    Convert mac address to link-local IPv6 address
+    '''
+    # Remove the most common delimiters; dots, dashes, etc.
+    mac_value = int(mac.translate(None, ' .:-'), 16)
+
+    # Split out the bytes that slot into the IPv6 address
+    # XOR the most significant byte with 0x02, inverting the
+    # Universal / Local bit
+    high2 = mac_value >> 32 & 0xffff ^ 0x0200
+    high1 = mac_value >> 24 & 0xff
+    low1 = mac_value >> 16 & 0xff
+    low2 = mac_value & 0xffff
+
+    return 'fe80::{:04x}:{:02x}ff:fe{:02x}:{:04x}'.format(high2, high1, low1, low2)