Several fixes to SRMulticast
- Add host discovery and location verifications
- Flush arp entries before host discovery
- Update mcast join and delete commands

Change-Id: If5c6d85e7441010c63ebf45f333552e24a07352c
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 59e1441..c5ee51d 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -605,6 +605,8 @@
                     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
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
         """