[ONOS-7625] Refactor SRMulticast for complex test scenarios

Change-Id: Id2a6a932523b06886d9f602c9bb720a7ce28e433
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
index 42e646a..30b7e92 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
@@ -20,96 +20,163 @@
 """
 
 import time
-from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
 
-class SRMulticastTest ():
+def setupTest( main, test_idx, onosNodes ):
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    skipPackage = False
+    init = False
+    if not hasattr( main, "apps" ):
+        init = True
+        lib.initTest( main )
+    # Skip onos packaging if the cluster size stays the same
+    if not init and onosNodes == main.Cluster.numCtrls:
+        skipPackage = True
 
-    def __init__( self ):
-        self.default = ''
-        self.switchNames = [ "leaf205", "leaf206", "spine227", "spine228" ]
+    main.resultFileName = "CASE%03d" % test_idx
+    main.Cluster.setRunningNode( onosNodes )
+    lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
+    # Load configuration files
+    main.step( "Load configurations" )
+    main.cfgName = "TEST_CONFIG_ipv4=1_ipv6=1_dhcp=1_routers=1"
+    lib.loadJson( main )
+    time.sleep( float( main.params[ "timers" ][ "loadNetcfgSleep" ] ) )
+    main.cfgName = "common"
+    lib.loadMulticastConfig( main )
 
-    def runTest( self, main, test_idx, onosNodes, description, removeRoute=False, linkFailure=False, switchFailure=False ):
-        skipPackage = False
-        init = False
-        if not hasattr( main, 'apps' ):
-            init = True
-            run.initTest( main )
-        # Skip onos packaging if the cluster size stays the same
-        if not init and onosNodes == main.Cluster.numCtrls:
-            skipPackage = True
+    if hasattr( main, "Mininet1" ):
+        # Run the test with Mininet
+        mininet_args = " --dhcp=1 --routers=1 --ipv6=1 --ipv4=1"
+        lib.startMininet( main, main.params[ "DEPENDENCY" ][ "topology" ], args=mininet_args )
+        time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
+    else:
+        # Run the test with physical devices
+        lib.connectToPhysicalNetwork( main, self.switchNames )
+        # Check if the devices are up
+        lib.checkDevices( main, switches=len( self.switchNames ) )
 
-        main.case( '%s, ONOS cluster size: %s' % ( description, onosNodes ) )
+    # Create scapy components
+    lib.startScapyHosts( main )
 
-        main.resultFileName = 'CASE%03d' % test_idx
-        main.Cluster.setRunningNode( onosNodes )
-        run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
-        # Load configuration files
-        main.step("Load configurations")
-        main.cfgName = 'TEST_CONFIG_ipv4=1_ipv6=1_dhcp=1_routers=1'
-        run.loadJson( main )
-        main.cfgName = 'CASE%03d' % test_idx
-        run.loadMulticastConfig( main )
-        if linkFailure:
-            run.loadLinkFailureChart( main )
-        if switchFailure:
-            run.loadSwitchFailureChart( main )
-        time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
+def verifyMcastRoutes( main ):
+    """
+    Install multicast routes and check traffic
+    """
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    for routeName in main.mcastRoutes.keys():
+        main.step( "Verify {} multicast route".format( routeName ) )
+        installMcastRoute( main, routeName )
+        lib.verifyMulticastTraffic( main, routeName, True )
 
-        if hasattr( main, 'Mininet1' ):
-            # Run the test with Mininet
-            mininet_args = ' --dhcp=1 --routers=1 --ipv6=1 --ipv4=1'
-            run.startMininet( main, main.params['DEPENDENCY']['topology'], args=mininet_args )
-            time.sleep( float( main.params[ 'timers' ][ 'startMininetSleep' ] ) )
-        else:
-            # Run the test with physical devices
-            run.connectToPhysicalNetwork( main, self.switchNames )
-            # Check if the devices are up
-            run.checkDevices( main, switches=len( self.switchNames ) )
+def installMcastRoute( main, routeName ):
+    """
+    Install a multicast route
+    """
+    routeData = main.multicastConfig[ routeName ]
+    src = main.mcastRoutes[ routeName ][ "src" ]
+    dst = main.mcastRoutes[ routeName ][ "dst" ]
+    main.Cluster.active( 0 ).CLI.mcastHostJoin( routeData[ "src" ][ src[ 0 ] ][ "ip" ], routeData[ "group" ],
+                                                [ routeData[ "src" ][ i ][ "port" ] for i in src ],
+                                                [ routeData[ "dst" ][ i ][ "id" ] for i in dst ] )
+    time.sleep( float( main.params[ "timers" ][ "mcastSleep" ] ) )
 
-        # Create scapy components
-        run.startScapyHosts( main )
+def verifyMcastRouteRemoval( main, routeName ):
+    """
+    Verify removal of a multicast route
+    """
+    routeData = main.multicastConfig[ routeName ]
+    main.step( "Verify removal of {} route".format( routeName ) )
+    main.Cluster.active( 0 ).CLI.mcastHostDelete( routeData[ "src" ][ 0 ][ "ip" ], routeData[ "group" ] )
+    # TODO: verify the deletion
 
-        for entry in main.multicastConfig:
-            main.step("Verify adding multicast route with group IP {}".format(entry["group"]))
-            # Create a multicast route
-            main.Cluster.active( 0 ).CLI.mcastHostJoin( entry["sIP"], entry["group"], entry["sPorts"], entry["dHosts"] )
-            time.sleep( float( main.params[ 'timers' ][ 'mcastSleep' ] ) )
-            # Check the flows against the devices
-            # run.checkFlows( main, minFlowCount=2, sleep=5 )
-            # Verify multicast traffic
-            run.verifyMulticastTraffic( main, entry, True, skipOnFail=True )
+def verifyMcastSinkRemoval( main, routeName, sinkIndex, expect ):
+    """
+    Verify removal of a multicast sink
+    """
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    routeData = main.multicastConfig[ routeName ]
+    sinkId = routeData[ "dst" ][ sinkIndex ][ "id" ]
+    main.step( "Verify removal of {} sink {}".format( routeName, sinkId ) )
+    main.Cluster.active( 0 ).CLI.mcastHostDelete( routeData[ "src" ][ 0 ][ "ip" ], routeData[ "group" ], sinkId )
+    time.sleep( float( main.params[ "timers" ][ "mcastSleep" ] ) )
+    lib.verifyMulticastTraffic( main, routeName, expect )
 
-            # Test switch failures
-            if switchFailure:
-                for switch, expected in main.switchFailureChart.items():
-                    run.killSwitch( main, switch, expected['switches_after_failure'], expected['links_after_failure'] )
-                    run.verifyMulticastTraffic( main, entry, True, skipOnFail=True )
+def verifyMcastSourceRemoval( main, routeName, sourceIndex, expect ):
+    """
+    Verify removal of a multicast source
+    """
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    routeData = main.multicastConfig[ routeName ]
+    sourcePort = [ routeData[ "src" ][ sourceIndex ][ "port" ] ]
+    main.step( "Verify removal of {} source {}".format( routeName, sourcePort ) )
+    main.Cluster.active( 0 ).CLI.mcastSourceDelete( routeData[ "src" ][ 0 ][ "ip" ], routeData[ "group" ], sourcePort )
+    time.sleep( float( main.params[ "timers" ][ "mcastSleep" ] ) )
+    lib.verifyMulticastTraffic( main, routeName, expect )
 
-                    run.recoverSwitch( main, switch, expected['switches_before_failure'], expected['links_before_failure'] )
-                    run.verifyMulticastTraffic( main, entry, True, skipOnFail=True )
+def verifyMcastRemoval( main, removeDHT1=True ):
+    """
+    Verify removal of IPv6 route, IPv4 sinks and IPv4 source
+    """
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    verifyMcastRouteRemoval( main, "ipv6" )
+    if removeDHT1:
+        verifyMcastSinkRemoval( main, "ipv4", 0, [ False, True, True ] )
+        verifyMcastSinkRemoval( main, "ipv4", 1, [ False, False, True ] )
+    else:
+        verifyMcastSinkRemoval( main, "ipv4", 2, [ True, True, False ] )
+        verifyMcastSinkRemoval( main, "ipv4", 1, [ True, False, False ] )
+    verifyMcastSourceRemoval( main, "ipv4", 0, False )
 
-            # Test link failures
-            if linkFailure:
-                for link_batch_name, info in main.linkFailureChart.items():
-                    linksToRemove = info['links'].values()
-                    linksBefore = info['links_before']
-                    linksAfter = info['links_after']
+def verifyLinkDown( main, link, affectedLinkNum, expectList={ "ipv4": True, "ipv6": True } ):
+    """
+    Kill a batch of links and verify traffic
+    Restore the links and verify traffic
+    """
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    link = link if ( isinstance( link, list ) and isinstance( link[ 0 ], list ) ) else [ link ]
+    # Kill the link(s)
+    lib.killLinkBatch( main, link, int( main.params[ "TOPO" ][ "linkNum" ] ) - affectedLinkNum, int( main.params[ "TOPO" ][ "switchNum" ] ) )
+    for routeName in expectList.keys():
+        lib.verifyMulticastTraffic( main, routeName, expectList[ routeName ] )
+    # Restore the link(s)
+    lib.restoreLinkBatch( main, link, int( main.params[ "TOPO" ][ "linkNum" ] ), int( main.params[ "TOPO" ][ "switchNum" ] ) )
+    for routeName in expectList.keys():
+        lib.verifyMulticastTraffic( main, routeName, True )
 
-                    run.killLinkBatch( main, linksToRemove, linksAfter, switches=10 )
-                    run.verifyMulticastTraffic( main, entry, True, skipOnFail=True )
+def verifySwitchDown( main, switchName, affectedLinkNum, expectList={ "ipv4": True, "ipv6": True } ):
+    """
+    Kill a batch of switches and verify traffic
+    Recover the swithces and verify traffic
+    """
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    switchName = switchName if isinstance( switchName, list ) else [ switchName ]
+    # Kill the switch(es)
+    lib.killSwitch( main, switchName, int( main.params[ "TOPO" ][ "switchNum" ] ) - len( switchName ), int( main.params[ "TOPO" ][ "linkNum" ] ) - affectedLinkNum )
+    for routeName in expectList.keys():
+        lib.verifyMulticastTraffic( main, routeName, expectList[ routeName ] )
+    # Recover the switch(es)
+    lib.recoverSwitch( main, switchName, int( main.params[ "TOPO" ][ "switchNum" ] ), int( main.params[ "TOPO" ][ "linkNum" ] ) )
+    for routeName in expectList.keys():
+        lib.verifyMulticastTraffic( main, routeName, True )
 
-                    run.restoreLinkBatch( main, linksToRemove, linksBefore, switches=10 )
-                    run.verifyMulticastTraffic( main, entry, True, skipOnFail=True )
-
-            if removeRoute:
-                main.step("Verify deleting multicast route with group IP {}".format(entry["group"]))
-                # delete a multicast route
-                main.Cluster.active( 0 ).CLI.mcastHostDelete( entry["sIP"], entry["group"] )
-                time.sleep( float( main.params[ 'timers' ][ 'mcastSleep' ] ) )
-                # Check the flows against the devices
-                # run.checkFlows( main, minFlowCount=2, sleep=5 )
-                # Verify multicast traffic (traffic check is expected to fail)
-                run.verifyMulticastTraffic( main, entry, False, skipOnFail=True )
-
-        # Clean up the environment
-        run.cleanup( main, copyKarafLog=False )
+def verifyOnosDown( main, expectList={ "ipv4": True, "ipv6": True } ):
+    """
+    Kill and recover ONOS instances Sequencially and check traffic
+    """
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    import json
+    numCtrls = len( main.Cluster.runningNodes )
+    links = len( json.loads( main.Cluster.next().links() ) )
+    switches = len( json.loads( main.Cluster.next().devices() ) )
+    for ctrl in xrange( numCtrls ):
+        # Kill node
+        lib.killOnos( main, [ ctrl ], switches, links, ( numCtrls - 1 ) )
+        main.Cluster.active(0).CLI.balanceMasters()
+        time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
+        for routeName in expectList.keys():
+            lib.verifyMulticastTraffic( main, routeName, True )
+        # Recover node
+        lib.recoverOnos( main, [ ctrl ], switches, links, numCtrls )
+        main.Cluster.active(0).CLI.balanceMasters()
+        time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
+        for routeName in expectList.keys():
+            lib.verifyMulticastTraffic( main, routeName, True )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE101.linkFailureChart b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE101.linkFailureChart
deleted file mode 100644
index 8a9e052..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE101.linkFailureChart
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-    "link_batch_1" : { "links" : { "link1" : ["leaf2", "spine101"] },
-                       "links_before" : 48,
-                       "links_after" : 44 },
-    "link_batch_2" : { "links" : { "link1" : ["leaf2", "spine102"] },
-                       "links_before" : 48,
-                       "links_after" : 44 }
-}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE102.linkFailureChart b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE102.linkFailureChart
deleted file mode 100644
index f102be4..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE102.linkFailureChart
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-    "link_batch_1" : { "links" : { "link1" : ["leaf4", "spine101"] },
-                       "links_before" : 48,
-                       "links_after" : 44 },
-    "link_batch_2" : { "links" : { "link1" : ["leaf4", "spine102"] },
-                       "links_before" : 48,
-                       "links_after" : 44 }
-}
-
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE103.linkFailureChart b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE103.linkFailureChart
deleted file mode 100644
index 8041a05..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/linkFailure/CASE103.linkFailureChart
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-    "link_batch_1" : { "links" : { "link1" : ["spine103", "spine101"] },
-                       "links_before" : 48,
-                       "links_after" : 46 },
-    "link_batch_2" : { "links" : { "link1" : ["spine104", "spine102"] },
-                       "links_before" : 48,
-                       "links_after" : 46 }
-}
-
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE001.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE001.multicastConfig
deleted file mode 100644
index 990507e..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE001.multicastConfig
+++ /dev/null
@@ -1,48 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE002.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE002.multicastConfig
deleted file mode 100644
index 14f770e..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE002.multicastConfig
+++ /dev/null
@@ -1,46 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:06/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h8v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:06/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h8v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE003.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE003.multicastConfig
deleted file mode 100644
index ffd2e6c..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE003.multicastConfig
+++ /dev/null
@@ -1,46 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE004.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE004.multicastConfig
deleted file mode 100644
index 8fc69d1..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE004.multicastConfig
+++ /dev/null
@@ -1,54 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None", "00:AA:00:00:00:06/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                },
-                {
-                    "host": "h8v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None", "00:BB:00:00:00:06/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                },
-                {
-                    "host": "h8v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE005.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE005.multicastConfig
deleted file mode 100644
index 7d089ae..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE005.multicastConfig
+++ /dev/null
@@ -1,52 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:06/None", "00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h8v4"
-                },
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:06/None", "00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h8v6"
-                },
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE006.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE006.multicastConfig
deleted file mode 100644
index 9c1029a..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE006.multicastConfig
+++ /dev/null
@@ -1,54 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None", "00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                },
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None", "00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                },
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE007.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE007.multicastConfig
deleted file mode 100644
index 218ed4d..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE007.multicastConfig
+++ /dev/null
@@ -1,60 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None", "00:AA:00:00:00:06/None", "00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                },
-                {
-                    "host": "h8v4"
-                },
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None", "00:BB:00:00:00:06/None", "00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                },
-                {
-                    "host": "h8v6"
-                },
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE008.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE008.multicastConfig
deleted file mode 100644
index 218ed4d..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE008.multicastConfig
+++ /dev/null
@@ -1,60 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None", "00:AA:00:00:00:06/None", "00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                },
-                {
-                    "host": "h8v4"
-                },
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None", "00:BB:00:00:00:06/None", "00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                },
-                {
-                    "host": "h8v6"
-                },
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE101.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE101.multicastConfig
deleted file mode 100644
index 218ed4d..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE101.multicastConfig
+++ /dev/null
@@ -1,60 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None", "00:AA:00:00:00:06/None", "00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                },
-                {
-                    "host": "h8v4"
-                },
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None", "00:BB:00:00:00:06/None", "00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                },
-                {
-                    "host": "h8v6"
-                },
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE102.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE102.multicastConfig
deleted file mode 100644
index 218ed4d..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE102.multicastConfig
+++ /dev/null
@@ -1,60 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None", "00:AA:00:00:00:06/None", "00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                },
-                {
-                    "host": "h8v4"
-                },
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None", "00:BB:00:00:00:06/None", "00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                },
-                {
-                    "host": "h8v6"
-                },
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE103.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE103.multicastConfig
deleted file mode 100644
index 218ed4d..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE103.multicastConfig
+++ /dev/null
@@ -1,60 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None", "00:AA:00:00:00:06/None", "00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                },
-                {
-                    "host": "h8v4"
-                },
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None", "00:BB:00:00:00:06/None", "00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                },
-                {
-                    "host": "h8v6"
-                },
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE201.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE201.multicastConfig
deleted file mode 100644
index 218ed4d..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/CASE201.multicastConfig
+++ /dev/null
@@ -1,60 +0,0 @@
-[
-    {
-        "ipVersion": 4,
-        "sIP": "10.2.0.1",
-        "group": "224.2.0.1",
-        "sPorts": ["of:0000000000000002/9"],
-        "dHosts": ["00:AA:00:00:00:03/None", "00:AA:00:00:00:06/None", "00:AA:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v4",
-                "interface": "h3v4-eth0",
-                "Ether": "01:00:5e:02:00:01",
-                "UDP": 40051,
-                "filter": "ip multicast and dst host 224.2.0.1 and udp dst port 40051",
-                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v4",
-                    "interface": "h4v4-bond0"
-                },
-                {
-                    "host": "h8v4"
-                },
-                {
-                    "host": "h1v4"
-                }
-            ]
-        }
-    },
-    {
-        "ipVersion": 6,
-        "sIP": "1002::3fe",
-        "group": "ff08::3fe",
-        "sPorts": ["of:0000000000000002/6"],
-        "dHosts": ["00:BB:00:00:00:03/None", "00:BB:00:00:00:06/None", "00:BB:00:00:00:01/None"],
-        "scapy": {
-            "src": {
-                "host": "h3v6",
-                "interface": "h3v6-eth0",
-                "Ether": "33:33:00:00:03:fe",
-                "UDP": 40051,
-                "filter": "ip6 multicast and dst host ff08::3fe and udp dst port 40051",
-                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
-            },
-            "dst": [
-                {
-                    "host": "h4v6",
-                    "interface": "h4v6-bond0"
-                },
-                {
-                    "host": "h8v6"
-                },
-                {
-                    "host": "h1v6"
-                }
-            ]
-        }
-    }
-]
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/common.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/common.multicastConfig
new file mode 100644
index 0000000..842d540
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/common.multicastConfig
@@ -0,0 +1,58 @@
+{
+    "ipv4": {
+        "ipVersion": 4,
+        "group": "224.2.0.1",
+        "src": [
+            {
+                "host": "h3v4",
+                "ip": "10.2.0.1",
+                "port": "of:0000000000000002/9",
+                "interface": "h3v4-eth0",
+                "Ether": "01:00:5e:02:00:01",
+                "UDP": 40051,
+                "filter": "ip host 224.2.0.1",
+                "packet": "dst=01:00:5e:02:00:01 src=00:aa:00:00:00:02"
+            }
+        ],
+        "dst": [
+            {
+                "host": "h4v4",
+                "id": "00:AA:00:00:00:03/None",
+                "interface": "h4v4-bond0",
+                "dualHomed": "True"
+            },
+            {
+                "host": "h8v4",
+                "id": "00:AA:00:00:00:06/None",
+                "dualHomed": "False"
+            },
+            {
+                "host": "h10v4",
+                "id": "00:AA:00:00:00:08/40",
+                "dualHomed": "True"
+            }
+        ]
+    },
+    "ipv6": {
+        "ipVersion": 6,
+        "group": "ff08::3fe",
+        "src": [
+            {
+                "host": "h3v6",
+                "ip": "1002::3fe",
+                "port": "of:0000000000000002/6",
+                "interface": "h3v6-eth0",
+                "Ether": "33:33:00:00:03:fe",
+                "UDP": 40051,
+                "filter": "ip6 host ff08::3fe",
+                "packet": "dst=33:33:00:00:03:fe src=00:bb:00:00:00:02"
+            }
+        ],
+        "dst": [
+            {
+                "host": "h1v6",
+                "id": "00:BB:00:00:00:01/None"
+            }
+        ]
+    }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/switchFailure/CASE201.switchFailureChart b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/switchFailure/CASE201.switchFailureChart
deleted file mode 100644
index 6614e5f..0000000
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/switchFailure/CASE201.switchFailureChart
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-    "spine101": { "switches_before_failure": 10,
-                  "links_before_failure": 48,
-                  "switches_after_failure": 9,
-                  "links_after_failure": 30 },
-    "spine102": { "switches_before_failure": 10,
-                  "links_before_failure": 48,
-                  "switches_after_failure": 9,
-                  "links_after_failure": 30 },
-    "spine103": { "switches_before_failure": 10,
-                  "links_before_failure": 48,
-                  "switches_after_failure": 9,
-                  "links_after_failure": 42 },
-    "spine104": { "switches_before_failure": 10,
-                  "links_before_failure": 48,
-                  "switches_after_failure": 9,
-                  "links_after_failure": 42 }
-}