Merge "Add error handling when sendline() returns None"
diff --git a/DELTA/README.md b/DELTA/README.md
new file mode 100644
index 0000000..8a7cc5d
--- /dev/null
+++ b/DELTA/README.md
@@ -0,0 +1,15 @@
+The scripts in this directory automates DELTA security tests against ONOS.
+
+run-DELTA.sh automates DELTA tests (All-In-One Single Machine mode). It installs DELTA and all dependencies; brings up VMs and configures the network; triggers tests using a python script (run-DELTA.py); cleans up the environment after tests are done.
+Usage of run-DELTA.sh:
+-h        show help message
+-d        initialize DELTA repo, build and configure DELTA
+-v        destroy and reinstall vagrant VMs
+-o <name> specify name of ONOS nightly build file
+-p <path> specify path of DELTA
+
+run-DELTA.py uses pexpect to talk to DELTA manager and triggers all CONTROL_PLANE_OF and ADVANCED test cases. It also reads the DELTA log and prints the results for each test case. run-DELTA.py can take one argument for specifying DELTA directory.
+
+Note: run-DELTA.sh and run-DELTA.py should be put into the same folder.
+
+For more information of DELTA, please go to https://github.com/OpenNetworkingFoundation/delta
diff --git a/DELTA/run-DELTA.py b/DELTA/run-DELTA.py
new file mode 100755
index 0000000..1bfd7a3
--- /dev/null
+++ b/DELTA/run-DELTA.py
@@ -0,0 +1,116 @@
+#!/usr/bin/python
+'''
+This script uses pexpect to talk to DELTA manager and triggers all CONTROL_PLANE_OF and
+ADVANCED test cases. It also reads the DELTA log and prints the results for each case
+'''
+
+import sys
+import pexpect
+import time
+import datetime
+
+DELTA_DIR = '/home/sdn/DELTA'
+DELTA_LOG = 'delta.log'
+RESULT_FILE = 'summary.txt'
+LOG_CHECK_INTERVAL = 10
+# TODO: get attack codes from DELTA CLI
+CODES = ['2.1.010','2.1.020','2.1.030','2.1.040','2.1.050','2.1.060','2.1.070','2.1.071','2.1.072','2.1.073','2.1.080','3.1.010','3.1.020','3.1.030','3.1.040','3.1.050','3.1.060','3.1.070','3.1.080','3.1.090','3.1.100','3.1.110','3.1.120','3.1.130','3.1.140','3.1.150','3.1.160','3.1.170','3.1.180','3.1.190','3.1.200']
+CODE_TO_SKIP = ['3.1.090','3.1.160']
+# Timeout for each test case
+TIMEOUT = 1800
+
+def triggerTest( handle, code ):
+    testAvailable = True
+    print datetime.datetime.now(), "Starting test", code
+    # TODO: expect Exceptions thrown by DELTA
+    i = handle.expect( ['Command>', pexpect.EOF, pexpect.TIMEOUT], 60 )
+    if i != 0:
+        print "pexpect EOF or TIMEOUT, exiting..."
+        return -1
+    time.sleep(0.5)
+
+    handle.sendline( 'k' )
+    i = handle.expect( ['Select the attack code>', pexpect.EOF, pexpect.TIMEOUT], 60 )
+    if i != 0:
+        print "pexpect EOF or TIMEOUT, exiting..."
+        return -1
+    time.sleep(0.5)
+
+    handle.sendline( code )
+    i = handle.expect( ['not available', 'Press ENTER key to continue..', pexpect.EOF, pexpect.TIMEOUT], 60 )
+    if i == 0:
+        testAvailable = False
+    elif i == 1:
+        testAvailable = True
+    else:
+        print "pexpect EOF or TIMEOUT, exiting..."
+        return -1
+    time.sleep(0.5)
+
+    handle.sendline( '' )
+    if not testAvailable:
+        print "Test", code, "is not available"
+        return 0
+
+    return 1
+
+def waitForTest( code ):
+    startTime = time.time()
+    while True:
+        if time.time() - startTime > TIMEOUT:
+            print "Test timeout, exiting..."
+            return -1
+        time.sleep( LOG_CHECK_INTERVAL )
+        log = open( DELTA_LOG ).read()
+        log = log.split( code )
+        if len( log ) == 1:
+            pass
+        elif "done" in log[-1]:
+            try:
+                testName = log[1].split( ' - ' )[1]
+            except IndexError:
+                print "Error getting test name"
+                testName = "Unknown Test Name"
+            result = "UNKNOWN"
+            if "FAIL" in log[-1]:
+                result = "FAIL"
+            elif "PASS" in log[-1]:
+                result = "PASS"
+            print datetime.datetime.now(), "Test result:", result, "Time taken:", time.time() - startTime, "seconds"
+            resultFile = open( RESULT_FILE, 'a' )
+            resultFile.write( code + " " + testName + ": " + result + "\n" )
+            resultFile.close()
+            return 1
+        else:
+            pass
+
+def runTests():
+    resultFile = open( RESULT_FILE, 'w' )
+    resultFile.write( "Test started on " + str(datetime.datetime.now())+"\n" )
+    resultFile.close()
+    handle=pexpect.spawn( 'java -jar ' + DELTA_DIR + '/manager/target/delta-manager-1.0-SNAPSHOT-jar-with-dependencies.jar ' + DELTA_DIR + '/tools/config/manager.cfg' )
+    for code in CODES:
+        # Skip some broken cases
+        if code in CODE_TO_SKIP:
+            continue
+        triggerResult = triggerTest( handle, code )
+        # pexpect failures
+        if triggerResult == -1:
+            return
+        # Test not available
+        elif triggerResult == 0:
+            continue
+        testResult = waitForTest( code )
+        # Test timed out
+        if testResult == -1:
+            break
+    # Exit DELTA
+    print "All tests done, exiting DELTA"
+    i = handle.expect( ['Command>', pexpect.EOF, pexpect.TIMEOUT], 60 )
+    handle.sendline( 'q' )
+
+if __name__ == '__main__':
+    if len( sys.argv ) >= 2:
+        DELTA_DIR = sys.argv[1]
+    print 'DELTA directory is', DELTA_DIR
+    runTests()
diff --git a/DELTA/run-DELTA.sh b/DELTA/run-DELTA.sh
new file mode 100755
index 0000000..c1f3aab
--- /dev/null
+++ b/DELTA/run-DELTA.sh
@@ -0,0 +1,157 @@
+#!/bin/bash
+# This script automates DELTA tests (All-In-One Single Machine mode). It
+# installs DELTA and all dependencies; brings up VMs and configures the
+# network; triggers tests using a python script (run-DELTA.py); cleans
+# up the environment after tests are done.
+# Note: run-DELTA.py and this script should be put in the same folder
+
+set -e
+
+DELTA_PATH=/home/sdn
+
+# Install DELTA and dependencies
+function init_delta() {
+    echo "*** Initialize DELTA ***"
+    if [ ! -d "$DELTA_DIR" ]
+    then
+        echo "Downloading DELTA..."
+        (cd $DELTA_PATH && git clone https://github.com/OpenNetworkingFoundation/DELTA.git)
+        cd $DELTA_DIR
+        echo "Installing DELTA dependencies..."
+        ./tools/dev/delta-setup/delta-setup-devenv-ubuntu
+        echo "Building DELTA..."
+        source ./tools/dev/delta-setup/bash_profile
+        mvn clean install
+        echo "Installing virtualbox and vagrant..."
+        ./tools/dev/delta-setup/delta-setup-vms-ubuntu
+        # TODO: change ./tools/config/manager.cfg
+        cd -
+    fi
+}
+
+# Bring up VMs and config network
+function setup_vm() {
+    echo "*** Setting up VMs ***"
+    echo "Bringing up VMs..."
+    cd $DELTA_DIR"/tools/dev/vagrant/"
+    vagrant up >/dev/null 2>&1
+    echo "Checking if all VMs are up..."
+    vagrant status | grep controller | grep running
+    vagrant status | grep channel | grep running
+    vagrant status | grep mininet | grep running
+    echo "Setting up NAT network..."
+    VBoxManage natnetwork add --netname NatNetwork --network 10.0.2.0/24 --enable --dhcp on
+    VBoxManage controlvm $(VBoxManage list vms | grep mininet | awk '{print $1}' | sed 's/"//g') nic1 natnetwork NatNetwork
+    VBoxManage controlvm $(VBoxManage list vms | grep mininet | awk '{print $1}' | sed 's/"//g') nicpromisc1 allow-all
+    source ../delta-setup/bash_profile
+    if [[ $INIT_VM -eq 1 ]]
+    then
+        INIT_VM=0
+        echo "Setting up passwordless login..."
+        for vm in $DELTA_APP $DELTA_CHANNEL $DELTA_HOST
+        do
+            IFS=@ read name ip <<< $vm
+            ssh-keygen -f "$HOME/.ssh/known_hosts" -R $ip
+            cat ~/.ssh/id_rsa.pub | sshpass -p "vagrant" ssh -o StrictHostKeyChecking=no $vm 'cat >> .ssh/authorized_keys'
+        done
+        echo "Setting up DELTA_APP VM..."
+        ssh $DELTA_APP "sudo echo 'export JAVA_HOME=/usr/lib/jvm/java-8-oracle' | sudo tee --append /etc/environment;\
+                        sudo echo 'export ONOS_APPS=drivers,openflow,proxyarp,mobility,fwd' | sudo tee --append /etc/environment"
+        echo "Copying files to VMs..."
+        ../onos-setup/onos-1.6.0-scp
+        ../delta-setup/delta-agents-scp
+    fi
+    echo "Setting up ONOS..."
+    ssh $DELTA_APP "echo 'Downloading ONOS nightly build...';\
+                    set -e;\
+                    wget -c http://downloads.onosproject.org/nightly/$NIGHTLY_FILE_NAME.tar.gz >/dev/null 2>&1;\
+                    tar xzf $NIGHTLY_FILE_NAME.tar.gz;\
+                    rm $NIGHTLY_FILE_NAME.tar.gz;\
+                    if [ -d onos ]; then rm -r onos; fi;\
+                    mv onos-*-SNAPSHOT onos;\
+                    cp delta-agent-app-onos-1.6-1.0-SNAPSHOT.jar onos/apache-karaf-*/deploy/"
+    cd -
+}
+
+# Run DELTA tests
+function run_test() {
+    echo "*** Run tests ***"
+    cd $DELTA_DIR
+    source ./tools/dev/delta-setup/bash_profile
+    cd -
+    ./run-DELTA.py $DELTA_DIR
+}
+
+# Clean up
+function teardown_vm() {
+    echo "*** Tearing down VMs ***"
+    echo "Killing DELTA..."
+    sudo kill -9 $(ps -ef | grep delta-manager | grep -v grep | awk '{print $2}')
+    echo "Deleting NAT network..."
+    VBoxManage controlvm $(VBoxManage list vms | grep mininet | awk '{print $1}' | sed 's/"//g') nic1 nat || echo "nic1 of mininet VM not reset"
+    VBoxManage natnetwork remove --netname NatNetwork || echo "NAT network not removed"
+    echo "Bringing down VMs..."
+    cd $DELTA_DIR"/tools/dev/vagrant/"
+    if [[ $INIT_VM -eq 1 ]]
+    then
+        vagrant destroy -f
+        echo "Checking if all VMs are gone..."
+        vagrant status | grep controller | grep "not created"
+        vagrant status | grep channel | grep "not created"
+        vagrant status | grep mininet | grep "not created"
+    else
+        vagrant halt
+        echo "Checking if all VMs are down..."
+        vagrant status | grep controller | grep poweroff
+        vagrant status | grep channel | grep poweroff
+        vagrant status | grep mininet | grep poweroff
+    fi
+    cd -
+}
+
+INIT_DELTA=0
+INIT_VM=0
+NIGHTLY_FILE_NAME="onos-1.10.0.20170223-NIGHTLY"
+
+while getopts "hdvo:p:" opt; do
+    case ${opt} in
+        h )
+            echo "Usage:"
+            echo "-h        show this help message"
+            echo "-d        initialize DELTA repo, build and configure DELTA"
+            echo "-v        destroy and reinstall vagrant VMs"
+            echo "-o <name> specify name of ONOS nightly build file"
+            echo "-p <path> specify path of DELTA"
+            exit 0
+        ;;
+        d ) INIT_DELTA=1
+        ;;
+        v ) INIT_VM=1
+        ;;
+        o ) NIGHTLY_FILE_NAME=$OPTARG
+        ;;
+        p ) DELTA_PATH=$OPTARG
+        ;;
+        \? ) echo "Invalid option: -$OPTARG"
+            exit 1
+            ;;
+    esac
+done
+
+DELTA_DIR=$DELTA_PATH"/DELTA"
+
+teardown_vm
+
+if [[ $INIT_DELTA -eq 1 ]]
+then
+    init_delta
+fi
+
+setup_vm
+
+run_test
+
+teardown_vm
+
+echo "Done"
+exit 0
diff --git a/TestON/bin/copy-key-to-cells.sh b/TestON/bin/copy-key-to-cells.sh
new file mode 100755
index 0000000..d6555eb
--- /dev/null
+++ b/TestON/bin/copy-key-to-cells.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# ------------------------------------------------------------------------
+# This script is a workaround for the key collision issue when loging into
+# onos cli from both test-station and onos cells with identical user names.
+# It copies both private and public keys of localhost (test-station) to
+# all remote hosts specified in your cell.
+# It also backs up the original keys of the remote hosts before
+# overwriting them.
+# Setting up passwordless login is recommended before running the script.
+# ------------------------------------------------------------------------
+
+ADDRESSES=()
+# Check if OC1 to OC7 exist
+for i in $(seq 1 7); do
+    if [ -n "$OC$i" ]; then
+        TEMP=OC$i
+        ADDRESSES+=(${!TEMP})
+    fi
+done
+
+# Check if OCN exists
+[ -n "$OCN" ] && ADDRESSES+=($OCN)
+
+# Copy keys to remote hosts
+for address in "${ADDRESSES[@]}"; do
+    echo "Backing up remote keys on" $address
+    ssh sdn@$address "cd ~/.ssh; \
+    cp id_rsa id_rsa.old; \
+    cp id_rsa.pub id_rsa.pub.old; "
+
+    echo "Copying keys to" $address
+    scp ~/.ssh/id_rsa sdn@$address:~/.ssh/
+    scp ~/.ssh/id_rsa.pub sdn@$address:~/.ssh/
+done
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 15e1e88..d5c1114 100755
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -474,6 +474,7 @@
                         ethSrc="",
                         ethDst="",
                         bandwidth="",
+                        protected=False,
                         lambdaAlloc=False,
                         ipProto="",
                         ipSrc="",
@@ -543,6 +544,9 @@
                                              "types": [ "OPTICAL" ],
                                              "inclusive": "false" } ] }
 
+            # if protected:
+            #     intentJson['constraints'].append( { "type": "Protection", "types": ["Protection"], "inclusive": "true" } )
+
             if ethType == "IPV4":
                 intentJson[ 'selector' ][ 'criteria' ].append( {
                                                          "type":"ETH_TYPE",
@@ -1333,6 +1337,7 @@
                  udpSrc="",
                  mpls="",
                  priority=100,
+                 groupId="",
                  ip="DEFAULT",
                  port="DEFAULT",
                  debug=False ):
@@ -1371,6 +1376,12 @@
                            "selector": {"criteria":[]}}
             if appId:
                 flowJson[ "appId" ] = appId
+
+            if groupId:
+                flowJson[ 'treatment' ][ 'instructions' ].append( {
+                                                        "type":"GROUP",
+                                                        "groupId":groupId } )
+
             if egressPort:
                 flowJson[ 'treatment' ][ 'instructions' ].append( {
                                                         "type":"OUTPUT",
@@ -1985,3 +1996,180 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
             main.exit()
+
+    def addGroup( self, deviceId, groupType, bucketList, appCookie, groupId, ip="DEFAULT", port="DEFAULT", debug=False ):
+        """
+        Description:
+            Creates a single Group for the specified device.
+        Required:
+            * deviceId: id of the device
+            * type: Type of the Group
+            * bucketList: Buckets to be added to the group
+            * appCookie: Cookie for the Group
+            * groupId: Id of the Group
+        Returns:
+            Returns main.TRUE for successful requests; Returns main.FALSE
+            if error on requests;
+            Returns None for exceptions
+        Note:
+            The ip and port option are for the requests input's ip and port
+            of the ONOS node
+        """
+        try:
+            groupJson = { "type": groupType,
+                          "appCookie": appCookie,
+                          "groupId": groupId,
+                          "buckets": bucketList
+                        }
+            return self.sendGroup( deviceId=deviceId, groupJson=groupJson, ip="DEFAULT", port="DEFAULT", debug=False )
+
+        except ( AttributeError, TypeError ):
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def sendGroup( self, deviceId, groupJson, ip="DEFAULT", port="DEFAULT", debug=False ):
+        """
+        Description:
+            Sends a single group to the specified device.
+        Required:
+            * deviceId: id of the device
+            * groupJson: the group in json
+        Returns:
+            Returns main.TRUE for successful requests; Returns main.FALSE
+            if error on requests;
+            Returns None for exceptions
+        NOTE:
+            The ip and port option are for the requests input's ip and port
+            of the ONOS node
+        """
+        try:
+            if debug: main.log.debug( "Adding group: " + self.pprint( groupJson ) )
+            output = None
+            if ip == "DEFAULT":
+                main.log.warn( "No ip given, reverting to ip from topo file" )
+                ip = self.ip_address
+            if port == "DEFAULT":
+                main.log.warn( "No port given, reverting to port " +
+                               "from topo file" )
+                port = self.port
+            url = "/groups/" + deviceId
+            response = self.send( method="POST",
+                                  url=url, ip = ip, port = port,
+                                  data=json.dumps( groupJson ) )
+            if response:
+                if "201" in str( response[ 0 ] ):
+                    main.log.info( self.name + ": Successfully POST group " +
+                                   "in device: " + str( deviceId ) )
+                    return main.TRUE
+                else:
+                    main.log.error( "Error with REST request, response was: " +
+                                    str( response ) )
+                    return main.FALSE
+        except NotImplementedError as e:
+            raise e  # Inform the caller
+        except ( AttributeError, TypeError ):
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def getGroups( self, deviceId=None, appCookie=None, ip="DEFAULT", port="DEFAULT" ):
+        """
+        Description:
+            Get all the groups or get a specific group by giving the
+            deviceId and appCookie
+        Optional:
+            * deviceId: id of the Device
+            * appCookie: Cookie of the Group
+        Returns:
+            Returns Groups for successful requests; Returns main.FALSE
+            if error on requests;
+            Returns None for exceptions
+        NOTE:
+            The ip and port option are for the requests input's ip and port
+            of the ONOS node
+        """
+        try:
+            output = None
+            if ip == "DEFAULT":
+                main.log.warn( "No ip given, reverting to ip from topo file" )
+                ip = self.ip_address
+            if port == "DEFAULT":
+                main.log.warn( "No port given, reverting to port " +
+                               "from topo file" )
+                port = self.port
+            url = "/groups"
+            if deviceId:
+                url += "/" + deviceId
+                if appCookie:
+                   url += "/" + appCookie
+            response = self.send( url=url, ip = ip, port = port )
+            if response:
+                if 200 <= response[ 0 ] <= 299:
+                    output = response[ 1 ]
+                    groupsJson = json.loads( output ).get( 'groups' )
+                    assert groupsJson is not None, "Error parsing json object"
+                    groups = json.dumps( groupsJson )
+                    return groups
+                else:
+                    main.log.error( "Error with REST request, response was: " +
+                                    str( response ) )
+                    return main.FALSE
+        except ( AttributeError, AssertionError, TypeError ):
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def removeGroup( self, deviceId, appCookie,
+                       ip="DEFAULT", port="DEFAULT" ):
+        """
+        Description:
+            Removes specific device group
+        Required:
+            * deviceId: id of the Device
+            * appCookie: Cookie of the Group
+        Returns:
+            Returns main.TRUE for successful requests; Returns main.FALSE
+            if error on requests;
+            Returns None for exceptions
+        NOTE:
+            The ip and port option are for the requests input's ip and port
+            of the ONOS node
+
+        """
+        try:
+            output = None
+            if ip == "DEFAULT":
+                main.log.warn( "No ip given, reverting to ip from topo file" )
+                ip = self.ip_address
+            if port == "DEFAULT":
+                main.log.warn( "No port given, reverting to port " +
+                               "from topo file" )
+                port = self.port
+            query = "/" + str( deviceId ) + "/" + str( appCookie )
+            response = self.send( method="DELETE",
+                                  url="/groups" + query, ip = ip, port = port )
+            if response:
+                if 200 <= response[ 0 ] <= 299:
+                    return main.TRUE
+                else:
+                    main.log.error( "Error with REST request, response was: " +
+                                    str( response ) )
+                    return main.FALSE
+        except ( AttributeError, TypeError ):
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
diff --git a/TestON/drivers/common/cli/emulator/lincoemininetdriver.py b/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
index bcdbf33..49ceea8 100644
--- a/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
@@ -130,7 +130,7 @@
             main.lastResult = main.TRUE
             return main.TRUE
         else:
-            main.log.error(
+            main.log.info(
                 self.name +
                 ": PACKET LOST, HOST IS NOT REACHABLE" )
             main.lastResult = main.FALSE
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 2d61501..90f79a9 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -587,11 +587,10 @@
                 main.log.info( self.name + ": no packets lost, host is reachable" )
                 return main.TRUE
             else:
-                main.log.error(
+                main.log.warn(
                     self.name +
                     ": PACKET LOST, HOST IS NOT REACHABLE" )
                 return main.FALSE
-
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
@@ -636,7 +635,7 @@
                 main.log.info( self.name + ": no packets lost, host is reachable" )
                 return main.TRUE
             else:
-                main.log.error(
+                main.log.info(
                     self.name +
                     ": PACKET LOST, HOST IS NOT REACHABLE" )
                 return main.FALSE
@@ -1603,7 +1602,7 @@
             main.log.info( self.name + ": Ping between two hosts SUCCESSFUL" )
             return main.TRUE
         else:
-            main.log.error( self.name + ": PACKET LOST, HOSTS NOT REACHABLE" )
+            main.log.info( self.name + ": PACKET LOST, HOSTS NOT REACHABLE" )
             return main.FALSE
 
     def link( self, **linkargs ):
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index f4adb81..8788af0 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -318,7 +318,7 @@
             main.lastResult = main.TRUE
             return main.TRUE
         else:
-            main.log.error(
+            main.log.info(
                 self.name +
                 ": PACKET LOST, HOST IS NOT REACHABLE" )
             main.lastResult = main.FALSE
@@ -345,7 +345,7 @@
                 main.lastResult = main.TRUE
                 return main.TRUE
             else:
-                main.log.error( "PACKET LOST, HOST IS NOT REACHABLE" )
+                main.log.info( "PACKET LOST, HOST IS NOT REACHABLE" )
                 main.lastResult = main.FALSE
                 return main.FALSE
         except pexpect.EOF:
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index b9d90ef..4052db2 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -249,14 +249,15 @@
         """
         self.onosIp = ONOSIp
         try:
+            # Check if we are already in the cli
             self.handle.sendline( "" )
             x = self.handle.expect( [
                 "\$", "onos>" ], commandlineTimeout)
-
             if x == 1:
                 main.log.info( "ONOS cli is already running" )
                 return main.TRUE
 
+            # Not in CLI so login
             if waitForStart:
                 # Wait for onos start ( -w ) and enter onos cli
                 startCliCommand = "onos -w "
@@ -396,7 +397,7 @@
             main.cleanup()
             main.exit()
 
-    def log( self, cmdStr, level="",noExit=False):
+    def log( self, cmdStr, level="", noExit=False ):
         """
             log  the commands in the onos CLI.
             returns main.TRUE on success
@@ -404,6 +405,7 @@
             if noExit is True, TestON will not exit, but clean up
             Available level: DEBUG, TRACE, INFO, WARN, ERROR
             Level defaults to INFO
+            if cmdStr has spaces then put quotes in the passed string
         """
         try:
             lvlStr = ""
@@ -1285,6 +1287,7 @@
             ethDst="",
             bandwidth="",
             lambdaAlloc=False,
+            protected=False,
             ipProto="",
             ipSrc="",
             ipDst="",
@@ -1351,6 +1354,8 @@
                 cmd += " --setVlan " + str( setVlan )
             if encap:
                 cmd += " --encapsulation " + str( encap )
+            if protected:
+                cmd += " --protect "
 
             # Check whether the user appended the port
             # or provided it as an input
@@ -2660,18 +2665,13 @@
         """
         try:
             # Obtain output of intents function
-            intentsStr = self.intents(jsonFormat=False)
+            intentsStr = self.intents(jsonFormat=True)
+            # Convert to a dictionary
+            intents = json.loads( intentsStr )
             intentIdList = []
-
-            # Parse the intents output for ID's
-            intentsList = [ s.strip() for s in intentsStr.splitlines() ]
-            for intents in intentsList:
-                match = re.search('id=0x([\da-f]+),', intents)
-                if match:
-                    tmpId = match.group()[3:-1]
-                    intentIdList.append( tmpId )
+            for intent in intents:
+                intentIdList.append( intent[ 'id' ] )
             return intentIdList
-
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return None
@@ -3373,7 +3373,7 @@
             main.cleanup()
             main.exit()
 
-    def partitions( self, jsonFormat=True ):
+    def partitions( self, candidates=False, jsonFormat=True ):
         """
         Returns the output of the raft partitions command for ONOS.
         """
@@ -3390,6 +3390,8 @@
         # },
         try:
             cmdStr = "onos:partitions"
+            if candidates:
+                cmdStr += " -c"
             if jsonFormat:
                 cmdStr += " -j"
             output = self.sendline( cmdStr )
@@ -4134,7 +4136,7 @@
             containsCheck = None
             # Patterns to match
             setPattern = "\[(.*)\]"
-            pattern = "Items in set " + setName + ":\n" + setPattern
+            pattern = "Items in set " + setName + ":\r\n" + setPattern
             containsTrue = "Set " + setName + " contains the value " + values
             containsFalse = "Set " + setName + " did not contain the value " +\
                             values
@@ -4170,11 +4172,11 @@
                 match = re.search( pattern, output )
             else:  # if given values
                 if length == 1:  # Contains output
-                    patternTrue = pattern + "\n" + containsTrue
-                    patternFalse = pattern + "\n" + containsFalse
+                    patternTrue = pattern + "\r\n" + containsTrue
+                    patternFalse = pattern + "\r\n" + containsFalse
                 else:  # ContainsAll output
-                    patternTrue = pattern + "\n" + containsAllTrue
-                    patternFalse = pattern + "\n" + containsAllFalse
+                    patternTrue = pattern + "\r\n" + containsAllTrue
+                    patternFalse = pattern + "\r\n" + containsAllFalse
                 matchTrue = re.search( patternTrue, output )
                 matchFalse = re.search( patternFalse, output )
                 if matchTrue:
@@ -4236,7 +4238,7 @@
             setName = str( setName ).strip()
             # Patterns to match
             setPattern = "\[(.*)\]"
-            pattern = "There are (\d+) items in set " + setName + ":\n" +\
+            pattern = "There are (\d+) items in set " + setName + ":\r\n" +\
                           setPattern
             cmdStr = "set-test-get -s "
             cmdStr += setName
@@ -4735,7 +4737,7 @@
             return main.TRUE
         except AssertionError:
             main.log.exception( "" )
-            return None
+            return main.FALSE
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return main.FALSE
@@ -4819,7 +4821,7 @@
             return main.TRUE
         except AssertionError:
             main.log.exception( "" )
-            return None
+            return main.FALSE
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return main.FALSE
@@ -4855,7 +4857,7 @@
             return main.TRUE
         except AssertionError:
             main.log.exception( "" )
-            return None
+            return main.FALSE
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return main.FALSE
@@ -4869,20 +4871,22 @@
             main.cleanup()
             main.exit()
 
-    def portstate(self, dpid='of:0000000000000102', port='2', state='enable'):
+    def portstate( self, dpid, port, state ):
         '''
         Description:
              Changes the state of port in an OF switch by means of the
              PORTSTATUS OF messages.
         params:
-            dpid - (string) Datapath ID of the device
-            port - (string) target port in the device
-            state - (string) target state (enable or disabled)
+            dpid - (string) Datapath ID of the device. Ex: 'of:0000000000000102'
+            port - (string) target port in the device. Ex: '2'
+            state - (string) target state (enable or disable)
         returns:
             main.TRUE if no exceptions were thrown and no Errors are
             present in the resoponse. Otherwise, returns main.FALSE
         '''
         try:
+            state = state.lower()
+            assert state == 'enable' or state == 'disable', "Unknown state"
             cmd =  "portstate {} {} {}".format( dpid, port, state )
             response = self.sendline( cmd, showResponse=True )
             assert response is not None, "Error in sendline"
@@ -4893,7 +4897,7 @@
             return main.TRUE
         except AssertionError:
             main.log.exception( "" )
-            return None
+            return main.FALSE
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return main.FALSE
@@ -5044,30 +5048,54 @@
             return None
         return respDic
 
-    def logSearch( self, searchTerm, mode='all' ):
+    def logSearch( self, mode='all', searchTerm='', startLine='', logNum=1 ):
         """
         Searches the latest ONOS log file for the given search term and
         return a list that contains all the lines that have the search term.
 
         Arguments:
-            searchTerm - A string to grep for in the ONOS log.
+            searchTerm:
+                The string to grep from the ONOS log.
+            startLine:
+                The term that decides which line is the start to search the searchTerm in
+                the karaf log. For now, startTerm only works in 'first' mode.
+            logNum:
+                In some extreme cases, one karaf log is not big enough to contain all the
+                information.Because of this, search mutiply logs is necessary to capture
+                the right result. logNum is the number of karaf logs that we need to search
+                the searchTerm.
             mode:
                 all: return all the strings that contain the search term
                 last: return the last string that contains the search term
                 first: return the first string that contains the search term
-                num: return the number that the searchTerm appears in the log
+                num: return the number of times that the searchTerm appears in the log
+                total: return how many lines in karaf log
         """
         try:
             assert type( searchTerm ) is str
-            cmd = "cat /opt/onos/log/karaf.log | grep \'" + searchTerm + "\'"
+            #Build the log paths string
+            logPath = '/opt/onos/log/karaf.log.'
+            logPaths = '/opt/onos/log/karaf.log'
+            for i in range( 1, logNum ):
+                logPaths = logPath + str( i ) + " " + logPaths
+            cmd = "cat " + logPaths
+            if mode == 'all':
+                cmd = cmd + " | grep \'" + searchTerm + "\'"
             if mode == 'last':
-                cmd = cmd + " | tail -n 1"
+                cmd = cmd + " | grep \'" + searchTerm + "\'" + " | tail -n 1"
             if mode == 'first':
-                cmd = cmd + " | head -n 1"
+                if startLine != '':
+                    # 100000000 is just a extreme large number to make sure this function can grep all the lines after startLine
+                    cmd = cmd + " | grep -A 100000000 \'" + startLine + "\' | grep \'" + searchTerm + "\'" + "| head -n 1"
+                else:
+                    cmd = cmd + " | grep \'" + searchTerm + "\'" + " | head -n 1"
             if mode == 'num':
-                cmd = "cat /opt/onos/log/karaf.log | grep -c \'" + searchTerm + "\'"
+                cmd = cmd + " | grep -c \'" + searchTerm + "\'"
                 num = self.sendline( cmd )
                 return num
+            if mode == 'total':
+                totalLines = self.sendline( "cat /opt/onos/log/karaf.log | wc -l" )
+                return int(totalLines)
             before = self.sendline( cmd )
             before = before.splitlines()
             # make sure the returned list only contains the search term
@@ -5090,3 +5118,385 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
             main.exit()
+
+    def vplsShow( self, jsonFormat=True ):
+        """
+        Description: Returns result of onos:vpls show, which should list the
+                     configured VPLS networks and the assigned interfaces.
+        Optional:
+            * jsonFormat: enable json formatting of output
+        Returns:
+            The output of the command or None on error.
+        """
+        try:
+            cmdStr = "vpls show"
+            if jsonFormat:
+                raise NotImplementedError
+                cmdStr += " -j"
+            handle = self.sendline( cmdStr )
+            assert handle is not None, "Error in sendline"
+            assert "Command not found:" not in handle, handle
+            return handle
+        except AssertionError:
+            main.log.exception( "" )
+            return None
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except NotImplementedError:
+            main.log.exception( self.name + ": Json output not supported")
+            return None
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def parseVplsShow( self ):
+        """
+        Parse the cli output of 'vpls show' into json output. This is required
+        as there is currently no json output available.
+        """
+        try:
+            output = []
+            raw = self.vplsShow( jsonFormat=False )
+            namePat = "VPLS name: (?P<name>\w+)"
+            interfacesPat = "Associated interfaces: \[(?P<interfaces>.*)\]"
+            encapPat = "Encapsulation: (?P<encap>\w+)"
+            pattern = "\s+".join( [ namePat, interfacesPat, encapPat ] )
+            mIter = re.finditer( pattern, raw )
+            for match in mIter:
+                item = {}
+                item[ 'name' ] = match.group( 'name' )
+                ifaces = match.group( 'interfaces' ).split( ', ')
+                if ifaces == [ "" ]:
+                    ifaces = []
+                item[ 'interfaces' ] = ifaces
+                encap = match.group( 'encap' )
+                if encap != 'NONE':
+                    item[ 'encapsulation' ] = encap.lower()
+                output.append( item )
+            return output
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def vplsList( self, jsonFormat=True ):
+        """
+        Description: Returns result of onos:vpls list, which should list the
+                     configured VPLS networks.
+        Optional:
+            * jsonFormat: enable json formatting of output
+        """
+        try:
+            cmdStr = "vpls list"
+            if jsonFormat:
+                raise NotImplementedError
+                cmdStr += " -j"
+            handle = self.sendline( cmdStr )
+            assert handle is not None, "Error in sendline"
+            assert "Command not found:" not in handle, handle
+            return handle
+        except AssertionError:
+            main.log.exception( "" )
+            return None
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except NotImplementedError:
+            main.log.exception( self.name + ": Json output not supported")
+            return None
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def vplsCreate( self, network ):
+        """
+        CLI command to create a new VPLS network.
+        Required arguments:
+            network - String name of the network to create.
+        returns:
+            main.TRUE on success and main.FALSE on failure
+        """
+        try:
+            network = str( network )
+            cmdStr = "vpls create "
+            cmdStr += network
+            output = self.sendline( cmdStr )
+            assert output is not None, "Error in sendline"
+            assert "Command not found:" not in output, output
+            assert "Error executing command" not in output, output
+            assert "VPLS already exists:" not in output, output
+            return main.TRUE
+        except AssertionError:
+            main.log.exception( "" )
+            return main.FALSE
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def vplsDelete( self, network ):
+        """
+        CLI command to delete a VPLS network.
+        Required arguments:
+            network - Name of the network to delete.
+        returns:
+            main.TRUE on success and main.FALSE on failure
+        """
+        try:
+            network = str( network )
+            cmdStr = "vpls delete "
+            cmdStr += network
+            output = self.sendline( cmdStr )
+            assert output is not None, "Error in sendline"
+            assert "Command not found:" not in output, output
+            assert "Error executing command" not in output, output
+            assert " not found" not in output, output
+            return main.TRUE
+        except AssertionError:
+            main.log.exception( "" )
+            return main.FALSE
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def vplsAddIface( self, network, iface ):
+        """
+        CLI command to add an interface to a VPLS network.
+        Required arguments:
+            network - Name of the network to add the interface to.
+            iface - The ONOS name for an interface.
+        returns:
+            main.TRUE on success and main.FALSE on failure
+        """
+        try:
+            network = str( network )
+            iface = str( iface )
+            cmdStr = "vpls add-if "
+            cmdStr += network + " " + iface
+            output = self.sendline( cmdStr )
+            assert output is not None, "Error in sendline"
+            assert "Command not found:" not in output, output
+            assert "Error executing command" not in output, output
+            assert "already associated to network" not in output, output
+            assert "Interface cannot be added." not in output, output
+            return main.TRUE
+        except AssertionError:
+            main.log.exception( "" )
+            return main.FALSE
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def vplsRemIface( self, network, iface ):
+        """
+        CLI command to remove an interface from a VPLS network.
+        Required arguments:
+            network - Name of the network to remove the interface from.
+            iface - Name of the interface to remove.
+        returns:
+            main.TRUE on success and main.FALSE on failure
+        """
+        try:
+            iface = str( iface )
+            cmdStr = "vpls rem-if "
+            cmdStr += network + " " + iface
+            output = self.sendline( cmdStr )
+            assert output is not None, "Error in sendline"
+            assert "Command not found:" not in output, output
+            assert "Error executing command" not in output, output
+            assert "is not configured" not in output, output
+            return main.TRUE
+        except AssertionError:
+            main.log.exception( "" )
+            return main.FALSE
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def vplsClean( self ):
+        """
+        Description: Clears the VPLS app configuration.
+        Returns: main.TRUE on success and main.FALSE on failure
+        """
+        try:
+            cmdStr = "vpls clean"
+            handle = self.sendline( cmdStr )
+            assert handle is not None, "Error in sendline"
+            assert "Command not found:" not in handle, handle
+            return handle
+        except AssertionError:
+            main.log.exception( "" )
+            return main.FALSE
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def vplsSetEncap( self, network, encapType ):
+        """
+        CLI command to add an interface to a VPLS network.
+        Required arguments:
+            network - Name of the network to create.
+            encapType - Type of encapsulation.
+        returns:
+            main.TRUE on success and main.FALSE on failure
+        """
+        try:
+            network = str( network )
+            encapType = str( encapType ).upper()
+            assert encapType in [ "MPLS", "VLAN", "NONE" ], "Incorrect type"
+            cmdStr = "vpls set-encap "
+            cmdStr += network + " " + encapType
+            output = self.sendline( cmdStr )
+            assert output is not None, "Error in sendline"
+            assert "Command not found:" not in output, output
+            assert "Error executing command" not in output, output
+            assert "already associated to network" not in output, output
+            assert "Encapsulation type " not in output, output
+            return main.TRUE
+        except AssertionError:
+            main.log.exception( "" )
+            return main.FALSE
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def interfaces( self, jsonFormat=True ):
+        """
+        Description: Returns result of interfaces command.
+        Optional:
+            * jsonFormat: enable json formatting of output
+        Returns:
+            The output of the command or None on error.
+        """
+        try:
+            cmdStr = "interfaces"
+            if jsonFormat:
+                #raise NotImplementedError
+                cmdStr += " -j"
+            handle = self.sendline( cmdStr )
+            assert handle is not None, "Error in sendline"
+            assert "Command not found:" not in handle, handle
+            return handle
+        except AssertionError:
+            main.log.exception( "" )
+            return None
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except NotImplementedError:
+            main.log.exception( self.name + ": Json output not supported")
+            return None
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def getTimeStampFromLog( self, mode, searchTerm, splitTerm_before, splitTerm_after, startLine='', logNum=1 ):
+        '''
+        Get the timestamp of searchTerm from karaf log.
+
+        Arguments:
+            splitTerm_before and splitTerm_after:
+
+                The terms that split the string that contains the timeStamp of
+                searchTerm. For example, if that string is "xxxxxxxcreationTime =
+                1419510501xxxxxx", then the splitTerm_before is "CreationTime = "
+                and the splitTerm_after is "x"
+
+            others:
+
+                plz look at the "logsearch" Function in onosclidriver.py
+
+
+        '''
+        if logNum < 0:
+            main.log.error("Get wrong log number ")
+            return main.ERROR
+        lines = self.logSearch( mode=mode, searchTerm=searchTerm, startLine=startLine, logNum=logNum )
+        if len(lines) == 0:
+            main.log.warn( "Captured timestamp string is empty" )
+            return main.ERROR
+        lines = lines[ 0 ]
+        try:
+            assert type(lines) is str
+            # get the target value
+            line = lines.split( splitTerm_before )
+            key = line[ 1 ].split( splitTerm_after )
+            return int( key[ 0 ] )
+        except IndexError:
+            main.log.warn( "Index Error!" )
+            return main.ERROR
+        except AssertionError:
+            main.log.warn( "Search Term Not Found " )
+            return main.ERROR
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 644b9f7..9c9e70d 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -727,7 +727,7 @@
             main.exit()
 
     def createCellFile( self, benchIp, fileName, mnIpAddrs,
-                        appString, onosIpAddrs, onosUser="sdn", useSSH=False ):
+                        appString, onosIpAddrs, onosUser="sdn", useSSH=True ):
         """
         Creates a cell file based on arguments
         Required:
@@ -745,44 +745,43 @@
         NOTE: Assumes cells are located at:
             ~/<self.home>/tools/test/cells/
         """
-        # Variable initialization
-        cellDirectory = self.home + "/tools/test/cells/"
-        # We want to create the cell file in the dependencies directory
-        # of TestON first, then copy over to ONOS bench
-        tempDirectory = "/tmp/"
-        # Create the cell file in the directory for writing ( w+ )
-        cellFile = open( tempDirectory + fileName, 'w+' )
-        if isinstance( onosIpAddrs, types.StringType ):
-            onosIpAddrs = [ onosIpAddrs ]
-
-        # App string is hardcoded environment variables
-        # That you may wish to use by default on startup.
-        # Note that you  may not want certain apps listed
-        # on here.
-        appString = "export ONOS_APPS=" + appString
-        onosGroup = "export ONOS_GROUP=" + onosUser
-        onosUser = "export ONOS_USER=" + onosUser
-        # FIXME: unset ONOS_USE_SSH when not using SSH?
-        if useSSH:
-            onosUseSSH = "export ONOS_USE_SSH=true"
-        mnString = "export OCN="
-        if mnIpAddrs == "":
-            mnString = ""
-        onosString = "export OC"
-        tempCount = 1
-
-        # Create ONOSNIC ip address prefix
-        tempOnosIp = str( onosIpAddrs[ 0 ] )
-        tempList = []
-        tempList = tempOnosIp.split( "." )
-        # Omit last element of list to format for NIC
-        tempList = tempList[ :-1 ]
-        # Structure the nic string ip
-        nicAddr = ".".join( tempList ) + ".*"
-        self.nicAddr = nicAddr
-        onosNicString = "export ONOS_NIC=" + nicAddr
-
         try:
+            # Variable initialization
+            cellDirectory = self.home + "/tools/test/cells/"
+            # We want to create the cell file in the dependencies directory
+            # of TestON first, then copy over to ONOS bench
+            tempDirectory = "/tmp/"
+            # Create the cell file in the directory for writing ( w+ )
+            cellFile = open( tempDirectory + fileName, 'w+' )
+            if isinstance( onosIpAddrs, types.StringType ):
+                onosIpAddrs = [ onosIpAddrs ]
+
+            # App string is hardcoded environment variables
+            # That you may wish to use by default on startup.
+            # Note that you  may not want certain apps listed
+            # on here.
+            appString = "export ONOS_APPS=" + appString
+            onosGroup = "export ONOS_GROUP=" + onosUser
+            onosUser = "export ONOS_USER=" + onosUser
+            if useSSH:
+                onosUseSSH = "export ONOS_USE_SSH=true"
+            mnString = "export OCN="
+            if mnIpAddrs == "":
+                mnString = ""
+            onosString = "export OC"
+            tempCount = 1
+
+            # Create ONOSNIC ip address prefix
+            tempOnosIp = str( onosIpAddrs[ 0 ] )
+            tempList = []
+            tempList = tempOnosIp.split( "." )
+            # Omit last element of list to format for NIC
+            tempList = tempList[ :-1 ]
+            # Structure the nic string ip
+            nicAddr = ".".join( tempList ) + ".*"
+            self.nicAddr = nicAddr
+            onosNicString = "export ONOS_NIC=" + nicAddr
+
             # Start writing to file
             cellFile.write( onosNicString + "\n" )
 
@@ -2124,7 +2123,36 @@
 
         return sorted( self.onosIps.values() )
 
-    def logReport( self, nodeIp, searchTerms, outputMode="s" ):
+    def listLog( self, nodeIp ):
+        """
+            Get a list of all the karaf log names
+        """
+        try:
+            cmd = "onos-ssh " + nodeIp + " ls -tr /opt/onos/log"
+            self.handle.sendline( cmd )
+            self.handle.expect( ":~" )
+            before = self.handle.before.splitlines()
+            logNames = []
+            for word in before:
+                if 'karaf.log' in word:
+                    logNames.append( word )
+            return logNames
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": TIMEOUT exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def logReport( self, nodeIp, searchTerms, outputMode="s", startStr=None, endStr=None ):
         """
         Searches the latest ONOS log file for the given search terms and
         prints the total occurances of each term. Returns to combined total of
@@ -2141,6 +2169,10 @@
                            number of occurances of each term. Defaults to 's',
                            which prints the simple output of just the number
                            of occurances for each term.
+            * startStr - the start string to be given to stream editor command
+                         as the start point for extraction of data
+            * endStr -  the end string to be given to stream editor command as
+                        the end point for extraction of data
         """
         try:
             main.log.info( " Log Report for {} ".format( nodeIp ).center( 70, '=' ) )
@@ -2154,7 +2186,14 @@
             for termIndex in range( numTerms ):
                 term = searchTerms[termIndex]
                 logLines.append( [term] )
-                cmd = "onos-ssh " + nodeIp + " cat /opt/onos/log/karaf.log | grep " + term
+                if startStr and endStr:
+                    cmd = "onos-ssh {} \"sed -n '/{}/,/{}/p' /opt/onos/log/karaf.log | grep {}\"".format( nodeIp,
+                                                                                                          startStr,
+                                                                                                          endStr,
+                                                                                                          term )
+                else:
+                    cmd = "onos-ssh {} cat /opt/onos/log/karaf.log | grep {}".format( nodeIp,
+                                                                                      term )
                 self.handle.sendline( cmd )
                 self.handle.expect( ":~" )
                 before = self.handle.before.splitlines()
@@ -2379,7 +2418,7 @@
         except Exception:
             main.log.exception( "Uncaught exception" )
 
-    def startBasicONOS( self, nodeList, opSleep=60, onosStartupSleep=60 ):
+    def startBasicONOS( self, nodeList, opSleep=60, onosStartupSleep=30 ):
         '''
         Start onos cluster with defined nodes, but only with drivers app
         '''
@@ -2398,9 +2437,17 @@
         main.log.info( self.name + ": Creating ONOS package" )
         packageResult = self.buckBuild( timeout=opSleep )
 
+        main.log.info( self.name + ": Uninstalling ONOS" )
+        for nd in nodeList:
+            self.onosUninstall( nodeIp=nd )
+
         main.log.info( self.name + ": Installing ONOS package" )
         for nd in nodeList:
-                    self.onosInstall( node=nd )
+            self.onosInstall( node=nd )
+
+        main.log.info( self.name + ": Set up ONOS secure SSH" )
+        for nd in nodeList:
+            self.onosSecureSSH( node=nd )
 
         main.log.info( self.name + ": Starting ONOS service" )
         time.sleep( onosStartupSleep )
diff --git a/TestON/requirements.txt b/TestON/requirements.txt
index 86c8741..28f7503 100644
--- a/TestON/requirements.txt
+++ b/TestON/requirements.txt
@@ -11,3 +11,4 @@
 pylint==1.1.0
 requests==2.2.1
 scapy==2.3.1
+ipaddress==1.0.16
diff --git a/TestON/tests/CHO/CHOtest/CHOtest.py b/TestON/tests/CHO/CHOtest/CHOtest.py
index 411035d..41f1693 100644
--- a/TestON/tests/CHO/CHOtest/CHOtest.py
+++ b/TestON/tests/CHO/CHOtest/CHOtest.py
@@ -134,16 +134,6 @@
                                      onfail="Test step FAIL" )
             installResult = ( installResult and i_result )
 
-        main.step( "Verify ONOS nodes UP status" )
-        statusResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
-            onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
-            utilities.assert_equals( expect=main.TRUE, actual=onos_status,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            statusResult = ( statusResult and onos_status )
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
         for i in range( int( main.numCtrls ) ):
@@ -152,6 +142,30 @@
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
+        time.sleep( 5 )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
         main.step( "Start ONOS CLI on all nodes" )
         cliResult = main.TRUE
         main.step(" Start ONOS cli using thread ")
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index ec64601..78bed55 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -147,16 +147,6 @@
                                      onfail="Test step FAIL" )
             installResult = ( installResult and iResult )
 
-        main.step( "Verify ONOS nodes UP status" )
-        statusResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
-            onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
-            utilities.assert_equals( expect=main.TRUE, actual=onos_status,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            statusResult = ( statusResult and onos_status )
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
         for i in range( int( main.numCtrls ) ):
@@ -165,6 +155,30 @@
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
+        time.sleep( 5 )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
         main.step( "Start ONOS CLI on all nodes" )
         cliResult = main.TRUE
         startCliResult  = main.TRUE
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
index 282e623..9d049fc 100755
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
@@ -41,6 +41,7 @@
         """
 
         import os
+
         main.log.info( "ONOS Single node start " +
                          "Scapy Tool - initialization" )
         main.case( "Setting up test environment" )
@@ -128,30 +129,30 @@
 
         main.step( "Installing ONOS package" )
         onosInstallResult = main.ONOSbench.onosInstall(
-                options="-f", node=main.nodes[0].ip_address )
+                options="-f", node=main.nodes[ 0 ].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult,
                                  onpass="ONOS install successful",
                                  onfail="ONOS install failed" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.ONOSbench.onosSecureSSH( node=main.nodes[ 0 ].ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         print main.nodes[0].ip_address
         for i in range( 2 ):
-            onos1Isup = main.ONOSbench.isup( main.nodes[0].ip_address )
+            onos1Isup = main.ONOSbench.isup( main.nodes[ 0 ].ip_address )
             if onos1Isup:
                 break
         utilities.assert_equals( expect=main.TRUE, actual=onos1Isup,
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.ONOSbench.onosSecureSSH( node=main.nodes[0].ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
-        print main.nodes[0].ip_address
-        cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
+        print main.nodes[ 0 ].ip_address
+        cliResults = main.ONOScli1.startOnosCli( main.nodes[ 0 ].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=cliResults,
                                  onpass="ONOS cli startup successful",
                                  onfail="ONOS cli startup failed" )
@@ -160,8 +161,8 @@
         appCheck = main.ONOScli1.appToIDCheck()
 
         if appCheck !=main.TRUE:
-            main.log.warn( main.CLIs[0].apps() )
-            main.log.warn( main.CLIs[0].appIDs() )
+            main.log.warn( main.CLIs[ 0 ].apps() )
+            main.log.warn( main.CLIs[ 0 ].appIDs() )
             utilities.assert_equals( expect=main.TRUE, actual=appCheck,
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
@@ -170,10 +171,6 @@
             main.cleanup()
             main.exit()
 
-
-
-
-
     def CASE2( self, main ):
         """
         Discovery the topology using BGPLS
@@ -183,6 +180,7 @@
         import time
 
         main.case( "Testcase 2 : Discovery the Network Topology using BGPLS" )
+        main.ONOScli1.log( "\"testcase2 start\"" )
 
         try:
             from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
@@ -218,7 +216,7 @@
         bgplsConfig.Comments()
 
         bgplsConfig.Comments()
-        main.log.info( "Sending BGPLS information " )
+        main.log.info( "Sending BGPLS information" )
         bgplsConfig.Comments()
 
 
@@ -249,24 +247,30 @@
         bgplsConfig.Comments()
 
         print (bgpls_post)
-        main.ONOSrest.user_name = "karaf"
-        main.ONOSrest.pwd = "karaf"
+        main.ONOSrest.user_name = "onos"
+        main.ONOSrest.pwd = "rocks"
         Poststatus, result = main.ONOSrest.send( '/network/configuration/', method="POST", data=bgpls_post)
         main.step( "Configure BGP through RESTCONF" )
 
-        utilities.assert_equals(
-                expect='200',
-                actual=Poststatus,
-                onpass="Post Port Success",
-                onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
+        utilities.assert_equals( expect='200',
+                                 actual=Poststatus,
+                                 onpass="Post Port Success",
+                                 onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
 
 
         bgplsConfig.Comments()
-        main.log.info( "Check Network devices are Updated in ONOS " )
+        main.step( "Check Network devices are Updated in ONOS " )
         bgplsConfig.Comments()
         time.sleep(15)
-
         response = main.ONOScli1.devices()
+        responseCheck = main.FALSE
+        if response:
+            responseCheck = main.TRUE
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=responseCheck,
+                                 onpass="Network Devices update in ONOS successful",
+                                 onfail="Network Devices update in ONOS failed" )
+
         main.step( "Check the nodes are discovered" )
         if response.find( Ne_id[1][0]) and response.find(Ne_id[1][1]) and response.find(Ne_id[1][2]) != -1:
             stepResult = main.TRUE
@@ -276,8 +280,17 @@
                                  actual=stepResult,
                                  onpass="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + "  sucess",
                                  onfail="Node " + str( Ne_id[1][0]) + ( Ne_id[1][1]) + ( Ne_id[1][2]) + " failed" )
+        main.ONOScli1.log( "\"testcase2 end\"" )
 
-
+        main.step( "Check for Errors or Exception in testcase2" )
+        startStr = "testcase2 start"
+        endStr = "testcase2 end"
+        errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+                                             ["ERROR","EXCEPT"], "s",
+                                             startStr, endStr )
+        utilities.assert_equals( expect=0, actual=errorLog,
+                                 onpass="No Exception or Error occured in testcase2",
+                                 onfail="Exception or Error occured in testcase2" )
         bgplsConfig.Comments()
         main.log.info( "Kill Scapy process" )
         bgplsConfig.Comments()
@@ -285,9 +298,6 @@
         main.Scapy1.handle.sendline( "\x03" )
         time.sleep( 90 ) #This Sleep time gives time for the socket to close.
 
-
-
-
     def CASE3( self, main ):
         """
         Addition of new Node to existing topology
@@ -297,6 +307,7 @@
         import time
 
         main.case( "Testcase 3: Addition of New Node to existing topology" )
+        main.ONOScli1.log( "\"testcase3 start\"" )
         try:
             from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
         except ImportError:
@@ -360,11 +371,17 @@
         bgplsConfig.Comments()
 
         bgplsConfig.Comments()
-        main.log.info( "Check Network devices are Updated in ONOS " )
+        main.step( "Check Network devices are Updated in ONOS" )
         bgplsConfig.Comments()
         time.sleep(120)
-
         response = main.ONOScli1.devices()
+        responseCheck = main.FALSE
+        if response:
+            responseCheck = main.TRUE
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=responseCheck,
+                                 onpass="Network Devices update in ONOS successful",
+                                 onfail="Network Devices update in ONOS failed" )
         main.step( "Check Newly added Node is getting updated" )
 
         if response.find( Ne_id[1][3]) != -1:
@@ -375,13 +392,23 @@
                                  actual=stepResult,
                                  onpass="Node " + str( Ne_id[ 1 ][ 3 ] ) + " update  sucess",
                                  onfail="Node " + str( Ne_id[ 1 ][ 3 ] ) + " update failed" )
+        main.ONOScli1.log( "\"testcase3 end\"" )
+
+        main.step( "Check for Errors or Exception in testcase3" )
+        startStr = "testcase3 start"
+        endStr = "testcase3 end"
+        errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+                                             ["ERROR","EXCEPT"], "s",
+                                             startStr, endStr )
+        utilities.assert_equals( expect=0, actual=errorLog,
+                                 onpass="No Exception or Error occured in testcase3",
+                                 onfail="Exception or Error occured in testcase3" )
         bgplsConfig.Comments()
         main.log.info( "Kill Scapy process" )
         bgplsConfig.Comments()
         main.Scapy1.handle.sendline( "\x03" )
         time.sleep( 90 ) #This Sleep time gives time for the socket to close.
 
-
     def CASE4( self, main ):
         """
         Verification of Links in existing topology
@@ -390,6 +417,7 @@
         import time
         import os
         main.case( "Testcase 4: Verification of Links thats is discovered" )
+        main.ONOScli1.log( "\"testcase4 start\"" )
         try:
             from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
         except ImportError:
@@ -436,7 +464,7 @@
                                  onpass="Install onos-app-bgp successful",
                                  onfail="Install onos-app-bgp failed" )
         bgplsConfig.Comments()
-        main.log.info( "Checking the Link Discovery Status" )
+        main.step( "Checking the Link Discovery Status" )
         bgplsConfig.Comments()
         time.sleep( 120 )   # Time taken to discovery the links
         response = main.ONOScli1.links()
@@ -445,10 +473,20 @@
 
         if check_link == True:
             reply_Check_Link = main.TRUE
-        utilities.assert_equals( expect= main.TRUE,
-                                     actual=reply_Check_Link ,
-                                     onpass="Link  Discovery Success.",
-                                     onfail="Link  Discovery Failed." )
+        utilities.assert_equals( expect= main.TRUE, actual=reply_Check_Link,
+                                 onpass="Link Discovery Success.",
+                                 onfail="Link Discovery Failed." )
+        main.ONOScli1.log( "\"testcase4 end\"" )
+
+        main.step( "Check for Errors or Exception in testcase4 " )
+        startStr = "testcase4 start"
+        endStr = "testcase4 end"
+        errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+                                             ["ERROR","EXCEPT"], "s",
+                                             startStr, endStr )
+        utilities.assert_equals( expect= 0, actual=errorLog,
+                                 onpass="No Exception or Error occured in testcase4",
+                                 onfail="Exception or Error occured in testcase4" )
         bgplsConfig.Comments()
         main.log.info( "Kill Scapy process" )
         bgplsConfig.Comments()
@@ -463,6 +501,8 @@
         import time
         import os
         main.case( "Testcase 5: Deletion of Link in existing topology" )
+
+        main.ONOScli1.log( "\"testcase5 start\"" )
         try:
             from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
         except ImportError:
@@ -494,7 +534,7 @@
 
         main.Scapy1.handle.sendline( "sudo python  OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py" )
         bgplsConfig.Comments()
-        main.log.info( "Enable BGPlS plugin in ONOS" )
+        main.log.info( "Enable BGPlS plugin in ONOS " )
         bgplsConfig.Comments()
 
         main.step( "UnInstall onos-app-bgp" )
@@ -509,7 +549,7 @@
                                  onpass="Install onos-app-bgp successful",
                                  onfail="Install onos-app-bgp failed" )
         bgplsConfig.Comments()
-        main.log.info( "Checking whether the links is deleted" )
+        main.step( "Checking whether the links is deleted" )
         bgplsConfig.Comments()
         time.sleep( 120 )  # Time taken to discovery the links
         response = main.ONOScli1.links()
@@ -517,10 +557,20 @@
         check_link = bgplsConfig.checkLinks( linksResp )
         if check_link == False:
             reply_Check_Link = main.TRUE
-        utilities.assert_equals( expect= main.TRUE,
-                                     actual=reply_Check_Link ,
-                                     onpass="Link  is Deleted Successfully.",
-                                     onfail="Link  is Deletion Failed." )
+        utilities.assert_equals( expect= main.TRUE, actual=reply_Check_Link,
+                                 onpass="Link is Deleted Successfully.",
+                                 onfail="Link is Deletion Failed." )
+        main.ONOScli1.log( "\"testcase5 end\"" )
+
+        main.step( "Check for Errors or Exception in testcase5" )
+        startStr = "testcase5 start"
+        endStr = "testcase5 end"
+        errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+                                             ["ERROR","EXCEPT"], "s",
+                                             startStr, endStr )
+        utilities.assert_equals( expect=0, actual=errorLog,
+                                 onpass="No Exception or Error occured in testcase5",
+                                 onfail="Exception or Error occured in testcase5" )
         bgplsConfig.Comments()
         main.log.info( "Kill Scapy process" )
         bgplsConfig.Comments()
@@ -535,7 +585,8 @@
         import re
         import time
 
-        main.case( "TestCase 5: UnInstalling of app" )
+        main.case( "TestCase 6: UnInstalling of app" )
+        main.ONOScli1.log( "\"testcase6 start\"" )
         try:
             from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
         except ImportError:
@@ -575,7 +626,7 @@
         cellResult = main.ONOSbench.setCell( cellName )
 
         bgplsConfig.Comments()
-        main.log.info( "Logging into ONOS CLI " )
+        main.step( "Logging into ONOS CLI " )
         bgplsConfig.Comments()
 
         cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address )
@@ -592,9 +643,20 @@
                                  onpass="Uninstall  onos-app-bgp successful",
                                  onfail="Uninstall  onos-app-bgp failed" )
 
-        main.log.info( "Check for Errors or Exception End of the Script" )
-        errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address, ["ERROR",\
-                                            "EXCEPT"] )
-        utilities.assert_equals( expect= 0, actual=errorLog,
+        main.ONOScli1.log( "\"testcase6 end\"" )
+        main.step( "Check for Errors or Exception in testcase6" )
+        startStr = "testcase6 start"
+        endStr = "testcase6 end"
+        errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+                                             ["ERROR","EXCEPT"], "s",
+                                             startStr, endStr )
+        utilities.assert_equals( expect=0, actual=errorLog,
+                                 onpass="No Exception or Error occured in testcase6",
+                                 onfail="Exception or Error occured in testcase6" )
+
+        main.step( "Check for Errors or Exception End of the Script" )
+        errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address,
+                                             ["ERROR","EXCEPT"] )
+        utilities.assert_equals( expect=0, actual=errorLog,
                                  onpass="No Exception or Error occured",
                                  onfail="Exception or Error occured" )
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.py b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
index 1acc76a..df64bb4 100644
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
@@ -175,6 +175,14 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         time.sleep( main.startUpSleep )
         main.step( "Starting ONOS service" )
         stopResult = main.TRUE
@@ -200,14 +208,6 @@
                                  onpass="ONOS service is ready",
                                  onfail="ONOS service did not start properly" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
new file mode 100644
index 0000000..585eca3
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
@@ -0,0 +1,66 @@
+
+<PARAMS>
+    # CASE - Description
+    # 1    - Variable initialization and optional pull and build ONOS package
+    # 2    - install ONOS
+    # 3    - Start mininet and verify topology
+    # 4    - Testing Scapy
+    # 5    - Testing GROUP with type "ALL"
+    # 6    - Deleting the Group and Flow
+    # 7    - Testing GROUP with type "INDIRECT"
+    # 8    - Deleting the group and flow
+    # 100  - Check logs for Errors and Warnings
+    <testcases>1,2,3,5,6,7,8,100</testcases>
+
+    <SCALE>
+        <max>1</max>
+    </SCALE>
+
+    <DEBUG>on</DEBUG>
+
+    <DEPENDENCY>
+        <path>/tests/FUNC/FUNCgroup/dependencies/</path>
+        <wrapper1>startUp</wrapper1>
+        <wrapper2>topo</wrapper2>
+        <topology>topo-group.py</topology>
+        <bucket>group-bucket</bucket>
+    </DEPENDENCY>
+
+    <ENV>
+        <cellName>productionCell</cellName>
+        <cellApps>drivers,openflow</cellApps>
+    </ENV>
+
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+
+    <CTRL>
+        <port>6653</port>
+    </CTRL>
+
+    <TEST>
+     <swDPID>of:0000000000000001</swDPID>
+     <waitTime>200</waitTime>
+     <appCookie>0x1234abcd</appCookie>
+     <type1>ALL</type1>
+     <type2>INDIRECT</type2>
+     <groupId>1</groupId>
+     <priority>38000</priority>
+     <ingressPort>1</ingressPort>
+     <egressPort1>2</egressPort1>
+     <egressPort2>3</egressPort2>
+     <egressPort3>4</egressPort3>
+    </TEST>
+
+    <SLEEP>
+        <startup>15</startup>
+        <startMN>5</startMN>
+        <addFlow>10</addFlow>
+        <delFlow>10</delFlow>
+        <addGroup>10</addGroup>
+        <delGroup>10</delGroup>
+    </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
new file mode 100644
index 0000000..4eb2fb8
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
@@ -0,0 +1,748 @@
+class FUNCgroup:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        import os
+        import imp
+
+        """
+        - Construct tests variables
+        - GIT ( optional )
+            - Checkout ONOS master branch
+            - Pull latest ONOS code
+        - Building ONOS ( optional )
+            - Install ONOS package
+            - Build ONOS package
+        """
+        main.case( "Constructing test variables and building ONOS package" )
+        main.step( "Constructing test variables" )
+
+        # Test variables
+        main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+        main.cellName = main.params[ 'ENV' ][ 'cellName' ]
+        main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+        gitBranch = main.params[ 'GIT' ][ 'branch' ]
+        gitPull = main.params[ 'GIT' ][ 'pull' ]
+        main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+        main.dependencyPath = main.testOnDirectory + \
+                              main.params[ 'DEPENDENCY' ][ 'path' ]
+        wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+        wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
+        main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+        bucket = main.params[ 'DEPENDENCY' ][ 'bucket' ]
+        main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
+        main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+        main.startMNSleep = int( main.params[ 'SLEEP' ][ 'startMN' ] )
+        main.addFlowSleep = int( main.params[ 'SLEEP' ][ 'addFlow' ] )
+        main.delFlowSleep = int( main.params[ 'SLEEP' ][ 'delFlow' ] )
+        main.addGroupSleep = int( main.params[ 'SLEEP' ][ 'addGroup' ] )
+        main.delGroupSleep = int( main.params[ 'SLEEP' ][ 'delGroup' ] )
+        main.debug = main.params[ 'DEBUG' ]
+        main.swDPID = main.params[ 'TEST' ][ 'swDPID' ]
+        egressPort1 = main.params[ 'TEST' ][ 'egressPort1' ]
+        egressPort2 = main.params[ 'TEST' ][ 'egressPort2' ]
+        egressPort3 = main.params[ 'TEST' ][ 'egressPort3' ]
+        ingressPort = main.params[ 'TEST' ][ 'ingressPort' ]
+        appCookie = main.params[ 'TEST' ][ 'appCookie' ]
+        type1 = main.params[ 'TEST' ][ 'type1' ]
+        type2 = main.params[ 'TEST' ][ 'type2' ]
+        groupId = main.params[ 'TEST' ][ 'groupId' ]
+        priority = main.params[ 'TEST' ][ 'priority' ]
+        deviceId = main.params[ 'TEST' ][ 'swDPID' ]
+
+        main.cellData = { } # for creating cell file
+        main.CLIs = [ ]
+        main.ONOSip = [ ]
+
+        main.debug = True if "on" in main.debug else False
+
+        main.ONOSip = main.ONOSbench.getOnosIps( )
+
+        # Assigning ONOS cli handles to a list
+        for i in range( 1,  main.maxNodes + 1 ):
+            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+
+        # -- INIT SECTION, ONLY RUNS ONCE -- #
+        main.startUp = imp.load_source( wrapperFile1,
+                                        main.dependencyPath +
+                                        wrapperFile1 +
+                                        ".py" )
+
+        main.topo = imp.load_source( wrapperFile2,
+                                     main.dependencyPath +
+                                     wrapperFile2 +
+                                     ".py" )
+
+        main.buckets = imp.load_source( bucket,
+                                        main.dependencyPath +
+                                        bucket +
+                                        ".py" )
+
+        copyResult = main.ONOSbench.scp( main.Mininet1,
+                                         main.dependencyPath + main.topology,
+                                         main.Mininet1.home + '/custom/',
+                                         direction="to" )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=copyResult,
+                                 onpass="Successfully copy " + "test variables ",
+                                 onfail="Failed to copy test variables" )
+
+        if main.CLIs:
+            stepResult = main.TRUE
+        else:
+            main.log.error( "Did not properly created list of ONOS CLI handle" )
+            stepResult = main.FALSE
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully construct " + "test variables ",
+                                 onfail="Failed to construct test variables" )
+
+        if gitPull == 'True':
+            main.step( "Building ONOS in " + gitBranch + " branch" )
+            onosBuildResult = main.startUp.onosBuild( main, gitBranch )
+            stepResult = onosBuildResult
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=stepResult,
+                                     onpass="Successfully compiled " + "latest ONOS",
+                                     onfail="Failed to compile " + "latest ONOS" )
+        else:
+            main.log.warn( "Did not pull new code so skipping mvn " +
+                           "clean install" )
+
+    def CASE2( self, main ):
+        """
+        - Set up cell
+            - Create cell file
+            - Set cell file
+            - Verify cell file
+        - Kill ONOS process
+        - Uninstall ONOS cluster
+        - Verify ONOS start up
+        - Install ONOS cluster
+        - Connect to cli
+        """
+        import time
+
+        main.numCtrls = int( main.maxNodes )
+
+        main.case( "Starting up " + str( main.numCtrls ) +
+                   " node(s) ONOS cluster" )
+
+        #kill off all onos processes
+        main.log.info( "Safety check, killing all ONOS processes" +
+                       " before initiating environment setup" )
+
+        for i in range( main.maxNodes ):
+            main.ONOSbench.onosDie( main.ONOSip[ i ] )
+
+        main.log.info( "NODE COUNT = " + str( main.numCtrls ) )
+
+        tempOnosIp = [ ]
+        for i in range( main.numCtrls ):
+            tempOnosIp.append( main.ONOSip[ i ] )
+
+        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
+                                       "temp",
+                                       main.Mininet1.ip_address,
+                                       main.apps,
+                                       tempOnosIp )
+
+        main.step( "Apply cell to environment" )
+        cellResult = main.ONOSbench.setCell( "temp" )
+        verifyResult = main.ONOSbench.verifyCell( )
+        stepResult = cellResult and verifyResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully applied cell to " + "environment",
+                                 onfail="Failed to apply cell to environment " )
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.buckBuild()
+        stepResult = packageResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully created ONOS package",
+                                 onfail="Failed to create ONOS package" )
+
+        time.sleep( main.startUpSleep )
+        main.step( "Uninstalling ONOS package" )
+        onosUninstallResult = main.TRUE
+        for ip in main.ONOSip:
+            onosUninstallResult = onosUninstallResult and \
+                    main.ONOSbench.onosUninstall( nodeIp=ip )
+        stepResult = onosUninstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully uninstalled ONOS package",
+                                 onfail="Failed to uninstall ONOS package" )
+        time.sleep( main.startUpSleep )
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.TRUE
+        for i in range( main.numCtrls ):
+            onosInstallResult = onosInstallResult and \
+                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
+        stepResult = onosInstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully installed ONOS package",
+                                 onfail="Failed to install ONOS package" )
+
+        time.sleep( main.startUpSleep )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
+        main.step( "Start ONOS cli" )
+        cliResult = main.TRUE
+        for i in range( main.numCtrls ):
+            cliResult = cliResult and \
+                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
+        stepResult = cliResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully start ONOS cli",
+                                 onfail="Failed to start ONOS cli" )
+
+    def CASE3( self, main ):
+        '''
+            Start Mininet
+        '''
+        import json
+
+        main.case( "Setup mininet and compare ONOS topology view to Mininet topology" )
+        main.caseExplanation = "Start mininet with custom topology and compare topology " +\
+                "elements between Mininet and ONOS"
+
+        main.step( "Setup Mininet Topology" )
+        topology = main.Mininet1.home + '/custom/' + main.topology
+        stepResult = main.Mininet1.startNet( topoFile = topology )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
+
+        main.step( "Assign switch to controller" )
+        stepResult = main.Mininet1.assignSwController( "s1", main.ONOSip[0] )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully assigned switch to controller",
+                                 onfail="Failed to assign switch to controller" )
+
+        time.sleep( main.startMNSleep )
+
+        main.step( "Comparing MN topology to ONOS topology" )
+        main.log.info( "Gathering topology information" )
+        devices = main.topo.getAllDevices( main )
+        hosts = main.topo.getAllHosts( main )
+        ports = main.topo.getAllPorts( main )
+        links = main.topo.getAllLinks( main )
+
+        mnSwitches = main.Mininet1.getSwitches( )
+        mnLinks = main.Mininet1.getLinks( )
+        mnHosts = main.Mininet1.getHosts( )
+
+        for controller in range( main.numCtrls ):
+            controllerStr = str( controller + 1 )
+            if devices[ controller ] and ports[ controller ] and\
+                "Error" not in devices[ controller ] and\
+                "Error" not in ports[ controller ]:
+
+                currentDevicesResult = main.Mininet1.compareSwitches(
+                        mnSwitches,
+                        json.loads( devices[ controller ] ),
+                        json.loads( ports[ controller ] ) )
+            else:
+                currentDevicesResult = main.FALSE
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=currentDevicesResult,
+                                     onpass="ONOS" + controllerStr +
+                                            " Switches view is correct",
+                                     onfail="ONOS" + controllerStr +
+                                            " Switches view is incorrect" )
+            if links[ controller ] and "Error" not in links[ controller ]:
+                currentLinksResult = main.Mininet1.compareLinks(
+                        mnSwitches, mnLinks,
+                        json.loads( links[ controller ] ) )
+            else:
+                currentLinksResult = main.FALSE
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=currentLinksResult,
+                                     onpass="ONOS" + controllerStr +
+                                            " links view is correct",
+                                     onfail="ONOS" + controllerStr +
+                                            " links view is incorrect" )
+
+            if hosts[ controller ] or "Error" not in hosts[ controller ]:
+                currentHostsResult = main.Mininet1.compareHosts(
+                        mnHosts,
+                        json.loads( hosts[ controller ] ) )
+            else:
+                currentHostsResult = main.FALSE
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=currentHostsResult,
+                                     onpass="ONOS" + controllerStr +
+                                            " hosts exist in Mininet",
+                                     onfail="ONOS" + controllerStr +
+                                            " hosts don't match Mininet")
+
+
+    def CASE4( self, main ):
+        '''
+        Testing scapy
+        '''
+        main.case( "Testing scapy" )
+        main.step( "Creating Host1 component" )
+        main.Scapy.createHostComponent( "h1" )
+        main.Scapy.createHostComponent( "h2" )
+        hosts = [ main.h1, main.h2 ]
+        for host in hosts:
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
+            main.log.debug( host.name )
+            main.log.debug( host.hostIp )
+            main.log.debug( host.hostMac )
+
+        main.step( "Sending/Receiving Test packet - Filter doesn't match" )
+        main.log.info( "Starting Filter..." )
+        main.h2.startFilter( )
+        main.log.info( "Building Ether frame..." )
+        main.h1.buildEther( dst=main.h2.hostMac )
+        main.log.info( "Sending Packet..." )
+        main.h1.sendPacket( )
+        main.log.info( "Checking Filter..." )
+        finished = main.h2.checkFilter( )
+        main.log.debug( finished )
+        i = ""
+        if finished:
+            a = main.h2.readPackets( )
+            for i in a.splitlines( ):
+                main.log.info( i )
+        else:
+            kill = main.h2.killFilter( )
+            main.log.debug( kill )
+            main.h2.handle.sendline( "" )
+            main.h2.handle.expect( main.h2.scapyPrompt )
+            main.log.debug( main.h2.handle.before )
+        utilities.assert_equals( expect=True,
+                                 actual="dst=00:00:00:00:00:02 src=00:00:00:00:00:01" in i,
+                                 onpass="Pass",
+                                 onfail="Fail" )
+
+        main.step( "Sending/Receiving Test packet - Filter matches" )
+        main.h2.startFilter( )
+        main.h1.buildEther( dst=main.h2.hostMac )
+        main.h1.buildIP( dst=main.h2.hostIp )
+        main.h1.sendPacket( )
+        finished = main.h2.checkFilter( )
+        i = ""
+        if finished:
+            a = main.h2.readPackets( )
+            for i in a.splitlines( ):
+                main.log.info( i )
+        else:
+            kill = main.h2.killFilter( )
+            main.log.debug( kill )
+            main.h2.handle.sendline( "" )
+            main.h2.handle.expect( main.h2.scapyPrompt )
+            main.log.debug( main.h2.handle.before )
+        utilities.assert_equals( expect=True,
+                                 actual="dst=00:00:00:00:00:02 src=00:00:00:00:00:01" in i,
+                                 onpass="Pass",
+                                 onfail="Fail" )
+
+
+
+        main.step( "Clean up host components" )
+        for host in hosts:
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
+
+    def CASE5( self, main ):
+        '''
+           Adding Group of type "ALL" using Rest api
+        '''
+        import json
+        import time
+        isAdded = main.FALSE
+        main.case( "Verify Group of type All are successfully Added" )
+        main.caseExplanation = " Install a Group of type ALL " +\
+                               " Verify the Group is Added " +\
+                               " Add a flow using the group " +\
+                               " Send a packet that verifies the action bucket of the group"
+
+        main.step( "Add Group using Rest api" )
+        bucketList = []
+        bucket = main.buckets.addBucket( main, egressPort = egressPort1 )
+        bucketList.append( bucket )
+        bucket = main.buckets.addBucket( main, egressPort = egressPort2 )
+        bucketList.append( bucket )
+        bucket = main.buckets.addBucket( main, egressPort = egressPort3 )
+        bucketList.append( bucket )
+        response = main.ONOSrest.addGroup( deviceId = deviceId,
+                                           groupType = type1,
+                                           bucketList = bucketList,
+                                           appCookie = appCookie,
+                                           groupId = groupId )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=response,
+                                 onpass="Successfully added Groups of type ALL",
+                                 onfail="Failed to add Groups of type ALL" )
+
+        # Giving ONOS time to add the group
+        time.sleep( main.addGroupSleep )
+
+        main.step( "Check groups are in ADDED state" )
+
+        response = main.ONOSrest.getGroups( deviceId = deviceId,
+                                            appCookie = appCookie )
+        responsejson = json.loads( response )
+        for item in responsejson :
+            if item["state"] == "ADDED" :
+                isAdded = main.TRUE
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=isAdded,
+                                 onpass="All Group is in Added State",
+                                 onfail="All Group is not in Added State" )
+
+        '''
+           Adding flow using rest api
+        '''
+        isAdded = main.FALSE
+
+        main.step( "Adding flow with Group using rest api" )
+        response = main.ONOSrest.addFlow( deviceId = deviceId,
+                                          priority = priority,
+                                          ingressPort = ingressPort,
+                                          groupId = groupId )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=response,
+                                 onpass="Successfully Added Flows",
+                                 onfail="Failed to Add flows" )
+
+        # Giving ONOS time to add the flow
+        time.sleep( main.addFlowSleep )
+
+        response = main.ONOSrest.getFlows( deviceId = deviceId )
+        responsejson = json.loads( response )
+        for item in responsejson :
+            if item["priority"] == int( priority ) and item["state"] == "ADDED" :
+                isAdded = main.TRUE
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=isAdded,
+                                 onpass="Flow is in Added State",
+                                 onfail="Flow is not in Added State" )
+
+        '''
+        Sends a packet using  scapy
+        '''
+        main.step( "Testing Group by sending packet using  Scapy" )
+        main.log.info( "Creating host components" )
+        main.Scapy.createHostComponent( "h1" )
+        main.Scapy.createHostComponent( "h2" )
+        main.Scapy.createHostComponent( "h3" )
+        main.Scapy.createHostComponent( "h4" )
+
+        hosts = [main.h1, main.h2, main.h3, main.h4]
+        for host in hosts:
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
+        main.log.info( "Constructing Packet" )
+        main.h1.buildEther( dst=main.h1.hostMac )
+        main.h1.buildIP( dst=main.h1.hostIp )
+        main.log.info( "Start Filter on host2,host3,host4" )
+        main.h2.startFilter( pktFilter="ether host %s and ip host %s" % ( main.h1.hostMac, main.h1.hostIp ) )
+        main.h3.startFilter( pktFilter="ether host %s and ip host %s" % ( main.h1.hostMac, main.h1.hostIp ) )
+        main.h4.startFilter( pktFilter="ether host %s and ip host %s" % ( main.h1.hostMac, main.h1.hostIp ) )
+        main.log.info( "sending packet to Host" )
+        main.h1.sendPacket( )
+        main.log.info( "Checking filter for our packet" )
+        stepResultH2 = main.h2.checkFilter( )
+        stepResultH3 = main.h3.checkFilter( )
+        stepResultH4 = main.h4.checkFilter( )
+
+        if stepResultH2:
+            main.log.info( "Packet : %s" % main.h2.readPackets( ) )
+        else:
+            main.h2.killFilter( )
+
+        if stepResultH3:
+            main.log.info( "Packet : %s" % main.h3.readPackets( ) )
+        else:
+            main.h2.killFilter( )
+
+        if stepResultH4:
+            main.log.info( "Packet : %s" % main.h4.readPackets( ) )
+        else:
+            main.h4.killFilter( )
+
+        if stepResultH2 and stepResultH3 and stepResultH4 :
+            main.log.info( "Success!!!Packet sent to port 1 is received at port 2,3 and 4" )
+            stepResult = main.TRUE
+        else:
+            main.log.info( "Failure!!!Packet sent to port 1 is not received at port 2,3 and 4" )
+            stepResult = main.FALSE
+
+        main.log.info( "Clean up host components" )
+        for host in hosts:
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
+        main.Mininet1.removeHostComponent( "h3" )
+        main.Mininet1.removeHostComponent( "h4" )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Packet sent to port 1 is received at port 2,3,4 ",
+                                 onfail="Packet sent to port 1 is not received at port 2,3,4 " )
+
+    def CASE6( self, main ):
+        '''
+         Deleting the Group and Flow
+        '''
+        import json
+        import time
+        respFlowId = 1
+
+        main.case( "Delete the Group and Flow added through Rest api " )
+        main.step( "Deleting Group and Flows" )
+
+        #Get Flow ID
+        response = main.ONOSrest.getFlows( deviceId = deviceId )
+        responsejson = json.loads( response )
+        for item in responsejson :
+            if item["priority"] == int( priority ) :
+                respFlowId = item["id"]
+
+        main.step( "Deleting the created flow by deviceId and flowId" )
+        flowResponse = main.ONOSrest.removeFlow( deviceId = deviceId,
+                                          flowId = respFlowId )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=flowResponse,
+                                 onpass="Deleting flow is successful!!!",
+                                 onfail="Deleting flow is failure!!!" )
+
+        # Giving ONOS time to delete the flow
+        time.sleep( main.delFlowSleep )
+
+        main.step( "Deleting the created group by deviceId and appCookie" )
+        groupResponse = main.ONOSrest.removeGroup( deviceId = deviceId,
+                                                   appCookie = appCookie )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=groupResponse,
+                                 onpass="Deleting Group is successful!!!",
+                                 onfail="Deleting Group is failure!!!" )
+
+        # Giving ONOS time to delete the group
+        time.sleep( main.delGroupSleep )
+
+    def CASE7( self, main ):
+        '''
+           Adding Group of type "INDIRECT" using Rest api.
+        '''
+        import json
+        import time
+        isAdded = main.FALSE
+
+        main.case( "Verify Group of type INDIRECT are successfully Added" )
+        main.caseExplanation = " Install a Group of type INDIRECT " +\
+                               " Verify the Group is Added " +\
+                               " Add a flow using the group " +\
+                               " Send a packet that verifies the action bucket of the group"
+
+        main.step( "Add Group using Rest api" )
+        bucketList = []
+        bucket = main.buckets.addBucket( main, egressPort = egressPort1 )
+        bucketList.append( bucket )
+        response = main.ONOSrest.addGroup( deviceId = deviceId,
+                                           groupType = type2,
+                                           bucketList = bucketList,
+                                           appCookie = appCookie,
+                                           groupId = groupId )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=response,
+                                 onpass="Successfully added Groups of type INDIRECT",
+                                 onfail="Failed to add Groups of type INDIRECT" )
+
+        # Giving ONOS time to add the group
+        time.sleep( main.addGroupSleep )
+
+        main.step( "Check groups are in ADDED state" )
+
+        response = main.ONOSrest.getGroups( deviceId = deviceId,
+                                            appCookie = appCookie )
+        responsejson = json.loads( response )
+        for item in responsejson :
+            if item["state"] == "ADDED" :
+                isAdded = main.TRUE
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=isAdded,
+                                 onpass="INDIRECT Group is in Added State",
+                                 onfail="INDIRECT Group is not in Added State" )
+
+        '''
+           Adding flows using rest api
+        '''
+        isAdded = main.FALSE
+
+        main.step( "Adding flow with Group using rest api" )
+        response = main.ONOSrest.addFlow( deviceId = deviceId,
+                                          priority = priority,
+                                          ingressPort = ingressPort,
+                                          groupId = groupId )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=response,
+                                 onpass="Successfully Added Flows",
+                                 onfail="Failed to Add flows" )
+
+        # Giving ONOS time to add the flow
+        time.sleep( main.addFlowSleep )
+
+        response = main.ONOSrest.getFlows( deviceId = deviceId )
+        responsejson = json.loads( response )
+        for item in responsejson :
+            if item["priority"] == int( priority ) and item["state"] == "ADDED" :
+                isAdded = main.TRUE
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=isAdded,
+                                 onpass="Flow is in Added State",
+                                 onfail="Flow is not in Added State" )
+
+        '''
+        Sends a packet using scapy
+        '''
+        main.step( "Testing Group by sending packet using  Scapy" )
+        main.log.info( "Creating host components" )
+        main.Scapy.createHostComponent( "h1" )
+        main.Scapy.createHostComponent( "h2" )
+
+        hosts = [main.h1, main.h2]
+        for host in hosts:
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
+        main.log.info( "Constructing Packet" )
+        main.h1.buildEther( dst=main.h1.hostMac )
+        main.h1.buildIP( dst=main.h1.hostIp )
+        main.log.info( "Start Filter on host2" )
+        main.h2.startFilter( pktFilter="ether host %s and ip host %s" % ( main.h1.hostMac, main.h1.hostIp ) )
+        main.log.info( "sending packet to Host" )
+        main.h1.sendPacket( )
+        main.log.info( "Checking filter for our packet" )
+        stepResultH2 = main.h2.checkFilter( )
+
+        if stepResultH2:
+            main.log.info( "Packet : %s" % main.h2.readPackets( ) )
+        else:
+            main.h2.killFilter( )
+
+        main.log.info( "Clean up host components" )
+        for host in hosts:
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResultH2,
+                                 onpass="Packet sent to port 1 is received at port 2 successfully!!!",
+                                 onfail="Failure!!!Packet sent to port 1 is not received at port 2" )
+
+    def CASE8( self, main ):
+        '''
+         Deleting the Group and Flow
+        '''
+        import json
+        import time
+        respFlowId = 1
+
+        main.case( "Delete the Group and Flow added through Rest api " )
+        main.step( "Deleting Group and Flows" )
+
+        #Getting Flow ID
+        response = main.ONOSrest.getFlows( deviceId = deviceId )
+        responsejson = json.loads( response )
+        for item in responsejson :
+            if item["priority"] == int( priority ) :
+                respFlowId = item["id"]
+
+        main.step( "Deleting the created flow by deviceId and flowId" )
+        flowResponse = main.ONOSrest.removeFlow( deviceId = deviceId,
+                                          flowId = respFlowId )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=flowResponse,
+                                 onpass="Deleting flow is successful!!!",
+                                 onfail="Deleting flow is failure!!!" )
+
+        # Giving ONOS time to delete the flow
+        time.sleep( main.delFlowSleep )
+
+        groupResponse = main.ONOSrest.removeGroup( deviceId = deviceId,
+                                          appCookie = appCookie )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=groupResponse,
+                                 onpass="Deleting Group is successful!!!",
+                                 onfail="Deleting Group is failure!!!" )
+
+        # Giving ONOS time to delete the group
+        time.sleep( main.delGroupSleep )
+
+    def CASE100( self, main ):
+        '''
+            Report errors/warnings/exceptions
+        '''
+        main.log.info( "Error report: \n" )
+        main.ONOSbench.logReport( main.ONOSip[ 0 ],
+                                  [ "INFO",
+                                    "FOLLOWER",
+                                    "WARN",
+                                    "flow",
+                                    "group",
+                                    "ERROR",
+                                    "Except" ],
+                                  "s" )
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo
new file mode 100644
index 0000000..50e5d63
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo
@@ -0,0 +1,54 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>localhost</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+                <nodes>3</nodes>
+            </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>localhost</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOScli1>
+
+        <Mininet1>
+            <host>OCN</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </Mininet1>
+
+        <ONOSrest>
+            <host>OC1</host>
+            <port>8181</port>
+            <user>onos</user>
+            <password>rocks</password>
+            <type>OnosRestDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOSrest>
+
+        <Scapy>
+            <host>OCN</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>ScapyCliDriver</type>
+            <connect_order>7</connect_order>
+        </Scapy>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/FUNC/FUNCgroup/README b/TestON/tests/FUNC/FUNCgroup/README
new file mode 100644
index 0000000..ac903d7
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/README
@@ -0,0 +1,43 @@
+FUNCgroup test suite
+
+Summary:
+
+        The purpose of this test suite is to test the Group Subsystem.
+        As part of this test, we are testing the functionality of the Group Subsystem.
+        Install a group of type ‘ALL’ whose bucket will have treatments of type ‘OUTPUT’ to port 2,3, and 4 respectively.
+        Install a flow which will have selector criteria IN_PORT as port 1 and Instructions as type ‘Group’ with the Group Id already created.
+        Verify when port 1 receives any packet, it should follow the actions which are mentioned in the Group and send the packet to port 2, 3 and 4.
+
+Topology:
+        The topology consists of one switch with four hosts connected to it.
+
+Required:
+        Ths test requires Mininet topology file topo-group.py located in the dependencies folder.
+        You will also need to install the Python module, Scapy.
+
+Test Description:
+    # CASE - Description
+    # 1    - Variable initialization and optional pull and build ONOS package
+    # 2    - install ONOS
+    # 3    - Start mininet and verify topology
+    # 4    - Testing Scapy
+    # 5    - Testing GROUP with type "ALL"
+             # 5.1 - Adds a Group with type ‘ALL’ and whose bucket will have treatments as type ‘OUTPUT’
+                     to port 2, 3,  4 respectively and verify if the Group was added correctly.
+             # 5.2 - Adds a flow with selector criteria as IN_PORT 1 and Instructions as type ‘Group’
+                     with GroupId already created and tests if the flow was added correctly.
+             # 5.3 - Sends a packet using SCAPY to port 1 of the device and check whether the
+                     same packet was received at port 2, 3, and 4 of the device.
+    # 6    - Deleting the Group and Flow
+    # 7    - Testing GROUP with type "INDIRECT"
+             # 7.1 - Adds a Group with type ‘INDIRECT’ and whose bucket will have treatments
+                     as type ‘OUTPUT’ to port 2 respectively and verify  if the Group was added correctly
+             # 7.2 - Adds a flow with selector criteria as IN_PORT 1 and Instructions as  type ‘Group’
+                     with GroupId already created and tests if the flow was added correctly.
+             # 7.3 - Sends a packet using SCAPY to port 1 of the device and check whether
+                     the same packet was received at port 2 of the device.
+    # 8    - Deleting the group and flow
+
+
+Scapy install:
+    sudo apt-get install Scapy
diff --git a/TestON/tests/FUNC/FUNCgroup/__init__.py b/TestON/tests/FUNC/FUNCgroup/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/__init__.py
diff --git a/TestON/tests/FUNC/FUNCgroup/dependencies/group-bucket.py b/TestON/tests/FUNC/FUNCgroup/dependencies/group-bucket.py
new file mode 100644
index 0000000..290a26a
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/dependencies/group-bucket.py
@@ -0,0 +1,31 @@
+def addBucket( main , egressPort = "" ):
+       """
+       Description:
+            Create a single bucket which can be added to a Group.
+       Optional:
+            * egressPort: port of egress device
+       Returns:
+            * Returns a Bucket
+            * Returns None in case of error
+       Note:
+            The ip and port option are for the requests input's ip and port
+            of the ONOS node.
+       """
+       try:
+
+           bucket = {
+                        "treatment":{ "instructions":[] }
+                    }
+           if egressPort:
+               bucket[ 'treatment' ][ 'instructions' ].append( {
+                                                        "type":"OUTPUT",
+                                                        "port":egressPort } )
+           return bucket
+
+       except ( AttributeError, TypeError ):
+           main.log.exception( self.name + ": Object not as expected" )
+           return None
+       except Exception:
+           main.log.exception( self.name + ": Uncaught exception!" )
+           main.cleanup()
+           main.exit()
diff --git a/TestON/tests/FUNC/FUNCgroup/dependencies/startUp.py b/TestON/tests/FUNC/FUNCgroup/dependencies/startUp.py
new file mode 100644
index 0000000..bf2a2b6
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/dependencies/startUp.py
@@ -0,0 +1,38 @@
+"""
+    This wrapper function is use for starting up onos instance
+"""
+
+import time
+import os
+import json
+
+def onosBuild( main, gitBranch ):
+    """
+        This includes pulling ONOS and building it using maven install
+    """
+
+    buildResult = main.FALSE
+
+    # Git checkout a branch of ONOS
+    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
+    # Does the git pull on the branch that was checked out
+    if not checkOutResult:
+        main.log.warn( "Failed to checked out " + gitBranch +
+                                           " branch")
+    else:
+        main.log.info( "Successfully checked out " + gitBranch +
+                                           " branch")
+    gitPullResult = main.ONOSbench.gitPull()
+    if gitPullResult == main.ERROR:
+        main.log.error( "Error pulling git branch" )
+    else:
+        main.log.info( "Successfully pulled " + gitBranch + " branch" )
+
+    # Maven clean install
+    buildResult = main.ONOSbench.cleanInstall()
+
+    return buildResult
+
+
+
+
diff --git a/TestON/tests/FUNC/FUNCgroup/dependencies/topo-group.py b/TestON/tests/FUNC/FUNCgroup/dependencies/topo-group.py
new file mode 100644
index 0000000..14e28e5
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/dependencies/topo-group.py
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+
+"""
+Custom topology for Mininet
+"""
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import Host, RemoteController
+from mininet.node import Node
+from mininet.node import CPULimitedHost
+from mininet.link import TCLink
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.util import dumpNodeConnections
+from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
+
+class MyTopo( Topo ):
+
+    def __init__( self, **opts ):
+        # Initialize topology
+        Topo.__init__( self, **opts)
+
+        # IPv4 hosts
+        host1=self.addHost( 'h1', ip='10.0.0.1/24' )
+        host2=self.addHost( 'h2', ip='10.0.0.2/24' )
+        host3=self.addHost( 'h3', ip='10.0.0.3/24' )
+        host4=self.addHost( 'h4', ip='10.0.0.4/24' )
+
+        s1 = self.addSwitch( 's1' )
+
+        self.addLink(s1, host1)
+        self.addLink(s1, host2)
+        self.addLink(s1, host3)
+        self.addLink(s1, host4)
+
+        topos = { 'mytopo': ( lambda: MyTopo() ) }
+
+def setupNetwork():
+    "Create network"
+    topo = MyTopo()
+    network = Mininet(topo=topo, autoSetMacs=True, autoStaticArp=True, controller=None)
+    network.start()
+    CLI( network )
+    network.stop()
+
+if __name__ == '__main__':
+    setLogLevel('info')
+    #setLogLevel('debug')
+    setupNetwork()
diff --git a/TestON/tests/FUNC/FUNCgroup/dependencies/topo.py b/TestON/tests/FUNC/FUNCgroup/dependencies/topo.py
new file mode 100644
index 0000000..b44e3fc
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/dependencies/topo.py
@@ -0,0 +1,100 @@
+"""
+    These functions can be used for topology comparisons
+"""
+
+import time
+import os
+import json
+
+def getAllDevices( main ):
+    """
+        Return a list containing the devices output from each ONOS node
+    """
+    devices = []
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].devices,
+                         name="devices-" + str( i ),
+                         args=[ ] )
+        threads.append( t )
+        t.start()
+
+    for t in threads:
+        t.join()
+        devices.append( t.result )
+    return devices
+
+def getAllHosts( main ):
+    """
+        Return a list containing the hosts output from each ONOS node
+    """
+    hosts = []
+    ipResult = main.TRUE
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].hosts,
+                         name="hosts-" + str( i ),
+                         args=[ ] )
+        threads.append( t )
+        t.start()
+
+    for t in threads:
+        t.join()
+        hosts.append( t.result )
+    return hosts
+
+def getAllPorts( main ):
+    """
+        Return a list containing the ports output from each ONOS node
+    """
+    ports = []
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].ports,
+                         name="ports-" + str( i ),
+                         args=[ ] )
+        threads.append( t )
+        t.start()
+
+    for t in threads:
+        t.join()
+        ports.append( t.result )
+    return ports
+
+def getAllLinks( main ):
+    """
+        Return a list containing the links output from each ONOS node
+    """
+    links = []
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].links,
+                         name="links-" + str( i ),
+                         args=[ ] )
+        threads.append( t )
+        t.start()
+
+    for t in threads:
+        t.join()
+        links.append( t.result )
+    return links
+
+def getAllClusters( main ):
+    """
+        Return a list containing the clusters output from each ONOS node
+    """
+    clusters = []
+    threads = []
+    for i in range( main.numCtrls ):
+        t = main.Thread( target=main.CLIs[i].clusters,
+                         name="clusters-" + str( i ),
+                         args=[ ] )
+        threads.append( t )
+        t.start()
+
+    for t in threads:
+        t.join()
+        clusters.append( t.result )
+    return clusters
+
+
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 1371453..6297464 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -205,6 +205,14 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         time.sleep( main.startUpSleep )
         main.step( "Starting ONOS service" )
         stopResult = main.TRUE
@@ -229,14 +237,6 @@
                                  onpass="ONOS service is ready on all nodes",
                                  onfail="ONOS service did not start properly on all nodes" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
@@ -1119,6 +1119,42 @@
                                  actual=testResult,
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
+
+        main.step("Protected: Add point intents between h1 and h9")
+        main.assertReturnString = "Assertion Result for protected point intent\n"
+        senders = [
+            {"name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01"}
+        ]
+        recipients = [
+            {"name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09"}
+        ]
+        testResult = main.FALSE
+        installResult = main.intentFunction.installPointIntent(
+            main,
+            name="Protected",
+            senders=senders,
+            recipients=recipients,
+            protected=True )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                main,
+                name="Protected",
+                intentId=installResult,
+                senders=senders,
+                recipients=recipients,
+                sw1="s5",
+                sw2="s2",
+                protected=True,
+                expectedLink=18 )
+        else:
+            main.CLIs[ 0 ].removeAllIntents( purge=True )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
+
         main.step( "IPV4_2: Add point intents between h1 and h9" )
         main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
         senders = [
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 1760324..d8a0e36 100755
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -309,6 +309,7 @@
                         ethType="",
                         bandwidth="",
                         lambdaAlloc=False,
+                        protected=False,
                         ipProto="",
                         ipSrc="",
                         ipDst="",
@@ -397,6 +398,7 @@
                                             ethDst=dstMac,
                                             bandwidth=bandwidth,
                                             lambdaAlloc=lambdaAlloc,
+                                            protected=protected,
                                             ipProto=ipProto,
                                             ipSrc=ipSrc,
                                             ipDst=ipDst,
@@ -423,6 +425,7 @@
                 main.assertReturnString += 'Encapsulation intents check Passed\n'
             else:
                 main.assertReturnString += 'Encapsulation intents check failed\n'
+
         if flowDuration( main ):
             main.assertReturnString += 'Flow duration check Passed\n'
             return intentId
@@ -972,6 +975,7 @@
                      ethType="",
                      bandwidth="",
                      lambdaAlloc=False,
+                     protected=False,
                      ipProto="",
                      ipAddresses="",
                      tcp="",
@@ -1109,6 +1113,21 @@
             main.assertReturnString += 'Link Down Failed\n'
             testResult = main.FALSE
 
+        if protected:
+            # Check Connection
+            if utilities.retry(f=scapyCheckConnection, retValue=main.FALSE,
+                               args=(main, senderNames, recipientNames, vlanId, useTCP) ):
+                main.assertReturnString += 'Link down Scapy Packet Received Passed\n'
+            else:
+                main.assertReturnString += 'Link down Scapy Packet Recieved Failed\n'
+                testResult = main.FALSE
+
+            if ProtectedIntentCheck( main ):
+                main.assertReturnString += 'Protected Intent Check Passed\n'
+            else:
+                main.assertReturnString += 'Protected Intent Check Failed\n'
+                testResult = main.FALSE
+
         # Check intent state
         if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
             main.assertReturnString += 'Link Down Intent State Passed\n'
@@ -1996,4 +2015,11 @@
     if pop == totalflows and push == totalflows:
         return main.TRUE
     else:
-        return main.FALSE
\ No newline at end of file
+        return main.FALSE
+
+def ProtectedIntentCheck( main ):
+    import json
+    intent = main.CLIs[ 0 ].intents( jsonFormat=False )
+    if "Protection" in intent:
+        return main.TRUE
+    return main.FALSE
\ No newline at end of file
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index dc8df66..71bf286 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -230,6 +230,14 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         time.sleep( main.startUpSleep )
         main.step( "Starting ONOS service" )
         stopResult = main.TRUE
@@ -259,14 +267,6 @@
         # supported by the Rest API remove this when Leader Checking is supported
         # by the REST API
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
@@ -1173,6 +1173,39 @@
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
+        # main.step( "Protected: Add point intents between h1 and h9" )
+        # main.assertReturnString = "Assertion Result for protected point intent\n"
+        # senders = [
+        #     { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
+        # ]
+        # recipients = [
+        #     { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
+        # ]
+        # testResult = main.FALSE
+        # installResult = main.intentFunction.installPointIntent(
+        #     main,
+        #     name="Protected",
+        #     senders=senders,
+        #     recipients=recipients,
+        #     protected=True )
+        # 
+        # if installResult:
+        #     testResult = main.intentFunction.testPointIntent(
+        #         main,
+        #         name="Protected",
+        #         intentId=installResult,
+        #         senders=senders,
+        #         recipients=recipients,
+        #         sw1="s5",
+        #         sw2="s2",
+        #         protected=True,
+        #         expectedLink=18 )
+        #
+        # utilities.assert_equals( expect=main.TRUE,
+        #                          actual=testResult,
+        #                          onpass=main.assertReturnString,
+        #                          onfail=main.assertReturnString )
+
         main.step( "IPV4_2: Add point intents between h1 and h9" )
         main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
         senders = [
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 088d38d..8fa65f2 100755
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -305,6 +305,7 @@
                         ethType="",
                         bandwidth="",
                         lambdaAlloc=False,
+                        protected=False,
                         ipProto="",
                         ipSrc="",
                         ipDst="",
@@ -394,6 +395,7 @@
                                             ethDst=dstMac,
                                             bandwidth=bandwidth,
                                             lambdaAlloc=lambdaAlloc,
+                                            protected=protected,
                                             ipProto=ipProto,
                                             ipSrc=ipSrc,
                                             ipDst=ipDst,
@@ -436,6 +438,7 @@
                      ethType="",
                      bandwidth="",
                      lambdaAlloc=False,
+                     protected=False,
                      ipProto="",
                      ipAddresses="",
                      tcp="",
@@ -575,6 +578,21 @@
             main.assertReturnString += 'Link Down Failed\n'
             testResult = main.FALSE
 
+        if protected:
+            # Check Connection
+            if utilities.retry(f=scapyCheckConnection, retValue=main.FALSE,
+                               args=(main, senderNames, recipientNames, vlanId, useTCP)):
+                main.assertReturnString += 'Link down Scapy Packet Received Passed\n'
+            else:
+                main.assertReturnString += 'Link down Scapy Packet Recieved Failed\n'
+                testResult = main.FALSE
+
+            if ProtectedIntentCheck(main):
+                main.assertReturnString += 'Protected Intent Check Passed\n'
+            else:
+                main.assertReturnString += 'Protected Intent Check Failed\n'
+                testResult = main.FALSE
+
         # Check intent state
         if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
             main.assertReturnString += 'Link Down Intent State Passed\n'
@@ -1731,3 +1749,11 @@
     else:
         return main.FALSE
     return main.TRUE
+
+def ProtectedIntentCheck( main ):
+    intent = main.RESTs[ 0 ].intents()
+    main.log.debug(intent)
+    main.stop()
+    if "Protection" in intent:
+        return main.TRUE
+    return main.FALSE
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
index 8694a0d..d13762e 100755
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
@@ -196,6 +196,14 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         time.sleep( main.startUpSleep )
         main.step( "Starting ONOS service" )
         stopResult = main.TRUE
@@ -222,14 +230,6 @@
                                  onpass="ONOS service is ready",
                                  onfail="ONOS service did not start properly" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
@@ -258,7 +258,7 @@
 
         main.step( "setup the ipv6NeighbourDiscovery" )
         cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.incubator.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" )
-        cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
+        cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "useIpv6ND", "true" )
         cfgResult = cfgResult1 and cfgResult2
         utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
                                 onpass="ipv6NeighborDiscovery cfg is set to true",
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
index edca254..863d406 100755
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
@@ -1794,7 +1794,7 @@
     getDataResult = main.TRUE
     main.log.info( "Activating reactive forwarding app " )
     activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
-    main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true")
+    main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "useIpv6ND", "true")
     main.CLIs[ 0 ].setCfg( "org.onosproject.incubator.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" )
     main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true")
     main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true")
diff --git a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
index 8b145ab..7154a28 100644
--- a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
@@ -214,6 +214,14 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         time.sleep( main.startUpSleep )
         main.step( "Starting ONOS service" )
         stopResult = main.TRUE
@@ -243,14 +251,6 @@
         # supported by the Rest API remove this when Leader Checking is supported
         # by the REST API
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
index a97b2eb..27ead3e 100644
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
@@ -58,7 +58,7 @@
     main.cfgJson = '{ "devices":{ "netconf:'+ main.configDeviceIp + ":" +\
                     main.configDevicePort + '":' + '{ "basic":{ "driver":"'+\
                     main.configDriver + '" } } }, "apps": { "' +\
-                    main.configApps + '":{ "devices":[ { "name":' +\
+                    main.configApps + '":{ "devices":[ { "username":' +\
                     main.configName + ', "password":' + main.configPass +\
                     ', "ip":"' + main.configDeviceIp + '", "port":' +\
                     main.configPort + '} ] } } }'
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconfConfig.json b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconfConfig.json
index fc5a231..a0079e4 100644
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconfConfig.json
+++ b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconfConfig.json
@@ -4,7 +4,7 @@
             "devices": [
                 {
                     "ip": "10.128.50.10",
-                    "name": "sdn",
+                    "username": "sdn",
                     "password": "rocks",
                     "port": 830
                 }
diff --git a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
index c85d39e..08c0aaa 100644
--- a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
+++ b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
@@ -185,6 +185,14 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         time.sleep( main.startUpSleep )
         main.step( "Starting ONOS service" )
         stopResult = main.TRUE
@@ -209,14 +217,6 @@
                                  onpass="ONOS service is ready on all nodes",
                                  onfail="ONOS service did not start properly on all nodes" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
diff --git a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
index 5ff2606..3563efb 100644
--- a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
+++ b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
@@ -130,6 +130,14 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.nodes[ i ].ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         time.sleep( main.startUpSleep )
         main.step("Starting ONOS service")
         stopResult = main.TRUE
@@ -152,14 +160,6 @@
                                  onpass="ONOS service is ready on all nodes",
                                  onfail="ONOS service did not start properly on all nodes" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.ONOScli1.startOnosCli( main.nodes[ 0 ].ip_address )
         utilities.assert_equals( expect=main.TRUE, actual=cliResults,
diff --git a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
index 9545a4e..81eb698 100644
--- a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
+++ b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
@@ -144,6 +144,12 @@
                                 onfail="ONOS install failed" )
         time.sleep( main.startUpSleep )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.ONOSbench.onosSecureSSH( node=main.nodes[0].ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
 
         for i in range( 2 ):
@@ -155,12 +161,6 @@
                      onfail="ONOS startup failed" )
         time.sleep( main.startUpSleep )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.ONOSbench.onosSecureSSH( node=main.nodes[0].ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
 
         print main.nodes[0].ip_address
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
index fba0007..1112aa8 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
@@ -208,6 +208,14 @@
                                  onpass="ONOS install successful",
                                  onfail="ONOS install failed" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for node in main.nodes:
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
@@ -222,14 +230,6 @@
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for node in main.nodes:
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
@@ -292,10 +292,10 @@
             for app in apps:
                 state = main.CLIs[ 0 ].appStatus( app )
                 if state == "ACTIVE":
-                    activateResult = activeResult and True
+                    activateResult = activateResult and True
                 else:
                     main.log.error( "{} is in {} state".format( app, state ) )
-                    activeResult = False
+                    activateResult = False
             utilities.assert_equals( expect=True,
                                      actual=activateResult,
                                      onpass="Successfully activated apps",
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
index 6f53489..f7aec3b 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
@@ -233,6 +233,14 @@
             main.cleanup()
             main.exit()
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for node in main.nodes:
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
@@ -247,14 +255,6 @@
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for node in main.nodes:
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
@@ -317,10 +317,10 @@
             for app in apps:
                 state = main.CLIs[ 0 ].appStatus( app )
                 if state == "ACTIVE":
-                    activateResult = activeResult and True
+                    activateResult = activateResult and True
                 else:
                     main.log.error( "{} is in {} state".format( app, state ) )
-                    activeResult = False
+                    activateResult = False
             utilities.assert_equals( expect=True,
                                      actual=activateResult,
                                      onpass="Successfully activated apps",
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.py b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
index a579cff..336f0f1 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
@@ -180,6 +180,8 @@
         handle = main.ONOSbench.handle
         handle.sendline( "sed -i -e 's/^respawn$/#respawn/g' tools/package/init/onos.conf" )
         handle.expect( "\$" )  # $ from the command
+        handle.sendline( "sed -i -e 's/^Restart=always/Restart=no/g' tools/package/init/onos.service" )
+        handle.expect( "\$" )  # $ from the command
         handle.expect( "\$" )  # $ from the prompt
 
         # GRAPHS
@@ -240,6 +242,14 @@
             main.cleanup()
             main.exit()
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for node in main.nodes:
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
@@ -254,14 +264,6 @@
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for node in main.nodes:
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
@@ -292,6 +294,7 @@
 
         main.step( "Clean up ONOS service changes" )
         handle.sendline( "git checkout -- tools/package/init/onos.conf" )
+        handle.sendline( "git checkout -- tools/package/init/onos.service" )
         handle.expect( "\$" )
 
         main.step( "Checking ONOS nodes" )
@@ -328,10 +331,10 @@
             for app in apps:
                 state = main.CLIs[ 0 ].appStatus( app )
                 if state == "ACTIVE":
-                    activateResult = activeResult and True
+                    activateResult = activateResult and True
                 else:
                     main.log.error( "{} is in {} state".format( app, state ) )
-                    activeResult = False
+                    activateResult = False
             utilities.assert_equals( expect=True,
                                      actual=activateResult,
                                      onpass="Successfully activated apps",
diff --git a/TestON/tests/HA/HAsanity/HAsanity.py b/TestON/tests/HA/HAsanity/HAsanity.py
index feb69bf..32b7e14 100644
--- a/TestON/tests/HA/HAsanity/HAsanity.py
+++ b/TestON/tests/HA/HAsanity/HAsanity.py
@@ -209,6 +209,14 @@
                                  onpass="ONOS install successful",
                                  onfail="ONOS install failed" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for node in main.nodes:
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
@@ -223,14 +231,6 @@
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for node in main.nodes:
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
@@ -293,10 +293,10 @@
             for app in apps:
                 state = main.CLIs[ 0 ].appStatus( app )
                 if state == "ACTIVE":
-                    activateResult = activeResult and True
+                    activateResult = activateResult and True
                 else:
                     main.log.error( "{} is in {} state".format( app, state ) )
-                    activeResult = False
+                    activateResult = False
             utilities.assert_equals( expect=True,
                                      actual=activateResult,
                                      onpass="Successfully activated apps",
diff --git a/TestON/tests/HA/HAscaling/HAscaling.py b/TestON/tests/HA/HAscaling/HAscaling.py
index 2bc1d13..112306a 100644
--- a/TestON/tests/HA/HAscaling/HAscaling.py
+++ b/TestON/tests/HA/HAscaling/HAscaling.py
@@ -273,6 +273,15 @@
                             path,
                             direction="to" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( main.numCtrls ):
+            node = main.nodes[i]
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
@@ -288,14 +297,6 @@
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for node in main.nodes:
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
@@ -1898,6 +1899,7 @@
             onosIsupResult = main.TRUE
             for i in main.activeNodes:
                 node = main.nodes[i]
+                main.ONOSbench.onosSecureSSH( node=node.ip_address )
                 started = main.ONOSbench.isup( node.ip_address )
                 if not started:
                     main.log.error( node.name + " didn't start!" )
diff --git a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index 702b09e..4d8eedc 100644
--- a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -198,6 +198,14 @@
                                  onpass="ONOS install successful",
                                  onfail="ONOS install failed" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for node in main.nodes:
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
@@ -212,14 +220,6 @@
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for node in main.nodes:
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
@@ -282,10 +282,10 @@
             for app in apps:
                 state = main.CLIs[ 0 ].appStatus( app )
                 if state == "ACTIVE":
-                    activateResult = activeResult and True
+                    activateResult = activateResult and True
                 else:
                     main.log.error( "{} is in {} state".format( app, state ) )
-                    activeResult = False
+                    activateResult = False
             utilities.assert_equals( expect=True,
                                      actual=activateResult,
                                      onpass="Successfully activated apps",
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.py b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
index ddf9b2a..b6a74e5 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
@@ -233,6 +233,14 @@
             main.cleanup()
             main.exit()
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for node in main.nodes:
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
@@ -247,14 +255,6 @@
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for node in main.nodes:
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
@@ -317,10 +317,10 @@
             for app in apps:
                 state = main.CLIs[ 0 ].appStatus( app )
                 if state == "ACTIVE":
-                    activateResult = activeResult and True
+                    activateResult = activateResult and True
                 else:
                     main.log.error( "{} is in {} state".format( app, state ) )
-                    activeResult = False
+                    activateResult = False
             utilities.assert_equals( expect=True,
                                      actual=activateResult,
                                      onpass="Successfully activated apps",
diff --git a/TestON/tests/HA/HAswapNodes/HAswapNodes.py b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
index 60dff34..1be977a 100644
--- a/TestON/tests/HA/HAswapNodes/HAswapNodes.py
+++ b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
@@ -267,6 +267,15 @@
                             path,
                             direction="to" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( main.numCtrls ):
+            node = main.nodes[i]
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onosIsupResult = main.TRUE
@@ -282,14 +291,6 @@
                                  onpass="ONOS startup successful",
                                  onfail="ONOS startup failed" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for node in main.nodes:
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Starting ONOS CLI sessions" )
         cliResults = main.TRUE
         threads = []
@@ -1886,6 +1887,7 @@
             onosIsupResult = main.TRUE
             for i in main.activeNodes:
                 node = main.nodes[i]
+                main.ONOSbench.onosSecureSSH( node=node.ip_address )
                 started = main.ONOSbench.isup( node.ip_address )
                 if not started:
                     main.log.error( node.name + " didn't start!" )
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
index ef2a46a..f35fb67 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
@@ -32,7 +32,7 @@
     </CASE0>
 
     <CASE1>
-        <NodeList>OC1,OC2,OC3</NodeList>
+        <NodeList>OC1</NodeList>
         <SleepTimers>
             <onosStartup>60</onosStartup>
             <onosCfg>5</onosCfg>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
index 3ad2f30..ce01cdd 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
@@ -68,33 +68,23 @@
         main.onosCfgSleep = float( main.params['CASE1']['SleepTimers']['onosCfg'] )
         main.mnStartupSleep = float( main.params['CASE1']['SleepTimers']['mnStartup'] )
         main.mnCfgSleep = float( main.params['CASE1']['SleepTimers']['mnCfg'] )
+        main.numCtrls = int( main.params['CASE10']['numNodes'] )
+        main.AllONOSip = main.ONOSbench.getOnosIps()
+        main.ONOSip = []
+        for i in range( main.numCtrls ):
+            main.ONOSip.append( main.AllONOSip[i] )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=main.TRUE,
                                  onpass="Successfully construct " +
                                         "test variables ",
                                  onfail="Failed to construct test variables" )
 
-
-
-        main.step( "Uninstall all onos nodes in the env.")
-        stepResult = main.TRUE
-        for node in main.nodeList:
-            nodeResult = main.ONOSbench.onosUninstall( nodeIp = "$" + node )
-            stepResult = stepResult & nodeResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstall onos on all nodes in env.",
-                                 onfail="Failed to uninstall onos on all nodes in env!" )
-        if not stepResult:
-            main.log.error( "Failure to clean test env. Exiting test..." )
-            main.exit()
-
     def CASE2( self, main ):
         '''
             Report errors/warnings/exceptions
         '''
         main.log.info("Error report: \n" )
-        main.ONOSbench.logReport( main.ONOScli1.ip_address,
+        main.ONOSbench.logReport( main.ONOSip[0],
                                   [ "INFO",
                                     "FOLLOWER",
                                     "WARN",
@@ -113,16 +103,9 @@
 
         import time
 
-        numNodes = int( main.params['CASE10']['numNodes'] )
-        main.case( "Start up " + str( numNodes ) + "-node onos cluster.")
-
+        main.case( "Start up " + str( main.numCtrls ) + "-node onos cluster.")
         main.step( "Start ONOS cluster with basic (drivers) app.")
-        onosClusterIPs = []
-        for n in range( 1, numNodes + 1 ):
-            handle = "main.ONOScli" + str( n )
-            onosClusterIPs.append( eval( handle ).ip_address )
-
-        stepResult = main.ONOSbench.startBasicONOS(nodeList = onosClusterIPs, opSleep = 200 )
+        stepResult = main.ONOSbench.startBasicONOS( nodeList=main.ONOSip, opSleep=200 )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully started basic ONOS cluster ",
@@ -130,9 +113,9 @@
 
         main.step( "Establishing Handles on ONOS CLIs.")
         cliResult = main.TRUE
-        for n in range( 1, numNodes + 1 ):
+        for n in range( 1, main.numCtrls + 1 ):
             handle = "main.ONOScli" + str( n )
-            cliResult = cliResult & ( eval( handle ).startCellCli() )
+            cliResult = cliResult & ( eval( handle ).startOnosCli( main.ONOSip[ n-1 ] ) )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=cliResult,
                                  onpass="Successfully started onos cli's ",
@@ -196,10 +179,9 @@
 
         main.step( "Assign switches to controllers.")
         assignResult = main.TRUE
-        onosNodes = [ main.ONOScli1.ip_address ]
         for i in range(1, 8):
             assignResult = assignResult & main.Mininet1.assignSwController( sw="s" + str( i ),
-                                                         ip=onosNodes,
+                                                         ip=main.ONOSip,
                                                          port='6653' )
         time.sleep(main.mnCfgSleep)
         utilities.assert_equals( expect=main.TRUE,
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
index 4fee9ff..cda1ed6 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
@@ -17,7 +17,7 @@
         </ONOSbench>
 
         <ONOScli1>
-            <host>OC1</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index 90bfb14..3673622 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
@@ -68,33 +68,23 @@
         main.onosCfgSleep = float( main.params['CASE1']['SleepTimers']['onosCfg'] )
         main.mnStartupSleep = float( main.params['CASE1']['SleepTimers']['mnStartup'] )
         main.mnCfgSleep = float( main.params['CASE1']['SleepTimers']['mnCfg'] )
+        main.numCtrls = int( main.params['CASE10']['numNodes'] )
+        main.AllONOSip = main.ONOSbench.getOnosIps()
+        main.ONOSip = []
+        for i in range( main.numCtrls ):
+            main.ONOSip.append( main.AllONOSip[i] )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=main.TRUE,
                                  onpass="Successfully construct " +
                                         "test variables ",
                                  onfail="Failed to construct test variables" )
 
-
-
-        main.step( "Uninstall all onos nodes in the env.")
-        stepResult = main.TRUE
-        for node in main.nodeList:
-            nodeResult = main.ONOSbench.onosUninstall( nodeIp = "$" + node )
-            stepResult = stepResult & nodeResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstall onos on all nodes in env.",
-                                 onfail="Failed to uninstall onos on all nodes in env!" )
-        if not stepResult:
-            main.log.error( "Failure to clean test env. Exiting test..." )
-            main.exit()
-
     def CASE2( self, main ):
         '''
             Report errors/warnings/exceptions
         '''
         main.log.info("Error report: \n" )
-        main.ONOSbench.logReport( main.ONOScli1.ip_address,
+        main.ONOSbench.logReport( main.ONOSip[0],
                                   [ "INFO",
                                     "FOLLOWER",
                                     "WARN",
@@ -113,16 +103,9 @@
 
         import time
 
-        numNodes = int( main.params['CASE10']['numNodes'] )
-        main.case( "Start up " + str( numNodes ) + "-node onos cluster.")
-
+        main.case( "Start up " + str( main.numCtrls ) + "-node onos cluster.")
         main.step( "Start ONOS cluster with basic (drivers) app.")
-        onosClusterIPs = []
-        for n in range( 1, numNodes + 1 ):
-            handle = "main.ONOScli" + str( n )
-            onosClusterIPs.append( eval( handle ).ip_address )
-
-        stepResult = main.ONOSbench.startBasicONOS(nodeList = onosClusterIPs, opSleep = 200 )
+        stepResult = main.ONOSbench.startBasicONOS( nodeList=main.ONOSip, opSleep=200 )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully started basic ONOS cluster ",
@@ -130,9 +113,9 @@
 
         main.step( "Establishing Handles on ONOS CLIs.")
         cliResult = main.TRUE
-        for n in range( 1, numNodes + 1 ):
+        for n in range( 1, main.numCtrls + 1 ):
             handle = "main.ONOScli" + str( n )
-            cliResult = cliResult & ( eval( handle ).startCellCli() )
+            cliResult = cliResult & ( eval( handle ).startOnosCli( main.ONOSip[ n-1 ] ) )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=cliResult,
                                  onpass="Successfully started onos cli's ",
@@ -196,10 +179,9 @@
 
         main.step( "Assign switches to controllers.")
         assignResult = main.TRUE
-        onosNodes = [ main.ONOScli1.ip_address, main.ONOScli2.ip_address, main.ONOScli3.ip_address ]
         for i in range(1, 8):
             assignResult = assignResult & main.Mininet1.assignSwController( sw="s" + str( i ),
-                                                         ip=onosNodes,
+                                                         ip=main.ONOSip,
                                                          port='6653' )
         time.sleep(main.mnCfgSleep)
         utilities.assert_equals( expect=main.TRUE,
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
index c01bb0a..367633b 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
@@ -17,7 +17,7 @@
         </ONOSbench>
 
         <ONOScli1>
-            <host>OC1</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>
@@ -27,7 +27,7 @@
         </ONOScli1>
 
         <ONOScli2>
-            <host>OC2</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>
@@ -37,7 +37,7 @@
         </ONOScli2>
 
          <ONOScli3>
-            <host>OC3</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>
diff --git a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
index 936bf3d..fee655b 100644
--- a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
@@ -80,7 +80,8 @@
         main.step("Safety check, killing all ONOS processes")
         main.step("before initiating environment setup")
         for node in range(1, maxNodes + 1):
-            main.ONOSbench.onosDie(ONOSIp[node])
+            main.ONOSbench.onosStop(ONOSIp[node])
+            main.ONOSbench.onosKill(ONOSIp[node])
 
         #Uninstall everywhere
         main.step( "Cleaning Enviornment..." )
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
index 50ca811..559f30f 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
@@ -88,7 +88,8 @@
         main.step("Safety check, killing all ONOS processes")
         main.step("before initiating environment setup")
         for node in range(1, main.maxNodes + 1):
-            main.ONOSbench.onosDie(ONOSIp[node])
+            main.ONOSbench.onosStop(ONOSIp[node])
+            main.ONOSbench.onosKill(ONOSIp[node])
 
         #Uninstall everywhere
         main.step( "Cleaning Enviornment..." )
@@ -120,6 +121,9 @@
             main.ONOSbench.onosInstall( ONOSIp[node])
 
         for node in range(1, clusterCount + 1):
+            secureSshResult = main.ONOSbench.onosSecureSSH( ONOSIp[node] )
+
+        for node in range(1, clusterCount + 1):
             for i in range( 2 ):
                 isup = main.ONOSbench.isup( ONOSIp[node] )
                 if isup:
@@ -129,7 +133,6 @@
                 main.log.report( "ONOS " + str(node) + " didn't start!" )
 
         for node in range(1, clusterCount + 1):
-            secureSshResult = main.ONOSbench.onosSecureSSH( ONOSIp[node] )
             exec "a = main.ONOS%scli.startOnosCli" %str(node)
             a(ONOSIp[node])
 
diff --git a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
index 42159b4..12b93e6 100644
--- a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
+++ b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
@@ -116,7 +116,8 @@
                        " before initiating environment setup" )
 
         for i in range( main.numCtrls ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
+            main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            main.ONOSbench.onosKill( main.ONOSip[ i ] )
 
         main.log.info( "NODE COUNT = %s" % main.numCtrls)
 
@@ -167,16 +168,6 @@
                                      onpass="Test step PASS",
                                      onfail="Test step FAIL" )
             installResult = installResult and i_result
-        time.sleep( main.startUpSleep )
-        main.step( "Verify ONOS nodes UP status" )
-        statusResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            main.log.info( "ONOS Node " + main.ONOSip[i] + " status:" )
-            onos_status = main.ONOSbench.onosStatus( node=main.ONOSip[i] )
-            utilities.assert_equals( expect=main.TRUE, actual=onos_status,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            statusResult = ( statusResult and onos_status )
 
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
@@ -186,6 +177,31 @@
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
+        time.sleep( main.startUpSleep )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
         main.step( "Start ONOS CLI on all nodes" )
         cliResult = main.TRUE
         main.step(" Start ONOS cli using thread ")
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
index cf4c6ac..620982d 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
@@ -64,6 +64,7 @@
         <duration>400</duration>
         <log_interval>20</log_interval>
         <numKeys>40000</numKeys>
+        <numKeysFlowObj>4000</numKeysFlowObj>
         <cyclePeriod>1000</cyclePeriod>
         <neighbors>0,a</neighbors>           #a == all nodes (-1)
         <flowRuleBUEnabled>true</flowRuleBUEnabled>
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index 42c3522..75c0aa1 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -74,15 +74,16 @@
         main.testDuration = main.params[ 'TEST' ][ 'duration' ]
         main.logInterval = main.params[ 'TEST' ][ 'log_interval' ]
         main.debug = main.params[ 'debugMode' ]
-        main.numKeys = main.params[ 'TEST' ][ 'numKeys' ]
         main.timeout = int(main.params['SLEEP']['timeout'])
         main.cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ]
         if main.flowObj == "True":
             main.flowObj = True
             main.dbFileName = main.params['DATABASE']['dbFlowObj']
+            main.numKeys = main.params[ 'TEST' ][ 'numKeysFlowObj' ]
         else:
             main.flowObj = False
             main.dbFileName = main.params['DATABASE']['dbName']
+            main.numKeys = main.params[ 'TEST' ][ 'numKeys' ]
         # Create DataBase file
         main.log.info( "Create Database file " + main.dbFileName )
         resultsDB = open( main.dbFileName, "w+" )
@@ -120,7 +121,8 @@
                       " before initiating environment setup")
 
         for i in range( main.numCtrls ):
-            main.ONOSbench.onosDie( main.ONOSip[i] )
+            main.ONOSbench.onosStop( main.ONOSip[i] )
+            main.ONOSbench.onosKill( main.ONOSip[i] )
 
         main.log.info( "NODE COUNT = %s" % main.numCtrls )
         main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
@@ -166,17 +168,6 @@
                                     onfail="Test step FAIL")
             installResult = installResult and i_result
 
-        main.step( "Verify ONOS nodes UP status" )
-        statusResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            main.log.info( "ONOS Node " + main.ONOSip[i] + " status:" )
-            onos_status = main.ONOSbench.onosStatus(node=main.ONOSip[i])
-            utilities.assert_equals(expect=main.TRUE, actual=onos_status,
-                                    onpass="Test step PASS",
-                                    onfail="Test step FAIL")
-            statusResult = (statusResult and onos_status)
-        time.sleep(2)
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
         for i in range( int( main.numCtrls ) ):
@@ -185,6 +176,30 @@
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
+        time.sleep( main.startUpSleep )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
         main.step( "Start ONOS cli using thread" )
         startCliResult = main.TRUE
         pool = []
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index 1c04fd1..c6b1f34 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -118,7 +118,8 @@
                       " before initiating environment setup")
 
         for i in range(main.numCtrls):
-            main.ONOSbench.onosDie(main.ONOSip[i])
+            main.ONOSbench.onosStop(main.ONOSip[i])
+            main.ONOSbench.onosKill(main.ONOSip[i])
 
         main.log.info("NODE COUNT = %s" % main.numCtrls)
         main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
@@ -164,16 +165,6 @@
                                     onfail="Test step FAIL")
             installResult = installResult and i_result
 
-        main.step("Verify ONOS nodes UP status")
-        statusResult = main.TRUE
-        for i in range(int(main.numCtrls)):
-            main.log.info("ONOS Node " + main.ONOSip[i] + " status:")
-            onos_status = main.ONOSbench.onosStatus(node=main.ONOSip[i])
-            utilities.assert_equals(expect=main.TRUE, actual=onos_status,
-                                    onpass="Test step PASS",
-                                    onfail="Test step FAIL")
-            statusResult = (statusResult and onos_status)
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
         for i in range( int( main.numCtrls ) ):
@@ -182,6 +173,30 @@
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
+        time.sleep( main.startUpSleep )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
         time.sleep(2)
         main.step("Start ONOS CLI on all nodes")
         cliResult = main.TRUE
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
index 19d9806..c3c0ff6 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
@@ -10,6 +10,16 @@
         <cellApps>drivers,null,intentperf,metrics</cellApps>
     </ENV>
 
+    <DEPENDENCY>
+        <FILE1>intentRerouteLatFuncs</FILE1>
+        <PATH>/tests/SCPF/SCPFintentRerouteLat/dependencies/</PATH>
+    </DEPENDENCY>
+
+    <SEARCHTERM>
+        <TopologyTime>TopologyManager</TopologyTime>
+        <InstallTime>INSTALLED</InstallTime>
+    </SEARCHTERM>
+
     <TEST>
         <skipCleanInstall>yes</skipCleanInstall>
         <warmUp>5</warmUp>
@@ -30,6 +40,7 @@
             <port>0000000000000003/2</port>>
         </end2>
     </TEST>
+
     <DATABASE>
         <dbName>/tmp/IntentRerouteLatDB</dbName>
         <dbFlowObj>/tmp/IntentRerouteLatDBWithFlowObj</dbFlowObj>
@@ -41,15 +52,15 @@
     </GIT>
 
     <ATTEMPTS>
-        <verify>3</verify>
+        <verify>5</verify>
+        <maxInvalidRun>10</maxInvalidRun>
     </ATTEMPTS>
 
     <SLEEP>
-        <startup>10</startup>
+        <startup>5</startup>
         <setmaster>5</setmaster>
         <install>10</install>
-        <verify>3</verify>
-        <reroute>3</reroute>
+        <verify>5</verify>
         # timeout for pexpect
         <timeout>300</timeout>
     </SLEEP>
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index e861f0c..ac0a673 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -14,11 +14,14 @@
     - The unit of the latency result is milliseconds
 """
 
+
 class SCPFintentRerouteLat:
     def __init__(self):
         self.default = ''
 
     def CASE0( self, main ):
+        import imp
+        import os
         '''
         - GIT
         - BUILDING ONOS
@@ -40,7 +43,8 @@
                                     actual=stepResult,
                                     onpass="Successfully checkout onos branch.",
                                     onfail="Failed to checkout onos branch. Exiting test...")
-            if not stepResult: main.exit()
+            if not stepResult:
+                main.exit()
 
             main.step("Git Pull on ONOS branch:" + gitBranch)
             stepResult = main.ONOSbench.gitPull()
@@ -56,11 +60,12 @@
                                     actual=stepResult,
                                     onpass="Successfully build onos.",
                                     onfail="Failed to build onos. Exiting test...")
-            if not stepResult: main.exit()
+            if not stepResult:
+                main.exit()
 
         else:
             main.log.warn("Skipped pulling onos and Skipped building ONOS")
-
+        main.onosIp = main.ONOSbench.getOnosIps()
         main.apps = main.params['ENV']['cellApps']
         main.BENCHUser = main.params['BENCH']['user']
         main.BENCHIp = main.params['BENCH']['ip1']
@@ -75,6 +80,7 @@
         main.verifySleep = int(main.params['SLEEP']['verify'])
         main.setMasterSleep = int(main.params['SLEEP']['setmaster'])
         main.verifyAttempts = int(main.params['ATTEMPTS']['verify'])
+        main.maxInvalidRun = int(main.params['ATTEMPTS']['maxInvalidRun'])
         main.sampleSize = int(main.params['TEST']['sampleSize'])
         main.warmUp = int(main.params['TEST']['warmUp'])
         main.ingress = main.params['TEST']['ingress']
@@ -84,7 +90,7 @@
         main.deviceCount = int(main.params['TEST']['deviceCount'])
         main.end1 = main.params['TEST']['end1']
         main.end2 = main.params['TEST']['end2']
-
+        main.searchTerm = main.params['SEARCHTERM']
         if main.flowObj == "True":
             main.flowObj = True
             main.dbFileName = main.params['DATABASE']['dbFlowObj']
@@ -100,6 +106,11 @@
         main.log.info("Create Database file " + main.dbFileName)
         resultsDB = open(main.dbFileName, "w+")
         resultsDB.close()
+        file1 = main.params[ "DEPENDENCY" ][ "FILE1" ]
+        main.dependencyPath = os.path.dirname( os.getcwd() ) + main.params[ "DEPENDENCY" ][ "PATH" ]
+        main.intentRerouteLatFuncs = imp.load_source(file1, main.dependencyPath + file1 + ".py")
+
+        main.record = 0
 
     def CASE1( self, main ):
         '''
@@ -133,7 +144,8 @@
                       " before initiating environment setup")
 
         for i in range(main.numCtrls):
-            main.ONOSbench.onosDie(main.ONOSip[i])
+            main.ONOSbench.onosStop(main.ONOSip[i])
+            main.ONOSbench.onosKill(main.ONOSip[i])
 
         main.log.info("NODE COUNT = %s" % main.numCtrls)
         main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
@@ -179,25 +191,39 @@
                                     onfail="Test step FAIL")
             installResult = installResult and i_result
 
-        main.step("Verify ONOS nodes UP status")
-        statusResult = main.TRUE
-        for i in range(int(main.numCtrls)):
-            main.log.info("ONOS Node " + main.ONOSip[i] + " status:")
-            onos_status = main.ONOSbench.onosStatus(node=main.ONOSip[i])
-            utilities.assert_equals(expect=main.TRUE, actual=onos_status,
-                                    onpass="Test step PASS",
-                                    onfail="Test step FAIL")
-            statusResult = (statusResult and onos_status)
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
         for i in range( int( main.numCtrls ) ):
             secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+            utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                    onpass="Test step PASS",
+                                    onfail="Test step FAIL" )
+
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE, actual=stepResult,
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
-        time.sleep(2)
+        time.sleep(main.startUpSleep)
         main.step("Start ONOS CLI on all nodes")
         cliResult = main.TRUE
         main.step(" Start ONOS cli using thread ")
@@ -226,10 +252,13 @@
         if main.flowObj:
             main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
                                 "useFlowObjectives", value="true")
-        time.sleep(main.startUpSleep)
-
+        time.sleep( main.startUpSleep )
+        for i in range( int( main.numCtrls ) ):
+            main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.topology" )
+            main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.intent" )
         # Balance Master
         main.CLIs[0].balanceMasters()
+        time.sleep( main.setMasterSleep )
         if len(main.ONOSip) > 1:
             main.CLIs[0].deviceRole(main.end1[ 'name' ], main.ONOSip[0])
             main.CLIs[0].deviceRole(main.end2[ 'name' ], main.ONOSip[0])
@@ -245,26 +274,33 @@
         ts = time.time()
         print(main.intentsList)
         for batchSize in main.intentsList:
+            main.batchSize = batchSize
             main.log.report("Intent Batch size: " + str(batchSize) + "\n      ")
             main.LatencyList = []
-            validRun = 0
-            invalidRun = 0
-            while validRun <= main.warmUp + main.sampleSize and invalidRun <= 20:
-                if validRun >= main.warmUp:
+            main.LatencyListTopoToFirstInstalled = []
+            main.LatencyListFirstInstalledToLastInstalled = []
+            main.validRun = 0
+            main.invalidRun = 0
+            # initial a variables to record the term of startLine in karaf logs of each node
+            main.totalLines = []
+            for i in range( main.numCtrls ):
+                main.totalLines.append( '' )
+            while main.validRun <= main.warmUp + main.sampleSize and main.invalidRun <= main.maxInvalidRun:
+                if main.validRun >= main.warmUp:
                     main.log.info("================================================")
-                    main.log.info("Starting test iteration: {} ".format(validRun - main.warmUp))
-                    main.log.info("Total iteration: {}".format(validRun + invalidRun))
+                    main.log.info("Starting test iteration: {} ".format( main.validRun - main.warmUp))
+                    main.log.info("Total iteration: {}".format( main.validRun + main.invalidRun))
                     main.log.info("================================================")
                 else:
                     main.log.info("====================Warm Up=====================")
 
                 # push intents
-                main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
+                main.CLIs[0].pushTestIntents(main.ingress, main.egress, main.batchSize,
                                              offset=1, options="-i", timeout=main.timeout)
 
                 # check links and flows
                 k = 0
-                verify = main.FALSE
+                main.verify = main.FALSE
                 linkCheck = 0
                 flowsCheck = 0
                 while k <= main.verifyAttempts:
@@ -274,128 +310,74 @@
                     flowsCheck = summary.get("flows")
                     if linkCheck == main.deviceCount * 2 and flowsCheck == batchSize * (main.deviceCount - 1 ):
                         main.log.info("links: {}, flows: {} ".format(linkCheck, flowsCheck))
-                        verify = main.TRUE
+                        main.verify = main.TRUE
                         break
                     k += 1
-                if not verify:
-                    main.log.warn("Links or flows number are not match!")
+                if not main.verify:
+                    main.log.warn("Links or flows number not as expected")
                     main.log.warn("links: {}, flows: {} ".format(linkCheck, flowsCheck))
                     # bring back topology
-                    main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
-                    time.sleep(1)
-                    main.CLIs[0].purgeWithdrawnIntents()
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=main.deviceCount)
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
-                    if validRun >= main.warmUp:
-                        invalidRun += 1
+                    main.intentRerouteLatFuncs.bringBackTopology( main )
+                    if main.validRun >= main.warmUp:
+                        main.invalidRun += 1
                         continue
                     else:
-                        validRun += 1
+                        main.validRun += 1
                         continue
-
                 # Bring link down
                 main.CLIs[0].link( main.end1[ 'port' ], main.end2[ 'port' ], "down",
                                   timeout=main.timeout, showResponse=False)
-                verify = main.FALSE
+                main.verify = main.FALSE
                 k = 0
-                topoManagerLog = ""
                 while k <= main.verifyAttempts:
                     time.sleep(main.verifySleep)
                     summary = json.loads(main.CLIs[0].summary(timeout=main.timeout))
                     linkCheck = summary.get("links")
                     flowsCheck = summary.get("flows")
-                    if linkCheck == (main.deviceCount - 1) * 2:
+                    if linkCheck == (main.deviceCount - 1) * 2 and flowsCheck == batchSize * main.deviceCount:
                         main.log.info("links: {}, flows: {} ".format(linkCheck, flowsCheck))
-                        verify = main.TRUE
+                        main.verify = main.TRUE
                         break
                     k += 1
-                if not verify:
-                    main.log.warn("Links number are not match in TopologyManager log!")
-                    main.log.warn(topoManagerLog)
+                if not main.verify:
+                    main.log.warn("Links or flows number not as expected")
+                    main.log.warn("links: {}, flows: {} ".format(linkCheck, flowsCheck))
                     # bring back topology
-                    main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
-                    time.sleep(1)
-                    main.CLIs[0].purgeWithdrawnIntents()
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=main.deviceCount)
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
-                    if validRun >= main.warmUp:
-                        invalidRun += 1
+                    main.intentRerouteLatFuncs.bringBackTopology( main )
+                    if main.validRun >= main.warmUp:
+                        main.invalidRun += 1
                         continue
                     else:
-                        validRun += 1
+                        main.validRun += 1
                         continue
-
-                try:
-                    # expect twice to clean the pexpect buffer
-                    main.ONOSbench.handle.sendline("")
-                    main.ONOSbench.handle.expect("\$")
-                    main.ONOSbench.handle.expect("\$")
-                    # send line by using bench, can't use driver because pexpect buffer problem
-                    cmd = "onos-ssh $OC1 cat /opt/onos/log/karaf.log | grep TopologyManager| tail -1"
-                    main.ONOSbench.handle.sendline(cmd)
-                    time.sleep(1)
-                    main.ONOSbench.handle.expect(":~")
-                    topoManagerLog = main.ONOSbench.handle.before
-                    topoManagerLogTemp = topoManagerLog.splitlines()
-                    # To make sure we get correct topology log
-                    for lines in topoManagerLogTemp:
-                        if "creationTime" in lines:
-                            topoManagerLog = lines
-                    main.log.info("Topology Manager log:")
-                    print(topoManagerLog)
-                    cutTimestamp = float(topoManagerLog.split("creationTime=")[1].split(",")[0])
-                except:
-                    main.log.error("Topology Log is not correct!")
-                    print(topoManagerLog)
-                    # bring back topology
-                    verify = main.FALSE
-                    main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
-                    time.sleep(1)
-                    main.CLIs[0].purgeWithdrawnIntents()
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=main.deviceCount)
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
-                    if validRun >= main.warmUp:
-                        invalidRun += 1
+                # record the link romving time as the startLine
+                for i in range( main.numCtrls ):
+                    logNum = main.intentRerouteLatFuncs.checkLog( main, i )
+                    main.totalLines[i] = str(main.CLIs[ i ].getTimeStampFromLog( "last", "LINK_REMOVED", "time = ", " ", logNum=logNum ))
+                    main.log.info("Node " + str( i+1 ) + ": the start timestamp is " + main.totalLines[i] + " this iteration" )
+                #Calculate values
+                lastTopologyToFirstInstalled, firstInstalledToLastInstalled, totalTime = main.intentRerouteLatFuncs.getValues( main )
+                if totalTime == -1:
+                    if main.validRun >= main.warmUp:
+                        main.invalidRun += 1
                     else:
-                        validRun += 1
-                    # If we got wrong Topology log, we should skip this iteration, and continue for next one
+                        main.validRun += 1
                     continue
-
-                installedTemp = []
-                time.sleep(1)
-                for cli in main.CLIs:
-                    tempJson = json.loads(cli.intentsEventsMetrics())
-                    Installedtime = tempJson.get('intentInstalledTimestamp').get('value')
-                    installedTemp.append(float(Installedtime))
-                for i in range(0, len(installedTemp)):
-                    main.log.info("ONOS Node {} Installed Time stemp: {}".format((i + 1), installedTemp[i]))
-                maxInstallTime = float(max(installedTemp))
-                if validRun >= main.warmUp and verify:
-                    main.log.info("Installed time stemp: {0:f}".format(maxInstallTime))
-                    main.log.info("CutTimestamp: {0:f}".format(cutTimestamp))
-                    # Both timeStemps are milliseconds
-                    main.log.info("Latency: {0:f}".format(float(maxInstallTime - cutTimestamp)))
-                    main.LatencyList.append(float(maxInstallTime - cutTimestamp))
-                # We get valid latency, validRun + 1
-                validRun += 1
+                else:
+                    main.log.info("Get valid latency")
+                    main.validRun += 1
 
                 # Verify Summary after we bring up link, and withdrawn intents
                 main.CLIs[0].link( main.end1[ 'port' ], main.end2[ 'port' ], "up",
                                   timeout=main.timeout)
                 k = 0
-                verify = main.FALSE
+                main.verify = main.FALSE
                 linkCheck = 0
                 flowsCheck = 0
                 while k <= main.verifyAttempts:
                     time.sleep(main.verifySleep)
-                    main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
-                    time.sleep(1)
+                    main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
+                                                 offset=1, options="-w", timeout=main.timeout)
                     main.CLIs[0].purgeWithdrawnIntents()
                     summary = json.loads(main.CLIs[0].summary())
                     linkCheck = summary.get("links")
@@ -403,31 +385,41 @@
                     intentCheck = summary.get("intents")
                     if linkCheck == main.deviceCount * 2 and flowsCheck == 0 and intentCheck == 0:
                         main.log.info("links: {}, flows: {}, intents: {} ".format(linkCheck, flowsCheck, intentCheck))
-                        verify = main.TRUE
+                        main.verify = main.TRUE
                         break
                     k += 1
-                if not verify:
-                    main.log.error("links, flows, or intents are not correct!")
+                if not main.verify:
+                    main.log.error("links, flows or intents number not as expected")
                     main.log.info("links: {}, flows: {}, intents: {} ".format(linkCheck, flowsCheck, intentCheck))
                     # bring back topology
-                    main.log.info("Bring back topology...")
-                    main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
-                    time.sleep(1)
-                    main.CLIs[0].purgeWithdrawnIntents()
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="false")
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=main.deviceCount)
-                    main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
+                    main.intentRerouteLatFuncs.bringBackTopology( main )
                     continue
+                #main.log.info("total negative results num: " + str( main.record ) )
 
             aveLatency = 0
+            aveLatencyTopoToFirstInstalled = 0
+            aveLatencyFirstInstalledToLastInstalled = 0
+
             stdLatency = 0
-            aveLatency = numpy.average(main.LatencyList)
-            stdLatency = numpy.std(main.LatencyList)
-            main.log.report("Scale: " + str(main.numCtrls) + "  \tIntent batch: " + str(batchSize))
-            main.log.report("Latency average:................" + str(aveLatency))
-            main.log.report("Latency standard deviation:....." + str(stdLatency))
-            main.log.report("________________________________________________________")
+            stdLatencyTopoToFirstInstalled = 0
+            stdLatencyFirstInstalledToLastInstalled = 0
+
+            aveLatency = numpy.average( main.LatencyList )
+            aveLatencyTopoToFirstInstalled = numpy.average( main.LatencyListTopoToFirstInstalled )
+            aveLatencyFirstInstalledToLastInstalled = numpy.average( main.LatencyListFirstInstalledToLastInstalled )
+
+            stdLatency = numpy.std( main.LatencyList )
+            stdLatencyTopoToFirstInstalled = numpy.std( main.LatencyListTopoToFirstInstalled )
+            stdLatencyFirstInstalledToLastInstalled = numpy.std( main.LatencyListFirstInstalledToLastInstalled )
+
+            main.log.report( "Scale: " + str( main.numCtrls ) + "  \tIntent batch: " + str( batchSize ) )
+            main.log.report( "Total Latency average:................" + str( aveLatency ) )
+            main.log.report( "Latency standard deviation:..........." + str( stdLatency ) )
+            main.log.report( "Last Topology to first installed Latency average:................." + str( aveLatencyTopoToFirstInstalled ) )
+            main.log.report( "Last Topology to first installed Latency standard deviation:......" + str( stdLatencyTopoToFirstInstalled ) )
+            main.log.report( "First installed to last installed Latency average:................" + str( aveLatencyFirstInstalledToLastInstalled ) )
+            main.log.report( "First installed to last installed Latency standard deviation:....." + str( stdLatencyFirstInstalledToLastInstalled ) )
+            main.log.report( "________________________________________________________" )
 
             if not (numpy.isnan(aveLatency) or numpy.isnan(stdLatency)):
                 # check if got NaN for result
@@ -436,6 +428,10 @@
                 resultsDB.write(str(main.numCtrls) + ",")
                 resultsDB.write(str(batchSize) + ",")
                 resultsDB.write(str(aveLatency) + ",")
-                resultsDB.write(str(stdLatency) + "\n")
+                resultsDB.write(str(stdLatency) + ",")
+                resultsDB.write(str(aveLatencyTopoToFirstInstalled) + ",")
+                resultsDB.write(str(stdLatencyTopoToFirstInstalled) + ",")
+                resultsDB.write(str(aveLatencyFirstInstalledToLastInstalled) + ",")
+                resultsDB.write(str(stdLatencyFirstInstalledToLastInstalled) + "\n")
                 resultsDB.close()
         del main.scale[0]
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/dependencies/intentRerouteLatFuncs.py b/TestON/tests/SCPF/SCPFintentRerouteLat/dependencies/intentRerouteLatFuncs.py
new file mode 100644
index 0000000..24cf32b
--- /dev/null
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/dependencies/intentRerouteLatFuncs.py
@@ -0,0 +1,109 @@
+'''
+The functions for intentRerouteLat
+
+'''
+import numpy
+import time
+
+def _init_( self ):
+    self.default = ''
+
+def checkLog( main, nodeId ):
+    try:
+        logNames = main.ONOSbench.listLog( main.onosIp[ nodeId ] )
+        assert logNames is not None
+        if len( logNames ) >= 2:
+            return 2
+        return 1
+    except AssertionError:
+        main.log.error("There is no karaf log")
+        return -1
+
+def bringBackTopology( main ):
+    main.log.info( "Bring back topology " )
+    main.CLIs[ 0 ].pushTestIntents(main.ingress, main.egress, main.batchSize,
+                                 offset=1, options="-w", timeout=main.timeout)
+    main.CLIs[ 0 ].purgeWithdrawnIntents()
+    main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
+    main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "enabled", value="false")
+    main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "deviceCount", value=main.deviceCount)
+    main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "enabled", value="true")
+    main.CLIs[ 0 ].balanceMasters()
+    time.sleep( main.setMasterSleep )
+    if len( main.ONOSip ) > 1:
+        main.CLIs[ 0 ].deviceRole(main.end1[ 'name' ], main.ONOSip[ 0 ])
+        main.CLIs[ 0 ].deviceRole(main.end2[ 'name' ], main.ONOSip[ 0 ])
+    time.sleep( main.setMasterSleep )
+
+def getValues( main ):
+    '''
+    Calculated the wanted values for intentRerouteTest
+
+    1. Get the first "last topology timestamp" from karaf.log in different node
+    2. Get the first "first intent installed timestamp" from  karaf log in different node
+    3. Get the last "last intent installed timestamp" from karaf log in different node
+
+    Return:
+        last_topology_to_first_installed: The time from the last topology to the first intent installed
+        first_installed_to_last_installed: Time time from the first topology to the last intent installed
+        totalTime: The time from the last topology to the last intent installed
+
+    '''
+    lastTopologyTimestamp = compareTimestamp( main, main.searchTerm[ "TopologyTime" ], "creationTime=", ",",  'last',func='min' )
+    firstIntentInstalledTimestamp = compareTimestamp( main, main.searchTerm[ "InstallTime" ], "time = ", " ",  'first',func='min' )
+    lastIntentInstalledTimestamp = compareTimestamp( main, main.searchTerm[ "InstallTime" ], "time = ", " ",  'last',func='max' )
+
+    if lastTopologyTimestamp == -1 or firstIntentInstalledTimestamp == -1 or lastIntentInstalledTimestamp == -1:
+        main.log.warn( "Can't get timestamp from karaf log! " )
+        bringBackTopology( main )
+        return -1, -1, -1
+
+    #calculate values
+    lastTopologyToFirstInstalled = firstIntentInstalledTimestamp - lastTopologyTimestamp
+    if lastTopologyToFirstInstalled < 0:
+        main.record = main.record + 1
+
+    firstInstalledToLastInstalled = lastIntentInstalledTimestamp - firstIntentInstalledTimestamp
+    totalTime = lastIntentInstalledTimestamp - lastTopologyTimestamp
+
+    if main.validRun >= main.warmUp and main.verify:
+        main.log.info( "Last topology time stamp: {0:f}".format( lastTopologyTimestamp ))
+        main.log.info( "First installed time stamp: {0:f}".format( firstIntentInstalledTimestamp ))
+        main.log.info( "Last installed time stamp: {0:f}".format( lastIntentInstalledTimestamp ))
+        main.log.info( "Last topology to first installed latency:{0:f}".format( lastTopologyToFirstInstalled ))
+        main.log.info( "First installed to last installed latency:{0:f}".format( firstInstalledToLastInstalled ))
+        main.log.info( "Overall latency:{0:f}".format( totalTime ))
+        main.LatencyList.append( totalTime )
+        main.LatencyListTopoToFirstInstalled.append( lastTopologyToFirstInstalled )
+        main.LatencyListFirstInstalledToLastInstalled.append( firstInstalledToLastInstalled )
+    return lastTopologyToFirstInstalled, firstInstalledToLastInstalled, totalTime
+
+def compareTimestamp( main, compareTerm, splitTerm_before, splitTerm_after, mode, func='max' ):
+    '''
+    Compare all the timestamps of compareTerm from different node.
+
+    func:
+        max: Compare which one is the biggest and retun it
+        min: Compare which one is the smallest and return it
+
+    return:
+        This function will return the biggest or smallest timestamps of the compareTerm.
+
+    '''
+    compareTermList = []
+    for i in range( main.numCtrls ):
+        timestamp = main.CLIs[ i ].getTimeStampFromLog( mode, compareTerm, splitTerm_before, splitTerm_after, startLine=main.totalLines[ i ], logNum=checkLog( main, i ) )
+        compareTermList.append( timestamp )
+    main.log.info("-----------------------------------------------")
+    for i in range( main.numCtrls ):
+        main.log.info( "ONOS Node {} {} {} time stamp: {}".format((i+1), mode, compareTerm, compareTermList[ i ]))
+    x = min( compareTermList )
+    main.log.info("-----------------------------------------------")
+    if x == -1:
+        main.log.warn( "Can't compare timestamps" )
+        return -1
+    else:
+        if func == 'max':
+            return max( compareTermList )
+        if func == 'min':
+            return min( compareTermList )
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
index 59dc3a1..b29ca81 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
@@ -122,7 +122,8 @@
                       " before initiating environment setup")
 
         for i in range( main.numCtrls ):
-            main.ONOSbench.onosDie( main.ONOSip[i] )
+            main.ONOSbench.onosStop( main.ONOSip[i] )
+            main.ONOSbench.onosKill( main.ONOSip[i] )
 
         main.log.info( "NODE COUNT = %s" % main.numCtrls )
         main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
@@ -168,17 +169,6 @@
                                     onfail="Test step FAIL")
             installResult = installResult and i_result
 
-        main.step( "Verify ONOS nodes UP status" )
-        statusResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            main.log.info( "ONOS Node " + main.ONOSip[i] + " status:" )
-            onos_status = main.ONOSbench.onosStatus( node=main.ONOSip[i] )
-            utilities.assert_equals(expect=main.TRUE, actual=onos_status,
-                                    onpass="Test step PASS",
-                                    onfail="Test step FAIL")
-            statusResult = statusResult and onos_status
-        time.sleep(2)
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
         for i in range( int( main.numCtrls ) ):
@@ -187,6 +177,30 @@
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
+        time.sleep( main.startUpSleep )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
         main.step( "Start ONOS CLI on all nodes" )
         cliResult = main.TRUE
         main.step( " Start ONOS cli using thread " )
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 1a1e38f..3304d27 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -167,7 +167,8 @@
                        " before initiating environment setup" )
 
         for i in range( main.numCtrls ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
+            main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            main.ONOSbench.onosKill( main.ONOSip[ i ] )
 
         tempOnosIp = []
         for i in range( main.numCtrls ):
@@ -219,6 +220,14 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
         time.sleep( main.startUpSleep )
         main.step( "Starting ONOS service" )
         stopResult = main.TRUE
@@ -245,14 +254,6 @@
                                  onpass="ONOS service is ready",
                                  onfail="ONOS service did not start properly" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         main.activeNodes = []
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
index 254956c..f7a8782 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
@@ -56,14 +56,14 @@
 
     '''
     try:
-        termInfo = main.CLIs[ index ].logSearch( term, mode=Mode)
+        termInfo = main.CLIs[ index ].logSearch( mode=Mode, searchTerm=term )
         termTime = getTimestampFromString( main, termInfo[ 0 ] )
         roleRequestTime = getRoleRequestTimeFromTshark( main )
         if termTime == -1 or roleRequestTime == -1:
             main.writeData = -1
             main.log.error( "Can't compare the difference with role request time" )
             return -1
-	# Only concern about the absolute value of difference.
+        # Only concern about the absolute value of difference.
         return abs( roleRequestTime - termTime )
     except IndexError:
         main.log.error( "Catch the wrong information of search term " )
@@ -87,8 +87,8 @@
 
     '''
     try:
-        termInfo1 = main.CLIs[ index ].logSearch( term1, mode=mode1 )
-        termInfo2 = main.CLIs[ index ].logSearch( term2, mode=mode2 )
+        termInfo1 = main.CLIs[ index ].logSearch( mode=mode1, searchTerm=term1 )
+        termInfo2 = main.CLIs[ index ].logSearch( mode=mode2, searchTerm=term2 )
         if funcMode == 'TD':
             startTime = getTimestampFromString( main, termInfo1[0] )
             endTime = getTimestampFromString ( main, termInfo2[0] )
@@ -449,6 +449,16 @@
         restartResult = main.FALSE
         main.log.error( main.topoName + ": Failed to install ONOS cluster" )
 
+    main.log.info( main.topoName + ": set up ONOS secure SSH" )
+    secureSshResult = []
+    for i in range( int( main.numCtrls ) ):
+        secureSshResult.append( main.onosSecureSSH( node=main.ONOSip[i] ) )
+    if all( result == main.TRUE for result in secureSshResult ):
+        main.log.info( main.topoName + ": Successfully set up ONOS secure SSH" )
+    else:
+        main.log.error( main.topoName + ": Failed to set up ONOS secure SSH" )
+        restartResult = main.FALSE
+
     for i in range( main.numCtrls ):
         onosIsUpResult.append( main.ONOSbench.isup( main.ONOSip[ i ] ) )
 
@@ -473,16 +483,6 @@
         else:
             main.log.error( main.topoName + ": Failed to start ONOS cluster" )
 
-    main.log.info( main.topoName + ": set up ONOS secure SSH" )
-    secureSshResult = []
-    for i in range( int( main.numCtrls ) ):
-        secureSshResult.append( main.onosSecureSSH( node=main.ONOSip[i] ) )
-    if all( result == main.TRUE for result in secureSshResult ):
-        main.log.info( main.topoName + ": Successfully set up ONOS secure SSH" )
-    else:
-        main.log.error( main.topoName + ": Failed to set up ONOS secure SSH" )
-        restartResult = main.FALSE
-
     main.log.info( main.topoName + ": Starting ONOS CLI" )
     cliResult = []
     for i in range( main.numCtrls ):
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index a7a7bc5..f82d684 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -140,7 +140,8 @@
                        " before initiating environment setup" )
 
         for i in range( main.numCtrls ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
+            main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            main.ONOSbench.onosKill( main.ONOSip[ i ] )
 
         main.log.info( "NODE COUNT = %s" % main.numCtrls)
 
@@ -192,16 +193,6 @@
                                      onfail="Test step FAIL" )
             installResult = installResult and i_result
 
-        main.step( "Verify ONOS nodes UP status" )
-        statusResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            main.log.info( "ONOS Node " + main.ONOSip[i] + " status:" )
-            onos_status = main.ONOSbench.onosStatus( node=main.ONOSip[i] )
-            utilities.assert_equals( expect=main.TRUE, actual=onos_status,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            statusResult = ( statusResult and onos_status )
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
         for i in range( int( main.numCtrls ) ):
@@ -210,6 +201,30 @@
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
+        time.sleep( main.startUpSleep )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
         main.step( "Start ONOS CLI on all nodes" )
         cliResult = main.TRUE
         main.step(" Start ONOS cli using thread ")
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
index 3fef087..e62951a 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
@@ -125,7 +125,8 @@
                       " before initiating environment setup")
 
         for i in range(main.numCtrls):
-            main.ONOSbench.onosDie(main.ONOSip[i])
+            main.ONOSbench.onosStop(main.ONOSip[i])
+            main.ONOSbench.onosKill(main.ONOSip[i])
 
         main.log.info("NODE COUNT = %s" % main.numCtrls)
         main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
@@ -171,16 +172,6 @@
                                     onfail="Test step FAIL")
             installResult = installResult and i_result
 
-        main.step("Verify ONOS nodes UP status")
-        statusResult = main.TRUE
-        for i in range(int(main.numCtrls)):
-            main.log.info("ONOS Node " + main.ONOSip[i] + " status:")
-            onos_status = main.ONOSbench.onosStatus(node=main.ONOSip[i])
-            utilities.assert_equals(expect=main.TRUE, actual=onos_status,
-                                    onpass="Test step PASS",
-                                    onfail="Test step FAIL")
-            statusResult = (statusResult and onos_status)
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
         for i in range( int( main.numCtrls ) ):
@@ -189,6 +180,30 @@
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
+        time.sleep( main.startUpSleep )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
         time.sleep(2)
         main.step("Start ONOS CLI on all nodes")
         cliResult = main.TRUE
diff --git a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
index 41a2fc4..4f46e48 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
@@ -15,7 +15,7 @@
         searchTerm: the key term of timestamp
 
     '''
-    lines = main.CLIs[ index ].logSearch( searchTerm, mode='last' )
+    lines = main.CLIs[ index ].logSearch( mode='last', searchTerm=searchTerm )
     try:
         assert lines != None
         logString = lines[ len ( lines ) - 1 ]
@@ -195,6 +195,13 @@
             resultFile.close()
         FinAckSeq = processPackage( FinAckText )[ 'Seq' ]
         FinAckOFseq = findSeqBySeqAck( FinAckSeq, resultText )
+        if FinAckOFseq == None:
+            main.log.warn( "Tshark Result was incorrect!" )
+            main.log.warn( resultText )
+            main.wrong[ 'TsharkValueIncorrect' ] += 1
+            main.wrong[ 'totalWrong' ] += 1
+            checkTotalWrongNum()
+            return
         with open( main.tsharkResultPath[ 'down' ][ 'ACK' ], "r" ) as resultFile:
             ACKlines = resultFile.readlines()
             resultFile.close()
diff --git a/TestON/tests/USECASE/SDNIPfunction/SDNIPfunction.py b/TestON/tests/USECASE/SDNIPfunction/SDNIPfunction.py
index 0873626..1c19c30 100644
--- a/TestON/tests/USECASE/SDNIPfunction/SDNIPfunction.py
+++ b/TestON/tests/USECASE/SDNIPfunction/SDNIPfunction.py
@@ -57,6 +57,9 @@
         onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
                                                            node = ONOS1Ip )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
@@ -65,9 +68,6 @@
         if not onos1Isup:
             main.log.report( "ONOS1 didn't start!" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
-
         cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
                 commandlineTimeout = 100, onosStartTimeout = 600 )
 
diff --git a/TestON/tests/USECASE/SDNIPperf/SDNIPperf.py b/TestON/tests/USECASE/SDNIPperf/SDNIPperf.py
index 4bfa244..9d6ae4a 100644
--- a/TestON/tests/USECASE/SDNIPperf/SDNIPperf.py
+++ b/TestON/tests/USECASE/SDNIPperf/SDNIPperf.py
@@ -56,6 +56,9 @@
         onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
                                                            node=ONOS1Ip )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
+
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
             onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
@@ -64,9 +67,6 @@
         if not onos1Isup:
             main.log.report( "ONOS1 didn't start!" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
-
         cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
                 commandlineTimeout=100, onosStartTimeout=600)
 
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 7ef28e6..08eb9c9 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -8,7 +8,7 @@
 
 class Testcaselib:
 
-    useSSH=False
+    useSSH=True
 
     @staticmethod
     def initTest( main ):
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
index 6348632..2c91806 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
@@ -2,8 +2,9 @@
 
 import os
 import re
+import math
 from optparse import OptionParser
-
+from ipaddress import IPv6Network, IPv4Network
 from mininet.net import Mininet
 from mininet.topo import Topo
 from mininet.node import RemoteController, UserSwitch, Host, OVSBridge
@@ -26,12 +27,77 @@
                        help='number of ONOS Instances, default=0, 0 means localhost, 1 will use OC1 and so on' )
     parser.add_option( '--vlan', dest='vlan', type='int', default=-1,
                        help='vid of cross connect, default=-1, -1 means utilize default value' )
+    parser.add_option( '--ipv6', action="store_true", dest='ipv6',
+                       help='hosts are capable to use also ipv6' )
     (options, args) = parser.parse_args( )
     return options, args
 
 
 opts, args = parseOptions( )
 
+IP6_SUBNET_CLASS = 120
+IP4_SUBNET_CLASS = 24
+
+class LeafAndSpine6( Topo ):
+    """
+    Create Leaf and Spine Topology for IPv4/IPv6 tests.
+    """
+    def __init__( self, spine=2, leaf=2, fanout=2, **opts ):
+        Topo.__init__( self, **opts )
+        spines          = {}
+        leafs           = {}
+        """
+        We calculate the offset from /120 and from /24 in order to have
+        a number of /120 and /24 subnets == leaf
+        """
+        offset          = int(math.ceil(math.sqrt( leaf )))
+        """
+        We calculate the subnets to use and set options
+        """
+        ipv6SubnetClass = unicode('2000::/%s' % (IP6_SUBNET_CLASS - offset))
+        ipv6Subnets     = list(IPv6Network(ipv6SubnetClass).subnets( new_prefix = IP6_SUBNET_CLASS ))
+        ipv4SubnetClass = unicode('10.0.0.0/%s' % (IP4_SUBNET_CLASS - offset))
+        ipv4Subnets     = list(IPv4Network(ipv4SubnetClass).subnets( new_prefix = IP4_SUBNET_CLASS ))
+        linkopts        = dict( bw=100 )
+        """
+        We create the spine switches
+        """
+        for s in range( spine ):
+            spines[ s ] = self.addSwitch( 'spine10%s' % (s + 1),
+                                          dpid="00000000010%s" % (s + 1) )
+        """
+        We create the leaf switches
+        """
+        for ls in range( leaf ):
+            leafs[ ls ] = self.addSwitch( 'leaf%s' % (ls + 1),
+                                          dpid="00000000000%s" % (1 + ls) )
+            ipv6Subnet  = ipv6Subnets[ ls ]
+            ipv6Hosts   = list(ipv6Subnet.hosts())
+            ipv4Subnet  = ipv4Subnets[ ls ]
+            ipv4Hosts   = list(ipv4Subnet.hosts())
+            """
+            We add the hosts
+            """
+            for f in range( fanout ):
+                ipv6 = ipv6Hosts[ f ]
+                ipv6Gateway = ipv6Hosts[ len( ipv6Hosts ) - 1 ]
+                ipv4 = ipv4Hosts[ f ]
+                ipv4Gateway = ipv4Hosts[ len( ipv4Hosts ) - 1 ]
+                host = self.addHost(
+                    name='h%s' % (ls * fanout + f + 1),
+                    cls=Ipv6Host,
+                    ip="%s/%s" %(ipv4, IP4_SUBNET_CLASS),
+                    gateway='%s' % ipv4Gateway,
+                    ipv6="%s/%s" %(ipv6, IP6_SUBNET_CLASS),
+                    ipv6Gateway="%s" % ipv6Gateway
+                    )
+                self.addLink( host, leafs[ ls ], **linkopts )
+            """
+            Connect leaf to all spines
+            """
+            for s in range( spine ):
+                switch = spines[ s ]
+                self.addLink( leafs[ ls ], switch, **linkopts )
 
 class LeafAndSpine( Topo ):
     def __init__( self, spine=2, leaf=2, fanout=2, **opts ):
@@ -92,6 +158,22 @@
         self.cmd( mtu )
         self.cmd( 'ip route add default via %s' % self.gateway )
 
+class Ipv6Host( IpHost ):
+    """
+    Abstraction to model an augmented host with a ipv6
+    functionalities as well
+    """
+    def __init__( self, name, *args, **kwargs ):
+        IpHost.__init__(self, name, *args, **kwargs)
+
+    def config( self, **kwargs ):
+        IpHost.config( self, **kwargs )
+        ipv6Cmd         = 'ifconfig %s-eth0 inet6 add %s' % (self.name, kwargs['ipv6'])
+        ipv6GatewayCmd  = 'ip -6 route add default via %s' % kwargs['ipv6Gateway']
+        ipv6MtuCmd      = 'ifconfig %s-eth0 inet6 mtu 1490' % (self.name)
+        self.cmd( ipv6Cmd )
+        self.cmd( ipv6GatewayCmd )
+        self.cmd( ipv6MtuCmd )
 
 class VLANHost( Host ):
     "Host connected to VLAN interface"
@@ -143,15 +225,34 @@
         link = self.mn.addLink( host, switch )
         host.config(**params)
 
+    def do_pingall6( self, line ):
+        "Ping6 between all hosts."
+        self.mn.pingAll6( line )
+
 def config( opts ):
     spine = opts.spine
     leaf = opts.leaf
     fanout = opts.fanout
     vlan = opts.vlan
+    ipv6 = opts.ipv6
     controllers = [ os.environ[ 'OC%s' % i ] for i in
                     range( 1, opts.onos + 1 ) ] if (opts.onos) else [
         '127.0.0.1' ]
-    topo = LeafAndSpine( spine=spine, leaf=leaf, fanout=fanout, vlan=vlan )
+    if not ipv6:
+        topo = LeafAndSpine(
+            spine=spine,
+            leaf=leaf,
+            fanout=fanout,
+            vlan=vlan,
+            )
+    else:
+        topo = LeafAndSpine6(
+            spine=spine,
+            leaf=leaf,
+            fanout=fanout,
+            vlan=vlan,
+            ipv6=ipv6
+            )
     net = Mininet( topo=topo, link=TCLink, build=False,
                    switch=UserSwitch, controller=None, autoSetMacs=True )
     i = 0
@@ -160,12 +261,12 @@
         i += 1;
     net.build( )
     net.start( )
-    out1 = net.get( 'out1' )
-    out1.cmd( "arp -s 10.0.9.254 10:00:00:00:00:01 -i %s " % (out1.intf()) )
-    CLI(net)
+    if not ipv6:
+        out1 = net.get( 'out1' )
+        out1.cmd( "arp -s 10.0.9.254 10:00:00:00:00:01 -i %s " % (out1.intf()) )
+    ExtendedCLI(net)
     net.stop( )
 
-
 if __name__ == '__main__':
     setLogLevel( 'info' )
     config( opts )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.params b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.params
index 3570fd0..104fe3f 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.params
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.params
@@ -4,6 +4,7 @@
 
     #Environment variables
     <ENV>
+        #Cells that you use
         <cellName>sdnip_single</cellName>
         <appString>drivers,openflow,proxyarp</appString>
     </ENV>
@@ -21,14 +22,14 @@
     </DEPENDENCY>
 
     <config>
-        <peerNum> 3 </peerNum>
+        <peerNum> 7 </peerNum>
         <switchNum> 39 </switchNum>
     </config>
 
     <timers>
         <SdnIpSetup>10</SdnIpSetup>
         <TopoDiscovery>60</TopoDiscovery>
-        <PingTestWithRoutes>20</PingTestWithRoutes>
+        <PingTestWithRoutes>30</PingTestWithRoutes>
         <PingTestWithoutRoutes>100</PingTestWithoutRoutes>
         <RouteDelivery>60</RouteDelivery>
         <PathAvailable>20</PathAvailable>
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
index f1ace78..4ca92c7 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
@@ -10,7 +10,6 @@
             Start mininet
         """
         import os
-        import imp
         main.case( "Setup the Mininet testbed" )
         main.dependencyPath = main.testDir + \
                               main.params[ 'DEPENDENCY' ][ 'path' ]
@@ -69,10 +68,8 @@
            onos-install -f
            onos-wait-for-start
         """
-        import json
         import time
         import os
-        from operator import eq
 
         main.case( "Setting up ONOS environment" )
 
@@ -160,13 +157,6 @@
                                  onpass="Install ONOS succeeded",
                                  onfail="Install ONOS failed" )
 
-        main.step( "Checking if ONOS is up yet" )
-        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=onos1UpResult,
-                                 onpass="ONOS is up",
-                                 onfail="ONOS is NOT up" )
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
         utilities.assert_equals( expect=main.TRUE,
@@ -174,6 +164,13 @@
                                  onpass="Set up ONOS secure SSH succeeded",
                                  onfail="Set up ONOS secure SSH failed " )
 
+        main.step( "Checking if ONOS is up yet" )
+        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onos1UpResult,
+                                 onpass="ONOS is up",
+                                 onfail="ONOS is NOT up" )
+
         main.step( "Checking if ONOS CLI is ready" )
         cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
                 commandlineTimeout=100, onosStartTimeout=600 )
@@ -200,6 +197,9 @@
             main.exit()
 
     def CASE200( self, main ):
+        import json
+        import time
+
         main.case( "Activate sdn-ip application" )
         main.log.info( "waiting link discovery......" )
         time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
@@ -242,6 +242,8 @@
         '''
         This test case is to load the methods from other Python files.
         '''
+        import imp
+
         main.case( "Loading methods from other Python file" )
         # load the methods from other file
         wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
@@ -253,20 +255,29 @@
 
     def CASE1( self, main ):
         '''
-        ping test from 3 bgp peers to BGP speaker
+        ping test from 7 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=[ "spk1" ],
+                                          peers=[ "p64514", "p64515", "p64516" ],
+                                          expectAllSuccess=True )
 
+        main.Functions.pingSpeakerToPeer( main, speakers=[ "spk2" ],
+                                          peers=[ "p64517", "p64518" ],
+                                          expectAllSuccess=True )
+
+        main.Functions.pingSpeakerToPeer( main, speakers=[ "spk3" ],
+                                          peers=[ "p64519", "p64520" ],
+                                          expectAllSuccess=True )
 
     def CASE2( self, main ):
         '''
         point-to-point intents test for each BGP peer and BGP speaker pair
         '''
         import time
+        from operator import eq
+
         main.case( "Check point-to-point intents" )
         main.log.info( "There are %s BGP peers in total "
                        % main.params[ 'config' ][ 'peerNum' ] )
@@ -304,6 +315,11 @@
         allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
         allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
 
+        allRoutesExpected.append( "7.0.0.0/24" + "/" + "10.0.7.1" )
+        allRoutesExpected.append( "8.0.0.0/24" + "/" + "10.0.8.1" )
+        allRoutesExpected.append( "9.0.0.0/24" + "/" + "10.0.9.1" )
+        allRoutesExpected.append( "20.0.0.0/24" + "/" + "10.0.20.1" )
+
         getRoutesResult = main.ONOScli.routes( jsonFormat=True )
         allRoutesActual = \
             main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
@@ -330,7 +346,7 @@
         getIntentsResult = main.ONOScli.intents( jsonFormat=True )
         routeIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
-        routeIntentsExpectedNum = 3
+        routeIntentsExpectedNum = 7
         if routeIntentsActualNum != routeIntentsExpectedNum:
             time.sleep( int( main.params['timers']['RouteDelivery'] ) )
             getIntentsResult = main.ONOScli.intents( jsonFormat=True )
@@ -364,10 +380,19 @@
         Ping test in data plane for each route
         '''
         main.case( "Ping test for each route, all hosts behind BGP peers" )
+        #No vlan
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
-                        expectAllSuccess=True )
+                                       hosts=[ "h64514", "h64515", "h64516" ],
+                                       expectAllSuccess=True )
+        #vlan 10
+        main.Functions.pingHostToHost( main,
+                                       hosts=[ "h64519", "h64520" ],
+                                       expectAllSuccess=True )
 
+        # vlan 20
+        main.Functions.pingHostToHost( main,
+                                       hosts=[ "h64517", "h64518" ],
+                                       expectAllSuccess=True )
 
     def CASE5( self, main ):
         '''
@@ -375,8 +400,8 @@
         '''
         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",
+        main.step( "Bring down the link between sw32 and p64514" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="p64514",
                                          OPTION="down" )
         utilities.assertEquals( expect=main.TRUE,
                                 actual=linkResult1,
@@ -385,15 +410,15 @@
 
         if linkResult1 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
-            main.Functions.checkRouteNum( main, 2 )
-            main.Functions.checkM2SintentNum( main, 2 )
+            main.Functions.checkRouteNum( main, 6 ) #We have 7 links between peers and sw. After one link down, 7-1=6.
+            main.Functions.checkM2SintentNum( main, 6 )
         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",
+        main.step( "Bring down the link between sw8 and p64515" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="p64515",
                                          OPTION="down" )
         utilities.assertEquals( expect=main.TRUE,
                                 actual=linkResult2,
@@ -401,15 +426,15 @@
                                 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 )
+            main.Functions.checkRouteNum( main, 5 ) #2 links down, 7-2=5.
+            main.Functions.checkM2SintentNum( main, 5 )
         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",
+        main.step( "Bring down the link between sw28 and p64516" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="p64516",
                                          OPTION="down" )
         utilities.assertEquals( expect=main.TRUE,
                                 actual=linkResult3,
@@ -417,8 +442,8 @@
                                 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 )
+            main.Functions.checkRouteNum( main, 4 ) #3 links downs 7-3=4
+            main.Functions.checkM2SintentNum( main, 4 )
         else:
             main.log.error( "Bring down link failed!" )
             main.cleanup()
@@ -436,12 +461,13 @@
             onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
-                       expectAllSuccess=False )
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                                          peers=["p64514", "p64515", "p64516"],
+                                          expectAllSuccess=False )
+
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
-                        expectAllSuccess=False )
+                                       hosts=["h64514", "h64515", "h64516"],
+                                       expectAllSuccess=False )
 
 
     def CASE6( self, main ):
@@ -450,8 +476,8 @@
         '''
         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",
+        main.step( "Bring up the link between sw32 and p64514" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="p64514",
                                          OPTION="up" )
         utilities.assertEquals( expect=main.TRUE,
                                 actual=linkResult1,
@@ -459,15 +485,15 @@
                                 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 )
+            main.Functions.checkRouteNum( main, 5 ) #one links up, 4+1=5
+            main.Functions.checkM2SintentNum( main, 5 )
         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",
+        main.step( "Bring up the link between sw8 and p64515" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="p64515",
                                          OPTION="up" )
         utilities.assertEquals( expect=main.TRUE,
                                 actual=linkResult2,
@@ -475,15 +501,15 @@
                                 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 )
+            main.Functions.checkRouteNum( main, 6 )
+            main.Functions.checkM2SintentNum( main, 6 )
         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",
+        main.step( "Bring up the link between sw28 and p64516" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="p64516",
                                          OPTION="up" )
         utilities.assertEquals( expect=main.TRUE,
                                 actual=linkResult3,
@@ -491,8 +517,8 @@
                                 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 )
+            main.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
         else:
             main.log.error( "Bring up link failed!" )
             main.cleanup()
@@ -510,11 +536,11 @@
             onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
 
 
@@ -532,18 +558,18 @@
 
         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 )
+            main.Functions.checkRouteNum( main, 6 ) #stop one sw, which bring one link between peer and sw down.
+            main.Functions.checkM2SintentNum( main, 6 )
+            main.Functions.checkP2PintentNum( main, 36 ) #6 intents from sw to speakers x 6 intents to sw x 2 intents between them
         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" )
+        result1 = main.Mininet.pingHost( src="h64514", target="h64515" )
+        result2 = main.Mininet.pingHost( src="h64515", target="h64516" )
+        result3 = main.Mininet.pingHost( src="h64514", target="h64516" )
 
         pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
                                                 and ( result3 == main.FALSE )
@@ -556,9 +582,9 @@
             main.exit()
 
         main.step( "Check ping between BGP peers and speakers" )
-        result4 = main.Mininet.pingHost( src="speaker1", target="peer64514" )
-        result5 = main.Mininet.pingHost( src="speaker1", target="peer64515" )
-        result6 = main.Mininet.pingHost( src="speaker1", target="peer64516" )
+        result4 = main.Mininet.pingHost( src="spk1", target="p64514" )
+        result5 = main.Mininet.pingHost( src="spk1", target="p64515" )
+        result6 = main.Mininet.pingHost( src="spk1", target="p64516" )
 
         pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
                                                 and ( result6 == main.TRUE )
@@ -606,9 +632,9 @@
 
         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 )
+            main.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
+            main.Functions.checkP2PintentNum( main, 42 )
         else:
             main.log.error( "Starting switch failed!" )
             main.cleanup()
@@ -626,11 +652,11 @@
             onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
 
 
@@ -643,9 +669,9 @@
         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", 13 )
+        main.Functions.checkFlowNum( main, "sw11", 43 )
         main.Functions.checkFlowNum( main, "sw1", 3 )
-        main.Functions.checkFlowNum( main, "sw7", 3 )
+        main.Functions.checkFlowNum( main, "sw7", 34 )
         main.log.debug( main.Mininet.checkFlows( "sw11" ) )
         main.log.debug( main.Mininet.checkFlows( "sw1" ) )
         main.log.debug( main.Mininet.checkFlows( "sw7" ) )
@@ -658,9 +684,9 @@
         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 )
+            main.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
+            main.Functions.checkP2PintentNum( main, 42 )
         else:
             main.log.error( "Stopping switch failed!" )
             main.cleanup()
@@ -677,11 +703,11 @@
             onpass="Flow status is correct!",
             onfail="Flow status is wrong!" )
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
 
 
@@ -694,8 +720,8 @@
         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", 11 )
-        main.Functions.checkFlowNum( main, "sw7", 5 )
+        main.Functions.checkFlowNum( main, "sw1", 33 )
+        main.Functions.checkFlowNum( main, "sw7", 28 )
         main.log.debug( main.Mininet.checkFlows( "sw1" ) )
         main.log.debug( main.Mininet.checkFlows( "sw7" ) )
 
@@ -710,9 +736,9 @@
                                 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 )
+            main.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
+            main.Functions.checkP2PintentNum( main, 42 )
 
             main.log.debug( main.Mininet.checkFlows( "sw11" ) )
             main.log.debug( main.Mininet.checkFlows( "sw1" ) )
@@ -733,9 +759,9 @@
             onpass="Flow status is correct!",
             onfail="Flow status is wrong!" )
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/Functions.py b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/Functions.py
index 428cbce..e99f4f6 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/Functions.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/Functions.py
@@ -78,8 +78,8 @@
         onfail = "Flow number in " + switch + " is wrong!" )
 
 
-def pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["peer64514", "peer64515", "peer64516"],
+def pingSpeakerToPeer( main, speakers = [ "spk1" ],
+                       peers = [ "peer64514", "peer64515", "peer64516" ],
                        expectAllSuccess = True ):
     """
     Carry out ping test between each BGP speaker and peer pair
@@ -125,7 +125,8 @@
         main.exit()
 
 
-def pingHostToHost( main, hosts = ["host64514", "host64515", "host64516"],
+def pingHostToHost( main,
+                    hosts = [ "h64514", "h64515", "h64516" ],
                 expectAllSuccess = True ):
     """
     Carry out ping test between each BGP host pair
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
index 754c03c..71907ea 100755
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
@@ -12,16 +12,11 @@
 """
 
 from mininet.net import Mininet
-from mininet.node import Controller, RemoteController
 from mininet.log import setLogLevel, info
 from mininet.cli import CLI
+from mininet.node import Host, RemoteController
 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'
@@ -29,6 +24,18 @@
 # onos1IP = '10.254.1.201'
 numSw = 39
 
+class VLANHost( Host ):
+    def config( self, vlan=100, intfName=None, **params ):
+        r = super( Host, self ).config( **params )
+        intf = self.intf( intfName )
+        self.cmd( 'ifconfig %s inet 0' % intf )
+        self.cmd( 'vconfig add %s %d' % ( intf, vlan ) )
+        self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) )
+        newName = '%s.%d' % ( intf, vlan )
+        intf.name = newName
+        self.nameToIntf[ newName ] = intf
+        return r
+
 
 class SDNTopo( Topo ):
     "SDN Topology"
@@ -38,9 +45,14 @@
         Topo.__init__( self, *args, **kwargs )
 
         # BGP peer hosts
-        peer64514 = self.addHost( 'peer64514' )
-        peer64515 = self.addHost( 'peer64515' )
-        peer64516 = self.addHost( 'peer64516' )
+        p64514 = self.addHost( 'p64514' )
+        p64515 = self.addHost( 'p64515' )
+        p64516 = self.addHost( 'p64516' )
+
+        p64517 = self.addHost( 'p64517', cls=VLANHost, vlan=20 )
+        p64518 = self.addHost( 'p64518', cls=VLANHost, vlan=20 )
+        p64519 = self.addHost( 'p64519', cls=VLANHost, vlan=10 )
+        p64520 = self.addHost( 'p64520', cls=VLANHost, vlan=10 )
 
         '''
         sw1 = self.addSwitch( 'SEAT', dpid = '00000000000000a1' )
@@ -131,18 +143,26 @@
 
 
         # BGP speaker hosts
-        speaker1 = self.addHost( 'speaker1' )
-        speaker2 = self.addHost( 'speaker2' )
+        spk1 = self.addHost( 'spk1' )
+        spk2 = self.addHost( 'spk2', cls=VLANHost, vlan=20 )
+        spk3 = self.addHost( 'spk3', cls=VLANHost, vlan=10 )
 
         root = self.addHost( 'root', inNamespace = False , ip = '0' )
 
         # hosts behind each AS
-        host64514 = self.addHost( 'host64514' )
-        host64515 = self.addHost( 'host64515' )
-        host64516 = self.addHost( 'host64516' )
+        h64514 = self.addHost( 'h64514' )
+        h64515 = self.addHost( 'h64515' )
+        h64516 = self.addHost( 'h64516' )
 
-        self.addLink( 'speaker1', sw24 )
-        self.addLink( 'speaker2', sw24 )
+        #VLAN hosts behind each AS
+        h64517 = self.addHost( 'h64517', cls=VLANHost, vlan=20 )
+        h64518 = self.addHost( 'h64518', cls=VLANHost, vlan=20 )
+        h64519 = self.addHost( 'h64519', cls=VLANHost, vlan=10 )
+        h64520 = self.addHost( 'h64520', cls=VLANHost, vlan=10 )
+
+        self.addLink( 'spk1', sw24 )
+        self.addLink( 'spk2', sw24 )
+        self.addLink( 'spk3', sw24 )
 
         # connect all switches
         self.addLink( sw1, sw2 )
@@ -197,26 +217,45 @@
         self.addLink( sw38, sw39 )
 
         # connection between switches and peers
-        self.addLink( peer64514, sw32 )
-        self.addLink( peer64515, sw8 )
-        self.addLink( peer64516, sw28 )
+        self.addLink( p64514, sw32 )
+        self.addLink( p64515, sw8 )
+        self.addLink( p64516, sw28 )
+
+        self.addLink( p64517, sw7 )
+        self.addLink( p64518, sw9 )
+        self.addLink( p64519, sw5 )
+        self.addLink( p64520, sw5 )  # should be sw5
 
         # connection between BGP peer and hosts behind the BGP peer
-        self.addLink( peer64514, host64514 )
-        self.addLink( peer64515, host64515 )
-        self.addLink( peer64516, host64516 )
+        self.addLink( p64514, h64514 )
+        self.addLink( p64515, h64515 )
+        self.addLink( p64516, h64516 )
+
+        self.addLink( p64517, h64517 )
+        self.addLink( p64518, h64518 )
+        self.addLink( p64519, h64519 )
+        self.addLink( p64520, h64520 )
+
 
         # Internal Connection To Hosts
-        self.addLink( swCtl100, peer64514 )
-        self.addLink( swCtl100, peer64515 )
-        self.addLink( swCtl100, peer64516 )
-        self.addLink( swCtl100, speaker1 )
-        self.addLink( swCtl100, speaker2 )
+        self.addLink( swCtl100, p64514 )
+        self.addLink( swCtl100, p64515 )
+        self.addLink( swCtl100, p64516 )
+
+        self.addLink( swCtl100, p64517 )
+        self.addLink( swCtl100, p64518 )
+        self.addLink( swCtl100, p64519 )
+        self.addLink( swCtl100, p64520 )
+
+        self.addLink( swCtl100, spk1 )
+        self.addLink( swCtl100, spk2 )
+        self.addLink( swCtl100, spk3 )
 
 
-
-        # add host64514 to control plane for ping test
-        self.addLink( swCtl100, host64514 )
+        # add h64514 to control plane for ping test
+        self.addLink( swCtl100, h64514 )
+        self.addLink( swCtl100, h64517 )
+        self.addLink( swCtl100, h64519 )
         self.addLink( swCtl100, root )
 
 
@@ -265,7 +304,6 @@
     host.cmd( zebra_cmd )
     host.cmd( quagga_cmd )
 
-
 def stopquagga():
     quietRun( 'sudo pkill -9 -f bgpd' )
     quietRun( 'sudo pkill -9 -f zebra' )
@@ -277,60 +315,118 @@
     net = Mininet( topo = topo, controller = RemoteController )
 
 
-    speaker1, speaker2, peer64514, peer64515, peer64516 = \
-    net.get( 'speaker1', 'speaker2' ,
-             'peer64514', 'peer64515', 'peer64516' )
+    spk1, spk2, spk3, p64514, p64515, p64516, p64517, p64518, p64519, p64520 = \
+    net.get( 'spk1', 'spk2', 'spk3',
+             'p64514', 'p64515', 'p64516', 'p64517', 'p64518', 'p64519', 'p64520' )
 
     # Adding addresses to host64513_1 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' )
+    spk1.setMAC( '00:00:00:00:00:01', 'spk1-eth0' )
+    spk1.cmd( 'ip addr add 10.0.4.101/24 dev spk1-eth0' )
+    spk1.cmd( 'ip addr add 10.0.5.101/24 dev spk1-eth0' )
+    spk1.cmd( 'ip addr add 10.0.6.101/24 dev spk1-eth0' )
+    spk1.defaultIntf().setIP( '10.1.4.101/24' )
+    spk1.defaultIntf().setMAC( '00:00:00:00:00:01' )
 
-    speaker1.defaultIntf().setIP( '10.1.4.101/24' )
-    speaker1.defaultIntf().setMAC( '00:00:00:00:00:01' )
+    spk2.setMAC( '00:00:00:00:00:02', 'spk2-eth0.20' )
+    spk2.cmd( 'ip addr add 10.0.7.101/24 dev spk2-eth0.20' )
+    spk2.cmd( 'ip addr add 10.0.8.101/24 dev spk2-eth0.20' )
+    spk2.defaultIntf().setIP( '10.1.7.101/24' )
+    spk2.defaultIntf().setMAC( '00:00:00:00:00:02' )
+
+    spk3.setMAC( '00:00:00:00:00:03', 'spk3-eth0.10' )
+    spk3.cmd( 'ip addr add 10.0.9.101/24 dev spk3-eth0.10' )
+    spk3.cmd( 'ip addr add 10.0.20.101/24 dev spk3-eth0.10' )
+    spk3.defaultIntf().setIP( '10.1.9.101/24' )
+    spk3.defaultIntf().setMAC( '00:00:00:00:00:03' )
+
+    p64517.config( vlan=20, intfName="p64517-eth1", ip="7.0.0.254" )
+    p64518.config( vlan=20, intfName="p64518-eth1", ip="8.0.0.254" )
+    p64519.config( vlan=10, intfName="p64519-eth1", ip="9.0.0.254" )
+    p64520.config( vlan=10, intfName="p64520-eth1", ip="20.0.0.254" )
 
     # 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.setMAC( '00:00:00:00:00:04', 'peer64514-eth0' )
-    peer64515.cmd( "ifconfig  peer64515-eth0 10.0.5.1 up" )
-    peer64515.setMAC( '00:00:00:00:00:05', 'peer64515-eth0' )
-    peer64516.cmd( "ifconfig  peer64516-eth0 10.0.6.1 up" )
-    peer64516.setMAC( '00:00:00:00:00:06', 'peer64516-eth0' )
+    p64514.cmd( "ifconfig  p64514-eth0 10.0.4.1 up" )
+    p64514.setMAC( '00:00:00:00:00:04', 'p64514-eth0' )
+    p64515.cmd( "ifconfig  p64515-eth0 10.0.5.1 up" )
+    p64515.setMAC( '00:00:00:00:00:05', 'p64515-eth0' )
+    p64516.cmd( "ifconfig  p64516-eth0 10.0.6.1 up" )
+    p64516.setMAC( '00:00:00:00:00:06', 'p64516-eth0' )
+
+    p64517.cmd( "ifconfig  p64517-eth0.20 10.0.7.1 up" )
+    p64517.setMAC( '00:00:00:00:00:07', 'p64517-eth0.20' )
+    p64518.cmd( "ifconfig  p64518-eth0.20 10.0.8.1 up" )
+    p64518.setMAC( '00:00:00:00:00:08', 'p64518-eth0.20' )
+
+    p64519.cmd( "ifconfig  p64519-eth0.10 10.0.9.1 up" )
+    p64519.setMAC( '00:00:00:00:00:09', 'p64519-eth0.10' )
+    p64520.cmd( "ifconfig  p64520-eth0.10 10.0.20.1 up" )
+    p64520.setMAC( '00:00:00:00:00:20', 'p64520-eth0.10' )
 
     # 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' )
+    p64514.setIP( "4.0.0.254", 8, "p64514-eth1" )
+    p64514.setMAC( '00:00:00:00:00:44', 'p64514-eth1' )
+    p64515.setIP( "5.0.0.254", 8, "p64515-eth1" )
+    p64515.setMAC( '00:00:00:00:00:55', 'p64515-eth1' )
+    p64516.setIP( "6.0.0.254", 8, "p64516-eth1" )
+    p64516.setMAC( '00:00:00:00:00:66', 'p64516-eth1' )
+
+    p64517.setIP( "7.0.0.254", 8, "p64517-eth1.20" )
+    p64517.setMAC( '00:00:00:00:00:77', 'p64517-eth1.20' )
+    p64518.setIP( "8.0.0.254", 8, "p64518-eth1.20" )
+    p64518.setMAC( '00:00:00:00:00:88', 'p64518-eth1.20' )
+
+    p64519.setIP( "9.0.0.254", 8, "p64519-eth1.10" )
+    p64519.setMAC( '00:00:00:00:00:99', 'p64519-eth1.10' )
+    p64520.setIP( "20.0.0.254", 8, "p64520-eth1.10" )
+    p64520.setMAC( '00:00:00:00:00:20', 'p64520-eth1.10' )
+
 
     # 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' )
+    p64514.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64515.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64516.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+
+    p64517.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64518.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64519.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64520.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" )
+    p64514.setIP( "192.168.0.4", 24, "p64514-eth2" )
+    p64515.setIP( "192.168.0.5", 24, "p64515-eth2" )
+    p64516.setIP( "192.168.0.6", 24, "p64516-eth2" )
+
+    p64517.setIP( "192.168.0.7", 24, "p64517-eth2" )
+    p64518.setIP( "192.168.0.8", 24, "p64518-eth2" )
+    p64519.setIP( "192.168.0.9", 24, "p64519-eth2" )
+    p64520.setIP( "192.168.0.20", 24, "p64520-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' )
+    h64514, h64515, h64516, h64517, h64518, h64519, h64520 = \
+    net.get( 'h64514', 'h64515', 'h64516', 'h64517', 'h64518', 'h64519', 'h64520' )
+    h64514.cmd( 'ifconfig h64514-eth0 4.0.0.1 up' )
+    h64514.cmd( 'ip route add default via 4.0.0.254' )
+    h64514.setIP( '192.168.0.44', 24, 'h64514-eth1' )  # for control plane
+    h64515.cmd( 'ifconfig h64515-eth0 5.0.0.1 up' )
+    h64515.cmd( 'ip route add default via 5.0.0.254' )
+    h64516.cmd( 'ifconfig h64516-eth0 6.0.0.1 up' )
+    h64516.cmd( 'ip route add default via 6.0.0.254' )
 
+    h64517.cmd( 'ifconfig h64517-eth0.20 7.0.0.1 up' )
+    h64517.cmd( 'ip route add default via 7.0.0.254' )
+    h64517.setIP( '192.168.0.77', 24, 'h64517-eth1' )  # for control plane
+    h64518.cmd( 'ifconfig h64518-eth0.20 8.0.0.1 up' )
+    h64518.cmd( 'ip route add default via 8.0.0.254' )
+
+    h64519.cmd( 'ifconfig h64519-eth0.10 9.0.0.1 up' )
+    h64519.cmd( 'ip route add default via 9.0.0.254' )
+    h64519.setIP( '192.168.0.99', 24, 'h64519-eth1' )  # for control plane
+    h64520.cmd( 'ifconfig h64520-eth0.10 20.0.0.1 up' )
+    h64520.cmd( 'ip route add default via 20.0.0.254' )
 
     # set up swCtl100 as a learning
     swCtl100 = net.get( 'swCtl100' )
@@ -343,29 +439,38 @@
         swX = net.get( 'sw%s' % ( i ) )
         swX.cmd( 'ovs-vsctl set-controller sw%s tcp:%s:6653' % ( i, onos1IP ) )
     '''
-    # Start Quagga on border routers
+    # Start Quagga as the external BGP routers
     '''
     for i in range ( 64514, 64516 + 1 ):
         startquagga( 'peer%s' % ( i ), i, 'quagga%s.conf' % ( i ) )
     '''
-    startquagga( peer64514, 64514, 'quagga64514.conf' )
-    startquagga( peer64515, 64515, 'quagga64515.conf' )
-    startquagga( peer64516, 64516, 'quagga64516.conf' )
+    startquagga( p64514, 64514, 'quagga64514.conf' )
+    startquagga( p64515, 64515, 'quagga64515.conf' )
+    startquagga( p64516, 64516, 'quagga64516.conf' )
 
-    # start Quagga in SDN network
-    startquagga( speaker1, 64513, 'quagga-sdn.conf' )
+    startquagga( p64517, 64517, 'quagga64517.conf' )
+    startquagga( p64518, 64518, 'quagga64518.conf' )
+    startquagga( p64519, 64519, 'quagga64519.conf' )
+    startquagga( p64520, 64520, 'quagga64520.conf' )
 
+    # start Quagga as the BGP speaker
+    startquagga( spk1, 64513, 'quagga-sdn.conf' )
+    startquagga( spk2, 64512, 'quagga-sdn2.conf' )
+    startquagga( spk3, 64511, 'quagga-sdn3.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' )
 
-    speaker1.intf( 'speaker1-eth1' ).setIP( '1.1.1.1/24' )
-
+    spk1.intf( 'spk1-eth1' ).setIP( '1.1.1.1/24' )
+    spk2.intf( 'spk2-eth1' ).setIP( '1.1.1.3/24' )
+    spk3.intf( 'spk3-eth1' ).setIP( '1.1.1.5/24' )
 
     stopsshd()
 
-    hosts = [ peer64514, peer64515, peer64516, host64514];
+    hosts = [ p64514, p64515, p64516, p64517, p64518, p64519, p64520,
+              h64514, h64517, h64519 ];
     startsshds( hosts )
     #
     '''
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn.conf b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn.conf
index b5d8b12..558b2cd 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn.conf
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn.conf
@@ -14,7 +14,6 @@
 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
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn2.conf b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn2.conf
new file mode 100644
index 0000000..6eb45d7
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn2.conf
@@ -0,0 +1,37 @@
+! -*- 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.7.101
+  timers bgp 1 2
+  neighbor 10.0.7.1 remote-as 64517
+  neighbor 10.0.7.1 ebgp-multihop
+  neighbor 10.0.7.1 timers connect 5
+  neighbor 10.0.8.1 remote-as 64518
+  neighbor 10.0.8.1 ebgp-multihop
+  neighbor 10.0.8.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
+
+!
+! 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/USECASE_SdnipFunction/dependencies/quagga-sdn3.conf b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn3.conf
new file mode 100644
index 0000000..9154424
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga-sdn3.conf
@@ -0,0 +1,37 @@
+! -*- 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.9.101
+  timers bgp 1 2
+  neighbor 10.0.9.1 remote-as 64519
+  neighbor 10.0.9.1 ebgp-multihop
+  neighbor 10.0.9.1 timers connect 5
+  neighbor 10.0.20.1 remote-as 64520
+  neighbor 10.0.20.1 ebgp-multihop
+  neighbor 10.0.20.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
+
+!
+! 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/USECASE_SdnipFunction/dependencies/quagga64517.conf b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga64517.conf
new file mode 100644
index 0000000..00e4cf8
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga64517.conf
@@ -0,0 +1,28 @@
+! -*- 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 64517
+  bgp router-id 10.0.7.1
+!  timers bgp 1 3
+ neighbor 10.0.7.101 remote-as 64513
+ network 7.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/USECASE_SdnipFunction/dependencies/quagga64518.conf b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga64518.conf
new file mode 100644
index 0000000..c156102
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga64518.conf
@@ -0,0 +1,28 @@
+! -*- 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 64518
+  bgp router-id 10.0.8.1
+!  timers bgp 1 3
+ neighbor 10.0.8.101 remote-as 64513
+ network 8.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/USECASE_SdnipFunction/dependencies/quagga64519.conf b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga64519.conf
new file mode 100644
index 0000000..11f1801
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga64519.conf
@@ -0,0 +1,28 @@
+! -*- 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 64519
+  bgp router-id 10.0.9.1
+!  timers bgp 1 3
+ neighbor 10.0.9.101 remote-as 64513
+ network 9.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/USECASE_SdnipFunction/dependencies/quagga64520.conf b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga64520.conf
new file mode 100644
index 0000000..5fa469d
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/quagga64520.conf
@@ -0,0 +1,28 @@
+! -*- 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 64520
+  bgp router-id 10.0.20.1
+!  timers bgp 1 3
+ neighbor 10.0.20.101 remote-as 64513
+ network 20.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/USECASE_SdnipFunction/network-cfg.json b/TestON/tests/USECASE/USECASE_SdnipFunction/network-cfg.json
index 303b1bd..bf6fa1a 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/network-cfg.json
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/network-cfg.json
@@ -3,6 +3,7 @@
         "of:00000000000000a8/5" : {
             "interfaces" : [
                 {
+                    "name": "sw8-5",
                     "ips"  : [ "10.0.5.101/24" ],
                     "mac"  : "00:00:00:00:00:01"
                 }
@@ -11,6 +12,7 @@
         "of:0000000000000a32/4" : {
             "interfaces" : [
                 {
+                    "name" : "sw32-4",
                     "ips"  : [ "10.0.4.101/24" ],
                     "mac"  : "00:00:00:00:00:01"
                 }
@@ -19,10 +21,51 @@
         "of:0000000000000a28/3" : {
             "interfaces" : [
                 {
+                    "name" : "sw28-3",
                     "ips"  : [ "10.0.6.101/24" ],
                     "mac"  : "00:00:00:00:00:01"
                 }
             ]
+        },
+        "of:00000000000000a5/5" : {
+              "interfaces" : [
+                  {
+                      "name" : "sw5-5",
+                      "ips"  : [ "10.0.20.101/24" ],
+                      "mac"  : "00:00:00:00:00:03",
+                      "vlan" : "10"
+                  }
+              ]
+        },
+        "of:00000000000000a5/4" : {
+            "interfaces" : [
+                {
+                    "name" : "sw5-4",
+                    "ips"  : [ "10.0.9.101/24" ],
+                    "mac"  : "00:00:00:00:00:03",
+                    "vlan" : "10"
+                }
+            ]
+        },
+        "of:00000000000000a7/3" : {
+            "interfaces" : [
+                {
+                    "name" : "sw7-3",
+                    "ips"  : [ "10.0.7.101/24" ],
+                    "mac"  : "00:00:00:00:00:02",
+                    "vlan" : "20"
+                }
+            ]
+        },
+        "of:00000000000000a9/3" : {
+              "interfaces" : [
+                  {
+                      "name" : "sw9-3",
+                      "ips"  : [ "10.0.8.101/24" ],
+                      "mac"  : "00:00:00:00:00:02",
+                      "vlan" : "20"
+                  }
+              ]
         }
     },
     "apps" : {
@@ -30,13 +73,33 @@
             "bgp" : {
                 "bgpSpeakers" : [
                     {
+                        "name": "bgpSpeaker1",
                         "connectPoint" : "of:0000000000000a24/1",
                         "peers" : [
                             "10.0.4.1",
                             "10.0.5.1",
                             "10.0.6.1"
                         ]
+                    },
+                    {
+                        "name": "bgpSpeaker2",
+                        "vlan": "20",
+                        "connectPoint" : "of:0000000000000a24/2",
+                        "peers" : [
+                            "10.0.7.1",
+                            "10.0.8.1"
+                        ]
+                    },
+                    {
+                          "name": "bgpSpeaker3",
+                          "vlan": "10",
+                          "connectPoint" : "of:0000000000000a24/3",
+                          "peers" : [
+                              "10.0.9.1",
+                              "10.0.20.1"
+                          ]
                     }
+
                 ]
             }
         }
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params
index 7f93976..0d6014f 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params
@@ -23,17 +23,17 @@
     </DEPENDENCY>
 
     <config>
-        <peerNum> 3 </peerNum>
+        <peerNum> 7 </peerNum>
         <switchNum> 39 </switchNum>
-        <peer64514> 10.0.14.1</peer64514>
-        <peer64515> 10.0.15.1</peer64515>
-        <peer64516> 10.0.16.1</peer64516>
+        <p64514> 10.0.14.1</p64514>
+        <p64515> 10.0.15.1</p64515>
+        <p64516> 10.0.16.1</p64516>
     </config>
 
     <timers>
         <SdnIpSetup>10</SdnIpSetup>
-        <TopoDiscovery>10</TopoDiscovery>
-        <PingTestWithRoutes>20</PingTestWithRoutes>
+        <TopoDiscovery>15</TopoDiscovery>
+        <PingTestWithRoutes>30</PingTestWithRoutes>
         <PingTestWithoutRoutes>100</PingTestWithoutRoutes>
         <RouteDelivery>30</RouteDelivery>
         <PathAvailable>20</PathAvailable>
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
index 87b628f..68ed759 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
@@ -69,12 +69,12 @@
         ONOS3Ip = os.getenv( main.params[ 'CTRL' ][ 'ip3' ] )
         ipList = [ ONOS1Ip, ONOS2Ip, ONOS3Ip ]
 
-        global peer64514
-        global peer64515
-        global peer64516
-        peer64514 = main.params['config']['peer64514']
-        peer64515 = main.params['config']['peer64515']
-        peer64516 = main.params['config']['peer64516']
+        global p64514
+        global p64515
+        global p64516
+        p64514 = main.params['config']['p64514']
+        p64515 = main.params['config']['p64515']
+        p64516 = main.params['config']['p64516']
 
         main.step( "Copying config files" )
         src = os.path.dirname( main.testFile ) + "/network-cfg.json"
@@ -140,6 +140,15 @@
                                  onpass="Install ONOS to nodes succeeded",
                                  onfail="Install ONOS to nodes failed" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
+        secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=ONOS2Ip )
+        secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=ONOS3Ip )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=secureSshResult,
+                                 onpass="Set up ONOS secure SSH succeeded",
+                                 onfail="Set up ONOS secure SSH failed " )
+
         main.step( "Checking if ONOS is up yet" )
         onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
         onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout=420 )
@@ -150,15 +159,6 @@
                                  onpass="ONOS nodes are up",
                                  onfail="ONOS nodes are NOT up" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
-        secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=ONOS2Ip )
-        secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=ONOS3Ip )
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=secureSshResult,
-                                 onpass="Set up ONOS secure SSH succeeded",
-                                 onfail="Set up ONOS secure SSH failed " )
-
         main.step( "Checking if ONOS CLI is ready" )
         main.CLIs = []
         cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip,
@@ -262,12 +262,21 @@
         '''
 
         main.case( "Ping 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 )
+        main.Functions.pingSpeakerToPeer( main, speakers=[ "spk1" ],
+                                          peers=[ "p64514", "p64515", "p64516" ],
+                                          expectAllSuccess=True )
+
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk2"],
+                                          peers=[ p64514, p64515, p64516 ],
+                                          expectAllSuccess=True )
+
+        main.Functions.pingSpeakerToPeer( main, speakers=[ "spk3" ],
+                                          peers=[ "p64519", "p64520" ],
+                                          expectAllSuccess=True )
+
+        main.Functions.pingSpeakerToPeer( main, speakers=[ "spk4" ],
+                                          peers=[ "p64517", "p64518" ],
+                                          expectAllSuccess=True )
 
     def CASE2( self, main ):
         '''
@@ -309,6 +318,10 @@
         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" )
+        allRoutesExpected.append( "7.0.0.0/24" + "/" + "10.0.7.1" )
+        allRoutesExpected.append( "8.0.0.0/24" + "/" + "10.0.8.1" )
+        allRoutesExpected.append( "9.0.0.0/24" + "/" + "10.0.9.1" )
+        allRoutesExpected.append( "20.0.0.0/24" + "/" + "10.0.20.1" )
 
         getRoutesResult = main.ONOScli1.routes( jsonFormat=True )
         allRoutesActual = \
@@ -335,7 +348,7 @@
         getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
         routeIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
-        routeIntentsExpectedNum = 3
+        routeIntentsExpectedNum = 7
         if routeIntentsActualNum != routeIntentsExpectedNum:
             time.sleep( int( main.params['timers']['RouteDelivery'] ) )
             getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
@@ -368,9 +381,14 @@
         '''
         main.case( "Ping test for each route, all hosts behind BGP peers" )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
-
+        main.Functions.pingHostToHost(main,
+                                      hosts=["h64517", "h64518"],
+                                      expectAllSuccess=True)
+        main.Functions.pingHostToHost(main,
+                                      hosts=["h64519", "h64520"],
+                                      expectAllSuccess=True)
 
     def CASE5( self, main ):
         '''
@@ -378,8 +396,8 @@
         '''
         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",
+        main.step( "Bring down the link between sw32 and p64514" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="p64514",
                                          OPTION="down" )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=linkResult1,
@@ -388,15 +406,15 @@
 
         if linkResult1 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
-            main.Functions.checkRouteNum( main, 2 )
-            main.Functions.checkM2SintentNum( main, 2 )
+            main.Functions.checkRouteNum( main, 6 )
+            main.Functions.checkM2SintentNum( main, 6 )
         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",
+        main.step( "Bring down the link between sw8 and p64515" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="p64515",
                                          OPTION="down" )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=linkResult2,
@@ -404,15 +422,15 @@
                                  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 )
+            main.Functions.checkRouteNum( main, 5 )
+            main.Functions.checkM2SintentNum( main, 5 )
         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",
+        main.step( "Bring down the link between sw28 and p64516" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="p64516",
                                          OPTION="down" )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=linkResult3,
@@ -420,8 +438,8 @@
                                  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 )
+            main.Functions.checkRouteNum( main, 4 )
+            main.Functions.checkM2SintentNum( main, 4 )
         else:
             main.log.error( "Bring down link failed!" )
             main.cleanup()
@@ -438,11 +456,11 @@
                                  onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=False )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=False )
 
     def CASE6( self, main ):
@@ -451,8 +469,8 @@
         '''
         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",
+        main.step( "Bring up the link between sw32 and p64514" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="p64514",
                                          OPTION="up" )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=linkResult1,
@@ -460,15 +478,15 @@
                                  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 )
+            main.Functions.checkRouteNum( main, 5 )
+            main.Functions.checkM2SintentNum( main, 5 )
         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",
+        main.step( "Bring up the link between sw8 and p64515" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="p64515",
                                          OPTION="up" )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=linkResult2,
@@ -476,15 +494,15 @@
                                  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 )
+            main.Functions.checkRouteNum( main, 6 )
+            main.Functions.checkM2SintentNum( main, 6 )
         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",
+        main.step( "Bring up the link between sw28 and p64516" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="p64516",
                                          OPTION="up" )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=linkResult3,
@@ -492,8 +510,8 @@
                                  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 )
+            main.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
         else:
             main.log.error( "Bring up link failed!" )
             main.cleanup()
@@ -510,11 +528,11 @@
                                  onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
 
     def CASE7( self, main ):
@@ -531,18 +549,18 @@
 
         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 )
+            main.Functions.checkRouteNum( main, 6 )
+            main.Functions.checkM2SintentNum( main, 6 )
+            main.Functions.checkP2PintentNum( main, 48 ) #14 * 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" )
+        result1 = main.Mininet.pingHost( src="h64514", target="h64515" )
+        result2 = main.Mininet.pingHost( src="h64515", target="h64516" )
+        result3 = main.Mininet.pingHost( src="h64514", target="h64516" )
 
         pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
                       and ( result3 == main.FALSE )
@@ -554,10 +572,10 @@
             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" )
+        main.step( "Check ping between BGP peers and spk1" )
+        result4 = main.Mininet.pingHost( src="spk1", target="p64514" )
+        result5 = main.Mininet.pingHost( src="spk1", target="p64515" )
+        result6 = main.Mininet.pingHost( src="spk1", target="p64516" )
 
         pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
                       and ( result6 == main.TRUE )
@@ -569,11 +587,11 @@
             main.cleanup()
             main.exit()
 
-        main.step( "Check ping between BGP peers and speaker2" )
+        main.step( "Check ping between BGP peers and spk2" )
         # 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 )
+        result7 = main.Mininet.pingHost( src="spk2", target=p64514 )
+        result8 = main.Mininet.pingHost( src="spk2", target=p64515 )
+        result9 = main.Mininet.pingHost( src="spk2", target=p64516 )
 
         pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \
                                                 and ( result9 == main.TRUE )
@@ -617,9 +635,9 @@
 
         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.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
+            main.Functions.checkP2PintentNum( main, 30 * 2 ) # 18*2
         else:
             main.log.error( "Starting switch failed!" )
             main.cleanup()
@@ -636,15 +654,17 @@
                                  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.pingSpeakerToPeer( main, speakers=[ "spk1" ],
+                                          peers=["p64514", "p64515", "p64516"],
+                                          expectAllSuccess=True )
+
+        main.Functions.pingSpeakerToPeer( main, speakers=[ "spk2" ],
+                                          peers=[ p64514, p64515, p64516 ],
+                                          expectAllSuccess=True )
+
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
-                        expectAllSuccess=True )
+                                       hosts=[ "h64514", "h64515", "h64516" ],
+                                       expectAllSuccess=True )
 
     def CASE9( self, main ):
         '''
@@ -655,9 +675,9 @@
         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.Functions.checkFlowNum( main, "sw11", 49 )
+        main.Functions.checkFlowNum( main, "sw1", 7 )
+        main.Functions.checkFlowNum( main, "sw7", 34 )
         main.log.info( main.Mininet.checkFlows( "sw11" ) )
         main.log.info( main.Mininet.checkFlows( "sw1" ) )
         main.log.info( main.Mininet.checkFlows( "sw7" ) )
@@ -670,9 +690,9 @@
         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 )
+            main.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
+            main.Functions.checkP2PintentNum( main, 30 * 2 ) #18 * 2
         else:
             main.log.error( "Stopping switch failed!" )
             main.cleanup()
@@ -688,14 +708,14 @@
                                  onpass="Flow status is correct!",
                                  onfail="Flow status is wrong!" )
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
-                       peers=[peer64514, peer64515, peer64516],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk2"],
+                       peers=[p64514, p64515, p64516],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
 
 
@@ -708,8 +728,8 @@
         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.Functions.checkFlowNum( main, "sw1", 36 )
+        main.Functions.checkFlowNum( main, "sw7", 30 )
         main.log.info( main.Mininet.checkFlows( "sw1" ) )
         main.log.info( main.Mininet.checkFlows( "sw7" ) )
 
@@ -724,9 +744,9 @@
                                  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.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
+            main.Functions.checkP2PintentNum( main, 30 * 2 )
 
             main.log.debug( main.Mininet.checkFlows( "sw11" ) )
             main.log.debug( main.Mininet.checkFlows( "sw1" ) )
@@ -746,25 +766,25 @@
                                  onpass="Flow status is correct!",
                                  onfail="Flow status is wrong!" )
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
-                       peers=[peer64514, peer64515, peer64516],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk2"],
+                       peers=[p64514, p64515, p64516],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
 
 
     def CASE11(self, main):
         import time
-        main.case( "Kill speaker1, check:\
+        main.case( "Kill spk1, 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.log.info( "Check network status before killing spk1" )
+        main.Functions.checkRouteNum( main, 7 )
+        main.Functions.checkM2SintentNum( main, 7 )
+        main.Functions.checkP2PintentNum( main, 30 * 2 )
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
                                      main.FALSE,
@@ -775,25 +795,25 @@
                                  onpass="Flow status is correct!",
                                  onfail="Flow status is wrong!" )
 
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
-                       peers=[peer64514, peer64515, peer64516],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk2"],
+                       peers=[p64514, p64515, p64516],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
 
-        main.step( "Kill speaker1" )
+        main.step( "Kill spk1" )
         command1 = "ps -e | grep bgp -c"
         result1 = main.Mininet.node( "root", command1 )
 
         # The total BGP daemon number in this test environment is 5.
         if "5" in result1:
-            main.log.debug( "Before kill speaker1, 5 BGP daemons - correct" )
+            main.log.debug( "Before kill spk1, 5 BGP daemons - correct" )
         else:
-            main.log.warn( "Before kill speaker1, number of BGP daemons is wrong" )
+            main.log.warn( "Before kill spk1, number of BGP daemons is wrong" )
             main.log.info( result1 )
 
         command2 = "sudo kill -9 `ps -ef | grep quagga-sdn.conf | grep -v grep | awk '{print $2}'`"
@@ -803,17 +823,17 @@
 
         utilities.assert_equals( expect=True,
                                  actual=( "4" in result3 ),
-                                 onpass="Kill speaker1 succeeded",
-                                 onfail="Kill speaker1 failed" )
+                                 onpass="Kill spk1 succeeded",
+                                 onfail="Kill spk1 failed" )
         if ( "4" not in result3 ) :
             main.log.info( result3 )
             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.Functions.checkRouteNum( main, 7 )
+        main.Functions.checkM2SintentNum( main, 7 )
+        main.Functions.checkP2PintentNum( main, 30 * 2 )
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
@@ -826,15 +846,15 @@
                                  onfail="Flow status is wrong!" )
 
         '''
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=False )
         '''
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
-                       peers=[peer64514, peer64515, peer64516],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk2"],
+                       peers=[p64514, p64515, p64516],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
 
 
@@ -871,9 +891,9 @@
         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.Functions.checkRouteNum( main, 7, ONOScli="ONOScli2" )
+            main.Functions.checkM2SintentNum( main, 7, ONOScli="ONOScli2" )
+            main.Functions.checkP2PintentNum( main, 30 * 2, ONOScli="ONOScli2" )
 
             main.step( "Check whether all flow status are ADDED" )
             flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
@@ -885,9 +905,9 @@
                                      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.Functions.checkRouteNum( main, 7 )
+            main.Functions.checkM2SintentNum( main, 7 )
+            main.Functions.checkP2PintentNum( main, 30 * 2 )
 
             main.step( "Check whether all flow status are ADDED" )
             flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
@@ -899,12 +919,12 @@
                                      onpass="Flow status is correct!",
                                      onfail="Flow status is wrong!" )
 
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
-                       peers=["peer64514", "peer64515", "peer64516"],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
+                       peers=["p64514", "p64515", "p64516"],
                        expectAllSuccess=True )
-        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
-                       peers=[peer64514, peer64515, peer64516],
+        main.Functions.pingSpeakerToPeer( main, speakers=["spk2"],
+                       peers=[p64514, p64515, p64516],
                        expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts=["host64514", "host64515", "host64516"],
+                        hosts=["h64514", "h64515", "h64516"],
                         expectAllSuccess=True )
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/Functions.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/Functions.py
index 5f78896..f2c0714 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/Functions.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/Functions.py
@@ -91,8 +91,8 @@
         onfail = "Flow number in " + switch + " is wrong!" )
 
 
-def pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["peer64514", "peer64515", "peer64516"],
+def pingSpeakerToPeer( main, speakers = ["spk1"],
+                       peers = ["p64514", "p64515", "p64516"],
                        expectAllSuccess = True ):
     """
     Carry out ping test between each BGP speaker and peer pair
@@ -138,7 +138,7 @@
         main.exit()
 
 
-def pingHostToHost( main, hosts = ["host64514", "host64515", "host64516"],
+def pingHostToHost( main, hosts = ["h64514", "h64515", "h64516"],
                 expectAllSuccess = True ):
     """
     Carry out ping test between each BGP host pair
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/USECASE_SdnipI2MN_Cluster.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/USECASE_SdnipI2MN_Cluster.py
index 264746c..9b192e2 100755
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/USECASE_SdnipI2MN_Cluster.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/USECASE_SdnipI2MN_Cluster.py
@@ -15,6 +15,7 @@
 from mininet.node import Controller, RemoteController
 from mininet.log import setLogLevel, info
 from mininet.cli import CLI
+from mininet.node import Host, RemoteController
 from mininet.topo import Topo
 from mininet.util import quietRun
 from mininet.moduledeps import pathCheck
@@ -29,6 +30,18 @@
 numSw = 39
 
 # net = Mininet( controller = RemoteController )
+class VLANHost( Host ):
+    def config( self, vlan=100, intfName=None, **params ):
+        r = super( Host, self ).config( **params )
+        intf = self.intf( intfName )
+        self.cmd( 'ifconfig %s inet 0' % intf )
+        self.cmd( 'vconfig add %s %d' % ( intf, vlan ) )
+        self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) )
+        newName = '%s.%d' % ( intf, vlan )
+        intf.name = newName
+        self.nameToIntf[ newName ] = intf
+        return r
+
 
 class SDNTopo( Topo ):
     "SDN Topology"
@@ -38,9 +51,14 @@
         Topo.__init__( self, *args, **kwargs )
 
         # BGP peer hosts
-        peer64514 = self.addHost( 'peer64514' )
-        peer64515 = self.addHost( 'peer64515' )
-        peer64516 = self.addHost( 'peer64516' )
+        p64514 = self.addHost( 'p64514' )
+        p64515 = self.addHost( 'p64515' )
+        p64516 = self.addHost( 'p64516' )
+
+        p64517 = self.addHost( 'p64517', cls=VLANHost, vlan=20 )
+        p64518 = self.addHost( 'p64518', cls=VLANHost, vlan=20 )
+        p64519 = self.addHost( 'p64519', cls=VLANHost, vlan=10 )
+        p64520 = self.addHost( 'p64520', cls=VLANHost, vlan=10 )
 
         '''
         sw1 = self.addSwitch( 'SEAT', dpid = '00000000000000a1' )
@@ -131,18 +149,27 @@
 
 
         # BGP speaker hosts
-        speaker1 = self.addHost( 'speaker1' )
-        speaker2 = self.addHost( 'speaker2' )
-
+        spk1 = self.addHost( 'spk1' )
+        spk2 = self.addHost( 'spk2' )
+        spk3 = self.addHost( 'spk3', cls=VLANHost, vlan=10 )
+        spk4 = self.addHost( 'spk4', cls=VLANHost, vlan=20 )
         root = self.addHost( 'root', inNamespace = False , ip = '0' )
 
         # hosts behind each AS
-        host64514 = self.addHost( 'host64514' )
-        host64515 = self.addHost( 'host64515' )
-        host64516 = self.addHost( 'host64516' )
+        h64514 = self.addHost( 'h64514' )
+        h64515 = self.addHost( 'h64515' )
+        h64516 = self.addHost( 'h64516' )
 
-        self.addLink( 'speaker1', sw24 )
-        self.addLink( 'speaker2', sw24 )
+        # VLAN hosts behind each AS
+        h64517 = self.addHost( 'h64517', cls=VLANHost, vlan=20 )
+        h64518 = self.addHost( 'h64518', cls=VLANHost, vlan=20 )
+        h64519 = self.addHost( 'h64519', cls=VLANHost, vlan=10 )
+        h64520 = self.addHost( 'h64520', cls=VLANHost, vlan=10 )
+
+        self.addLink( 'spk1', sw24 )
+        self.addLink( 'spk2', sw24 )
+        self.addLink( 'spk3', sw24 )
+        self.addLink( 'spk4', sw24 )
 
         # connect all switches
         self.addLink( sw1, sw2 )
@@ -197,25 +224,45 @@
         self.addLink( sw38, sw39 )
 
         # connection between switches and peers
-        self.addLink( peer64514, sw32 )
-        self.addLink( peer64515, sw8 )
-        self.addLink( peer64516, sw28 )
+        self.addLink( p64514, sw32 )
+        self.addLink( p64515, sw8 )
+        self.addLink( p64516, sw28 )
+
+        self.addLink( p64517, sw7 )
+        self.addLink( p64518, sw9 )
+        self.addLink( p64519, sw5 )
+        self.addLink( p64520, sw5 )
 
         # connection between BGP peer and hosts behind the BGP peer
-        self.addLink( peer64514, host64514 )
-        self.addLink( peer64515, host64515 )
-        self.addLink( peer64516, host64516 )
+        self.addLink( p64514, h64514 )
+        self.addLink( p64515, h64515 )
+        self.addLink( p64516, h64516 )
+
+        self.addLink( p64517, h64517 )
+        self.addLink( p64518, h64518 )
+        self.addLink( p64519, h64519 )
+        self.addLink( p64520, h64520 )
 
         # Internal Connection To Hosts
-        self.addLink( swCtl100, peer64514 )
-        self.addLink( swCtl100, peer64515 )
-        self.addLink( swCtl100, peer64516 )
-        self.addLink( swCtl100, speaker1 )
-        self.addLink( swCtl100, speaker2 )
+        self.addLink( swCtl100, p64514 )
+        self.addLink( swCtl100, p64515 )
+        self.addLink( swCtl100, p64516 )
 
+        self.addLink( swCtl100, p64517 )
+        self.addLink( swCtl100, p64518 )
+        self.addLink( swCtl100, p64519 )
+        self.addLink( swCtl100, p64520 )
 
-        # add host64514 to control plane for ping test
-        self.addLink( swCtl100, host64514 )
+        self.addLink( swCtl100, spk1 )
+        self.addLink( swCtl100, spk2 )
+        self.addLink( swCtl100, spk3 )
+        self.addLink( swCtl100, spk4 )
+
+        # add h64514 to control plane for ping test
+        self.addLink( swCtl100, h64514 )
+        self.addLink( swCtl100, h64517 )
+        self.addLink( swCtl100, h64519 )
+
         self.addLink( swCtl100, root )
         self.addLink( swCtl100, root )
         self.addLink( swCtl100, root )
@@ -286,70 +333,129 @@
     net = Mininet( topo = topo, controller = RemoteController )
 
 
-    speaker1, speaker2, peer64514, peer64515, peer64516 = \
-    net.get( 'speaker1', 'speaker2' ,
-             'peer64514', 'peer64515', 'peer64516' )
+    spk1, spk2, spk3, spk4, p64514, p64515, p64516, p64517, p64518, p64519, p64520 = \
+    net.get( 'spk1', 'spk2', 'spk3', 'spk4',
+             'p64514', 'p64515', 'p64516', 'p64517', 'p64518', 'p64519', 'p64520' )
 
     # 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' )
+    spk1.setMAC( '00:00:00:00:00:01', 'spk1-eth0' )
+    spk1.cmd( 'ip addr add 10.0.4.101/24 dev spk1-eth0' )
+    spk1.cmd( 'ip addr add 10.0.5.101/24 dev spk1-eth0' )
+    spk1.cmd( 'ip addr add 10.0.6.101/24 dev spk1-eth0' )
 
-    speaker1.defaultIntf().setIP( '10.0.4.101/24' )
-    speaker1.defaultIntf().setMAC( '00:00:00:00:00:01' )
+    spk1.defaultIntf().setIP( '10.0.4.101/24' )
+    spk1.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' )
+    spk2.setMAC( '00:00:00:00:00:02', 'spk2-eth0' )
+    spk2.cmd( 'ip addr add 10.0.14.101/24 dev spk2-eth0' )
+    spk2.cmd( 'ip addr add 10.0.15.101/24 dev spk2-eth0' )
+    spk2.cmd( 'ip addr add 10.0.16.101/24 dev spk2-eth0' )
 
-    speaker2.defaultIntf().setIP( '10.0.14.101/24' )
-    speaker2.defaultIntf().setMAC( '00:00:00:00:00:02' )
+    spk2.defaultIntf().setIP( '10.0.14.101/24' )
+    spk2.defaultIntf().setMAC( '00:00:00:00:00:02' )
+
+    spk3.setMAC( '00:00:00:00:00:03', 'spk3-eth0.10' )
+    spk3.cmd( 'ip addr add 10.0.9.101/24 dev spk3-eth0.10' )
+    spk3.cmd( 'ip addr add 10.0.20.101/24 dev spk3-eth0.10' )
+    spk3.defaultIntf().setIP( '10.1.9.101/24' )
+    spk3.defaultIntf().setMAC( '00:00:00:00:00:03' )
+
+    spk4.setMAC( '00:00:00:00:00:04', 'spk4-eth0.20' )
+    spk4.cmd( 'ip addr add 10.0.7.101/24 dev spk4-eth0.20' )
+    spk4.cmd( 'ip addr add 10.0.8.101/24 dev spk4-eth0.20' )
+    spk4.defaultIntf().setIP( '10.1.7.101/24' )
+    spk4.defaultIntf().setMAC( '00:00:00:00:00:04' )
+
+    p64517.config( vlan=20, intfName="p64517-eth1", ip="7.0.0.254" )
+    p64518.config( vlan=20, intfName="p64518-eth1", ip="8.0.0.254" )
+    p64519.config( vlan=10, intfName="p64519-eth1", ip="9.0.0.254" )
+    p64520.config( vlan=10, intfName="p64520-eth1", ip="20.0.0.254" )
 
     # 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' )
+    p64514.cmd( "ifconfig p64514-eth0 10.0.4.1 up" )
+    p64514.cmd( "ip addr add 10.0.14.1/24 dev p64514-eth0" )
+    p64514.setMAC( '00:00:00:00:00:14', 'p64514-eth0' ) # do not repeat spk4's MAC addr
+    p64515.cmd( "ifconfig p64515-eth0 10.0.5.1 up" )
+    p64515.cmd( "ip addr add 10.0.15.1/24 dev p64515-eth0" )
+    p64515.setMAC( '00:00:00:00:00:05', 'p64515-eth0' )
+    p64516.cmd( "ifconfig p64516-eth0 10.0.6.1 up" )
+    p64516.cmd( "ip addr add 10.0.16.1/24 dev p64516-eth0" )
+    p64516.setMAC( '00:00:00:00:00:06', 'p64516-eth0' )
+
+    p64517.cmd( "ifconfig p64517-eth0.20 10.0.7.1 up" )
+    p64517.setMAC( '00:00:00:00:00:07', 'p64517-eth0.20' )
+    p64518.cmd( "ifconfig p64518-eth0.20 10.0.8.1 up" )
+    p64518.setMAC( '00:00:00:00:00:08', 'p64518-eth0.20' )
+
+    p64519.cmd( "ifconfig p64519-eth0.10 10.0.9.1 up" )
+    p64519.setMAC( '00:00:00:00:00:09', 'p64519-eth0.10' )
+    p64520.cmd( "ifconfig p64520-eth0.10 10.0.20.1 up" )
+    p64520.setMAC( '00:00:00:00:00:20', 'p64520-eth0.10' )
 
     # 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' )
+    p64514.setIP( "4.0.0.254", 8, "p64514-eth1" )
+    p64514.setMAC( '00:00:00:00:00:44', 'p64514-eth1' )
+    p64515.setIP( "5.0.0.254", 8, "p64515-eth1" )
+    p64515.setMAC( '00:00:00:00:00:55', 'p64515-eth1' )
+    p64516.setIP( "6.0.0.254", 8, "p64516-eth1" )
+    p64516.setMAC( '00:00:00:00:00:66', 'p64516-eth1' )
+
+    p64517.setIP( "7.0.0.254", 8, "p64517-eth1.20" )
+    p64517.setMAC( '00:00:00:00:00:77', 'p64517-eth1.20' )
+    p64518.setIP( "8.0.0.254", 8, "p64518-eth1.20" )
+    p64518.setMAC( '00:00:00:00:00:88', 'p64518-eth1.20' )
+
+    p64519.setIP( "9.0.0.254", 8, "p64519-eth1.10" )
+    p64519.setMAC( '00:00:00:00:00:99', 'p64519-eth1.10' )
+    p64520.setIP( "20.0.0.254", 8, "p64520-eth1.10" )
+    p64520.setMAC( '00:00:00:00:00:20', 'p64520-eth1.10' )
 
     # 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' )
+    p64514.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64515.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64516.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+
+    p64517.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64518.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64519.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' )
+    p64520.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" )
+    p64514.setIP( "192.168.0.4", 24, "p64514-eth2" )
+    p64515.setIP( "192.168.0.5", 24, "p64515-eth2" )
+    p64516.setIP( "192.168.0.6", 24, "p64516-eth2" )
+
+    p64517.setIP( "192.168.0.7", 24, "p64517-eth2" )
+    p64518.setIP( "192.168.0.8", 24, "p64518-eth2" )
+    p64519.setIP( "192.168.0.9", 24, "p64519-eth2" )
+    p64520.setIP( "192.168.0.20", 24, "p64520-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' )
+    h64514, h64515, h64516, h64517, h64518, h64519, h64520 = \
+    net.get( 'h64514', 'h64515', 'h64516', 'h64517', 'h64518', 'h64519', 'h64520' )
+    h64514.cmd( 'ifconfig h64514-eth0 4.0.0.1 up' )
+    h64514.cmd( 'ip route add default via 4.0.0.254' )
+    h64514.setIP( '192.168.0.44', 24, 'h64514-eth1' )  # for control plane
+    h64515.cmd( 'ifconfig h64515-eth0 5.0.0.1 up' )
+    h64515.cmd( 'ip route add default via 5.0.0.254' )
+    h64516.cmd( 'ifconfig h64516-eth0 6.0.0.1 up' )
+    h64516.cmd( 'ip route add default via 6.0.0.254' )
+
+    h64517.cmd( 'ifconfig h64517-eth0.20 7.0.0.1 up' )
+    h64517.cmd( 'ip route add default via 7.0.0.254' )
+    h64517.setIP( '192.168.0.77', 24, 'h64517-eth1' )  # for control plane
+    h64518.cmd( 'ifconfig h64518-eth0.20 8.0.0.1 up' )
+    h64518.cmd( 'ip route add default via 8.0.0.254' )
+
+    h64519.cmd( 'ifconfig h64519-eth0.10 9.0.0.1 up' )
+    h64519.cmd( 'ip route add default via 9.0.0.254' )
+    h64519.setIP( '192.168.0.99', 24, 'h64519-eth1' )  # for control plane
+    h64520.cmd( 'ifconfig h64520-eth0.10 20.0.0.1 up' )
+    h64520.cmd( 'ip route add default via 20.0.0.254' )
 
 
     # set up swCtl100 as a learning
@@ -368,14 +474,20 @@
     '''
 
     # Start Quagga on border routers
-    startquagga( peer64514, 64514, 'quagga64514.conf' )
-    startquagga( peer64515, 64515, 'quagga64515.conf' )
-    startquagga( peer64516, 64516, 'quagga64516.conf' )
+    startquagga( p64514, 64514, 'quagga64514.conf' )
+    startquagga( p64515, 64515, 'quagga64515.conf' )
+    startquagga( p64516, 64516, 'quagga64516.conf' )
+
+    startquagga( p64517, 64517, 'quagga64517.conf' )
+    startquagga( p64518, 64518, 'quagga64518.conf' )
+    startquagga( p64519, 64519, 'quagga64519.conf' )
+    startquagga( p64520, 64520, 'quagga64520.conf' )
 
     # start Quagga in SDN network
-    startquagga( speaker1, 64513, 'quagga-sdn.conf' )
-    startquagga( speaker2, 64512, 'quagga-sdn-speaker2.conf' )
-
+    startquagga( spk1, 64513, 'quagga-sdn.conf' )
+    startquagga( spk2, 64512, 'quagga-sdn-speaker2.conf' )
+    startquagga( spk3, 64511, 'quagga-sdn3.conf' )
+    startquagga( spk4, 64510, 'quagga-sdn4.conf' )
 
     root = net.get( 'root' )
     root.intf( 'root-eth0' ).setIP( '1.1.1.2/24' )
@@ -387,13 +499,16 @@
     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' )
+    spk1.intf( 'spk1-eth1' ).setIP( '1.1.1.1/24' )
+    spk2.intf( 'spk2-eth1' ).setIP( '1.1.1.3/24' )
+    spk3.intf( 'spk3-eth1' ).setIP( '1.1.1.5/24' )
+    spk4.intf( 'spk4-eth1' ).setIP( '1.1.1.7/24' )
 
 
     stopsshd()
 
-    hosts = [ peer64514, peer64515, peer64516, host64514];
+    hosts = [ p64514, p64515, p64516, p64517, p64518, p64519, p64520,
+              h64514, h64517, h64519 ];
     startsshds( hosts )
 
 
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga-sdn3.conf b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga-sdn3.conf
new file mode 100644
index 0000000..7e78260
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga-sdn3.conf
@@ -0,0 +1,45 @@
+! -*- 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.9.101
+  timers bgp 1 2
+  neighbor 10.0.9.1 remote-as 64519
+  neighbor 10.0.9.1 ebgp-multihop
+  neighbor 10.0.9.1 timers connect 5
+  neighbor 10.0.20.1 remote-as 64520
+  neighbor 10.0.20.1 ebgp-multihop
+  neighbor 10.0.20.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/USECASE_SdnipFunctionCluster/dependencies/quagga-sdn4.conf b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga-sdn4.conf
new file mode 100644
index 0000000..7454ab3
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga-sdn4.conf
@@ -0,0 +1,45 @@
+! -*- 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.7.101
+  timers bgp 1 2
+  neighbor 10.0.7.1 remote-as 64517
+  neighbor 10.0.7.1 ebgp-multihop
+  neighbor 10.0.7.1 timers connect 5
+  neighbor 10.0.8.1 remote-as 64518
+  neighbor 10.0.8.1 ebgp-multihop
+  neighbor 10.0.8.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/USECASE_SdnipFunctionCluster/dependencies/quagga64517.conf b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga64517.conf
new file mode 100644
index 0000000..00e4cf8
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga64517.conf
@@ -0,0 +1,28 @@
+! -*- 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 64517
+  bgp router-id 10.0.7.1
+!  timers bgp 1 3
+ neighbor 10.0.7.101 remote-as 64513
+ network 7.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/USECASE_SdnipFunctionCluster/dependencies/quagga64518.conf b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga64518.conf
new file mode 100644
index 0000000..c156102
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga64518.conf
@@ -0,0 +1,28 @@
+! -*- 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 64518
+  bgp router-id 10.0.8.1
+!  timers bgp 1 3
+ neighbor 10.0.8.101 remote-as 64513
+ network 8.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/USECASE_SdnipFunctionCluster/dependencies/quagga64519.conf b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga64519.conf
new file mode 100644
index 0000000..11f1801
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga64519.conf
@@ -0,0 +1,28 @@
+! -*- 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 64519
+  bgp router-id 10.0.9.1
+!  timers bgp 1 3
+ neighbor 10.0.9.101 remote-as 64513
+ network 9.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/USECASE_SdnipFunctionCluster/dependencies/quagga64520.conf b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga64520.conf
new file mode 100644
index 0000000..5fa469d
--- /dev/null
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/quagga64520.conf
@@ -0,0 +1,28 @@
+! -*- 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 64520
+  bgp router-id 10.0.20.1
+!  timers bgp 1 3
+ neighbor 10.0.20.101 remote-as 64513
+ network 20.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/USECASE_SdnipFunctionCluster/network-cfg.json b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/network-cfg.json
index 602a72f..5efd5a7 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/network-cfg.json
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/network-cfg.json
@@ -3,10 +3,12 @@
         "of:00000000000000a8/5" : {
             "interfaces" : [
                 {
+                    "name": "sw8-5-1",
                     "ips"  : [ "10.0.5.101/24" ],
                     "mac"  : "00:00:00:00:00:01"
                 },
                 {
+                    "name": "sw8-5-2",
                     "ips"  : [ "10.0.15.101/24" ],
                     "mac"  : "00:00:00:00:00:02"
                 }
@@ -15,10 +17,12 @@
         "of:0000000000000a32/4" : {
             "interfaces" : [
                 {
+                    "name": "sw32-4-1",
                     "ips"  : [ "10.0.4.101/24" ],
                     "mac"  : "00:00:00:00:00:01"
                 },
                 {
+                    "name": "sw32-4-2",
                     "ips"  : [ "10.0.14.101/24" ],
                     "mac"  : "00:00:00:00:00:02"
                 }
@@ -27,14 +31,56 @@
         "of:0000000000000a28/3" : {
             "interfaces" : [
                 {
+                    "name": "sw28-3-1",
                     "ips"  : [ "10.0.6.101/24" ],
                     "mac"  : "00:00:00:00:00:01"
                 },
                 {
+                    "name": "sw28-3-2",
                     "ips"  : [ "10.0.16.101/24" ],
                     "mac"  : "00:00:00:00:00:02"
                 }
             ]
+        },
+        "of:00000000000000a5/5" : {
+              "interfaces" : [
+                  {
+                      "name" : "sw5-5",
+                      "ips"  : [ "10.0.20.101/24" ],
+                      "mac"  : "00:00:00:00:00:03",
+                      "vlan" : "10"
+                  }
+              ]
+        },
+        "of:00000000000000a5/4" : {
+            "interfaces" : [
+                {
+                    "name" : "sw5-4",
+                    "ips"  : [ "10.0.9.101/24" ],
+                    "mac"  : "00:00:00:00:00:03",
+                    "vlan" : "10"
+                }
+            ]
+        },
+        "of:00000000000000a7/3" : {
+            "interfaces" : [
+                {
+                    "name" : "sw7-3",
+                    "ips"  : [ "10.0.7.101/24" ],
+                    "mac"  : "00:00:00:00:00:04",
+                    "vlan" : "20"
+                }
+            ]
+        },
+        "of:00000000000000a9/3" : {
+              "interfaces" : [
+                  {
+                      "name" : "sw9-3",
+                      "ips"  : [ "10.0.8.101/24" ],
+                      "mac"  : "00:00:00:00:00:04",
+                      "vlan" : "20"
+                  }
+              ]
         }
     },
     "apps" : {
@@ -42,7 +88,7 @@
             "bgp" : {
                 "bgpSpeakers" : [
                     {
-                        "name" : "speaker1",
+                        "name" : "bgpSpeaker1",
                         "connectPoint" : "of:0000000000000a24/1",
                         "peers" : [
                             "10.0.4.1",
@@ -51,13 +97,31 @@
                         ]
                     },
                     {
-                        "name" : "speaker2",
+                        "name" : "bgpSpeaker2",
                         "connectPoint" : "of:0000000000000a24/2",
                         "peers" : [
                             "10.0.14.1",
                             "10.0.15.1",
                             "10.0.16.1"
                         ]
+                    },
+                    {
+                          "name": "bgpSpeaker3",
+                          "vlan": "10",
+                          "connectPoint" : "of:0000000000000a24/3",
+                          "peers" : [
+                              "10.0.9.1",
+                              "10.0.20.1"
+                          ]
+                    },
+                    {
+                        "name": "bgpSpeaker4",
+                        "vlan": "20",
+                        "connectPoint" : "of:0000000000000a24/4",
+                        "peers" : [
+                            "10.0.7.1",
+                            "10.0.8.1"
+                        ]
                     }
                 ]
             }
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
index 8458b9a..d7c44c9 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
@@ -145,6 +145,15 @@
                                  onpass="Install ONOS to nodes succeeded",
                                  onfail="Install ONOS to nodes failed" )
 
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
+        secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=ONOS2Ip )
+        secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=ONOS3Ip )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=secureSshResult,
+                                 onpass="Set up ONOS secure SSH succeeded",
+                                 onfail="Set up ONOS secure SSH failed " )
+
         main.step( "Checking if ONOS is up yet" )
         onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
         onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout=420 )
@@ -155,15 +164,6 @@
                                  onpass="ONOS nodes are up",
                                  onfail="ONOS nodes are NOT up" )
 
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
-        secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=ONOS2Ip )
-        secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=ONOS3Ip )
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=secureSshResult,
-                                 onpass="Set up ONOS secure SSH succeeded",
-                                 onfail="Set up ONOS secure SSH failed " )
-
         main.step( "Checking if ONOS CLI is ready" )
         main.CLIs = []
         cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip,
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
index ab57821..3601489 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
@@ -146,13 +146,6 @@
                                  onpass="Install ONOS succeeded",
                                  onfail="Install ONOS failed" )
 
-        main.step( "Checking if ONOS is up yet" )
-        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=onos1UpResult,
-                                 onpass="ONOS is up",
-                                 onfail="ONOS is NOT up" )
-
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
         utilities.assert_equals( expect=main.TRUE,
@@ -160,6 +153,13 @@
                                  onpass="Set up ONOS secure SSH succeeded",
                                  onfail="Set up ONOS secure SSH failed " )
 
+        main.step( "Checking if ONOS is up yet" )
+        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onos1UpResult,
+                                 onpass="ONOS is up",
+                                 onfail="ONOS is NOT up" )
+
         main.step( "Checking if ONOS CLI is ready" )
         cliResult = main.ONOScli1.startOnosCli( ONOS1Ip,
                                                commandlineTimeout=100,
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.params b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.params
new file mode 100755
index 0000000..9d9bab2
--- /dev/null
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.params
@@ -0,0 +1,32 @@
+<PARAMS>
+
+    <testcases>1,2,3</testcases>
+
+    <num_controllers>3</num_controllers>
+
+    <DEPENDENCY>
+        <wrapper1>startUp</wrapper1>
+        <topology>~/onos/tools/test/topos/vpls.json</topology>
+    </DEPENDENCY>
+
+    <ENV>
+        <cellName>vpls</cellName>
+        <cellApps>drivers,openflow,vpls</cellApps>
+        <cellUser>sdn</cellUser>
+    </ENV>
+
+    <CTRL>
+        <port>6653</port>
+    </CTRL>
+
+    <vpls>
+        <name>org.onosproject.vpls</name>
+        <hosts>6</hosts>
+    </vpls>
+
+    <SLEEP>
+        <startup>10</startup>
+        <netcfg>10</netcfg>
+    </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
new file mode 100755
index 0000000..07ae3b2
--- /dev/null
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
@@ -0,0 +1,370 @@
+# CASE1: Startup
+# CASE2: Load vpls topology and configurations from demo script
+# CASE3: Test CLI commands
+
+class VPLSBasic:
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        """
+        CASE1 is to compile ONOS and push it to the test machines
+
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        NOTE: temporary - onos-remove-raft-logs
+        onos-uninstall
+        start mininet
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        start cli sessions
+        start tcpdump
+        """
+        import imp
+        import time
+        import json
+        main.case( "Setting up test environment" )
+        main.caseExplanation = "Setup the test environment including " +\
+                                "installing ONOS, starting Mininet and ONOS" +\
+                                "cli sessions."
+
+        # load some variables from the params file
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+
+        main.numCtrls = int( main.params[ 'num_controllers' ] )
+
+        ofPort = main.params[ 'CTRL' ][ 'port' ]
+
+        main.CLIs = []
+        main.RESTs = []
+        main.nodes = []
+        ipList = []
+        for i in range( 1, main.numCtrls + 1 ):
+            try:
+                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+                main.RESTs.append( getattr( main, 'ONOSrest' + str( i ) ) )
+                main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+                ipList.append( main.nodes[ -1 ].ip_address )
+            except AttributeError:
+                break
+
+        main.step( "Create cell file" )
+        cellAppString = main.params[ 'ENV' ][ 'cellApps' ]
+        main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
+                                       main.Mininet1.ip_address,
+                                       cellAppString, ipList )
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        main.log.info( "Uninstalling ONOS" )
+        for node in main.nodes:
+            main.ONOSbench.onosUninstall( node.ip_address )
+
+        # Make sure ONOS is DEAD
+        main.log.info( "Killing any ONOS processes" )
+        killResults = main.TRUE
+        for node in main.nodes:
+            killed = main.ONOSbench.onosKill( node.ip_address )
+            killResults = killResults and killed
+
+        cleanInstallResult = main.TRUE
+
+        main.step( "Starting Mininet" )
+        # scp topo file to mininet
+        # TODO: move to params?
+        topoName = "vpls"
+        topoFile = "vpls.py"
+        filePath = main.ONOSbench.home + "/tools/test/topos/"
+        main.ONOSbench.scp( main.Mininet1,
+                            filePath + topoFile,
+                            main.Mininet1.home,
+                            direction="to" )
+        topo = " --custom " + main.Mininet1.home + topoFile + " --topo " + topoName
+        args = " --switch ovs,protocols=OpenFlow13 --controller=remote"
+        for node in main.nodes:
+            args += ",ip=" + node.ip_address
+        mnCmd = "sudo mn" + topo + args
+        mnResult = main.Mininet1.startNet( mnCmd=mnCmd )
+        utilities.assert_equals( expect=main.TRUE, actual=mnResult,
+                                 onpass="Mininet Started",
+                                 onfail="Error starting Mininet" )
+
+        main.ONOSbench.getVersion( report=True )
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.buckBuild()
+        utilities.assert_equals( expect=main.TRUE, actual=packageResult,
+                                 onpass="ONOS package successful",
+                                 onfail="ONOS package failed" )
+
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.TRUE
+        for node in main.nodes:
+            tmpResult = main.ONOSbench.onosInstall( options="-f",
+                                                    node=node.ip_address )
+            onosInstallResult = onosInstallResult and tmpResult
+        utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult,
+                                 onpass="ONOS install successful",
+                                 onfail="ONOS install failed" )
+
+        main.step( "Set up ONOS secure SSH" )
+        secureSshResult = main.TRUE
+        for node in main.nodes:
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=node.ip_address )
+        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
+        main.step( "Checking if ONOS is up yet" )
+        for i in range( 2 ):
+            onosIsupResult = main.TRUE
+            for node in main.nodes:
+                started = main.ONOSbench.isup( node.ip_address )
+                if not started:
+                    main.log.error( node.name + " hasn't started" )
+                onosIsupResult = onosIsupResult and started
+            if onosIsupResult == main.TRUE:
+                break
+        utilities.assert_equals( expect=main.TRUE, actual=onosIsupResult,
+                                 onpass="ONOS startup successful",
+                                 onfail="ONOS startup failed" )
+
+        main.step( "Starting ONOS CLI sessions" )
+        cliResults = main.TRUE
+        threads = []
+        for i in range( main.numCtrls ):
+            t = main.Thread( target=main.CLIs[i].startOnosCli,
+                             name="startOnosCli-" + str( i ),
+                             args=[main.nodes[i].ip_address] )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            cliResults = cliResults and t.result
+        utilities.assert_equals( expect=main.TRUE, actual=cliResults,
+                                 onpass="ONOS cli startup successful",
+                                 onfail="ONOS cli startup failed" )
+
+        main.activeNodes = [ i for i in range( 0, len( main.CLIs ) ) ]
+
+        main.step( "Activate apps defined in the params file" )
+        # get data from the params
+        apps = main.params.get( 'apps' )
+        if apps:
+            apps = apps.split(',')
+            main.log.warn( apps )
+            activateResult = True
+            for app in apps:
+                main.CLIs[ 0 ].app( app, "Activate" )
+            # TODO: check this worked
+            time.sleep( SLEEP )  # wait for apps to activate
+            for app in apps:
+                state = main.CLIs[ 0 ].appStatus( app )
+                if state == "ACTIVE":
+                    activateResult = activateResult and True
+                else:
+                    main.log.error( "{} is in {} state".format( app, state ) )
+                    activateResult = False
+            utilities.assert_equals( expect=True,
+                                     actual=activateResult,
+                                     onpass="Successfully activated apps",
+                                     onfail="Failed to activate apps" )
+        else:
+            main.log.warn( "No apps were specified to be loaded after startup" )
+
+        main.step( "Set ONOS configurations" )
+        config = main.params.get( 'ONOS_Configuration' )
+        if config:
+            main.log.debug( config )
+            checkResult = main.TRUE
+            for component in config:
+                for setting in config[component]:
+                    value = config[component][setting]
+                    check = main.CLIs[ 0 ].setCfg( component, setting, value )
+                    main.log.info( "Value was changed? {}".format( main.TRUE == check ) )
+                    checkResult = check and checkResult
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=checkResult,
+                                     onpass="Successfully set config",
+                                     onfail="Failed to set config" )
+        else:
+            main.log.warn( "No configurations were specified to be changed after startup" )
+
+        main.step( "App Ids check" )
+        appCheck = main.TRUE
+        threads = []
+        for i in main.activeNodes:
+            t = main.Thread( target=main.CLIs[i].appToIDCheck,
+                             name="appToIDCheck-" + str( i ),
+                             args=[] )
+            threads.append( t )
+            t.start()
+
+        for t in threads:
+            t.join()
+            appCheck = appCheck and t.result
+        if appCheck != main.TRUE:
+            main.log.warn( main.CLIs[0].apps() )
+            main.log.warn( main.CLIs[0].appIDs() )
+        utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+                                 onpass="App Ids seem to be correct",
+                                 onfail="Something is wrong with app Ids" )
+
+    def CASE2( self, main ):
+        """
+        Load and test vpls configurations from json configuration file
+        """
+        import os.path
+        from tests.USECASE.VPLS.dependencies import vpls
+
+        pprint = main.ONOSrest1.pprint
+        hosts = int( main.params['vpls']['hosts'] )
+        SLEEP = int( main.params['SLEEP']['netcfg'] )
+
+        main.step( "Discover hosts using pings" )
+        for i in range( 1, hosts + 1 ):
+            src = "h" + str( i )
+            for j in range( 1, hosts + 1 ):
+                if j == i:
+                    continue
+                dst = "h" + str( j )
+            pingResult = main.Mininet1.pingHost( SRC=src, TARGET=dst )
+
+        main.step( "Load VPLS configurations" )
+        # TODO: load from params
+        fileName = main.params['DEPENDENCY']['topology']
+        app = main.params['vpls']['name']
+        # TODO make this a function?
+        main.ONOSbench.handle.sendline( "onos-netcfg $OC1 " + fileName )
+        # Time for netcfg to load data
+        time.sleep( SLEEP )
+        # 'Master' copy of test configuration
+        try:
+            with open( os.path.expanduser( fileName ) ) as dataFile:
+                originalCfg = json.load( dataFile )
+                main.vplsConfig = originalCfg['apps'].get( app ).get( 'vpls' ).get( 'vplsList')
+        except Exception as e:
+            main.log.error( "Error loading config file: {}".format( e ) )
+        if main.vplsConfig:
+            result = True
+        else:
+            result = False
+        utilities.assert_equals( expect=True,
+                                 actual=result,
+                                 onpass="Loaded vpls configuration",
+                                 onfail="Failed to load vpls configuration" )
+
+        main.step( "Check interface configurations" )
+        result = False
+        getPorts = main.ONOSrest1.getNetCfg( subjectClass="ports" )
+        onosCfg = pprint( getPorts )
+        sentCfg = pprint( originalCfg.get( "ports" ) )
+
+        if onosCfg == sentCfg:
+            main.log.info( "ONOS interfaces NetCfg matches what was sent" )
+            result = True
+        else:
+            main.log.error( "ONOS interfaces NetCfg doesn't match what was sent" )
+            main.log.debug( "ONOS config: {}".format( onosCfg ) )
+            main.log.debug( "Sent config: {}".format( sentCfg ) )
+        utilities.assert_equals( expect=True,
+                                 actual=result,
+                                 onpass="Net Cfg added for interfaces",
+                                 onfail="Net Cfg not added for interfaces" )
+
+        # Run a bunch of checks to verify functionality based on configs
+        vpls.verify( main )
+
+    def CASE3( self, main ):
+        """
+        Test VPLS cli commands
+        High level steps:
+            remove interface from a network
+            Clean configs
+            create vpls network
+            add interfaces to a network
+            add encap
+            change encap
+            remove encap
+            list?
+        """
+        from tests.USECASE.VPLS.dependencies import vpls
+        SLEEP = int( main.params['SLEEP']['netcfg'] )
+        pprint = main.ONOSrest1.pprint
+
+        main.step( "Remove an interface from a vpls network" )
+        main.CLIs[0].vplsRemIface( 'VPLS1', 'h1' )
+        time.sleep( SLEEP )
+        #update master config json
+        for network in main.vplsConfig:
+            if network.get( 'name' ) == 'VPLS1':
+                ifaces = network.get( 'interfaces' )
+                ifaces.remove('h1')
+        vpls.verify( main )
+
+        main.step( "Clean all vpls configurations" )
+        main.CLIs[0].vplsClean()
+        time.sleep( SLEEP )
+        main.vplsConfig = []
+        vpls.verify( main )
+
+        main.step( "Create a new vpls network" )
+        name = "Network1"
+        main.CLIs[0].vplsCreate( name )
+        time.sleep( SLEEP )
+        network1 = { 'name': name, 'interfaces': [], 'encapsulation': 'NONE' }
+        main.vplsConfig.append( network1 )
+        vpls.verify( main )
+
+        main.step( "Add interfaces to the network" )
+        main.CLIs[0].vplsAddIface( name, "h1" )
+        main.CLIs[0].vplsAddIface( name, "h5" )
+        main.CLIs[0].vplsAddIface( name, "h4" )
+        time.sleep( SLEEP )
+        for network in main.vplsConfig:
+            if network.get( 'name' ) == name:
+                ifaces = network.get( 'interfaces' )
+                ifaces.append( 'h1' )
+                ifaces.append( 'h4' )
+                ifaces.append( 'h5' )
+                network[ 'interfaces' ] = ifaces
+        vpls.verify( main )
+
+        main.step( "Add MPLS encapsulation to a vpls network" )
+        encapType = "MPLS"
+        main.CLIs[0].vplsSetEncap( name, encapType )
+        for network in main.vplsConfig:
+            if network.get( 'name' ) == name:
+                network['encapsulation'] = encapType
+        time.sleep( SLEEP )
+        vpls.verify( main )
+
+        main.step( "Change an encapsulation type" )
+        encapType = "VLAN"
+        main.CLIs[0].vplsSetEncap( name, encapType )
+        for network in main.vplsConfig:
+            if network.get( 'name' ) == name:
+                network['encapsulation'] = encapType
+        time.sleep( SLEEP )
+        vpls.verify( main )
+
+        main.step( "Remove encapsulation" )
+        encapType = "NONE"
+        main.CLIs[0].vplsSetEncap( name, encapType )
+        for network in main.vplsConfig:
+            if network.get( 'name' ) == name:
+                network['encapsulation'] = encapType
+        time.sleep( SLEEP )
+        vpls.verify( main )
+
+        main.step( "Clean all vpls configurations" )
+        main.CLIs[0].vplsClean()
+        time.sleep( SLEEP )
+        main.vplsConfig = []
+        vpls.verify( main )
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.topo b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.topo
new file mode 100755
index 0000000..e9a1f8e
--- /dev/null
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.topo
@@ -0,0 +1,115 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>localhost</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+                <nodes>1</nodes>
+            </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>localhost</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>localhost</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+        <ONOScli3>
+            <host>localhost</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+        <ONOS1>
+            <host>OC1</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>OC2</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>OC3</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+        <ONOSrest1>
+            <host>OC1</host>
+            <port>8181</port>
+            <user>onos</user>
+            <password>rocks</password>
+            <type>OnosRestDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOSrest1>
+
+        <ONOSrest2>
+            <host>OC2</host>
+            <port>8181</port>
+            <user>onos</user>
+            <password>rocks</password>
+            <type>OnosRestDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOSrest2>
+
+        <ONOSrest3>
+            <host>OC3</host>
+            <port>8181</port>
+            <user>onos</user>
+            <password>rocks</password>
+            <type>OnosRestDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOSrest3>
+
+
+        <Mininet1>
+            <host>OCN</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>MininetCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+                <home>~/mininet/custom/</home>
+            </COMPONENTS>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/__init__.py b/TestON/tests/USECASE/VPLS/VPLSBasic/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/__init__.py
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/dependencies/__init__.py b/TestON/tests/USECASE/VPLS/VPLSBasic/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/dependencies/__init__.py
diff --git a/TestON/tests/USECASE/VPLS/__init__.py b/TestON/tests/USECASE/VPLS/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/VPLS/__init__.py
diff --git a/TestON/tests/USECASE/VPLS/dependencies/__init__.py b/TestON/tests/USECASE/VPLS/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/VPLS/dependencies/__init__.py
diff --git a/TestON/tests/USECASE/VPLS/dependencies/vpls.py b/TestON/tests/USECASE/VPLS/dependencies/vpls.py
new file mode 100644
index 0000000..8dfdd46
--- /dev/null
+++ b/TestON/tests/USECASE/VPLS/dependencies/vpls.py
@@ -0,0 +1,144 @@
+"""
+Functions for the vpls tests
+"""
+import time
+import json
+
+def sanitizeConfig( config ):
+    """
+    Take a python json object for vpls config and normalize it.
+    Things it does:
+        Converts all strings to the same format
+        Make sure each network has an encapsulation key:value
+        Makes sure encapsulation type is all uppercase
+        Make sure an empty list of interfaces is formated consistently
+        Sorts the list of interfaces
+    """
+    # Convert to same string formats
+    config = json.loads( json.dumps( config ) )
+    for network in config:
+        encap = network.get( 'encapsulation', None )
+        if encap is None:
+            encap = "NONE"
+        network[ 'encapsulation' ] = encap.upper()
+        ifaces = network.get( 'interfaces' )
+        if ifaces == ['']:
+            ifaces = []
+        else:
+            ifaces = sorted( ifaces )
+            network['interfaces'] = ifaces
+    return config
+
+def verify( main ):
+    """
+    Runs some tests to verify the vpls configurations.
+        - Compare sent vpls network configuration to what is stored in each:
+            - ONOS network configuration
+            - ONOS VPLS application configuration
+        - Ping between each pair of hosts to check connectivity
+
+    NOTE: This requires the expected/sent network config json for the vpls
+          application be stored in main.vplsConfig
+    """
+    # Variables
+    app = main.params['vpls']['name']
+    pprint = main.ONOSrest1.pprint
+    SLEEP = int( main.params['SLEEP']['netcfg'] )
+
+    main.step( "Check network configurations for vpls application" )
+    clusterResult = True
+    for node in main.RESTs:
+        result = False
+        getVPLS = node.getNetCfg( subjectClass="apps",
+                                  subjectKey=app )
+        onosCfg = json.loads( getVPLS ).get( 'vpls' ).get( 'vplsList' )
+        onosCfg = pprint( sanitizeConfig( onosCfg ) )
+        sentCfg = pprint( sanitizeConfig( main.vplsConfig ) )
+        result = onosCfg == sentCfg
+        if result:
+            main.log.info( "ONOS NetCfg matches what was sent" )
+        else:
+            clusterResult = False
+            main.log.error( "ONOS NetCfg doesn't match what was sent" )
+            main.log.debug( "ONOS config: {}".format( onosCfg ) )
+            main.log.debug( "Sent config: {}".format( sentCfg ) )
+    utilities.assert_equals( expect=True,
+                             actual=clusterResult,
+                             onpass="Net Cfg added for vpls",
+                             onfail="Net Cfg not added for vpls" )
+
+    main.step( "Check vpls app configurations" )
+    clusterResult = True
+    for node in main.CLIs:
+        result = False
+        #TODO Read from vpls show and match to pushed json
+        vpls = node.parseVplsShow()
+        parsedVpls = pprint( sanitizeConfig( vpls ) )
+        sentVpls = pprint( sanitizeConfig( main.vplsConfig ) )
+        result = parsedVpls == sentVpls
+        if result:
+            main.log.info( "VPLS config matches sent NetCfg" )
+        else:
+            clusterResult = False
+            main.log.error( "VPLS config doesn't match sent NetCfg" )
+            main.log.debug( "ONOS config: {}".format( parsedVpls ) )
+            main.log.debug( "Sent config: {}".format( sentVpls ) )
+    utilities.assert_equals( expect=True,
+                             actual=clusterResult,
+                             onpass="VPLS successfully configured",
+                             onfail="VPLS not configured correctly" )
+
+    # FIXME This doesn't work, some will be withdrawn if interfaces are removed
+    # TODO: if encapsulation is set, look for that
+    # TODO: can we look at the intent keys?
+    """
+    main.step( "Check intent states" )
+    # Print the intent states
+    intents = main.CLIs[0].intents()
+    count = 0
+    while count <= 5:
+        installedCheck = True
+        try:
+            for intent in json.loads( intents ):
+                state = intent.get( 'state', None )
+                if "INSTALLED" not in state:
+                    installedCheck = False
+        except ( ValueError, TypeError ):
+            main.log.exception( "Error parsing intents" )
+        if installedCheck:
+            break
+        count += 1
+    utilities.assert_equals( expect=True,
+                             actual=installedCheck ,
+                             onpass="All Intents in installed state",
+                             onfail="Not all Intents in installed state" )
+    """
+
+    main.step( "Check connectivity" )
+    connectivityCheck = True
+    hosts = int( main.params['vpls']['hosts'] )
+    networks = []
+    for network in main.vplsConfig:
+        nodes = network.get( 'interfaces', None )
+        if nodes:
+            networks.append( nodes )
+    for i in range( 1, hosts + 1 ):
+        src = "h" + str( i )
+        for j in range( 1, hosts + 1 ):
+            if j == i:
+                continue
+            dst = "h" + str( j )
+            pingResult = main.Mininet1.pingHost( SRC=src, TARGET=dst )
+            expected = main.FALSE
+            for network in networks:
+                if src in network and dst in network:
+                    expected = main.TRUE
+                    break
+            if pingResult != expected:
+                connectivityCheck = False
+                main.log.error( "%s <-> %s: %s; Expected: %s" %
+                               ( src, dst, pingResult, expected ) )
+    utilities.assert_equals( expect=True,
+                             actual=connectivityCheck,
+                             onpass="Connectivity is as expected",
+                             onfail="Connectivity is not as expected" )