Merge "FUNCintent checkIntentState() passes if the second check passes."
diff --git a/TestON/drivers/common/api/dockerapidriver.py b/TestON/drivers/common/api/dockerapidriver.py
new file mode 100644
index 0000000..2630f6b
--- /dev/null
+++ b/TestON/drivers/common/api/dockerapidriver.py
@@ -0,0 +1,242 @@
+#!/usr/bin/env python
+
+import json
+import os
+import re
+import subprocess
+from docker import Client
+from drivers.common.apidriver import API
+
+class DockerApiDriver( API ):
+
+    def __init__( self ):
+        """
+        Initialize client
+        """
+        self.name = None
+        self.home = None
+        self.handle = None
+        super( API, self ).__init__()
+
+    def connect( self, **connectargs ):
+        """
+        Create Client handle to connnect to Docker server
+        """
+        try:
+            for key in connectargs:
+                vars( self )[ key ] = connectargs[ key ]
+            self.name = self.options[ 'name' ]
+            for key in self.options:
+                if key == "home":
+                    self.home = self.options[ 'home' ]
+                    break
+            if self.home is None or self.home == "":
+                self.home = "/var/tmp"
+
+            self.handle = super( DockerApiDriver, self ).connect()
+            self.dockerClient = Client(base_url='unix://var/run/docker.sock')
+            return self.handle
+        except Exception as e:
+            main.log.exception( e )
+
+    def dockerPull( self, image="onosproject/onos", tag="latest" ):
+        """
+        Pulls Docker image from repository
+        """
+        try:
+            main.log.info( self.name +
+                           ": Pulling Docker image " + image + ":"+tag )
+            for line in self.dockerClient.pull( repository=image, \
+                    tag=tag, stream=True ):
+                response = json.dumps( json.loads( line ), indent=4 )
+            if( re.search( "Downloaded", response ) ):
+                return main.TRUE
+            else:
+                main.log.error( "Failed to download image: " + image +":"+ tag )
+                main.log.error( "Error respone: " )
+                main.log.error( response )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def dockerRun( self, image="onosproject/onos", node="onos1" ):
+        """
+            Run specified Docker container
+        """
+        try:
+            main.log.info( self.name +
+                           ": Creating Docker conatiner for node " + node )
+            reponse = self.dockerClient.create_container( image=image, \
+                    tty=True, hostname=node, detach=True )
+            if( reponse['Warnings'] == 'None' ):
+                main.log.info( "Created container for node: " + node )
+                return main.TRUE
+            else:
+                main.log.info( "Noticed warnings during create" )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def dockerStart( self, node="onos1" ):
+        """
+            Start Docker container
+        """
+        try:
+            main.log.info( self.name +
+                           ": Starting Docker conatiner for node " + node )
+            reponse = self.dockerClient.start( node )
+            if( reponse == 'None' ):
+                main.log.info( "Started container for node: " + node )
+                return main.TRUE
+            else:
+                main.log.info( "Noticed warnings during start" )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def dockerStop( self, node="onos1" ):
+        """
+            Stop docker container
+        """
+        try:
+            main.log.info( self.name +
+                           ": Stopping Docker conatiner for node " + node )
+            reponse = self.dockerClient.stop( node )
+            if( reponse == 'None' ):
+                main.log.info( "Stopped container for node: " + node )
+                return main.TRUE
+            else:
+                main.log.info( "Noticed warnings during stop" )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def dockerRestart( self, node="onos1" ):
+        """
+            Restart Docker container
+        """
+        try:
+            main.log.info( self.name +
+                           ": Restarting Docker conatiner for node " + node )
+            reponse = self.dockerClient.restart( node )
+            if( reponse == 'None' ):
+                main.log.info( "Restarted container for node: " + node )
+                return main.TRUE
+            else:
+                main.log.info( "Noticed warnings during Restart" )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def dockerStatus( self, node="onos1" ):
+        """
+            Check Docker conatiner status
+        """
+        try:
+            main.log.info( self.name +
+                           ": Checking Docker Status for node " + node )
+            reponse = self.dockerClient.inspect_container( node )
+            if( reponse == 'True' ):
+                main.log.info( "Container " + node + " is running" )
+                return main.TRUE
+            else:
+                main.log.info( "Container " + node + " is not running" )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def dockerRemove( self, node="onos1" ):
+        """
+            Remove Docker conatiner
+        """
+        try:
+            main.log.info( self.name +
+                           ": Removing Docker container for node " + node )
+            reponse = self.dockerClient.remove_container( node )
+            if( reponse == 'None' ):
+                main.log.info( "Removed container for node: " + node )
+                return main.TRUE
+            else:
+                main.log.info( "Noticed warnings during Remove " + node )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def dockerImageRemove( self, image="onosproject/onos" ):
+        """
+            Remove Docker image
+        """
+        try:
+            main.log.info( self.name +
+                           ": Removing Docker container for node " + node )
+            reponse = self.dockerClient.remove_image( image )
+            if( reponse == 'None' ):
+                main.log.info( "Removed Docker image: " + image )
+                return main.TRUE
+            else:
+                main.log.info( "Noticed warnings during Remove " + image )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def fetchLatestClusterFile( self, branch="master" ):
+        """
+            Fetch onos-form-cluster file from a particular branch
+        """
+        try:
+            command = "wget -N https://raw.githubusercontent.com/opennetworkinglab/\
+                    onos/" + branch + "/tools/package/bin/onos-form-cluster"
+            subprocess.call( command ) # output checks are missing for now
+            command = "chmod u+x " + "onos-form-cluster"
+            subprocess.call( command )
+            return main.TRUE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def onosFormCluster( self, onosIPs, user="onos", passwd="rocks" ):
+        """
+            From ONOS cluster for IP addresses in onosIPs list
+        """
+        try:
+            onosIPs = " ".join(onosIPs)
+            command = "./onos-form-cluster -u " + user + " -p " + passwd + \
+                    " `" + onosIPs + "`"
+            subprocess.call( command ) # output checks are missing for now
+            return main.TRUE # FALSE condition will be verified from output
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def dockerIP( self, node='onos1' ):
+        """
+            Fetch IP address assigned to specified node/container
+        """
+        try:
+            output = self.dockerClient.inspect_container(node)
+            nodeIP = output['NetworkSettings']['IPAddress']
+            #main.log.info( " Docker IP " + str(nodeIP) )
+            return str(nodeIP)
+
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index d726f2e..e7718c0 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -405,7 +405,7 @@
         main.log.info( self.name + ": \n---\n" + response )
         return main.FALSE
 
-    def pingallHosts( self, hostList ):
+    def pingallHosts( self, hostList, wait=1 ):
         """
             Ping all specified IPv4 hosts
 
@@ -417,8 +417,8 @@
 
             Returns main.FALSE if one or more of hosts specified
             cannot reach each other"""
-
-        cmd = " ping -c 1 -i 1 -W 8 "
+        wait = int( wait )
+        cmd = " ping -c 1 -i 1 -W " + str( wait ) + " "
 
         try:
             main.log.info( "Testing reachability between specified hosts" )
@@ -438,7 +438,7 @@
                     # Current host pings all other hosts specified
                     pingCmd = str( host ) + cmd + str( temp )
                     self.handle.sendline( pingCmd )
-                    self.handle.expect( "mininet>" )
+                    self.handle.expect( "mininet>", timeout=wait + 1 )
                     response = self.handle.before
                     if re.search( ',\s0\%\spacket\sloss', response ):
                         pingResponse += str(" h" + str( temp[1:] ))
@@ -463,19 +463,20 @@
             main.cleanup()
             main.exit()
 
-    def pingIpv6Hosts(self, hostList, prefix='1000::'):
+    def pingIpv6Hosts( self, hostList, prefix='1000::', wait=1 ):
         """
-           IPv6 ping all hosts in hostList. If no prefix passed this will use
-           default prefix of 1000::
+        IPv6 ping all hosts in hostList. If no prefix passed this will use
+        default prefix of 1000::
 
-           Returns main.TRUE if all hosts specified can reach each other
+        Returns main.TRUE if all hosts specified can reach each other
 
-           Returns main.FALSE if one or more of hosts specified cannot reach each other
+        Returns main.FALSE if one or more of hosts specified cannot reach each other
         """
         try:
             main.log.info( "Testing reachability between specified IPv6 hosts" )
             isReachable = main.TRUE
-            cmd = " ping6 -c 1 -i 1 -W 8 "
+            wait = int( wait )
+            cmd = " ping6 -c 1 -i 1 -W " + str( wait ) + " "
             pingResponse = "IPv6 Pingall output:\n"
             failedPings = 0
             for host in hostList:
@@ -490,7 +491,7 @@
                     # Current host pings all other hosts specified
                     pingCmd = str( host ) + cmd + prefix + str( temp[1:] )
                     self.handle.sendline( pingCmd )
-                    self.handle.expect( "mininet>" )
+                    self.handle.expect( "mininet>", timeout=wait + 1 )
                     response = self.handle.before
                     if re.search( ',\s0\%\spacket\sloss', response ):
                         pingResponse += str(" h" + str( temp[1:] ))
@@ -518,15 +519,19 @@
 
     def pingHost( self, **pingParams ):
         """
-           Ping from one mininet host to another
-           Currently the only supported Params: SRC and TARGET"""
-        args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
+        Ping from one mininet host to another
+        Currently the only supported Params: SRC, TARGET, and WAIT
+        """
+        args = utilities.parse_args( [ "SRC", "TARGET", 'WAIT' ], **pingParams )
+        wait = args['WAIT']
+        wait = int( wait if wait else 1 )
         command = args[ "SRC" ] + " ping " + \
-            args[ "TARGET" ] + " -c 1 -i 1 -W 8"
+            args[ "TARGET" ] + " -c 1 -i 1 -W " + str( wait ) + " "
         try:
             main.log.info( "Sending: " + command )
             self.handle.sendline( command )
-            i = self.handle.expect( [ command, pexpect.TIMEOUT ] )
+            i = self.handle.expect( [ command, pexpect.TIMEOUT ],
+                                    timeout=wait + 1 )
             if i == 1:
                 main.log.error(
                     self.name +
@@ -561,17 +566,20 @@
     def ping6pair( self, **pingParams ):
         """
            IPv6 Ping between a pair of mininet hosts
-           Currently the only supported Params are: SRC , TARGET
+           Currently the only supported Params are: SRC, TARGET, and WAIT
            FLOWLABEL and -I (src interface) will be added later after running some tests.
            Example: main.Mininet1.ping6pair( src="h1", target="1000::2" )
         """
-        args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
-        command = args[ "SRC" ] + " ping6 " + \
-            args[ "TARGET" ] + " -c 1 -i 1 -W 8"
+        args = utilities.parse_args( [ "SRC", "TARGET", 'WAIT' ], **pingParams )
+        wait = args['WAIT']
+        wait = int( wait if wait else 1 )
+        command = args[ "SRC" ] + " ping " + \
+            args[ "TARGET" ] + " -c 1 -i 1 -W " + str( wait ) + " "
         try:
             main.log.info( "Sending: " + command )
             self.handle.sendline( command )
-            i = self.handle.expect( [ command, pexpect.TIMEOUT ] )
+            i = self.handle.expect( [ command, pexpect.TIMEOUT ],
+                                    timeout=wait + 1 )
             if i == 1:
                 main.log.error(
                     self.name +
@@ -1039,7 +1047,7 @@
         main.log.info( self.name + ": List network links" )
         try:
             response = self.execute( cmd='links', prompt='mininet>',
-                                     timeout=10 )
+                                     timeout=20 )
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
@@ -1104,12 +1112,15 @@
             else:
                 main.log.error( self.name + ": iperf test failed" )
                 return main.FALSE
-
         except pexpect.TIMEOUT:
-            main.log.error( self.name + ": TIMEOUT exception found")
-            main.log.error( self.name + ": Exception: Cannot connect to iperf on port 5001" )
+            main.log.error( self.name + ": TIMEOUT exception found" )
+            main.log.error( self.name + " response: " +
+                            repr ( self.handle.before ) )
+            # NOTE: Send ctrl-c to make sure iperf is done
+            self.handle.sendline( "\x03" )
+            self.handle.expect( "Interrupt" )
+            self.handle.expect( "mininet>" )
             return main.FALSE
-
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index c261872..2fae817 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -192,6 +192,7 @@
             self.handle.sendline( "onos-package" )
             self.handle.expect( "onos-package" )
             self.handle.expect( "tar.gz", opTimeout )
+            self.handle.expect( "\$" )
             handle = str( self.handle.before )
             main.log.info( "onos-package command returned: " +
                            handle )
@@ -221,6 +222,7 @@
                 "BUILD FAILED" ],
                 timeout=120 )
             handle = str( self.handle.before )
+            self.handle.expect( "\$" )
 
             main.log.info( "onos-build command returned: " +
                            handle )
@@ -752,12 +754,11 @@
                 # Expect the cellname in the ONOSCELL variable.
                 # Note that this variable name is subject to change
                 #   and that this driver will have to change accordingly
-                self.handle.expect(str(cellname))
+                self.handle.expect( str( cellname ) )
                 handleBefore = self.handle.before
                 handleAfter = self.handle.after
                 # Get the rest of the handle
-                self.handle.sendline("")
-                self.handle.expect("\$")
+                self.handle.expect( "\$" )
                 handleMore = self.handle.before
 
                 cell_result = handleBefore + handleAfter + handleMore
@@ -768,7 +769,6 @@
                     main.cleanup()
                     main.exit()
                 return main.TRUE
-
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
@@ -793,19 +793,11 @@
             self.handle.expect( "\$" )
             handleBefore = self.handle.before
             handleAfter = self.handle.after
-            # Get the rest of the handle
-            self.handle.sendline( "" )
-            self.handle.expect( "\$" )
-            handleMore = self.handle.before
-
             main.log.info( "Verify cell returned: " + handleBefore +
-                           handleAfter + handleMore )
-
+                           handleAfter )
             return main.TRUE
         except pexpect.ExceptionPexpect as e:
-            main.log.error( self.name + ": Pexpect exception found of type " +
-                            str( type( e ) ) )
-            main.log.error ( e.get_trace() )
+            main.log.exception( self.name + ": Pexpect exception found: " )
             main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
@@ -851,9 +843,7 @@
                     return main.TRUE
 
             except pexpect.ExceptionPexpect as e:
-                main.log.error( self.name + ": Pexpect exception found of type " +
-                                str( type( e ) ) )
-                main.log.error ( e.get_trace() )
+                main.log.exception( self.name + ": Pexpect exception found: " )
                 main.log.error( self.name + ":    " + self.handle.before )
                 main.cleanup()
                 main.exit()
@@ -904,23 +894,12 @@
             self.handle.expect( "\$" )
 
             handleBefore = self.handle.before
-            print "handle_before = ", self.handle.before
-            # handleAfter = str( self.handle.after )
-
-            # self.handle.sendline( "" )
-            # self.handle.expect( "\$" )
-            # handleMore = str( self.handle.before )
-
             main.log.info( "Command sent successfully" )
-
             # Obtain return handle that consists of result from
             # the onos command. The string may need to be
             # configured further.
-            # returnString = handleBefore + handleAfter
             returnString = handleBefore
-            print "return_string = ", returnString
             return returnString
-
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
@@ -954,26 +933,28 @@
                                       "onos\sstart/running,\sprocess",
                                       "ONOS\sis\salready\sinstalled",
                                       pexpect.TIMEOUT ], timeout=60 )
-
             if i == 0:
                 main.log.warn( "Network is unreachable" )
+                self.handle.expect( "\$" )
                 return main.FALSE
             elif i == 1:
                 main.log.info(
                     "ONOS was installed on " +
                     node +
                     " and started" )
+                self.handle.expect( "\$" )
                 return main.TRUE
             elif i == 2:
                 main.log.info( "ONOS is already installed on " + node )
+                self.handle.expect( "\$" )
                 return main.TRUE
             elif i == 3:
                 main.log.info(
                     "Installation of ONOS on " +
                     node +
                     " timed out" )
+                self.handle.expect( "\$" )
                 return main.FALSE
-
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
@@ -999,7 +980,7 @@
                 "start/running",
                 "Unknown\sinstance",
                 pexpect.TIMEOUT ], timeout=120 )
-
+            self.handle.expect( "\$" )
             if i == 0:
                 main.log.info( "Service is already running" )
                 return main.TRUE
@@ -1035,7 +1016,7 @@
                 "Could not resolve hostname",
                 "Unknown\sinstance",
                 pexpect.TIMEOUT ], timeout=60 )
-
+            self.handle.expect( "\$" )
             if i == 0:
                 main.log.info( "ONOS service stopped" )
                 return main.TRUE
@@ -1049,7 +1030,6 @@
             else:
                 main.log.error( "ONOS service failed to stop" )
                 return main.FALSE
-
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
@@ -1070,13 +1050,10 @@
             self.handle.sendline( "" )
             self.handle.expect( "\$", timeout=60 )
             self.handle.sendline( "onos-uninstall " + str( nodeIp ) )
-            self.handle.expect( "\$" )
-
+            self.handle.expect( "\$", timeout=60 )
             main.log.info( "ONOS " + nodeIp + " was uninstalled" )
-
             # onos-uninstall command does not return any text
             return main.TRUE
-
         except pexpect.TIMEOUT:
             main.log.exception( self.name + ": Timeout in onosUninstall" )
             return main.FALSE
@@ -1186,10 +1163,7 @@
                                         timeout=120 )
                 if i == 1:
                     return main.FALSE
-            #self.handle.sendline( "" )
-            #self.handle.expect( "\$" )
             return main.TRUE
-
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
@@ -1237,7 +1211,7 @@
             main.cleanup()
             main.exit()
 
-    def isup(self, node = "", timeout = 120):
+    def isup( self, node="", timeout=120 ):
         """
         Run's onos-wait-for-start which only returns once ONOS is at run
         level 100(ready for use)
@@ -1245,8 +1219,8 @@
         Returns: main.TRUE if ONOS is running and main.FALSE on timeout
         """
         try:
-            self.handle.sendline("onos-wait-for-start " + node )
-            self.handle.expect("onos-wait-for-start")
+            self.handle.sendline( "onos-wait-for-start " + node )
+            self.handle.expect( "onos-wait-for-start" )
             # NOTE: this timeout is arbitrary"
             i = self.handle.expect(["\$", pexpect.TIMEOUT], timeout)
             if i == 0:
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 0202a15..7d6ef0b 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -145,12 +145,11 @@
         """
         result = super( CLI, self ).execute( self )
         defaultPrompt = '.*[$>\#]'
-        args = utilities.parse_args( [
-                     "CMD",
-                                     "TIMEOUT",
-                                     "PROMPT",
-                                     "MORE" ],
-                             **execparams )
+        args = utilities.parse_args( [ "CMD",
+                                       "TIMEOUT",
+                                       "PROMPT",
+                                       "MORE" ],
+                                     **execparams )
 
         expectPrompt = args[ "PROMPT" ] if args[ "PROMPT" ] else defaultPrompt
         self.LASTRSP = ""
@@ -164,20 +163,18 @@
             args[ "MORE" ] = " "
         self.handle.sendline( cmd )
         self.lastCommand = cmd
-        index = self.handle.expect( [
-                    expectPrompt,
-                                    "--More--",
-                                    'Command not found.',
-                                    pexpect.TIMEOUT,
-                                    "^:$" ],
-                            timeout=timeoutVar )
+        index = self.handle.expect( [ expectPrompt,
+                                      "--More--",
+                                      'Command not found.',
+                                      pexpect.TIMEOUT,
+                                      "^:$" ],
+                                    timeout=timeoutVar )
         if index == 0:
             self.LASTRSP = self.LASTRSP + \
                 self.handle.before + self.handle.after
-            main.log.info(
-                "Executed :" + str(
-                    cmd ) + " \t\t Expected Prompt '" + str(
-                        expectPrompt) + "' Found" )
+            main.log.info( "Executed :" + str(cmd ) +
+                           " \t\t Expected Prompt '" + str( expectPrompt) +
+                           "' Found" )
         elif index == 1:
             self.LASTRSP = self.LASTRSP + self.handle.before
             self.handle.send( args[ "MORE" ] )
@@ -196,26 +193,25 @@
             main.log.error( "Command not found" )
             self.LASTRSP = self.LASTRSP + self.handle.before
         elif index == 3:
-            main.log.error( "Expected Prompt not found , Time Out!!" )
+            main.log.error( "Expected Prompt not found, Time Out!!" )
             main.log.error( expectPrompt )
-            return "Expected Prompt not found , Time Out!!"
-
+            self.LASTRSP = self.LASTRSP + self.handle.before
+            return self.LASTRSP
         elif index == 4:
             self.LASTRSP = self.LASTRSP + self.handle.before
             # self.handle.send( args[ "MORE" ] )
             self.handle.sendcontrol( "D" )
             main.log.info(
-                "Found More screen to go , Sending a key to proceed" )
+                "Found More screen to go, Sending a key to proceed" )
             indexMore = self.handle.expect(
                 [ "^:$", expectPrompt ], timeout=timeoutVar )
             while indexMore == 0:
                 main.log.info(
-                    "Found another More screen to go , Sending a key to proceed" )
+                    "Found another More screen to go, Sending a key to proceed" )
                 self.handle.sendcontrol( "D" )
                 indexMore = self.handle.expect(
                     [ "^:$", expectPrompt ], timeout=timeoutVar )
                 self.LASTRSP = self.LASTRSP + self.handle.before
-
         main.last_response = self.remove_contol_chars( self.LASTRSP )
         return self.LASTRSP
 
@@ -297,7 +293,6 @@
                                 pexpect.EOF,
                                 pexpect.TIMEOUT ],
                                 120 )
-
             if i == 0:  # ask for ssh key confirmation
                 main.log.info( "ssh key confirmation received, sending yes" )
                 self.handle.sendline( 'yes' )
@@ -327,10 +322,7 @@
                     "@" +
                     ipAddress )
                 returnVal = main.FALSE
-
-        self.handle.sendline( "" )
-        self.handle.expect( "$" )
-
+        self.handle.expect( "\$" )
         return returnVal
 
     def scp( self, remoteHost, filePath, dstPath, direction="from" ):
diff --git a/TestON/tests/CHOtest/CHOtest.params b/TestON/tests/CHOtest/CHOtest.params
index 965e297..03574a0 100644
--- a/TestON/tests/CHOtest/CHOtest.params
+++ b/TestON/tests/CHOtest/CHOtest.params
@@ -18,7 +18,7 @@
     # 19X. IPv6 ping across Point,Multi-single,Single-Multi Intents
 
 <testcases>
-1,20,3,[40,5,140,60,160,70,170,80,180,10,5,90,190,71,171,81,181,10,5]*10,21,3,[41,5,141,61,161,72,172,82,182,10,5,91,191,73,173,83,183,10,5]*10,22,3,[42,5,142,62,162,74,174,84,184,10,5,92,192,75,175,85,185,10,5]*10
+1,20,3,[40,5,140,60,160,70,170,80,180,10,5,90,190,71,171,81,181,10,5]*50,21,3,[41,5,141,61,161,72,172,82,182,10,5,91,191,73,173,83,183,10,5]*50,22,3,[42,5,142,62,162,74,174,84,184,10,5,92,192,75,175,85,185,10,5]*50
 </testcases>
 
     <GIT>
diff --git a/TestON/tests/CHOtest/CHOtest.py b/TestON/tests/CHOtest/CHOtest.py
index fdee4be..a65bf3c 100644
--- a/TestON/tests/CHOtest/CHOtest.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -1822,7 +1822,7 @@
 
         if not caseResult and main.failSwitch:
             main.log.report("Stopping test")
-            main.stop( mail=main.emailOnStop )
+            main.stop( email=main.emailOnStop )
 
     def CASE72( self, main ):
         """
diff --git a/TestON/tests/HAminorityRestart/HAminorityRestart.py b/TestON/tests/HAminorityRestart/HAminorityRestart.py
index d175fd7..ca8a194 100644
--- a/TestON/tests/HAminorityRestart/HAminorityRestart.py
+++ b/TestON/tests/HAminorityRestart/HAminorityRestart.py
@@ -48,6 +48,7 @@
         start tcpdump
         """
         import imp
+        import pexpect
         main.log.info( "ONOS HA test: Restart minority of ONOS nodes - " +
                          "initialization" )
         main.case( "Setting up test environment" )
@@ -189,6 +190,16 @@
         main.log.wiki(graphs)
 
         main.step( "Creating ONOS package" )
+        # copy gen-partions file to ONOS
+        # NOTE: this assumes TestON and ONOS are on the same machine
+        srcFile = main.testDir + "/" + main.TEST + "/dependencies/onos-gen-partitions"
+        dstDir = main.ONOSbench.home + "/tools/test/bin/onos-gen-partitions"
+        cpResult = main.ONOSbench.secureCopy( main.ONOSbench.user_name,
+                                              main.ONOSbench.ip_address,
+                                              srcFile,
+                                              dstDir,
+                                              pwd=main.ONOSbench.pwd,
+                                              direction="from" )
         packageResult = main.ONOSbench.onosPackage()
         utilities.assert_equals( expect=main.TRUE, actual=packageResult,
                                  onpass="ONOS package successful",
@@ -203,6 +214,19 @@
         utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult,
                                  onpass="ONOS install successful",
                                  onfail="ONOS install failed" )
+        # clean up gen-partitions file
+        try:
+            main.ONOSbench.handle.sendline( "cd " + main.ONOSbench.home )
+            main.ONOSbench.handle.expect( main.ONOSbench.home + "\$" )
+            main.ONOSbench.handle.sendline( "git checkout -- tools/test/bin/onos-gen-partitions" )
+            main.ONOSbench.handle.expect( main.ONOSbench.home + "\$" )
+            main.log.info( " Cleaning custom gen partitions file, response was: \n" +
+                           str( main.ONOSbench.handle.before ) )
+        except ( pexpect.TIMEOUT, pexpect.EOF ):
+            main.log.exception( "ONOSbench: pexpect exception found:" +
+                                main.ONOSbench.handle.before )
+            main.cleanup()
+            main.exit()
 
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
@@ -1680,17 +1704,19 @@
             main.log.debug( "Checking logs for errors on " + node.name + ":" )
             main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
 
-        main.step( "Killing 3 ONOS nodes" )
+        n = len( main.nodes )  # Number of nodes
+        p = ( ( n + 1 ) / 2 ) + 1  # Number of partitions
+        main.kill = [ 0 ]  # ONOS node to kill, listed by index in main.nodes
+        if n > 3:
+            main.kill.append( p - 1 )
+            # NOTE: This only works for cluster sizes of 3,5, or 7.
+
+        main.step( "Killing " + str( len( main.kill ) ) + " ONOS nodes" )
         killTime = time.time()
-        # TODO: Randomize these nodes or base this on partitions
-        # TODO: use threads in this case
-        killResults = main.ONOSbench.onosKill( main.nodes[0].ip_address )
-        time.sleep( 10 )
-        killResults = killResults and\
-                      main.ONOSbench.onosKill( main.nodes[1].ip_address )
-        time.sleep( 10 )
-        killResults = killResults and\
-                      main.ONOSbench.onosKill( main.nodes[2].ip_address )
+        killResults = main.TRUE
+        for i in main.kill:
+            killResults = killResults and\
+                          main.ONOSbench.onosKill( main.nodes[i].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=killResults,
                                  onpass="ONOS Killed successfully",
                                  onfail="ONOS kill NOT successful" )
@@ -1699,21 +1725,20 @@
         count = 0
         onosIsupResult = main.FALSE
         while onosIsupResult == main.FALSE and count < 10:
-            onos1Isup = main.ONOSbench.isup( main.nodes[0].ip_address )
-            onos2Isup = main.ONOSbench.isup( main.nodes[1].ip_address )
-            onos3Isup = main.ONOSbench.isup( main.nodes[2].ip_address )
-            onosIsupResult = onos1Isup and onos2Isup and onos3Isup
+            onosIsupResult = main.TRUE
+            for i in main.kill:
+                onosIsupResult = onosIsupResult and\
+                                 main.ONOSbench.isup( main.nodes[i].ip_address )
             count = count + 1
-        # TODO: if it becomes an issue, we can retry this step  a few times
         utilities.assert_equals( expect=main.TRUE, actual=onosIsupResult,
                                  onpass="ONOS restarted successfully",
                                  onfail="ONOS restart NOT successful" )
 
         main.step( "Restarting ONOS main.CLIs" )
-        cliResult1 = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
-        cliResult2 = main.ONOScli2.startOnosCli( main.nodes[1].ip_address )
-        cliResult3 = main.ONOScli3.startOnosCli( main.nodes[2].ip_address )
-        cliResults = cliResult1 and cliResult2 and cliResult3
+        cliResults = main.TRUE
+        for i in main.kill:
+            cliResults = cliResults and\
+                         main.CLIs[i].startOnosCli( main.nodes[i].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=cliResults,
                                  onpass="ONOS cli restarted",
                                  onfail="ONOS cli did not restart" )
@@ -1722,17 +1747,6 @@
         # protocol has had time to work
         main.restartTime = time.time() - killTime
         main.log.debug( "Restart time: " + str( main.restartTime ) )
-        '''
-        # FIXME: revisit test plan for election with madan
-        # Rerun for election on restarted nodes
-        run1 = main.CLIs[0].electionTestRun()
-        run2 = main.CLIs[1].electionTestRun()
-        run3 = main.CLIs[2].electionTestRun()
-        runResults = run1 and run2 and run3
-        utilities.assert_equals( expect=main.TRUE, actual=runResults,
-                                 onpass="Reran for election",
-                                 onfail="Failed to rerun for election" )
-        '''
         # TODO: MAke this configurable. Also, we are breaking the above timer
         time.sleep( 60 )
         main.log.debug( main.CLIs[0].nodes( jsonFormat=False ) )
@@ -2052,11 +2066,12 @@
         main.step( "Leadership Election is still functional" )
         # Test of LeadershipElection
         leaderList = []
-        # FIXME: make sure this matches nodes that were restarted
-        restarted = [ main.nodes[0].ip_address, main.nodes[1].ip_address,
-                      main.nodes[2].ip_address ]
 
+        restarted = []
+        for i in main.kill:
+            restarted.append( main.nodes[i].ip_address )
         leaderResult = main.TRUE
+
         for cli in main.CLIs:
             leaderN = cli.electionTestLeader()
             leaderList.append( leaderN )
@@ -3409,23 +3424,7 @@
                                  onfail="Added counters are incorrect" )
 
         main.step( "Check counters are consistant across nodes" )
-        onosCounters = []
-        threads = []
-        for i in range( main.numCtrls ):
-            t = main.Thread( target=main.CLIs[i].counters,
-                             name="counters-" + str( i ) )
-            threads.append( t )
-            t.start()
-        for t in threads:
-            t.join()
-            onosCounters.append( t.result )
-        tmp = [ i == onosCounters[ 0 ] for i in onosCounters ]
-        if all( tmp ):
-            main.log.info( "Counters are consistent across all nodes" )
-            consistentCounterResults = main.TRUE
-        else:
-            main.log.error( "Counters are not consistent across all nodes" )
-            consistentCounterResults = main.FALSE
+        onosCounters, consistentCounterResults = main.Counters.consistentCheck()
         utilities.assert_equals( expect=main.TRUE,
                                  actual=consistentCounterResults,
                                  onpass="ONOS counters are consistent " +
@@ -3441,7 +3440,6 @@
                                  actual=incrementCheck,
                                  onpass="Added counters are correct",
                                  onfail="Added counters are incorrect" )
-
         # DISTRIBUTED SETS
         main.step( "Distributed Set get" )
         size = len( onosSet )
diff --git a/TestON/tests/HAminorityRestart/README b/TestON/tests/HAminorityRestart/README
new file mode 100644
index 0000000..a913f85
--- /dev/null
+++ b/TestON/tests/HAminorityRestart/README
@@ -0,0 +1,24 @@
+This test is designed to verify that an ONOS cluster behaves correctly when
+ONOS nodes die. Currently, we will kill nodes so that each raft partition will
+lose a member, but we make sure that there is always a majority of nodes
+available in each partition.
+
+As written, the test only supports an ONOS cluster of 3,5, or 7 nodes.
+This is because the test doesn't apply to a single node cluster, ONOS clusters
+should be deployed in odd numbers, and the partition generation and node
+killing scheme used doesn't give the same properties for clusters of more
+than 7 nodes. Namely, each partition won't have exactly one node killed.
+
+The gerneral structure for the test:
+- Startup
+- Assign switches
+- Verify ONOS state and functionality
+    - Device mastership
+    - Intents
+    - Leadership election
+    - Distributed Primitives
+- Kill some ONOS nodes
+- Verify ONOS state and functionality
+- Dataplane failures
+    - link down and up
+    - switch down and up
diff --git a/TestON/tests/HAminorityRestart/dependencies/Counters.py b/TestON/tests/HAminorityRestart/dependencies/Counters.py
index 21308c2..6614887 100644
--- a/TestON/tests/HAminorityRestart/dependencies/Counters.py
+++ b/TestON/tests/HAminorityRestart/dependencies/Counters.py
@@ -1,14 +1,19 @@
 def __init__( self ):
     self.default = ''
 
-def counterCheck( counterName, counterValue ):
+def consistentCheck():
     """
-    Add Text here
+    Checks that TestON counters are consistent across all nodes.
+
+    Returns the tuple (onosCounters, consistent)
+    - onosCounters is the parsed json output of the counters command on all nodes
+    - consistent is main.TRUE if all "TestON" counters are consitent across all
+        nodes or main.FALSE
     """
     import json
     correctResults = main.TRUE
     # Get onos counters results
-    onosCounters = []
+    onosCountersRaw = []
     threads = []
     for i in range( main.numCtrls ):
         t = main.Thread( target=main.CLIs[i].counters,
@@ -17,25 +22,58 @@
         t.start()
     for t in threads:
         t.join()
-        onosCounters.append( t.result )
-    tmp = [ i == onosCounters[ 0 ] for i in onosCounters ]
+        onosCountersRaw.append( t.result )
+    onosCounters = []
+    for i in range( main.numCtrls ):
+        try:
+            onosCounters.append( json.loads( onosCountersRaw[i] ) )
+        except ( ValueError, TypeError ):
+            main.log.error( "Could not parse counters response from ONOS" +
+                            str( i + 1 ) )
+            main.log.warn( repr( onosCountersRaw[ i ] ) )
+            return main.FALSE
+
+    testCounters = {}
+    # make a list of all the "TestON-*" counters in ONOS
+    # lookes like a dict whose keys are the name of the ONOS node and values
+    # are a list of the counters. I.E.
+    # { "ONOS1": [ {"name":"TestON-inMemory","value":56},
+    #              {"name":"TestON-Partitions","value":56} ]
+    # }
+    # NOTE: There is an assumtion that all nodes are active
+    #        based on the above for loops
+    for controller in enumerate( onosCounters ):
+        for dbType in controller[1]:
+            for dbName, items in dbType.iteritems():
+                for item in items:
+                    if 'TestON' in item['name']:
+                        node = 'ONOS' + str( controller[0] + 1 )
+                        try:
+                            testCounters[node].append( item )
+                        except KeyError:
+                            testCounters[node] = [ item ]
+    # compare the counters on each node
+    tmp = [ v == testCounters['ONOS1'] for k, v in testCounters.iteritems() ]
     if all( tmp ):
         consistent = main.TRUE
     else:
         consistent = main.FALSE
-        main.log.error( "ONOS nodes have different values for counters" )
-        for node in onosCounters:
-            main.log.debug( node )
+        main.log.error( "ONOS nodes have different values for counters:\n" +
+                        testCounters )
+    return ( onosCounters, consistent )
 
+def counterCheck( counterName, counterValue ):
+    """
+    Checks that TestON counters are consistent across all nodes and that
+    specified counter is in ONOS with the given value
+    """
+    import json
+    correctResults = main.TRUE
+    # Get onos counters results and consistentCheck
+    onosCounters, consistent = main.Counters.consistentCheck()
     # Check for correct values
     for i in range( main.numCtrls ):
-        try:
-            current = json.loads( onosCounters[i] )
-        except ( ValueError, TypeError ):
-            main.log.error( "Could not parse counters response from ONOS" +
-                            str( i + 1 ) )
-            main.log.warn( repr( onosCounters[ i ] ) )
-            return main.FALSE
+        current = onosCounters[i]
         onosValue = None
         try:
             for database in current:
diff --git a/TestON/tests/HAminorityRestart/dependencies/onos-gen-partitions b/TestON/tests/HAminorityRestart/dependencies/onos-gen-partitions
new file mode 100755
index 0000000..bf9a77b
--- /dev/null
+++ b/TestON/tests/HAminorityRestart/dependencies/onos-gen-partitions
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+'''
+  Generate the partitions json file from the $OC* environment variables
+
+  Usage: onos-gen-partitions [output file]
+  If output file is not provided, the json is written to stdout.
+'''
+
+from os import environ
+from collections import deque, OrderedDict
+import re
+import json
+import sys
+
+convert = lambda text: int(text) if text.isdigit() else text.lower()
+alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
+
+def get_OC_vars():
+  vars = []
+  for var in environ:
+    if re.match(r"OC[0-9]+", var):
+      vars.append(var)
+  return sorted(vars, key=alphanum_key)
+
+def get_nodes(vars, port=9876):
+  node = lambda k: { 'id': k, 'ip': k, 'tcpPort': port }
+  return [ node(environ[v]) for v in vars ]
+
+def generate_permutations(nodes, k):
+  l = deque(nodes)
+  perms = {}
+  for i in range(1, len(nodes)+1):
+    perms['p%d' % i] = list(l)[:k]
+    l.rotate(-1)
+  return OrderedDict(sorted(perms.iteritems(), key=lambda (k, v): alphanum_key(k)))
+
+def generate_permutations2(nodes, k):
+  l = deque(nodes)
+  perms = {}
+  for i in range(1, (len(nodes) + 1) / 2 + 1):
+    perms['p%d' % i] = list(l)[:k]
+    l.rotate(-2)
+  return OrderedDict(sorted(perms.iteritems(), key=lambda (k, v): alphanum_key(k)))
+
+
+if __name__ == '__main__':
+  vars = get_OC_vars()
+  nodes = get_nodes(vars)
+  partitions = generate_permutations2(nodes, 3)
+  data = {
+           'nodes': nodes,
+           'partitions': partitions
+         }
+  output = json.dumps(data, indent=4)
+
+  if len(sys.argv) == 2:
+    filename = sys.argv[1]
+    with open(filename, 'w') as f:
+      f.write(output)
+  else:
+    print output
diff --git a/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py
index 41bad86..ee0b120 100644
--- a/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py
+++ b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py
@@ -65,12 +65,10 @@
     # This case is to setup ONOS
     def CASE101( self, main ):
         """
-           Compile ONOS and install it
+           Package ONOS and install it
            Startup sequence:
            cell <name>
            onos-verify-cell
-           git pull
-           mvn clean install
            onos-package
            onos-install -f
            onos-wait-for-start
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/Functions.py b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/Functions.py
new file mode 100644
index 0000000..8d4007a
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/Functions.py
@@ -0,0 +1,178 @@
+
+def checkRouteNum( main, routeNumExpected, ONOScli = "ONOScli1" ):
+    main.step( "Check routes installed" )
+    main.log.info( "Route number expected:" )
+    main.log.info( routeNumExpected )
+    main.log.info( "Route number from ONOS CLI:" )
+
+    if ONOScli == "ONOScli1":
+        routeNumActual = main.ONOScli1.ipv4RouteNumber()
+    else:
+        routeNumActual = main.ONOScli2.ipv4RouteNumber()
+
+    main.log.info( routeNumActual )
+    utilities.assertEquals( \
+        expect = routeNumExpected, actual = routeNumActual,
+        onpass = "Route number is correct!",
+        onfail = "Route number is wrong!" )
+
+def checkM2SintentNum( main, intentNumExpected, ONOScli = "ONOScli1" ):
+    main.step( "Check M2S intents installed" )
+    main.log.info( "Intent number expected:" )
+    main.log.info( intentNumExpected )
+    main.log.info( "Intent number from ONOS CLI:" )
+    if ONOScli == "ONOScli1":
+        jsonResult = main.ONOScli1.intents( jsonFormat = True, summary = True,
+                                            TYPE = "multiPointToSinglePoint" )
+    else:
+        jsonResult = main.ONOScli2.intents( jsonFormat = True, summary = True,
+                                            TYPE = "multiPointToSinglePoint" )
+    intentNumActual = jsonResult['installed']
+    main.log.info( intentNumActual )
+    utilities.assertEquals( \
+        expect = intentNumExpected, actual = intentNumActual,
+        onpass = "M2S intent number is correct!",
+        onfail = "M2S intent number is wrong!" )
+
+def checkP2PintentNum( main, intentNumExpected, ONOScli = "ONOScli1" ):
+    main.step( "Check P2P intents installed" )
+    main.log.info( "Intent number expected:" )
+    main.log.info( intentNumExpected )
+    main.log.info( "Intent number from ONOS CLI:" )
+    if ONOScli == "ONOScli1":
+        jsonResult = main.ONOScli1.intents( jsonFormat = True, summary = True,
+                                            TYPE = "pointToPoint" )
+    else:
+        jsonResult = main.ONOScli2.intents( jsonFormat = True, summary = True,
+                                            TYPE = "pointToPoint" )
+    intentNumActual = jsonResult['installed']
+    main.log.info( intentNumActual )
+    utilities.assertEquals( \
+        expect = intentNumExpected, actual = intentNumActual,
+        onpass = "P2P intent number is correct!",
+        onfail = "P2P intent number is wrong!" )
+
+def checkFlowNum( main, switch, flowNumExpected ):
+    main.step( "Check flow entry number in " + switch )
+    main.log.info( "Flow number expected:" )
+    main.log.info( flowNumExpected )
+    main.log.info( "Flow number actual:" )
+    flowNumActual = main.Mininet.getSwitchFlowCount( switch )
+    main.log.info( flowNumActual )
+    utilities.assertEquals( \
+        expect = flowNumExpected, actual = flowNumActual,
+        onpass = "Flow number in " + switch + " is correct!",
+        onfail = "Flow number in " + switch + " is wrong!" )
+
+
+def pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True ):
+    """
+    Carry out ping test between each BGP speaker and peer pair
+    Optional argument:
+        * speakers - BGP speakers
+        * peers - BGP peers
+        * expectAllSuccess - boolean indicating if you expect all results
+        succeed if True, otherwise expect all results fail if False
+    """
+    if len( speakers ) == 0:
+        main.log.error( "Parameter speakers can not be empty." )
+        main.cleanup()
+        main.exit()
+    if len( peers ) == 0:
+        main.log.error( "Parameter speakers can not be empty." )
+        main.cleanup()
+        main.exit()
+
+    if expectAllSuccess:
+        main.step( "BGP speakers ping peers, expect all tests to succeed" )
+    else:
+        main.step( "BGP speakers ping peers, expect all tests to fail" )
+
+    result = True
+    if expectAllSuccess:
+        for speaker in speakers:
+            for peer in peers:
+                tmpResult = main.Mininet.pingHost( src = speaker,
+                                                   target = peer )
+                result = result and ( tmpResult == main.TRUE )
+    else:
+        for speaker in speakers:
+            for peer in peers:
+                tmpResult = main.Mininet.pingHost( src = speaker,
+                                                   target = peer )
+
+    utilities.assert_equals( expect = True, actual = result,
+                             onpass = "Ping test results are expected",
+                             onfail = "Ping test results are Not expected" )
+
+    if result == False:
+        main.cleanup()
+        main.exit()
+
+
+def pingHostToHost( main, hosts = ["host64514", "host64515", "host64516"],
+                expectAllSuccess = True ):
+    """
+    Carry out ping test between each BGP host pair
+    Optional argument:
+        * hosts - hosts behind BGP peer routers
+        * expectAllSuccess - boolean indicating if you expect all results
+        succeed if True, otherwise expect all results fail if False
+    """
+    main.step( "Check ping between each host pair" )
+    if len( hosts ) == 0:
+        main.log.error( "Parameter hosts can not be empty." )
+        main.cleanup()
+        main.exit()
+
+    result = True
+    if expectAllSuccess:
+        for srcHost in hosts:
+            for targetHost in hosts:
+                if srcHost != targetHost:
+                    tmpResult = main.Mininet.pingHost( src = srcHost,
+                                                       target = targetHost )
+                    result = result and ( tmpResult == main.TRUE )
+    else:
+        for srcHost in hosts:
+            for targetHost in hosts:
+                if srcHost != targetHost:
+                    tmpResult = main.Mininet.pingHost( src = srcHost,
+                                                       target = targetHost )
+                    result = result and ( tmpResult == main.FALSE )
+
+    utilities.assert_equals( expect = True, actual = result,
+                             onpass = "Ping test results are expected",
+                             onfail = "Ping test results are Not expected" )
+
+    '''
+    if result == False:
+        main.cleanup()
+        main.exit()
+    '''
+
+
+def setupTunnel( main, srcIp, srcPort, dstIp, dstPort ):
+    """
+    Create a tunnel from Mininet host to host outside Mininet
+    """
+    main.step( "Set up tunnel from Mininet node " +
+               str( srcIp ) + ":" + str( srcPort ) + " to ONOS node "
+               + str(dstIp) + ":" + str(dstPort) )
+    forwarding = '%s:%s:%s:%s' % ( srcIp, srcPort, dstIp, dstPort )
+    command = 'ssh -nNT -o "PasswordAuthentication no" \
+        -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding, dstIp )
+
+
+    tunnelResult = main.TRUE
+    tunnelResult = main.Mininet.node( "root", command )
+    utilities.assert_equals( expect = True,
+                             actual = ( "PasswordAuthentication" in tunnelResult ),
+                             onpass = "Created tunnel succeeded",
+                             onfail = "Create tunnel failed" )
+    if ( "PasswordAuthentication" not in tunnelResult ) :
+        main.cleanup()
+        main.exit()
+
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/USECASE_SdnipI2MN_Cluster.py b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/USECASE_SdnipI2MN_Cluster.py
new file mode 100755
index 0000000..f5d0cfd
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/USECASE_SdnipI2MN_Cluster.py
@@ -0,0 +1,422 @@
+#!/usr/bin/python
+
+"""
+Set up the SDN-IP topology as same as it on Internet2
+"""
+
+"""
+AS 64513, (SDN AS)
+AS 64514, reachable by 10.0.4.1, 10.0.14.1
+AS 64515, reachable by 10.0.5.1, 10.0.15.1
+AS 64516, reachable by 10.0.6.1, 10.0.16.1
+"""
+
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+
+import os.path
+import time
+from subprocess import Popen, STDOUT, PIPE
+
+QUAGGA_DIR = '/usr/lib/quagga'
+QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
+QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/'
+numSw = 39
+
+# net = Mininet( controller = RemoteController )
+
+class SDNTopo( Topo ):
+    "SDN Topology"
+
+    def __init__( self, *args, **kwargs ):
+
+        Topo.__init__( self, *args, **kwargs )
+
+        # BGP peer hosts
+        peer64514 = self.addHost( 'peer64514' )
+        peer64515 = self.addHost( 'peer64515' )
+        peer64516 = self.addHost( 'peer64516' )
+
+        '''
+        sw1 = self.addSwitch( 'SEAT', dpid = '00000000000000a1' )
+        sw2 = self.addSwitch( 'PORT', dpid = '00000000000000a2' )
+        sw3 = self.addSwitch( 'SUNN', dpid = '00000000000000a3' )
+        sw4 = self.addSwitch( 'RENO', dpid = '00000000000000a4' )
+        sw5 = self.addSwitch( 'LOSA', dpid = '00000000000000a5' )
+        sw6 = self.addSwitch( 'MISS', dpid = '00000000000000a6' )
+        sw7 = self.addSwitch( 'LASV', dpid = '00000000000000a7' )
+        sw8 = self.addSwitch( 'SALT', dpid = '00000000000000a8' )
+        sw9 = self.addSwitch( 'PHOE', dpid = '00000000000000a9' )
+        sw10 = self.addSwitch( 'TUCS', dpid = '0000000000000a10' )
+        sw11 = self.addSwitch( 'DENV', dpid = '0000000000000a11' )
+        sw12 = self.addSwitch( 'ELPA', dpid = '0000000000000a12' )
+        sw13 = self.addSwitch( 'MINN', dpid = '0000000000000a13' )
+        sw14 = self.addSwitch( 'KANS', dpid = '0000000000000a14' )
+        sw15 = self.addSwitch( 'TULS', dpid = '0000000000000a15' )
+        sw16 = self.addSwitch( 'DALL', dpid = '0000000000000a16' )
+        sw17 = self.addSwitch( 'HOUH', dpid = '0000000000000a17' )
+        sw18 = self.addSwitch( 'COLU', dpid = '0000000000000a18' )
+        sw19 = self.addSwitch( 'JCSN', dpid = '0000000000000a19' )
+        sw20 = self.addSwitch( 'BATO', dpid = '0000000000000a20' )
+        sw21 = self.addSwitch( 'EQCH', dpid = '0000000000000a21' )
+        sw22 = self.addSwitch( 'STAR', dpid = '0000000000000a22' )
+        sw23 = self.addSwitch( 'CHIC', dpid = '0000000000000a23' )
+        sw24 = self.addSwitch( 'INDI', dpid = '0000000000000a24' )
+        sw25 = self.addSwitch( 'CINC', dpid = '0000000000000a25' )
+        sw26 = self.addSwitch( 'LOUI', dpid = '0000000000000a26' )
+        sw27 = self.addSwitch( 'ATLA', dpid = '0000000000000a27' )
+        sw28 = self.addSwitch( 'JACK', dpid = '0000000000000a28' )
+        sw29 = self.addSwitch( 'CLEV', dpid = '0000000000000a29' )
+        sw30 = self.addSwitch( 'PITT', dpid = '0000000000000a30' )
+        sw31 = self.addSwitch( 'ASHB', dpid = '0000000000000a31' )
+        sw32 = self.addSwitch( 'WASH', dpid = '0000000000000a32' )
+        sw33 = self.addSwitch( 'RALE', dpid = '0000000000000a33' )
+        sw34 = self.addSwitch( 'CHAR', dpid = '0000000000000a34' )
+        sw35 = self.addSwitch( 'ALBA', dpid = '0000000000000a35' )
+        sw36 = self.addSwitch( 'BOST', dpid = '0000000000000a36' )
+        sw37 = self.addSwitch( 'HART', dpid = '0000000000000a37' )
+        sw38 = self.addSwitch( 'NEWY', dpid = '0000000000000a38' )
+        sw39 = self.addSwitch( 'PHIL', dpid = '0000000000000a39' )
+        '''
+        sw1 = self.addSwitch( 'sw1', dpid = '00000000000000a1' )
+        sw2 = self.addSwitch( 'sw2', dpid = '00000000000000a2' )
+        sw3 = self.addSwitch( 'sw3', dpid = '00000000000000a3' )
+        sw4 = self.addSwitch( 'sw4', dpid = '00000000000000a4' )
+        sw5 = self.addSwitch( 'sw5', dpid = '00000000000000a5' )
+        sw6 = self.addSwitch( 'sw6', dpid = '00000000000000a6' )
+        sw7 = self.addSwitch( 'sw7', dpid = '00000000000000a7' )
+        sw8 = self.addSwitch( 'sw8', dpid = '00000000000000a8' )
+        sw9 = self.addSwitch( 'sw9', dpid = '00000000000000a9' )
+        sw10 = self.addSwitch( 'sw10', dpid = '0000000000000a10' )
+        sw11 = self.addSwitch( 'sw11', dpid = '0000000000000a11' )
+        sw12 = self.addSwitch( 'sw12', dpid = '0000000000000a12' )
+        sw13 = self.addSwitch( 'sw13', dpid = '0000000000000a13' )
+        sw14 = self.addSwitch( 'sw14', dpid = '0000000000000a14' )
+        sw15 = self.addSwitch( 'sw15', dpid = '0000000000000a15' )
+        sw16 = self.addSwitch( 'sw16', dpid = '0000000000000a16' )
+        sw17 = self.addSwitch( 'sw17', dpid = '0000000000000a17' )
+        sw18 = self.addSwitch( 'sw18', dpid = '0000000000000a18' )
+        sw19 = self.addSwitch( 'sw19', dpid = '0000000000000a19' )
+        sw20 = self.addSwitch( 'sw20', dpid = '0000000000000a20' )
+        sw21 = self.addSwitch( 'sw21', dpid = '0000000000000a21' )
+        sw22 = self.addSwitch( 'sw22', dpid = '0000000000000a22' )
+        sw23 = self.addSwitch( 'sw23', dpid = '0000000000000a23' )
+        sw24 = self.addSwitch( 'sw24', dpid = '0000000000000a24' )
+        sw25 = self.addSwitch( 'sw25', dpid = '0000000000000a25' )
+        sw26 = self.addSwitch( 'sw26', dpid = '0000000000000a26' )
+        sw27 = self.addSwitch( 'sw27', dpid = '0000000000000a27' )
+        sw28 = self.addSwitch( 'sw28', dpid = '0000000000000a28' )
+        sw29 = self.addSwitch( 'sw29', dpid = '0000000000000a29' )
+        sw30 = self.addSwitch( 'sw30', dpid = '0000000000000a30' )
+        sw31 = self.addSwitch( 'sw31', dpid = '0000000000000a31' )
+        sw32 = self.addSwitch( 'sw32', dpid = '0000000000000a32' )
+        sw33 = self.addSwitch( 'sw33', dpid = '0000000000000a33' )
+        sw34 = self.addSwitch( 'sw34', dpid = '0000000000000a34' )
+        sw35 = self.addSwitch( 'sw35', dpid = '0000000000000a35' )
+        sw36 = self.addSwitch( 'sw36', dpid = '0000000000000a36' )
+        sw37 = self.addSwitch( 'sw37', dpid = '0000000000000a37' )
+        sw38 = self.addSwitch( 'sw38', dpid = '0000000000000a38' )
+        sw39 = self.addSwitch( 'sw39', dpid = '0000000000000a39' )
+
+
+        # Add a layer2 switch for control plane connectivity
+        # This switch isn't part of the SDN topology
+        # We'll use the ovs-controller to turn this into a learning switch
+        swCtl100 = self.addSwitch( 'swCtl100', dpid = '0000000000000100' )
+
+
+        # BGP speaker hosts
+        speaker1 = self.addHost( 'speaker1' )
+        speaker2 = self.addHost( 'speaker2' )
+
+        root = self.addHost( 'root', inNamespace = False , ip = '0' )
+
+        # hosts behind each AS
+        host64514 = self.addHost( 'host64514' )
+        host64515 = self.addHost( 'host64515' )
+        host64516 = self.addHost( 'host64516' )
+
+        self.addLink( 'speaker1', sw24 )
+        self.addLink( 'speaker2', sw24 )
+
+        # connect all switches
+        self.addLink( sw1, sw2 )
+        self.addLink( sw1, sw6 )
+        self.addLink( sw1, sw8 )
+        self.addLink( sw2, sw3 )
+        self.addLink( sw3, sw4 )
+        self.addLink( sw3, sw5 )
+        self.addLink( sw4, sw8 )
+        self.addLink( sw5, sw7 )
+        self.addLink( sw5, sw9 )
+        self.addLink( sw6, sw13 )
+        self.addLink( sw7, sw8 )
+        self.addLink( sw8, sw11 )
+        self.addLink( sw9, sw10 )
+        self.addLink( sw10, sw12 )
+        self.addLink( sw11, sw12 )
+        self.addLink( sw11, sw14 )
+        self.addLink( sw12, sw17 )
+        self.addLink( sw13, sw14 )
+        self.addLink( sw13, sw21 )
+        self.addLink( sw14, sw15 )
+        self.addLink( sw14, sw18 )
+        self.addLink( sw14, sw23 )
+        self.addLink( sw15, sw16 )
+        self.addLink( sw16, sw17 )
+        self.addLink( sw17, sw19 )
+        self.addLink( sw17, sw20 )
+        self.addLink( sw18, sw23 )
+        self.addLink( sw19, sw27 )
+        self.addLink( sw20, sw28 )
+        self.addLink( sw21, sw22 )
+        self.addLink( sw21, sw29 )
+        self.addLink( sw22, sw23 )
+        self.addLink( sw23, sw24 )
+        self.addLink( sw23, sw31 )
+        self.addLink( sw24, sw25 )
+        self.addLink( sw25, sw26 )
+        self.addLink( sw26, sw27 )
+        self.addLink( sw27, sw28 )
+        self.addLink( sw27, sw34 )
+        self.addLink( sw29, sw30 )
+        self.addLink( sw29, sw35 )
+        self.addLink( sw30, sw31 )
+        self.addLink( sw31, sw32 )
+        self.addLink( sw32, sw33 )
+        self.addLink( sw32, sw39 )
+        self.addLink( sw33, sw34 )
+        self.addLink( sw35, sw36 )
+        self.addLink( sw36, sw37 )
+        self.addLink( sw37, sw38 )
+        self.addLink( sw38, sw39 )
+
+        # connection between switches and peers
+        self.addLink( peer64514, sw32 )
+        self.addLink( peer64515, sw8 )
+        self.addLink( peer64516, sw28 )
+
+        # connection between BGP peer and hosts behind the BGP peer
+        self.addLink( peer64514, host64514 )
+        self.addLink( peer64515, host64515 )
+        self.addLink( peer64516, host64516 )
+
+        # Internal Connection To Hosts
+        self.addLink( swCtl100, peer64514 )
+        self.addLink( swCtl100, peer64515 )
+        self.addLink( swCtl100, peer64516 )
+        self.addLink( swCtl100, speaker1 )
+        self.addLink( swCtl100, speaker2 )
+
+
+        # add host64514 to control plane for ping test
+        self.addLink( swCtl100, host64514 )
+        self.addLink( swCtl100, root )
+        self.addLink( swCtl100, root )
+        self.addLink( swCtl100, root )
+
+
+def startsshd( host ):
+    "Start sshd on host"
+    info( '*** Starting sshd\n' )
+    name, intf, ip = host.name, host.defaultIntf(), host.IP()
+    banner = '/tmp/%s.banner' % name
+    host.cmd( 'echo "Welcome to %s at %s" >  %s' % ( name, ip, banner ) )
+    host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+    info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+    for h in hosts:
+        startsshd( h )
+
+def stopsshd():
+    "Stop *all* sshd processes with a custom banner"
+    info( '*** Shutting down stale sshd/Banner processes ',
+          quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def startquagga( host, num, config_file ):
+    info( '*** Starting Quagga on %s\n' % host )
+    host.cmd( "cd %s" % QUAGGA_CONFIG_DIR )
+    zebra_cmd = \
+    '%s/zebra -d -f  ./zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid'\
+     % ( QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
+    quagga_cmd = '%s/bgpd -d -f %s -z %s/zserv%s.api -i %s/bgpd%s.pid' \
+    % ( QUAGGA_DIR, config_file, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
+
+    print zebra_cmd
+    print quagga_cmd
+
+    host.cmd( zebra_cmd )
+    host.cmd( quagga_cmd )
+
+'''
+def startQuaggaFromTeston( host, num, config_file ):
+    global net
+    h = net.get( str( host ) )
+    startquagga( h, num, config_file )
+'''
+
+def startquaggahost5( host, num ):
+    info( '*** Starting Quagga on %s\n' % host )
+    zebra_cmd = \
+    '%s/zebra -d -f  ./zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid' \
+    % ( QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
+    quagga_cmd = \
+    '%s/bgpd -d -f ./as4quaggas/quagga%s.conf -z %s/zserv%s.api -i %s/bgpd%s.pid'\
+     % ( QUAGGA_DIR, num, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
+
+    host.cmd( zebra_cmd )
+    host.cmd( quagga_cmd )
+
+
+def stopquagga():
+    quietRun( 'sudo pkill -9 -f bgpd' )
+    quietRun( 'sudo pkill -9 -f zebra' )
+
+def sdn1net():
+    topo = SDNTopo()
+    info( '*** Creating network\n' )
+
+    # global net
+    net = Mininet( topo = topo, controller = RemoteController )
+
+
+    speaker1, speaker2, peer64514, peer64515, peer64516 = \
+    net.get( 'speaker1', 'speaker2' ,
+             'peer64514', 'peer64515', 'peer64516' )
+
+    # Adding addresses to speakers' interface connected to sw24
+    # for BGP peering
+    speaker1.setMAC( '00:00:00:00:00:01', 'speaker1-eth0' )
+    speaker1.cmd( 'ip addr add 10.0.4.101/24 dev speaker1-eth0' )
+    speaker1.cmd( 'ip addr add 10.0.5.101/24 dev speaker1-eth0' )
+    speaker1.cmd( 'ip addr add 10.0.6.101/24 dev speaker1-eth0' )
+
+    speaker1.defaultIntf().setIP( '10.0.4.101/24' )
+    speaker1.defaultIntf().setMAC( '00:00:00:00:00:01' )
+
+    speaker2.setMAC( '00:00:00:00:00:02', 'speaker2-eth0' )
+    speaker2.cmd( 'ip addr add 10.0.14.101/24 dev speaker2-eth0' )
+    speaker2.cmd( 'ip addr add 10.0.15.101/24 dev speaker2-eth0' )
+    speaker2.cmd( 'ip addr add 10.0.16.101/24 dev speaker2-eth0' )
+
+    speaker2.defaultIntf().setIP( '10.0.14.101/24' )
+    speaker2.defaultIntf().setMAC( '00:00:00:00:00:02' )
+
+    # Net has to be start after adding the above link
+    net.start()
+
+    # setup configuration on the interface connected to switch
+    peer64514.cmd( "ifconfig  peer64514-eth0 10.0.4.1 up" )
+    peer64514.cmd( "ip addr add 10.0.14.1/24 dev peer64514-eth0" )
+    peer64514.setMAC( '00:00:00:00:00:04', 'peer64514-eth0' )
+    peer64515.cmd( "ifconfig  peer64515-eth0 10.0.5.1 up" )
+    peer64515.cmd( "ip addr add 10.0.15.1/24 dev peer64515-eth0" )
+    peer64515.setMAC( '00:00:00:00:00:05', 'peer64515-eth0' )
+    peer64516.cmd( "ifconfig  peer64516-eth0 10.0.6.1 up" )
+    peer64516.cmd( "ip addr add 10.0.16.1/24 dev peer64516-eth0" )
+    peer64516.setMAC( '00:00:00:00:00:06', 'peer64516-eth0' )
+
+    # setup configuration on the interface connected to hosts
+    peer64514.setIP( "4.0.0.254", 8, "peer64514-eth1" )
+    peer64514.setMAC( '00:00:00:00:00:44', 'peer64514-eth1' )
+    peer64515.setIP( "5.0.0.254", 8, "peer64515-eth1" )
+    peer64515.setMAC( '00:00:00:00:00:55', 'peer64515-eth1' )
+    peer64516.setIP( "6.0.0.254", 8, "peer64516-eth1" )
+    peer64516.setMAC( '00:00:00:00:00:66', 'peer64516-eth1' )
+
+    # enable forwarding on BGP peer hosts
+    peer64514.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    peer64515.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    peer64516.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+
+    # config interface for control plane connectivity
+    peer64514.setIP( "192.168.0.4", 24, "peer64514-eth2" )
+    peer64515.setIP( "192.168.0.5", 24, "peer64515-eth2" )
+    peer64516.setIP( "192.168.0.6", 24, "peer64516-eth2" )
+
+    # Setup hosts in each non-SDN AS
+    host64514, host64515, host64516 = \
+    net.get( 'host64514', 'host64515', 'host64516' )
+    host64514.cmd( 'ifconfig host64514-eth0 4.0.0.1 up' )
+    host64514.cmd( 'ip route add default via 4.0.0.254' )
+    host64514.setIP( '192.168.0.44', 24, 'host64514-eth1' )  # for control plane
+    host64515.cmd( 'ifconfig host64515-eth0 5.0.0.1 up' )
+    host64515.cmd( 'ip route add default via 5.0.0.254' )
+    host64516.cmd( 'ifconfig host64516-eth0 6.0.0.1 up' )
+    host64516.cmd( 'ip route add default via 6.0.0.254' )
+
+
+    # set up swCtl100 as a learning
+    swCtl100 = net.get( 'swCtl100' )
+    swCtl100.cmd( 'ovs-vsctl set-controller swCtl100 none' )
+    swCtl100.cmd( 'ovs-vsctl set-fail-mode swCtl100 standalone' )
+
+    # connect all switches to controller
+    '''
+    onos1IP = "10.128.4.52"
+    onos2IP = "10.128.4.53"
+    onos3IP = "10.128.4.54"
+    for i in range ( 1, numSw + 1 ):
+        swX = net.get( 'sw%s' % ( i ) )
+        swX.cmd( 'ovs-vsctl set-controller sw%s tcp:%s:6653 tcp:%s:6653 tcp:%s:6653' % ( i, onos1IP, onos2IP, onos3IP) )
+    '''
+
+    # Start Quagga on border routers
+    startquagga( peer64514, 64514, 'quagga64514.conf' )
+    startquagga( peer64515, 64515, 'quagga64515.conf' )
+    startquagga( peer64516, 64516, 'quagga64516.conf' )
+
+    # start Quagga in SDN network
+    startquagga( speaker1, 64513, 'quagga-sdn.conf' )
+    startquagga( speaker2, 64512, 'quagga-sdn-speaker2.conf' )
+
+
+    root = net.get( 'root' )
+    root.intf( 'root-eth0' ).setIP( '1.1.1.2/24' )
+    root.cmd( 'ip addr add 192.168.0.100/24 dev root-eth0' )
+
+    root.intf( 'root-eth1' ).setIP( '1.1.1.4/24' )
+    root.cmd( 'ip addr add 192.168.0.101/24 dev root-eth1' )
+
+    root.intf( 'root-eth2' ).setIP( '1.1.1.6/24' )
+    root.cmd( 'ip addr add 192.168.0.102/24 dev root-eth2' )
+
+    speaker1.intf( 'speaker1-eth1' ).setIP( '1.1.1.1/24' )
+    speaker2.intf( 'speaker2-eth1' ).setIP( '1.1.1.3/24' )
+
+
+    stopsshd()
+
+    hosts = [ peer64514, peer64515, peer64516, host64514];
+    startsshds( hosts )
+
+
+    '''
+    forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', onos1IP )
+    root.cmd( 'ssh -nNT -o "PasswordAuthentication no" \
+    -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, onos1IP ) )
+
+    forwarding2 = '%s:2000:%s:2000' % ( '1.1.1.4', onos2IP )
+    root.cmd( 'ssh -nNT -o "PasswordAuthentication no" \
+    -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding2, onos2IP ) )
+
+    forwarding3 = '%s:2000:%s:2000' % ( '1.1.1.6', onos3IP )
+    root.cmd( 'ssh -nNT -o "PasswordAuthentication no" \
+    -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding3, onos3IP ) )
+    '''
+    CLI( net )
+
+    stopsshd()
+    stopquagga()
+    net.stop()
+
+
+if __name__ == '__main__':
+    setLogLevel( 'debug' )
+    sdn1net()
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga-sdn-speaker2.conf b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga-sdn-speaker2.conf
new file mode 100644
index 0000000..256e7e8
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga-sdn-speaker2.conf
@@ -0,0 +1,49 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+!
+router bgp 64513
+  bgp router-id 10.0.14.101
+  timers bgp 1 3
+  !timers bgp 3 9
+  neighbor 10.0.14.1 remote-as 64514
+  neighbor 10.0.14.1 ebgp-multihop
+  neighbor 10.0.14.1 timers connect 5
+  neighbor 10.0.15.1 remote-as 64515
+  neighbor 10.0.15.1 ebgp-multihop
+  neighbor 10.0.15.1 timers connect 5
+  neighbor 10.0.16.1 remote-as 64516
+  neighbor 10.0.16.1 ebgp-multihop
+  neighbor 10.0.16.1 timers connect 5
+
+  neighbor 1.1.1.2 remote-as 64513
+  neighbor 1.1.1.2 port 2000
+  neighbor 1.1.1.2 timers connect 5
+
+  neighbor 1.1.1.4 remote-as 64513
+  neighbor 1.1.1.4 port 2000
+  neighbor 1.1.1.4 timers connect 5
+
+  neighbor 1.1.1.6 remote-as 64513
+  neighbor 1.1.1.6 port 2000
+  neighbor 1.1.1.6 timers connect 5
+
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga-sdn.conf b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga-sdn.conf
new file mode 100644
index 0000000..3d2a455
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga-sdn.conf
@@ -0,0 +1,49 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+!
+router bgp 64513
+  bgp router-id 10.0.4.101
+  timers bgp 1 3
+  !timers bgp 3 9
+  neighbor 10.0.4.1 remote-as 64514
+  neighbor 10.0.4.1 ebgp-multihop
+  neighbor 10.0.4.1 timers connect 5
+  neighbor 10.0.5.1 remote-as 64515
+  neighbor 10.0.5.1 ebgp-multihop
+  neighbor 10.0.5.1 timers connect 5
+  neighbor 10.0.6.1 remote-as 64516
+  neighbor 10.0.6.1 ebgp-multihop
+  neighbor 10.0.6.1 timers connect 5
+
+  neighbor 1.1.1.2 remote-as 64513
+  neighbor 1.1.1.2 port 2000
+  neighbor 1.1.1.2 timers connect 5
+
+  neighbor 1.1.1.4 remote-as 64513
+  neighbor 1.1.1.4 port 2000
+  neighbor 1.1.1.4 timers connect 5
+
+  neighbor 1.1.1.6 remote-as 64513
+  neighbor 1.1.1.6 port 2000
+  neighbor 1.1.1.6 timers connect 5
+
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64514.conf b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64514.conf
new file mode 100644
index 0000000..cc056dd
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64514.conf
@@ -0,0 +1,29 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+router bgp 64514
+  bgp router-id 10.0.4.1
+!  timers bgp 1 3
+ neighbor 10.0.4.101 remote-as 64513
+ neighbor 10.0.14.101 remote-as 64513
+ network 4.0.0.0/24
+
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
\ No newline at end of file
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64515.conf b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64515.conf
new file mode 100644
index 0000000..7b45d57
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64515.conf
@@ -0,0 +1,29 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+router bgp 64515
+  bgp router-id 10.0.5.1
+!  timers bgp 1 3
+ neighbor 10.0.5.101 remote-as 64513
+ neighbor 10.0.15.101 remote-as 64513
+ network 5.0.0.0/24
+
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64516.conf b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64516.conf
new file mode 100644
index 0000000..20c104e
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/quagga64516.conf
@@ -0,0 +1,32 @@
+! -*- bgp -*-
+!
+! BGPd sample configuratin file
+!
+! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $
+!
+hostname bgpd
+password hello
+!enable password please-set-at-here
+!
+!bgp mulitple-instance
+!
+router bgp 64516
+  bgp router-id 10.0.6.1
+!  timers bgp 1 3
+ neighbor 10.0.6.101 remote-as 64513
+ neighbor 10.0.16.101 remote-as 64513
+ network 6.0.0.0/24
+
+! neighbor 10.0.0.2 route-map set-nexthop out
+! neighbor 10.0.0.2 ebgp-multihop
+! neighbor 10.0.0.2 next-hop-self
+!
+! access-list all permit any
+!
+!route-map set-nexthop permit 10
+! match ip address all
+! set ip next-hop 10.0.0.1
+!
+!log file /usr/local/var/log/quagga/bgpd.log
+!
+log stdout
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/zebra.conf b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/zebra.conf
new file mode 100644
index 0000000..517db94
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/zebra.conf
@@ -0,0 +1,26 @@
+! -*- zebra -*-
+!
+! zebra sample configuration file
+!
+! $Id: zebra.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $
+!
+hostname zebra
+password hello
+enable password 0fw0rk
+log stdout
+!
+! Interfaces description.
+!
+!interface lo
+! description test of desc.
+!
+!interface sit0
+! multicast
+
+!
+! Static default route sample.
+!
+!ip route 0.0.0.0/0 203.181.89.241
+!
+
+!log file /usr/local/var/log/quagga/zebra.log
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params
new file mode 100644
index 0000000..c746f55
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params
@@ -0,0 +1,51 @@
+<PARAMS>
+
+    <testcases>101, 100, 200, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12</testcases>
+    #Environment variables
+    <ENV>
+        <cellName>sdnip_multiple_instance_BM</cellName>
+    </ENV>
+
+    <CTRL>
+        <numCtrl>1</numCtrl>
+        <ip1>OC1</ip1>
+        <ip2>OC2</ip2>
+        <ip3>OC3</ip3>
+        <port1>6653</port1>
+    </CTRL>
+
+    <GIT>
+        <branch1>master</branch1>
+        <branch2>onos-1.3</branch2>
+    </GIT>
+
+    <JSON>
+        <prefix>prefix</prefix>
+        <nextHop>nextHop</nextHop>
+    </JSON>
+
+    <DEPENDENCY>
+        <path>/USECASE_SdnipFunctionCluster/Dependency/</path>
+        <topology>USECASE_SdnipI2MN_Cluster.py</topology>
+        <wrapper1>Functions</wrapper1>
+        <wrapper2>USECASE_SdnipI2MN_Cluster</wrapper2>
+    </DEPENDENCY>
+
+    <config>
+        <peerNum> 3 </peerNum>
+        <switchNum> 39 </switchNum>
+        <peer64514> 10.0.14.1</peer64514>
+        <peer64515> 10.0.15.1</peer64515>
+        <peer64516> 10.0.16.1</peer64516>
+    </config>
+
+    <timers>
+        <SdnIpSetup>10</SdnIpSetup>
+        <TopoDiscovery>10</TopoDiscovery>
+        <PingTestWithRoutes>20</PingTestWithRoutes>
+        <PingTestWithoutRoutes>100</PingTestWithoutRoutes>
+        <RouteDelivery>30</RouteDelivery>
+        <PathAvailable>20</PathAvailable>
+    </timers>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
new file mode 100644
index 0000000..4efd38a
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
@@ -0,0 +1,828 @@
+# Testing the functionality of SDN-IP with single ONOS instance
+class USECASE_SdnipFunctionCluster:
+
+    def __init__( self ):
+        self.default = ''
+        global branchName
+
+    def CASE100( self, main ):
+        """
+            Start mininet
+        """
+        import imp
+        main.log.case( "Setup the Mininet testbed" )
+        main.dependencyPath = main.testDir + \
+                              main.params[ 'DEPENDENCY' ][ 'path' ]
+        main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+
+        main.step( "Starting Mininet Topology" )
+        topology = main.dependencyPath + main.topology
+        topoResult = main.Mininet.startNet( topoFile = topology )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = topoResult,
+                                 onpass = "Successfully loaded topology",
+                                 onfail = "Failed to load topology" )
+        # Exit if topology did not load properly
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+        main.step( "Connect switches to controllers" )
+
+        # connect all switches to controllers
+        swResult = main.TRUE
+        for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
+            sw = "sw%s" % ( i )
+            swResult = swResult and main.Mininet.assignSwController( sw,
+                                                 [ONOS1Ip, ONOS2Ip, ONOS3Ip] )
+
+        utilities.assert_equals( expect = main.TRUE,
+                             actual = swResult,
+                             onpass = "Successfully connect all switches to ONOS",
+                             onfail = "Failed to connect all switches to ONOS" )
+        if not swResult:
+            main.cleanup()
+            main.exit()
+
+
+    def CASE101( self, main ):
+        """
+           Package ONOS and install it
+           Startup sequence:
+           cell <name>
+           onos-verify-cell
+           onos-package
+           onos-install -f
+           onos-wait-for-start
+        """
+        import json
+        import time
+        import os
+        from operator import eq
+
+        main.case( "Setting up ONOS environment" )
+
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        global ONOS1Ip
+        global ONOS2Ip
+        global ONOS3Ip
+        ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
+        ONOS2Ip = os.getenv( main.params[ 'CTRL' ][ 'ip2' ] )
+        ONOS3Ip = os.getenv( main.params[ 'CTRL' ][ 'ip3' ] )
+
+        global peer64514
+        global peer64515
+        global peer64516
+        peer64514 = main.params['config']['peer64514']
+        peer64515 = main.params['config']['peer64515']
+        peer64516 = main.params['config']['peer64516']
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = cellResult,
+                                 onpass = "Set cell succeeded",
+                                 onfail = "Set cell failed" )
+
+        verifyResult = main.ONOSbench.verifyCell()
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = verifyResult,
+                                 onpass = "Verify cell succeeded",
+                                 onfail = "Verify cell failed" )
+
+        branchName = main.ONOSbench.getBranchName()
+        main.log.report( "ONOS is on branch: " + branchName )
+
+        main.log.step( "Uninstalling ONOS" )
+        uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) \
+                          and main.ONOSbench.onosUninstall( ONOS2Ip ) \
+                          and main.ONOSbench.onosUninstall( ONOS3Ip )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = uninstallResult,
+                                 onpass = "Uninstall ONOS from nodes succeeded",
+                                 onfail = "Uninstall ONOS form nodes failed" )
+
+        main.ONOSbench.getVersion( report = True )
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = packageResult,
+                                 onpass = "Package ONOS succeeded",
+                                 onfail = "Package ONOS failed" )
+
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
+                                                         node = ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall( options = "-f",
+                                                         node = ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall( options = "-f",
+                                                         node = ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult \
+                            and onos3InstallResult
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = onosInstallResult,
+                                 onpass = "Install ONOS to nodes succeeded",
+                                 onfail = "Install ONOS to nodes failed" )
+
+        main.step( "Checking if ONOS is up yet" )
+        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
+        onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout = 420 )
+        onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout = 420 )
+        onosUpResult = onos1UpResult and onos2UpResult and onos3UpResult
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = onos1UpResult and onosUpResult,
+                                 onpass = "ONOS nodes are up",
+                                 onfail = "ONOS nodes are NOT up" )
+
+        main.step( "Checking if ONOS CLI is ready" )
+        cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip,
+                commandlineTimeout = 100, onosStartTimeout = 600 )
+        cliResult2 = main.ONOScli2.startOnosCli( ONOS2Ip,
+                commandlineTimeout = 100, onosStartTimeout = 600 )
+        cliResult = cliResult1 and cliResult2
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = cliResult,
+                                 onpass = "ONOS CLI (on node1) is ready",
+                                 onfail = "ONOS CLI (on node1) ready" )
+
+        caseResult = ( cellResult and verifyResult and
+                       packageResult and
+                       onosInstallResult and onosUpResult and cliResult )
+
+        utilities.assert_equals( expect = main.TRUE, actual = caseResult,
+                                 onpass = "ONOS startup successful",
+                                 onfail = "ONOS startup NOT successful" )
+
+        if caseResult == main.FALSE:
+            main.log.error( "ONOS startup failed!" )
+            main.cleanup()
+            main.exit()
+
+
+    def CASE200( self, main ):
+        main.case( "Activate sdn-ip application" )
+        main.log.info( "waiting link discovery......" )
+        time.sleep( int ( main.params['timers']['TopoDiscovery'] ) )
+
+        main.log.info( "Get links in the network" )
+        summaryResult = main.ONOScli1.summary()
+        linkNum = json.loads( summaryResult )[ "links" ]
+        listResult = main.ONOScli1.links( jsonFormat = False )
+        main.log.info( listResult )
+
+        if linkNum < 100:
+            main.log.error( "Link number is wrong!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Activate sdn-ip application" )
+        activeSDNIPresult = main.ONOScli1.activateApp( "org.onosproject.sdnip" )
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = activeSDNIPresult,
+                                 onpass = "Activate SDN-IP succeeded",
+                                 onfail = "Activate SDN-IP failed" )
+        if not activeSDNIPresult:
+            main.cleanup()
+            main.exit()
+
+        # TODO should be deleted in the future after the SDN-IP bug is fixed
+        main.ONOScli1.deactivateApp( "org.onosproject.sdnip" )
+        main.ONOScli1.activateApp( "org.onosproject.sdnip" )
+
+
+    def CASE102( self, main ):
+        '''
+        This test case is to load the methods from other Python files, and create
+        tunnels from mininet host to onos nodes.
+        '''
+        import time
+        main.case( "Load methods from other Python file and create tunnels" )
+        # load the methods from other file
+        wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+        main.Functions = imp.load_source( wrapperFile1,
+                                          main.dependencyPath +
+                                          wrapperFile1 +
+                                          ".py" )
+        # Create tunnels
+        main.Functions.setupTunnel( main, '1.1.1.2', 2000, ONOS1Ip, 2000 )
+        main.Functions.setupTunnel( main, '1.1.1.4', 2000, ONOS2Ip, 2000 )
+        main.Functions.setupTunnel( main, '1.1.1.6', 2000, ONOS3Ip, 2000 )
+
+        main.log.info( "Wait SDN-IP to finish installing connectivity intents \
+        and the BGP paths in data plane are ready..." )
+        time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
+
+        main.log.info( "Wait Quagga to finish delivery all routes to each \
+        other and to sdn-ip, plus finish installing all intents..." )
+        time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+        # TODO
+        # time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
+
+        '''
+        # TODO: use for together with wrapperFile1
+        wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
+        main.USECASE_SdnipI2MN_Cluster = imp.load_source( wrapperFile2,
+                                                         main.dependencyPath +
+                                                         wrapperFile2 +
+                                                         ".py" )
+        '''
+
+
+    def CASE1( self, main ):
+        '''
+        ping test from 3 bgp peers to BGP speaker
+        '''
+
+        main.case( "Ping tests between BGP peers and speakers" )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
+                       peers = [peer64514, peer64515, peer64516],
+                       expectAllSuccess = True )
+
+
+    def CASE2( self, main ):
+        '''
+        point-to-point intents test for each BGP peer and BGP speaker pair
+        '''
+        main.case( "Check point-to-point intents" )
+        main.log.info( "There are %s BGP peers in total "
+                       % main.params[ 'config' ][ 'peerNum' ] )
+        main.step( "Check P2P intents number from ONOS CLI" )
+
+        getIntentsResult = main.ONOScli1.intents( jsonFormat = True )
+        bgpIntentsActualNum = \
+            main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
+        bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 * 2
+        main.log.info( "bgpIntentsExpected num is:" )
+        main.log.info( bgpIntentsExpectedNum )
+        main.log.info( "bgpIntentsActual num is:" )
+        main.log.info( bgpIntentsActualNum )
+        utilities.assertEquals( \
+            expect = True,
+            actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
+            onpass = "PointToPointIntent Intent Num is correct!",
+            onfail = "PointToPointIntent Intent Num is wrong!" )
+
+
+    def CASE3( self, main ):
+        '''
+        routes and intents check to all BGP peers
+        '''
+        main.case( "Check routes and M2S intents to all BGP peers" )
+
+        allRoutesExpected = []
+        allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
+        allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
+        allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
+
+        getRoutesResult = main.ONOScli1.routes( jsonFormat = True )
+        allRoutesActual = \
+            main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
+        allRoutesStrExpected = str( sorted( allRoutesExpected ) )
+        allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
+
+        main.step( "Check routes installed" )
+        main.log.info( "Routes expected:" )
+        main.log.info( allRoutesStrExpected )
+        main.log.info( "Routes get from ONOS CLI:" )
+        main.log.info( allRoutesStrActual )
+        utilities.assertEquals( \
+            expect = allRoutesStrExpected, actual = allRoutesStrActual,
+            onpass = "Routes are correct!",
+            onfail = "Routes are wrong!" )
+
+        main.step( "Check M2S intents installed" )
+        getIntentsResult = main.ONOScli1.intents( jsonFormat = True )
+        routeIntentsActualNum = \
+            main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
+        routeIntentsExpectedNum = 3
+
+        main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
+        main.log.info( routeIntentsExpectedNum )
+        main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
+        main.log.info( routeIntentsActualNum )
+        utilities.assertEquals( \
+            expect = True,
+            actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
+            onpass = "MultiPointToSinglePoint Intent Num is correct!",
+            onfail = "MultiPointToSinglePoint Intent Num is wrong!" )
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+
+    def CASE4( self, main ):
+        '''
+        Ping test in data plane for each route
+        '''
+        main.case( "Ping test for each route, all hosts behind BGP peers" )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE5( self, main ):
+        '''
+        Cut links to peers one by one, check routes/intents
+        '''
+        import time
+        main.case( "Bring down links and check routes/intents" )
+        main.step( "Bring down the link between sw32 and peer64514" )
+        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
+                                         OPTION = "down" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult1,
+                                onpass = "Bring down link succeeded!",
+                                onfail = "Bring down link failed!" )
+
+        if linkResult1 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+        else:
+            main.log.error( "Bring down link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Bring down the link between sw8 and peer64515" )
+        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
+                                         OPTION = "down" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult2,
+                                onpass = "Bring down link succeeded!",
+                                onfail = "Bring down link failed!" )
+        if linkResult2 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 1 )
+            main.Functions.checkM2SintentNum( main, 1 )
+        else:
+            main.log.error( "Bring down link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Bring down the link between sw28 and peer64516" )
+        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
+                                         OPTION = "down" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult3,
+                                onpass = "Bring down link succeeded!",
+                                onfail = "Bring down link failed!" )
+        if linkResult3 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 0 )
+            main.Functions.checkM2SintentNum( main, 0 )
+        else:
+            main.log.error( "Bring down link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = False )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = False )
+
+
+    def CASE6( self, main ):
+        '''
+        Recover links to peers one by one, check routes/intents
+        '''
+        import time
+        main.case( "Bring up links and check routes/intents" )
+        main.step( "Bring up the link between sw32 and peer64514" )
+        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
+                                         OPTION = "up" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult1,
+                                onpass = "Bring up link succeeded!",
+                                onfail = "Bring up link failed!" )
+        if linkResult1 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 1 )
+            main.Functions.checkM2SintentNum( main, 1 )
+        else:
+            main.log.error( "Bring up link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Bring up the link between sw8 and peer64515" )
+        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
+                                         OPTION = "up" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult2,
+                                onpass = "Bring up link succeeded!",
+                                onfail = "Bring up link failed!" )
+        if linkResult2 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+        else:
+            main.log.error( "Bring up link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Bring up the link between sw28 and peer64516" )
+        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
+                                         OPTION = "up" )
+        utilities.assertEquals( expect = main.TRUE,
+                                actual = linkResult3,
+                                onpass = "Bring up link succeeded!",
+                                onfail = "Bring up link failed!" )
+        if linkResult3 == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+        else:
+            main.log.error( "Bring up link failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE7( self, main ):
+        '''
+        Shut down a edge switch, check P-2-P and M-2-S intents, ping test
+        '''
+        import time
+        main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
+        main.step( "Stop sw32" )
+        result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
+        utilities.assertEquals( expect = main.TRUE, actual = result,
+                                onpass = "Stopping switch succeeded!",
+                                onfail = "Stopping switch failed!" )
+
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+            main.Functions.checkP2PintentNum( main, 12 * 2 )
+        else:
+            main.log.error( "Stopping switch failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check ping between hosts behind BGP peers" )
+        result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" )
+        result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" )
+        result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" )
+
+        pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
+                      and ( result3 == main.FALSE )
+        utilities.assert_equals( expect = True, actual = pingResult1,
+                                 onpass = "Ping test result is correct",
+                                 onfail = "Ping test result is wrong" )
+
+        if pingResult1 == False:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check ping between BGP peers and speaker1" )
+        result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
+        result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
+        result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
+
+        pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
+                      and ( result6 == main.TRUE )
+        utilities.assert_equals( expect = True, actual = pingResult2,
+                                 onpass = "Speaker1 ping peers successful",
+                                 onfail = "Speaker1 ping peers NOT successful" )
+
+        if pingResult2 == False:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check ping between BGP peers and speaker2" )
+        # TODO
+        result7 = main.Mininet.pingHost( src = "speaker2", target = peer64514 )
+        result8 = main.Mininet.pingHost( src = "speaker2", target = peer64515 )
+        result9 = main.Mininet.pingHost( src = "speaker2", target = peer64516 )
+
+        pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \
+                                                and ( result9 == main.TRUE )
+        utilities.assert_equals( expect = True, actual = pingResult2,
+                                 onpass = "Speaker2 ping peers successful",
+                                 onfail = "Speaker2 ping peers NOT successful" )
+
+        if pingResult3 == False:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+
+    def CASE8( self, main ):
+        '''
+        Bring up the edge switch (sw32) which was shut down in CASE7,
+        check P-2-P and M-2-S intents, ping test
+        '''
+        import time
+        main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
+        main.step( "Start sw32" )
+        result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = result1,
+            onpass = "Starting switch succeeded!",
+            onfail = "Starting switch failed!" )
+
+        result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = result2,
+            onpass = "Connect switch to ONOS succeeded!",
+            onfail = "Connect switch to ONOS failed!" )
+
+        if result1 and result2:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 * 2 )
+        else:
+            main.log.error( "Starting switch failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
+                       peers = [peer64514, peer64515, peer64516],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE9( self, main ):
+        '''
+        Bring down a switch in best path, check:
+        route number, P2P intent number, M2S intent number, ping test
+        '''
+        main.case( "Stop sw11 located in best path, \
+        check route number, P2P intent number, M2S intent number, ping test" )
+
+        main.log.info( "Check the flow number correctness before stopping sw11" )
+        main.Functions.checkFlowNum( main, "sw11", 19 )
+        main.Functions.checkFlowNum( main, "sw1", 3 )
+        main.Functions.checkFlowNum( main, "sw7", 3 )
+        main.log.info( main.Mininet.checkFlows( "sw11" ) )
+        main.log.info( main.Mininet.checkFlows( "sw1" ) )
+        main.log.info( main.Mininet.checkFlows( "sw7" ) )
+
+        main.step( "Stop sw11" )
+        result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
+        utilities.assertEquals( expect = main.TRUE, actual = result,
+                                onpass = "Stopping switch succeeded!",
+                                onfail = "Stopping switch failed!" )
+        if result:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 * 2 )
+        else:
+            main.log.error( "Stopping switch failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
+                       peers = [peer64514, peer64515, peer64516],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE10( self, main ):
+        '''
+        Bring up the switch which was stopped in CASE9, check:
+        route number, P2P intent number, M2S intent number, ping test
+        '''
+        main.case( "Start sw11 which was stopped in CASE9, \
+        check route number, P2P intent number, M2S intent number, ping test" )
+
+        main.log.info( "Check the flow status before starting sw11" )
+        main.Functions.checkFlowNum( main, "sw1", 17 )
+        main.Functions.checkFlowNum( main, "sw7", 5 )
+        main.log.info( main.Mininet.checkFlows( "sw1" ) )
+        main.log.info( main.Mininet.checkFlows( "sw7" ) )
+
+        main.step( "Start sw11" )
+        result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" )
+        utilities.assertEquals( expect = main.TRUE, actual = result1,
+                                onpass = "Starting switch succeeded!",
+                                onfail = "Starting switch failed!" )
+        result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip )
+        utilities.assertEquals( expect = main.TRUE, actual = result2,
+                                onpass = "Connect switch to ONOS succeeded!",
+                                onfail = "Connect switch to ONOS failed!" )
+        if result1 and result2:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 * 2 )
+
+            main.log.debug( main.Mininet.checkFlows( "sw11" ) )
+            main.log.debug( main.Mininet.checkFlows( "sw1" ) )
+            main.log.debug( main.Mininet.checkFlows( "sw7" ) )
+        else:
+            main.log.error( "Starting switch failed!" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
+                       peers = [peer64514, peer64515, peer64516],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE11(self, main):
+        import time
+        main.case( "Kill speaker1, check:\
+        route number, P2P intent number, M2S intent number, ping test" )
+        main.log.info( "Check network status before killing speaker1" )
+        main.Functions.checkRouteNum( main, 3 )
+        main.Functions.checkM2SintentNum( main, 3 )
+        main.Functions.checkP2PintentNum( main, 18 * 2 )
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
+                       peers = [peer64514, peer64515, peer64516],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+        main.step( "Kill speaker1" )
+        result = main.TRUE
+        command = "sudo kill -9 `ps -ef | grep quagga-sdn.conf | grep -v grep | awk '{print $2}'`"
+        result = main.Mininet.node( "root", command )
+        utilities.assert_equals( expect = True,
+                                 actual = ( "quagga-sdn.conf" in result ),
+                                 onpass = "Kill speaker1 succeeded",
+                                 onfail = "Kill speaker1 failed" )
+        if ( "quagga-sdn.conf" not in result ) :
+            main.cleanup()
+            main.exit()
+
+        time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+        main.Functions.checkRouteNum( main, 3 )
+        main.Functions.checkM2SintentNum( main, 3 )
+        main.Functions.checkP2PintentNum( main, 18 * 2 )
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "Flow status is correct!",
+            onfail = "Flow status is wrong!" )
+
+        '''
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = False )
+        '''
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
+                       peers = [peer64514, peer64515, peer64516],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE12( self, main ):
+        import time
+        import json
+        main.case( "Bring down leader ONOS node, check: \
+        route number, P2P intent number, M2S intent number, ping test" )
+        main.step( "Find out ONOS leader node" )
+        result = main.ONOScli1.leaders()
+        jsonResult = json.loads( result )
+        leaderIP = ""
+        for entry in jsonResult:
+            if entry["topic"] == "org.onosproject.sdnip":
+                leaderIP = entry["leader"]
+                main.log.info( "leaderIP is: " )
+                main.log.info( leaderIP )
+
+        main.step( "Uninstall ONOS/SDN-IP leader node" )
+        if leaderIP == ONOS1Ip:
+            uninstallResult = main.ONOSbench.onosStop( ONOS1Ip )
+        elif leaderIP == ONOS2Ip:
+            uninstallResult = main.ONOSbench.onosStop( ONOS2Ip )
+        else:
+            uninstallResult = main.ONOSbench.onosStop( ONOS3Ip )
+
+        utilities.assert_equals( expect = main.TRUE,
+                                 actual = uninstallResult,
+                                 onpass = "Uninstall ONOS leader succeeded",
+                                 onfail = "Uninstall ONOS leader failed" )
+        if uninstallResult != main.TRUE:
+            main.cleanup()
+            main.exit()
+        time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+
+        if leaderIP == ONOS1Ip:
+            main.Functions.checkRouteNum( main, 3, ONOScli = "ONOScli2" )
+            main.Functions.checkM2SintentNum( main, 3, ONOScli = "ONOScli2" )
+            main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli = "ONOScli2" )
+
+            main.step( "Check whether all flow status are ADDED" )
+            utilities.assertEquals( \
+                expect = main.TRUE,
+                actual = main.ONOScli2.checkFlowsState( isPENDING_ADD = False ),
+                onpass = "Flow status is correct!",
+                onfail = "Flow status is wrong!" )
+        else:
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 * 2 )
+
+            main.step( "Check whether all flow status are ADDED" )
+            utilities.assertEquals( \
+                expect = main.TRUE,
+                actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
+                onpass = "Flow status is correct!",
+                onfail = "Flow status is wrong!" )
+
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
+                       peers = [peer64514, peer64515, peer64516],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.topo b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.topo
new file mode 100644
index 0000000..f3c9b5f
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.topo
@@ -0,0 +1,52 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+        <ONOScli2>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+        <QuaggaCliSpeaker1>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>QuaggaCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </QuaggaCliSpeaker1>
+
+        <Mininet>
+            <host>OCN</host>
+            <user>admin</user>
+            <password></password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+                <home>~/Mininet/mininet/custom/</home>
+            </COMPONENTS>
+        </Mininet>
+
+    </COMPONENT>
+</TOPOLOGY>
+
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/__init__.py b/TestON/tests/USECASE_SdnipFunctionCluster/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/__init__.py
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/network-cfg.json b/TestON/tests/USECASE_SdnipFunctionCluster/network-cfg.json
new file mode 100644
index 0000000..602a72f
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/network-cfg.json
@@ -0,0 +1,66 @@
+{
+    "ports" : {
+        "of:00000000000000a8/5" : {
+            "interfaces" : [
+                {
+                    "ips"  : [ "10.0.5.101/24" ],
+                    "mac"  : "00:00:00:00:00:01"
+                },
+                {
+                    "ips"  : [ "10.0.15.101/24" ],
+                    "mac"  : "00:00:00:00:00:02"
+                }
+            ]
+        },
+        "of:0000000000000a32/4" : {
+            "interfaces" : [
+                {
+                    "ips"  : [ "10.0.4.101/24" ],
+                    "mac"  : "00:00:00:00:00:01"
+                },
+                {
+                    "ips"  : [ "10.0.14.101/24" ],
+                    "mac"  : "00:00:00:00:00:02"
+                }
+            ]
+        },
+        "of:0000000000000a28/3" : {
+            "interfaces" : [
+                {
+                    "ips"  : [ "10.0.6.101/24" ],
+                    "mac"  : "00:00:00:00:00:01"
+                },
+                {
+                    "ips"  : [ "10.0.16.101/24" ],
+                    "mac"  : "00:00:00:00:00:02"
+                }
+            ]
+        }
+    },
+    "apps" : {
+        "org.onosproject.router" : {
+            "bgp" : {
+                "bgpSpeakers" : [
+                    {
+                        "name" : "speaker1",
+                        "connectPoint" : "of:0000000000000a24/1",
+                        "peers" : [
+                            "10.0.4.1",
+                            "10.0.5.1",
+                            "10.0.6.1"
+                        ]
+                    },
+                    {
+                        "name" : "speaker2",
+                        "connectPoint" : "of:0000000000000a24/2",
+                        "peers" : [
+                            "10.0.14.1",
+                            "10.0.15.1",
+                            "10.0.16.1"
+                        ]
+                    }
+                ]
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/sdnip_multiple_instance b/TestON/tests/USECASE_SdnipFunctionCluster/sdnip_multiple_instance
new file mode 100644
index 0000000..ed0c7d7
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/sdnip_multiple_instance
@@ -0,0 +1,14 @@
+export ONOS_CELL="sdnip_multiple_instance"
+
+export ONOS_INSTALL_DIR="/opt/onos"
+export ONOS_NIC=10.128.4.*
+export OC1="10.128.4.52"
+export OC2="10.128.4.53"
+export OC3="10.128.4.54"
+export OCN="127.0.0.1"
+export OCI="${OC1}"
+export ONOS_USER="sdn"                  # ONOS user on remote system
+export ONOS_PWD="rocks"
+
+export ONOS_APPS="drivers,openflow,proxyarp"
+
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/sdnip_multiple_instance_BM b/TestON/tests/USECASE_SdnipFunctionCluster/sdnip_multiple_instance_BM
new file mode 100644
index 0000000..1053083
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/sdnip_multiple_instance_BM
@@ -0,0 +1,14 @@
+export ONOS_CELL="sdnip_multiple_instance_BM"
+
+export ONOS_INSTALL_DIR="/opt/onos"
+export ONOS_NIC=10.254.1.*
+export OC1="10.254.1.201"
+export OC2="10.254.1.202"
+export OC3="10.254.1.203"
+export OCN="127.0.0.1"
+export OCI="${OC1}"
+export ONOS_USER="sdn"                  # ONOS user on remote system
+export ONOS_PWD="rocks"
+
+export ONOS_APPS="drivers,openflow,proxyarp"
+