Merge "Added CASE642 and 643 for SRRouting tests"
diff --git a/TestON/JenkinsFile/TriggerFuncs.groovy b/TestON/JenkinsFile/TriggerFuncs.groovy
index 8cefc50..96c0855 100644
--- a/TestON/JenkinsFile/TriggerFuncs.groovy
+++ b/TestON/JenkinsFile/TriggerFuncs.groovy
@@ -97,6 +97,7 @@
         ''' + preSetup( onos_branch, test_branch, onos_tag, manuallyRun ) + '''
         ''' + oldFlowCheck( jobOn, onos_branch ) + '''
         ''' + postSetup( onos_branch, test_branch, onos_tag, manuallyRun )
+        generateKey()
     }
 }
 def tagCheck( onos_tag, onos_branch ){
@@ -169,10 +170,23 @@
         echo -e "\n##### Stop all running instances of Karaf #####"
         kill $(ps -efw | grep karaf | grep -v grep | awk '{print $2}')
         sleep 30
-        git branch'''
+        git branch
+        '''
     }
     return result
 }
+def generateKey(){
+    try{
+        sh '''
+        #!/bin/bash -l
+        set +e
+        . ~/.bashrc
+        env
+        onos-push-bits-through-proxy
+        onos-gen-cluster-key -f
+        '''
+    }catch( all ){}
+}
 def returnCell( nodeName ){
     node( "TestStation-" + nodeName + "s" ){
         sh '''#!/bin/bash -l
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 54d9747..c5ee51d 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -574,55 +574,42 @@
 
             main.cleanAndExit()
 
-    def discoverIpv4Hosts( self, hostList, wait=1 , dstIp="6.6.6.6"):
+    def discoverHosts( self, hostList=[], wait=1, dstIp="6.6.6.6", dstIp6="1020::3fe" ):
         '''
-        Can only be used if hosts already have ipv4 addresses.
-
-        Hosts in hostList will do a single ping to a non-existent (dstIp) address for ONOS
-        to discover them again.
+        Hosts in hostList will do a single ping to a non-existent address for ONOS to
+        discover them. A host will use ping/ping6 to send echo requests depending on if
+        it has IPv4/IPv6 addresses configured.
+        Optional:
+            hostList: a list of names of the hosts that need to be discovered. If not
+                      specified mininet will send ping from all the hosts
+            wait: timeout for IPv4/IPv6 echo requests
+            dstIp: destination address used by IPv4 hosts
+            dstIp6: destination address used by IPv6 hosts
+        Returns:
+            main.TRUE if all ping packets were successfully sent. Otherwise main.FALSE
         '''
         try:
-            main.log.info( "Issuing dumb pings for ipv6 hosts to be discovered" )
-            cmd = " ping -c 1 -i 1 -W " + str( wait ) + " "
+            if not hostList:
+                hosts = self.getHosts( getInterfaces=False )
+                hostList = hosts.keys()
+            discoveryResult = main.TRUE
             for host in hostList:
-                pingCmd = str( host ) + cmd + dstIp
-                self.handle.sendline( pingCmd )
-                self.handle.expect( "mininet>", timeout=wait + 1 )
-
-        except pexpect.TIMEOUT:
-            main.log.exception( self.name + ": TIMEOUT exception" )
-            response = self.handle.before
-            # NOTE: Send ctrl-c to make sure command is stopped
-            self.handle.send( "\x03" )
-            self.handle.expect( "Interrupt" )
-            response += self.handle.before + self.handle.after
-            self.handle.expect( "mininet>" )
-            response += self.handle.before + self.handle.after
-            main.log.debug( response )
-            return main.FALSE
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":     " + self.handle.before )
-            main.cleanAndExit()
-        except Exception:
-            main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanAndExit()
-
-    def discoverIpv6Hosts( self, hostList, wait=1, dstIp="1020::3fe" ):
-        '''
-        Can only be used if hosts already have ipv6 addresses.
-
-        Hosts in hostList will do a single ping to a non-existent address (dstIp) for ONOS
-        to discover them again.
-        '''
-        try:
-            main.log.info( "Issuing dump pings for ipv6 hosts to be discovered" )
-            cmd = " ping6 -c 1 -i 1 -W " + str( wait ) + " "
-            for host in hostList:
-                pingCmd = str( host ) + cmd + dstIp
-                self.handle.sendline( pingCmd )
-                self.handle.expect( "mininet>", timeout=wait + 1 )
-
+                cmd = ""
+                if self.getIPAddress( host ):
+                    cmd = "{} ping -c 1 -i 1 -W {} {}".format( host, wait, dstIp )
+                    main.log.debug( "Sending IPv4 probe ping from host {}".format( host ) )
+                elif self.getIPAddress( host, proto='IPV6' ):
+                    cmd = "{} ping6 -c 1 -i 1 -W {} {}".format( host, wait, dstIp6 )
+                    main.log.debug( "Sending IPv6 probe ping from host {}".format( host ) )
+                else:
+                    main.log.warn( "No IP addresses configured on host {}, skipping discovery".format( host ) )
+                    discoveryResult = main.FALSE
+                if cmd:
+                    self.handle.sendline( "{} ip neigh flush all".format( host ) )
+                    self.handle.expect( "mininet>", timeout=wait + 1 )
+                    self.handle.sendline( cmd )
+                    self.handle.expect( "mininet>", timeout=wait + 1 )
+            return discoveryResult
         except pexpect.TIMEOUT:
             main.log.exception( self.name + ": TIMEOUT exception" )
             response = self.handle.before
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 7af7e4f..d806da6 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1179,9 +1179,10 @@
             for loc in locations:
                 discovered = False
                 for locDiscovered in locationsDiscovered:
-                    if loc in locDiscovered:
-                        discovered = True
+                    locToMatch = locDiscovered if "/" in loc else locDiscovered.split( "/" )[0]
+                    if loc == locToMatch:
                         main.log.debug( "Host {} discovered with location {}".format( hostIp, loc ) )
+                        discovered = True
                         break
                 if discovered:
                     locationsDiscovered.remove( locDiscovered )
@@ -6253,7 +6254,7 @@
         Create a multicast route by calling 'mcast-host-join' command
         sAddr: we can provide * for ASM or a specific address for SSM
         gAddr: specifies multicast group address
-        srcs: a list of the source connect points e.g. ["of:0000000000000003/12"]
+        srcs: a list of HostId of the sources e.g. ["00:AA:00:00:00:01/None"]
         sinks: a list of HostId of the sinks e.g. ["00:AA:00:00:01:05/40"]
         Returns main.TRUE if mcast route is added; Otherwise main.FALSE
         """
@@ -6330,12 +6331,52 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
+    def mcastSinkDelete( self, sAddr, gAddr, sink=None ):
+        """
+        Delete multicast sink(s) by calling 'mcast-sink-delete' command
+        sAddr: we can provide * for ASM or a specific address for SSM
+        gAddr: specifies multicast group address
+        host: HostId of the sink e.g. "00:AA:00:00:01:05/40",
+               will delete the route if not specified
+        Returns main.TRUE if the mcast sink is deleted; Otherwise main.FALSE
+        """
+        try:
+            cmdStr = "mcast-sink-delete"
+            cmdStr += " -sAddr " + str( sAddr )
+            cmdStr += " -gAddr " + str( gAddr )
+            if sink:
+                cmdStr += " -s " + str( sink )
+            handle = self.sendline( cmdStr )
+            assert handle is not None, "Error in sendline"
+            assert "Command not found:" not in handle, handle
+            assert "Unsupported command:" not in handle, handle
+            assert "Error executing command" not in handle, handle
+            if "Updated the mcast route" in handle:
+                return main.TRUE
+            elif "Deleted the mcast route" in handle:
+                return main.TRUE
+            else:
+                return main.FALSE
+        except AssertionError:
+            main.log.exception( "" )
+            return None
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanAndExit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanAndExit()
+
     def mcastSourceDelete( self, sAddr, gAddr, srcs=None ):
         """
         Delete multicast src(s) by calling 'mcast-source-delete' command
         sAddr: we can provide * for ASM or a specific address for SSM
         gAddr: specifies multicast group address
-        srcs: a list of connect points of the sources e.g. ["00:AA:00:00:01:05/40"],
+        srcs: a list of host IDs of the sources e.g. ["00:AA:00:00:01:05/40"],
               will delete the route if not specified
         Returns main.TRUE if mcast sink is deleted; Otherwise main.FALSE
         """
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.py b/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.py
index 5849a6f..144b4cf 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.py
@@ -307,7 +307,7 @@
         main.mcastRoutes = { "ipv4": { "src": [ 0 ], "dst": [ 0, 1, 2 ] }, "ipv6": { "src": [ 0 ], "dst": [ 0 ] } }
         setupTest( main, test_idx=202, onosNodes=3 )
         verifyMcastRoutes( main )
-        verifySwitchDown( main, "leaf2", 10, { "ipv4": False, "ipv6": False } )
+        verifySwitchDown( main, "leaf2", 10, { "ipv4": False, "ipv6": False }, [ "h4v4" ] )
         verifyMcastRemoval( main, removeDHT1=False )
         lib.cleanup( main, copyKarafLog=False )
 
@@ -327,7 +327,7 @@
         main.mcastRoutes = { "ipv4": { "src": [ 0 ], "dst": [ 0, 1, 2 ] }, "ipv6": { "src": [ 0 ], "dst": [ 0 ] } }
         setupTest( main, test_idx=203, onosNodes=3 )
         verifyMcastRoutes( main )
-        verifySwitchDown( main, "leaf5", 10 )
+        verifySwitchDown( main, "leaf5", 10, hostsToDiscover=[ "h10v4" ] )
         verifyMcastRemoval( main, removeDHT1=False )
         lib.cleanup( main, copyKarafLog=False )
 
@@ -347,7 +347,7 @@
         main.mcastRoutes = { "ipv4": { "src": [ 0 ], "dst": [ 0, 1, 2 ] }, "ipv6": { "src": [ 0 ], "dst": [ 0 ] } }
         setupTest( main, test_idx=204, onosNodes=3 )
         verifyMcastRoutes( main )
-        verifySwitchDown( main, "leaf4", 10, { "ipv4": [ True, False, True ], "ipv6": True } )
+        verifySwitchDown( main, "leaf4", 10, { "ipv4": [ True, False, True ], "ipv6": True }, [ "h8v4", "h10v4" ] )
         verifyMcastRemoval( main, removeDHT1=False )
         lib.cleanup( main, copyKarafLog=False )
 
@@ -367,7 +367,7 @@
         main.mcastRoutes = { "ipv4": { "src": [ 0 ], "dst": [ 0, 1, 2 ] }, "ipv6": { "src": [ 0 ], "dst": [ 0 ] } }
         setupTest( main, test_idx=205, onosNodes=3 )
         verifyMcastRoutes( main )
-        verifySwitchDown( main, [ "leaf1", "leaf3", "leaf4", "leaf5" ], 32, { "ipv4": [ True, False, False ], "ipv6": False } )
+        verifySwitchDown( main, [ "leaf1", "leaf3", "leaf4", "leaf5" ], 32, { "ipv4": [ True, False, False ], "ipv6": False }, [ "h4v4", "h8v4", "h10v4", "h1v6"] )
         verifyMcastRemoval( main, removeDHT1=False )
         lib.cleanup( main, copyKarafLog=False )
 
@@ -411,14 +411,13 @@
         main.mcastRoutes = { "ipv4": { "src": [ 0 ], "dst": [ 0, 1, 2 ] }, "ipv6": { "src": [ 0 ], "dst": [ 0 ] } }
         setupTest( main, test_idx=401, onosNodes=3 )
         verifyMcastRoutes( main )
-        #TODO: Verify host has both locations
         # Verify killing one link of dual-homed host h4
-        verifyLinkDown( main, [ "leaf2", "h4v4" ], 0 )
-        verifyLinkDown( main, [ "leaf3", "h4v4" ], 0 )
+        verifyPortDown( main, "of:0000000000000002", 10, hostsToDiscover=[ "h4v4" ], hostLocations={ "h4v4": ["of:0000000000000002/10", "of:0000000000000003/10"] } )
+        verifyPortDown( main, "of:0000000000000003", 10, hostsToDiscover=[ "h4v4" ], hostLocations={ "h4v4": ["of:0000000000000002/10", "of:0000000000000003/10"] } )
         # Verify killing one link of dual-homed host h10
-        verifyLinkDown( main, [ "leaf4", "h10v4" ], 0 )
-        verifyLinkDown( main, [ "leaf5", "h10v4" ], 0 )
-        verifySwitchDown( main, "leaf3", 10 )
+        verifyPortDown( main, "of:0000000000000004", 11, hostsToDiscover=[ "h10v4" ], hostLocations={ "h10v4": ["of:0000000000000004/11", "of:0000000000000005/10"] } )
+        verifyPortDown( main, "of:0000000000000005", 10, hostsToDiscover=[ "h10v4" ], hostLocations={ "h10v4": ["of:0000000000000004/11", "of:0000000000000005/10"] } )
+        verifySwitchDown( main, "leaf3", 10, hostsToDiscover=[ "h4v4" ] )
         verifyMcastRemoval( main, removeDHT1=False )
         lib.cleanup( main, copyKarafLog=False )
 
@@ -464,11 +463,11 @@
         setupTest( main, test_idx=403, onosNodes=3 )
         verifyMcastRoutes( main )
         # Verify killing one link of dual-homed host h4
-        verifyLinkDown( main, [ "leaf2", "h4v4" ], 0 )
-        verifyLinkDown( main, [ "leaf3", "h4v4" ], 0 )
+        verifyPortDown( main, "of:0000000000000002", 10, hostsToDiscover=[ "h4v4" ], hostLocations={ "h4v4": ["of:0000000000000002/10", "of:0000000000000003/10"] } )
+        verifyPortDown( main, "of:0000000000000003", 10, hostsToDiscover=[ "h4v4" ], hostLocations={ "h4v4": ["of:0000000000000002/10", "of:0000000000000003/10"] } )
         # Verify killing one link of dual-homed host h10
-        verifyLinkDown( main, [ "leaf4", "h10v4" ], 0 )
-        verifyLinkDown( main, [ "leaf5", "h10v4" ], 0 )
+        verifyPortDown( main, "of:0000000000000004", 11, hostsToDiscover=[ "h10v4" ], hostLocations={ "h10v4": ["of:0000000000000004/11", "of:0000000000000005/10"] } )
+        verifyPortDown( main, "of:0000000000000005", 10, hostsToDiscover=[ "h10v4" ], hostLocations={ "h10v4": ["of:0000000000000004/11", "of:0000000000000005/10"] } )
         verifyLinkDown( main, [ [ "leaf3", "spine101" ], [ "leaf3", "spine102" ] ], 8 )
         verifyMcastRemoval( main, removeDHT1=False )
         lib.cleanup( main, copyKarafLog=False )
@@ -494,11 +493,11 @@
         setupTest( main, test_idx=404, onosNodes=3 )
         verifyMcastRoutes( main )
         # Verify killing one link of dual-homed host h4
-        verifyLinkDown( main, [ "leaf2", "h4v4" ], 0 )
-        verifyLinkDown( main, [ "leaf3", "h4v4" ], 0 )
+        verifyPortDown( main, "of:0000000000000002", 10, hostsToDiscover=[ "h4v4" ], hostLocations={ "h4v4": ["of:0000000000000002/10", "of:0000000000000003/10"] } )
+        verifyPortDown( main, "of:0000000000000003", 10, hostsToDiscover=[ "h4v4" ], hostLocations={ "h4v4": ["of:0000000000000002/10", "of:0000000000000003/10"] } )
         # Verify killing one link of dual-homed host h10
-        verifyLinkDown( main, [ "leaf4", "h10v4" ], 0 )
-        verifyLinkDown( main, [ "leaf5", "h10v4" ], 0 )
+        verifyPortDown( main, "of:0000000000000004", 11, hostsToDiscover=[ "h10v4" ], hostLocations={ "h10v4": ["of:0000000000000004/11", "of:0000000000000005/10"] } )
+        verifyPortDown( main, "of:0000000000000005", 10, hostsToDiscover=[ "h10v4" ], hostLocations={ "h10v4": ["of:0000000000000004/11", "of:0000000000000005/10"] } )
         verifyLinkDown( main, [ [ "leaf3", "spine101" ], [ "leaf2", "spine102" ] ], 8 )
         verifyMcastRemoval( main, removeDHT1=False )
         lib.cleanup( main, copyKarafLog=False )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
index 30b7e92..f598f96 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
@@ -75,7 +75,7 @@
     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[ "src" ][ i ][ "id" ] for i in src ],
                                                 [ routeData[ "dst" ][ i ][ "id" ] for i in dst ] )
     time.sleep( float( main.params[ "timers" ][ "mcastSleep" ] ) )
 
@@ -85,7 +85,7 @@
     """
     routeData = main.multicastConfig[ routeName ]
     main.step( "Verify removal of {} route".format( routeName ) )
-    main.Cluster.active( 0 ).CLI.mcastHostDelete( routeData[ "src" ][ 0 ][ "ip" ], routeData[ "group" ] )
+    main.Cluster.active( 0 ).CLI.mcastSinkDelete( routeData[ "src" ][ 0 ][ "ip" ], routeData[ "group" ] )
     # TODO: verify the deletion
 
 def verifyMcastSinkRemoval( main, routeName, sinkIndex, expect ):
@@ -96,7 +96,7 @@
     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 )
+    main.Cluster.active( 0 ).CLI.mcastSinkDelete( routeData[ "src" ][ 0 ][ "ip" ], routeData[ "group" ], sinkId )
     time.sleep( float( main.params[ "timers" ][ "mcastSleep" ] ) )
     lib.verifyMulticastTraffic( main, routeName, expect )
 
@@ -106,9 +106,9 @@
     """
     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 )
+    sourceId = [ routeData[ "src" ][ sourceIndex ][ "id" ] ]
+    main.step( "Verify removal of {} source {}".format( routeName, sourceId ) )
+    main.Cluster.active( 0 ).CLI.mcastSourceDelete( routeData[ "src" ][ 0 ][ "ip" ], routeData[ "group" ], sourceId )
     time.sleep( float( main.params[ "timers" ][ "mcastSleep" ] ) )
     lib.verifyMulticastTraffic( main, routeName, expect )
 
@@ -126,7 +126,7 @@
         verifyMcastSinkRemoval( main, "ipv4", 1, [ True, False, False ] )
     verifyMcastSourceRemoval( main, "ipv4", 0, False )
 
-def verifyLinkDown( main, link, affectedLinkNum, expectList={ "ipv4": True, "ipv6": True } ):
+def verifyLinkDown( main, link, affectedLinkNum, expectList={ "ipv4": True, "ipv6": True }, hostsToDiscover=[], hostLocations={} ):
     """
     Kill a batch of links and verify traffic
     Restore the links and verify traffic
@@ -139,10 +139,34 @@
         lib.verifyMulticastTraffic( main, routeName, expectList[ routeName ] )
     # Restore the link(s)
     lib.restoreLinkBatch( main, link, int( main.params[ "TOPO" ][ "linkNum" ] ), int( main.params[ "TOPO" ][ "switchNum" ] ) )
+    if hostsToDiscover:
+        main.Network.discoverHosts( hostList=hostsToDiscover )
+    for host, loc in hostLocations.items():
+        lib.verifyHostLocation( main, host, loc, retry=5 )
     for routeName in expectList.keys():
         lib.verifyMulticastTraffic( main, routeName, True )
 
-def verifySwitchDown( main, switchName, affectedLinkNum, expectList={ "ipv4": True, "ipv6": True } ):
+def verifyPortDown( main, dpid, port, expectList={ "ipv4": True, "ipv6": True }, hostsToDiscover=[], hostLocations={} ):
+    """
+    Disable a port and verify traffic
+    Reenable the port and verify traffic
+    """
+    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
+    main.step( "Disable port {}/{}".format( dpid, port ) )
+    main.Cluster.active( 0 ).CLI.portstate( dpid=dpid, port=port, state="disable" )
+    time.sleep( 10 )
+    for routeName in expectList.keys():
+        lib.verifyMulticastTraffic( main, routeName, expectList[ routeName ] )
+    # Restore the link(s)
+    main.Cluster.active( 0 ).CLI.portstate( dpid=dpid, port=port, state="enable" )
+    if hostsToDiscover:
+        main.Network.discoverHosts( hostList=hostsToDiscover )
+    for host, loc in hostLocations.items():
+        lib.verifyHostLocation( main, host, loc, retry=5 )
+    for routeName in expectList.keys():
+        lib.verifyMulticastTraffic( main, routeName, True )
+
+def verifySwitchDown( main, switchName, affectedLinkNum, expectList={ "ipv4": True, "ipv6": True }, hostsToDiscover=[], hostLocations={} ):
     """
     Kill a batch of switches and verify traffic
     Recover the swithces and verify traffic
@@ -154,7 +178,9 @@
     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" ] ) )
+    lib.recoverSwitch( main, switchName, int( main.params[ "TOPO" ][ "switchNum" ] ), int( main.params[ "TOPO" ][ "linkNum" ] ), True if hostsToDiscover else False, hostsToDiscover )
+    for host, loc in hostLocations.items():
+        lib.verifyHostLocation( host, loc, retry=5 )
     for routeName in expectList.keys():
         lib.verifyMulticastTraffic( main, routeName, True )
 
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/common.multicastConfig b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/common.multicastConfig
index 842d540..4d06609 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/common.multicastConfig
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/multicast/common.multicastConfig
@@ -6,6 +6,7 @@
             {
                 "host": "h3v4",
                 "ip": "10.2.0.1",
+                "id": "00:AA:00:00:00:02/None",
                 "port": "of:0000000000000002/9",
                 "interface": "h3v4-eth0",
                 "Ether": "01:00:5e:02:00:01",
@@ -40,6 +41,7 @@
             {
                 "host": "h3v6",
                 "ip": "1002::3fe",
+                "id": "00:BB:00:00:00:02/None",
                 "port": "of:0000000000000002/6",
                 "interface": "h3v6-eth0",
                 "Ether": "33:33:00:00:03:fe",
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index ab1ac32..752296a 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -573,7 +573,7 @@
 
         main.linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
         main.log.info(
-                "Waiting %s seconds for links down to be discovered" % main.linkSleep )
+                "Waiting %s seconds for links up to be discovered" % main.linkSleep )
         time.sleep( main.linkSleep )
 
         topology = utilities.retry( main.Cluster.active( 0 ).CLI.checkStatus,
@@ -650,7 +650,7 @@
                                  onfail="Failed to kill switch?" )
 
     @staticmethod
-    def recoverSwitch( main, switch, switches, links, rediscoverHosts=False ):
+    def recoverSwitch( main, switch, switches, links, rediscoverHosts=False, hostsToDiscover=[] ):
         """
         Params: switches, links: number of expected switches and links after SwitchUp, ex.: '4', '6'
         Recover a switch and verify ONOS can see the proper change
@@ -665,8 +665,7 @@
             main.switchSleep ) )
         time.sleep( main.switchSleep )
         if rediscoverHosts:
-            main.Network.discoverIpv4Hosts( main.internalIpv4Hosts )
-            main.Network.discoverIpv6Hosts( main.internalIpv6Hosts )
+            main.Network.discoverHosts( hostList=hostsToDiscover )
             main.log.info( "Waiting %s seconds for hosts to get re-discovered" % (
                            main.switchSleep ) )
             time.sleep( main.switchSleep )
@@ -1039,7 +1038,7 @@
             main.log.debug( host.hostMac )
 
     @staticmethod
-    def verifyMulticastTraffic( main, routeName, expect, skipOnFail=True, maxRetry=0 ):
+    def verifyMulticastTraffic( main, routeName, expect, skipOnFail=True, maxRetry=1 ):
         """
         Verify multicast traffic using scapy
         """
@@ -1106,7 +1105,7 @@
             main.skipCase()
 
     @staticmethod
-    def verifyHostLocation( main, hostName, locations, ipv6=False ):
+    def verifyHostLocation( main, hostName, locations, ipv6=False, retry=0 ):
         """
         Verify if the specified host is discovered by ONOS on the given locations
         Required:
@@ -1118,7 +1117,13 @@
         Returns:
             main.TRUE if host is discovered on all locations provided, otherwise main.FALSE
         """
-        main.step( "Verify host {} is discovered at {}".format( hostName, locations ) )
+        main.log.info( "Verify host {} is discovered at {}".format( hostName, locations ) )
         hostIp = main.Network.getIPAddress( hostName, proto='IPV6' if ipv6 else 'IPV4' )
-        result = main.Cluster.active( 0 ).CLI.verifyHostLocation( hostIp, locations )
-        return result
+        result = utilities.retry( main.Cluster.active( 0 ).CLI.verifyHostLocation,
+                                  main.FALSE,
+                                  args=( hostIp, locations ),
+                                  attempts=retry + 1,
+                                  sleep=10 )
+        utilities.assert_equals( expect=main.TRUE, actual=result,
+                                 onpass="Location verification for Host {} passed".format( hostName ),
+                                 onfail="Location verification for Host {} failed".format( hostName ) )