diff --git a/README.md b/README.md
index bd2fa6f..b29c092 100644
--- a/README.md
+++ b/README.md
@@ -24,15 +24,11 @@
 
 Dependencies
 ------------
-1. Zookeeper
+1. ONOS
 
-2. Cassandra
+2. Mininet
 
-3. ONOS
-
-4. Mininet
-
-5. Install python packages configObj and pexpect. they can be installed as :
+3. Install python packages configObj and pexpect. they can be installed as :
 
      $ sudo pip install configObj
 
diff --git a/TestON/core/xmlparser.py b/TestON/core/xmlparser.py
index 9a2321c..3cb4aee 100644
--- a/TestON/core/xmlparser.py
+++ b/TestON/core/xmlparser.py
@@ -60,7 +60,8 @@
         '''
         topologyPath = re.sub("\.","/",topologyPath)
         topologyPath = re.sub("tests|examples","",topologyPath)
-        topology = self.parse(main.tests_path+"/"+topologyPath+".topo")
+        #topology = self.parse(main.tests_path+"/"+topologyPath+".topo")
+        topology = self.parse(main.tests_path+topologyPath+".topo")
         topoAsString = str(topology)
         return eval(topoAsString)
                                                                   
diff --git a/TestON/dependencies/topo-100sw.py b/TestON/dependencies/topo-100sw.py
new file mode 100644
index 0000000..308a3f1
--- /dev/null
+++ b/TestON/dependencies/topo-100sw.py
@@ -0,0 +1,31 @@
+
+from mininet.topo import Topo
+
+class MyTopo( Topo ):
+        "100 'floating' switch topology"
+
+        def __init__( self ):
+                # Initialize topology
+                Topo.__init__( self )
+
+                sw_list = []
+
+                for i in range(1, 101):
+                        sw_list.append(
+                                self.addSwitch(
+                                        's'+str(i),
+                                        dpid = str(i).zfill(16)))
+
+
+                #Below connections are used for test cases
+                #that need to test link and port events
+                #Add link between switch 1 and switch 2
+                self.addLink(sw_list[0],sw_list[1])
+                
+                #Create hosts and attach to sw 1 and sw 2
+                h1 = self.addHost('h1')
+                h2 = self.addHost('h2')
+                self.addLink(sw_list[0],h1)
+                self.addLink(sw_list[1],h2)
+        
+topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/dependencies/topo-intentFlower.py b/TestON/dependencies/topo-intentFlower.py
new file mode 100644
index 0000000..138c291
--- /dev/null
+++ b/TestON/dependencies/topo-intentFlower.py
@@ -0,0 +1,80 @@
+'''
+Topology with 3 core switches connected linearly.
+
+Each 'core' switch has a 'flower' of 10 switches
+for a total of 33 switches.
+
+Used in conjunction with 'IntentPerfNext' test
+'''
+
+from mininet.topo import Topo
+
+class MyTopo( Topo ):
+
+    def __init__( self ):
+        Topo.__init__( self )
+       
+        #Switches are listed out here for better view
+        #of the topology from this code
+        core_sw_list = ['s1','s2','s3']
+       
+        #Flower switches for core switch 1
+        flower_sw_list_s1 =\
+                ['s10', 's11', 's12', 's13', 's14',
+                 's15', 's16', 's17', 's18', 's19']
+        #Flower switches for core switch 2
+        flower_sw_list_s2 =\
+                ['s20', 's21', 's22', 's23', 's24',
+                 's25', 's26', 's27', 's28', 's29']
+        #Flower switches for core switch 3
+        flower_sw_list_s3 =\
+                ['s30', 's31', 's32', 's33', 's34',
+                 's35', 's36', 's37', 's38', 's39']
+
+        #Store switch objects in these variables
+        core_switches = []
+        flower_switches_1 = []
+        flower_switches_2 = []
+        flower_switches_3 = []
+       
+        #Add switches
+        for sw in core_sw_list:
+            core_switches.append(
+                    self.addSwitch(
+                        sw, 
+                        dpid = sw.replace('s','').zfill(16)
+                    )
+            )
+        for sw in flower_sw_list_s1:
+            flower_switches_1.append(
+                    self.addSwitch(
+                        sw,
+                        dpid = sw.replace('s','').zfill(16)
+                    )
+            )
+        for sw in flower_sw_list_s2:
+            flower_switches_2.append(
+                    self.addSwitch(
+                        sw,
+                        dpid = sw.replace('s','').zfill(16)
+                    )
+            )
+        for sw in flower_sw_list_s3:
+            flower_switches_3.append(
+                    self.addSwitch(
+                        sw,
+                        dpid = sw.replace('s','').zfill(16)
+                    )
+            )
+
+        self.addLink(core_switches[0], core_switches[1])
+        self.addLink(core_switches[1], core_switches[2])
+
+        for x in range(0, len(flower_sw_list_s1)):
+            self.addLink(core_switches[0], flower_switches_1[x]) 
+        for x in range(0, len(flower_sw_list_s2)):
+            self.addLink(core_switches[1], flower_switches_2[x])
+        for x in range(0, len(flower_sw_list_s3)):
+            self.addLink(core_switches[2], flower_switches_3[x])
+
+topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/drivers/common/api/onosapi/__init__.py b/TestON/drivers/common/api/onosapi/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/drivers/common/api/onosapi/__init__.py
+++ /dev/null
diff --git a/TestON/drivers/common/cli/cassandraclidriver.py b/TestON/drivers/common/cli/cassandraclidriver.py
deleted file mode 100644
index bad8c4e..0000000
--- a/TestON/drivers/common/cli/cassandraclidriver.py
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/usr/bin/env python
-'''
-Created on 31-May-2013
-
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
-
-
-    TestON is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
-
-    TestON is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.        
-
-
-CassandraCliDriver is the basic driver which will handle the Cassandra functions
-'''
-
-import pexpect
-import struct
-import fcntl
-import os
-import signal
-import re
-import sys
-import core.teston
-import time
-
-sys.path.append("../")
-from drivers.common.clidriver import CLI
-
-class CassandraCliDriver(CLI):
-    '''
-    CassandraCliDriver is the basic driver which will handle the Cassandra's functions
-    '''
-    def __init__(self):
-        super(CLI, self).__init__()
-        self.handle = self
-        self.wrapped = sys.modules[__name__]
-
-    def connect(self, **connectargs):
-        # Here the main is the TestON instance after creating all the log handles.
-        self.port = None
-        for key in connectargs:
-            vars(self)[key] = connectargs[key]       
-        
-        self.name = self.options['name']
-        self.handle = super(CassandraCliDriver, self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
-        
-        self.ssh_handle = self.handle
-        if self.handle :
-            #self.start()
-            return main.TRUE
-        else :
-            main.log.error(self.name + ": Connection failed to the host "+self.user_name+"@"+self.ip_address) 
-            main.log.error(self.name + ": Failed to connect to the Onos system")
-            return main.FALSE
-   
- 
-    def start(self):
-        '''
-        This Function will start the Cassandra
-        '''
-        main.log.info(self.name + ": Starting Cassandra" )
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("~/ONOS/start-cassandra.sh start")
-        self.handle.expect("start-cassandra.sh start")
-        self.handle.expect("\$")
-        response = self.handle.before + self.handle.after
-        time.sleep(5)
-        if re.search("Starting\scassandra(.*)", response):
-            main.log.info(self.name + ": Cassandra Started ")
-            return main.TRUE
-        else:
-            main.log.error(self.name + ": Failed to start Cassandra"+ response)
-            return main.FALSE
-        
-    def status(self):
-        '''
-        This Function will return the Status of the Cassandra
-        '''
-        time.sleep(5)
-        self.execute(cmd="\n",prompt="\$",timeout=10)
-        response = self.execute(cmd="~/ONOS/start-cassandra.sh status ",prompt="\d+\sinstance\sof\scassandra\srunning(.*)",timeout=10)
-        
-
-        #self.execute(cmd="\n",prompt="\$",timeout=10)
-        #return response
-        
-        if re.search("0\sinstance\sof\scassandra\srunning(.*)",response) :
-            main.log.info(self.name + ": Cassandra not running")
-            return main.FALSE
-        elif re.search("1\sinstance\sof\scassandra\srunning(.*)",response):
-            main.log.warn(self.name + ": Cassandra Running")
-            return main.TRUE
-        elif re.search("\sinstance\sof\scassandra\srunning(.*)",response):
-            main.log.warn(self.name + ": Multiple instances of Cassandra Running on the same machine!")
-            #Known bug: Once ONOS starts the script shows 2 instances
-            return main.TRUE
-	else: 
-	    main.log.warn(self.name + ": Cannot determine cassandra status")
-	    return main.False
-            
-    def stop(self):
-        '''
-        This Function will stop the Cassandra if it is Running
-        ''' 
-        self.execute(cmd="\n",prompt="\$",timeout=10)
-        time.sleep(5)
-        response = self.execute(cmd="~/ONOS/start-cassandra.sh stop ",prompt="Killed\sexisting\sprosess(.*)",timeout=10)
-        self.execute(cmd="\n",prompt="\$",timeout=10)
-        if re.search("Killed\sexisting\sprosess(.*)",response):
-            main.log.info(self.name + ": Cassandra Stopped")
-            return main.TRUE
-        else:
-            main.log.warn(self.name + ": Cassndra is not Running")
-            return main.FALSE
-            
-    def disconnect(self):
-        ''' 
-        Called at the end of the test to disconnect the ssh handle. 
-        ''' 
-        response = ''
-        if self.handle:
-            self.handle.sendline("exit")
-            self.handle.expect("closed")
-        else :
-            main.log.error(self.name + ": Connection failed to the host")
-            response = main.FALSE
-        return response 
-
-    def isup(self):
-        '''
-        A more complete status check of cassandra.
-        Tries 5 times to call start-cassandra.sh status
-        returns TRUE if it sees four occurances of both Up, and Normal 
-        '''
-        tries = 5
-        main.log.info(self.name + ": trying %i times" % tries )
-        for i in range(tries):
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            self.handle.sendline("")
-            self.handle.expect("\$") 
-            self.handle.sendline("~/ONOS/start-cassandra.sh status")
-            self.handle.expect("sh status") 
-            self.handle.expect("\$") 
-            result = self.handle.before + self.handle.after 
-            #pattern = '(.*)Up(.*)Normal(.*)\n(.*)Up(.*)Normal(.*)\n(.*)Up(.*)Normal(.*)\n(.*)Up(.*)Normal(.*)'
-	    pattern = '(' + self.ip_address.replace('.', '\\.') + '.*)Up(.*)Normal(.*)'
-            if re.search(pattern, result): 
-                return main.TRUE
-        return main.FALSE
diff --git a/TestON/drivers/common/cli/emulator/lincoedriver.py b/TestON/drivers/common/cli/emulator/lincoedriver.py
new file mode 100644
index 0000000..4d2cc01
--- /dev/null
+++ b/TestON/drivers/common/cli/emulator/lincoedriver.py
@@ -0,0 +1,315 @@
+#!/usr/bin/env python
+
+'''
+This driver handles the optical switch emulator linc-oe.
+
+Please follow the coding style demonstrated by existing
+functions and document properly.
+
+If you are a contributor to the driver, please
+list your email here for future contact:
+
+    andrew@onlab.us
+
+OCT 20 2014
+'''
+
+import traceback
+import pexpect
+import struct
+import fcntl
+import os
+import signal
+import re
+import sys
+import core.teston
+sys.path.append("../")
+from math import pow
+from drivers.common.cli.emulatordriver import Emulator
+from drivers.common.clidriver import CLI
+
+class LincOEDriver(Emulator):
+    '''
+    LincOEDriver class will handle all emulator functions    
+    '''
+    def __init__(self):
+        super(Emulator, self).__init__()
+        self.handle = self
+        self.wrapped = sys.modules[__name__]
+        self.flag = 0
+
+    def connect(self, **connectargs):
+        '''
+        Create ssh handle for Linc-OE cli
+        '''
+        import time
+
+        for key in connectargs:
+            vars(self)[key] = connectargs[key]       
+        
+        self.name = self.options['name']
+        self.handle = \
+                super(LincOEDriver, self).connect(\
+                user_name = self.user_name,
+                ip_address = self.ip_address,
+                port = None, 
+                pwd = self.pwd)
+        
+        self.ssh_handle = self.handle
+        
+        if self.handle :
+            main.log.info("Handle successfully created")
+            self.home = "~/linc-oe"
+            self.handle.sendline("cd "+self.home)
+            self.handle.expect("oe$")
+
+            main.log.info("Building Linc-OE")
+            self.handle.sendline("make rel")
+            i = self.handle.expect(["ERROR","linc-oe\$"],timeout=60)
+            if i == 0:
+                self.handle.sendline("sudo pkill -9 epmd")
+                self.handle.expect("\$")
+                self.handle.sendline("make rel")
+                x = self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+                main.log.info("make rel returned: "+ str(x))
+            else: 
+                main.log.info(self.name+": Starting Linc-OE CLI.. This may take a while")
+                time.sleep(30)
+                self.handle.sendline("sudo ./rel/linc/bin/linc console")
+                j = self.handle.expect(["linc@",pexpect.EOF,pexpect.TIMEOUT])
+          
+            if j == 0:
+                main.log.info("Linc-OE CLI started")
+                return main.TRUE
+
+        else:
+            main.log.error(self.name+
+                    ": Connection failed to the host "+
+                    self.user_name+"@"+self.ip_address) 
+            main.log.error(self.name+
+                    ": Failed to connect to Linc-OE")
+            return main.FALSE
+
+    def build(self):
+        '''
+        Build Linc-OE with the specified settings
+        '''
+        try:
+            self.handle.sendline("make rel")
+            i = self.handle.expect([
+                "ERROR",
+                "\$"])
+
+            if i == 0:
+                #If error, try to resolve the most common error
+                #(epmd running and cannot compile)
+                self.handle.sendline("sudo pkill -9 epmd")
+                self.handle.sendline("make rel")
+                self.handle.expect("\$")
+                    
+                handle = self.handle.before
+                return handle
+
+            else:
+                return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+
+    def set_interface_up(self, intfs):
+        '''
+        Specify interface to bring up.
+        When Linc-OE is started, tap interfaces should
+        be created. They must be brought up manually
+        '''
+        try:
+            self.handle.sendline("ifconfig "+str(intf)+" up")
+            self.handle.expect("linc@")
+   
+            handle = self.handle.before
+
+            return handle
+
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+
+    def start_switch(self, sw_id):
+        '''
+        Start a logical switch using switch id
+        '''
+        try:
+            self.handle.sendline("linc:start_switch("+str(sw_id)+").")
+            self.handle.expect("linc@")
+
+            handle = self.handle.before
+
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+
+    def stop_switch(self, sw_id):
+        '''
+        Stop a logical switch using switch id
+        '''
+        try:
+            self.handle.sendline("linc:stop_switch("+str(sw_id)+").")
+            self.handle.expect("linc@")
+
+            handle = self.handle.before
+
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+     
+    def get_datapath_id(self, sw_id):
+        '''
+        Get datapath id of a specific switch by switch id
+        '''
+        try:
+            self.handle.sendline("linc_logic:get_datapath_id("+
+                    str(sw_id)+").")
+            self.handle.expect("linc@")
+
+            handle = self.handle.before
+        
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+
+    def list_ports(self, sw_id):
+        '''
+        List all ports of a switch by switch id
+        '''
+        try:
+            self.handle.sendline("linc:ports("+str(sw_id)+").")
+            self.handle.expect("linc@")
+
+            handle = self.handle.before
+
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+
+    def port_up(self, sw_id, pt_id):
+        '''
+        Bring port up using switch id and port id
+        '''
+        try:
+            self.handle.sendline("linc:port_up("+
+                    str(sw_id)+", "+str(pt_id)+").")
+            self.handle.expect("linc@")
+
+            handle = self.handle.before
+
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+    
+    def port_down(self, sw_id, pt_id):
+        '''
+        Bring port down using switch id and port id
+        '''
+        try:
+            self.handle.sendline("linc:port_down("+
+                    str(sw_id)+", "+str(pt_id)+").")
+            self.handle.expect("linc@")
+
+            handle = self.handle.before
+
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+
+    def disconnect(self):
+        '''
+        Send disconnect prompt to Linc-OE CLI
+        (CTRL+C)
+        '''
+        try:
+            #Send CTRL+C twice to exit CLI
+            self.handle.sendline("\x03")
+            self.handle.sendline("\x03")
+            self.handle.expect("\$")
+
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" :::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" :::::::")
+            main.cleanup()
+            main.exit()
+
+if __name__ != "__main__":
+    import sys
+    sys.modules[__name__] = LincOEDriver()
+
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index a003f1b..ad07d95 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -31,6 +31,7 @@
 import sys
 import core.teston
 sys.path.append("../")
+from math import pow
 from drivers.common.cli.emulatordriver import Emulator
 from drivers.common.clidriver import CLI
 
@@ -73,9 +74,16 @@
  
             main.log.info(self.name+": building fresh mininet") 
             #### for reactive/PARP enabled tests
-            cmdString = "sudo mn " + self.options['arg1'] + " " + self.options['arg2'] +  " --mac --controller " + self.options['controller']
-            #### for proactive flow with static ARP entries
-            #cmdString = "sudo mn " + self.options['arg1'] + " " + self.options['arg2'] +  " --mac --arp --controller " + self.options['controller']
+            cmdString = "sudo mn " + self.options['arg1'] + " " + self.options['arg2'] +  " --mac --controller " + self.options['controller'] + " " + self.options['arg3']
+            
+            argList = self.options['arg1'].split(",")
+            global topoArgList
+            topoArgList = argList[0].split(" ")
+            argList = map(int, argList[1:])
+            topoArgList = topoArgList[1:] + argList
+            
+          #### for proactive flow with static ARP entries
+            #cmdString = "sudo mn " + self.options['arg1'] + " " + self.options['arg2'] +  " --mac --arp --controller " + self.options['controller'] + " " + self.options['arg3']
             self.handle.sendline(cmdString)
             self.handle.expect(["sudo mn",pexpect.EOF,pexpect.TIMEOUT])
             while 1: 
@@ -101,7 +109,43 @@
             main.log.error(self.name+": Connection failed to the host "+self.user_name+"@"+self.ip_address) 
             main.log.error(self.name+": Failed to connect to the Mininet")
             return main.FALSE
-                       
+                    
+    def num_switches_n_links(self,topoType,depth,fanout):
+        if topoType == 'tree':
+            if fanout is None:     #In tree topology, if fanout arg is not given, by default it is 2
+                fanout = 2
+            k = 0
+            count = 0
+            while(k <= depth-1): 
+                count = count + pow(fanout,k)
+                k = k+1
+                num_switches = count
+            while(k <= depth-2): 
+                '''depth-2 gives you only core links and not considering edge links as seen by ONOS
+                    If all the links including edge links are required, do depth-1
+                '''
+                count = count + pow(fanout,k)
+                k = k+1
+            num_links = count * fanout
+            #print "num_switches for %s(%d,%d) = %d and links=%d" %(topoType,depth,fanout,num_switches,num_links)
+        
+        elif topoType =='linear':
+            if fanout is None:     #In linear topology, if fanout or num_hosts_per_sw is not given, by default it is 1
+                fanout = 1
+            num_switches = depth
+            num_hosts_per_sw = fanout
+            total_num_hosts = num_switches * num_hosts_per_sw
+            num_links = total_num_hosts + (num_switches - 1)
+            print "num_switches for %s(%d,%d) = %d and links=%d" %(topoType,depth,fanout,num_switches,num_links) 
+        topoDict = {}
+        topoDict = {"num_switches":int(num_switches), "num_corelinks":int(num_links)}
+        return topoDict
+
+
+    def calculate_sw_and_links(self):
+        topoDict = self.num_switches_n_links(*topoArgList)
+        return topoDict
+
     def pingall(self):
         '''
         Verifies the reachability of the hosts using pingall command.
@@ -110,12 +154,15 @@
             main.log.info(self.name+": Checking reachabilty to the hosts using pingall")
             try:
                 response = self.execute(cmd="pingall",prompt="mininet>",timeout=120)
+                print "response: " + str(response)
             except pexpect.EOF:  
                 main.log.error(self.name + ": EOF exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
                 main.cleanup()
                 main.exit()
-            pattern = 'Results\:\s0\%\sdropped\s\(0\/\d+\slost\)\s*$'
+            pattern = 'Results\:\s0\%\sdropped\s'
+            #FIXME:Pending Mininet Pull Request #408
+            #pattern = 'Results\:\s0\.00\%\sdropped\s'
             #if utilities.assert_matches(expect=pattern,actual=response,onpass="All hosts are reaching",onfail="Unable to reach all the hosts"):
             if re.search(pattern,response):
                 main.log.info(self.name+": All hosts are reachable")
@@ -340,7 +387,7 @@
             return information dict about interfaces connected to the node
         '''
         if self.handle :
-            cmd = 'py "\\n".join(["name=%s,mac=%s,ip=%s,isUp=%s" % (i.name, i.MAC(), i.IP(), i.isUp())'
+            cmd = 'py "\\n".join(["name=%s,mac=%s,ip=%s,enabled=%s" % (i.name, i.MAC(), i.IP(), i.isUp())'
             cmd += ' for i in %s.intfs.values()])' % node
             try:
                 response = self.execute(cmd=cmd,prompt="mininet>",timeout=10)
@@ -443,11 +490,11 @@
         '''
         Bring link(s) between two nodes up or down
         '''
-        main.log.info('Bring link(s) between two nodes up or down')
         args = utilities.parse_args(["END1","END2","OPTION"],**linkargs)
         end1 = args["END1"] if args["END1"] != None else ""
         end2 = args["END2"] if args["END2"] != None else ""
         option = args["OPTION"] if args["OPTION"] != None else ""
+        main.log.info("Bring link between '"+ end1 +"' and '" + end2 + "' '" + option + "'")
         command = "link "+str(end1) + " " + str(end2)+ " " + str(option)
         try:
             #response = self.execute(cmd=command,prompt="mininet>",timeout=10)
@@ -669,7 +716,6 @@
             pattern = "flow_count=(\d+)"
             result = re.search(pattern, response, re.MULTILINE)
             if result is None:
-                print "no flow on switch print test"
                 main.log.info("Couldn't find flows on switch '', found: %s" % (switch, response))
                 return main.FALSE
             return result.group(1)
@@ -751,52 +797,28 @@
             main.cleanup()
             main.exit()
 
-    def compare_topo(self, topo, onos_json):
+    def compare_switches(self, topo, switches_json):
         '''
-        compares mn topology with ONOS topology
-        onos_list is a list of ONOS controllers, each element of the list should be (handle, name, ip, port)
-        onos_json is the output of the onos get_json function calling the /wm/onos/topology REST API
-        Returns: True if MN and ONOS topology match and False if the differ. 
-        Differences between ONOS and MN topology will be printed to the log.
+        Compare mn and onos switches
+        topo: sts TestONTopology object
+        switches_json: parsed json object from the onos devices api
 
-        Dependency: Requires STS to be installed on the TestON machine. STS can be pulled 
-        from https://github.com/ucb-sts/sts.git . Currently the required functions from STS are located in the 
-        topology_refactoring2 branch, but may be merged into the master branch soon. You may need to install some
-        python modules such as networkx to use the STS functions.
-
-        To install sts:
-            $ git clone git://github.com/ucb-sts/sts.git
-            $ cd sts
-            $ git clone -b debugger git://github.com/ucb-sts/pox.git
-            $ sudo apt-get install python-dev
-            $ ./tools/install_hassel_python.sh
-            $ sudo pip install networkx
-
-        Include sts in your PYTHONPATH. it should looks comething like: 
-            PYTHONPATH=/home/admin/TestON:/home/admin/sts
+        This uses the sts TestONTopology object
 
         '''
-        import sys
-        sys.path.append("~/sts")
-        #NOTE: Create this once per Test and pass the TestONTopology object around. It takes too long to create this object.
-        #      This will make it easier to use the sts methods for severing links and solve that issue
         import json
-
-        link_results = main.TRUE
-        switch_results = main.TRUE
-        port_results = main.TRUE
-
-        ########Switches#######
+        #main.log.debug("Switches_json string: ", switches_json)
         output = {"switches":[]}
         for switch in topo.graph.switches: #iterate through the MN topology and pull out switches and and port info
             ports = []
             for port in switch.ports.values():
-                #print port.hw_addr.toStr(separator = '')
                 ports.append({'of_port': port.port_no, 'mac': str(port.hw_addr).replace('\'',''), 'name': port.name})
             output['switches'].append({"name": switch.name, "dpid": str(switch.dpid).zfill(16), "ports": ports })
-        #print output
 
+        #print "mn"
         #print json.dumps(output, sort_keys=True,indent=4,separators=(',', ': '))
+        #print "onos"
+        #print json.dumps(switches_json, sort_keys=True,indent=4,separators=(',', ': '))
 
 
         # created sorted list of dpid's in MN and ONOS for comparison
@@ -804,15 +826,21 @@
         for switch in output['switches']:
             mnDPIDs.append(switch['dpid'])
         mnDPIDs.sort()
+        #print "List of Mininet switch DPID's"
         #print mnDPIDs
-        if onos_json == "":#if rest call fails
-            main.log.error(self.name + ".compare_topo(): Empty JSON object given from ONOS rest call")
+        if switches_json == "":#if rest call fails
+            main.log.error(self.name + ".compare_switches(): Empty JSON object given from ONOS")
             return main.FALSE
-        onos=onos_json
+        onos=switches_json
         onosDPIDs=[]
-        for switch in onos['switches']:
-            onosDPIDs.append(switch['dpid'].replace(":",''))
+        for switch in onos:
+            if switch['available'] == True:
+                onosDPIDs.append(switch['id'].replace(":",'').replace("of",''))
+            #else:
+                #print "Switch is unavailable:"
+                #print switch
         onosDPIDs.sort()
+        #print "List of ONOS switch DPID's"
         #print onosDPIDs
 
         if mnDPIDs!=onosDPIDs:
@@ -822,36 +850,137 @@
             main.log.report( "Switches in ONOS but not in MN:")
             main.log.report(  str([switch for switch in onosDPIDs if switch not in mnDPIDs]))
         else:#list of dpid's match in onos and mn
+            #main.log.report("DEBUG: The dpid's of the switches in Mininet and ONOS match")
             switch_results = main.TRUE
+        return switch_results
+
+
+
+    def compare_ports(self, topo, ports_json):
+        '''
+        Compare mn and onos ports
+        topo: sts TestONTopology object
+        ports_json: parsed json object from the onos ports api
+
+        Dependencies: 
+            1. This uses the sts TestONTopology object
+            2. numpy - "sudo pip install numpy"
+
+        '''
+        #FIXME: this does not look for extra ports in ONOS, only checks that ONOS has what is in MN
+        import json
+        from numpy import uint64
+        port_results = main.TRUE
+        output = {"switches":[]}
+        for switch in topo.graph.switches: #iterate through the MN topology and pull out switches and and port info
+            ports = []
+            for port in switch.ports.values():
+                #print port.hw_addr.toStr(separator = '')
+                tmp_port = {}
+                tmp_port['of_port'] = port.port_no
+                tmp_port['mac'] = str(port.hw_addr).replace('\'','')
+                tmp_port['name'] = port.name
+                tmp_port['enabled'] = port.enabled
+
+                ports.append(tmp_port)
+            tmp_switch = {}
+            tmp_switch['name'] = switch.name
+            tmp_switch['dpid'] = str(switch.dpid).zfill(16)
+            tmp_switch['ports'] = ports
+
+            output['switches'].append(tmp_switch)
+
 
         ################ports#############
-            for switch in output['switches']:
-                mn_ports = []
-                onos_ports = []
-                for port in switch['ports']:
+        for mn_switch in output['switches']:
+            mn_ports = []
+            onos_ports = []
+            for port in mn_switch['ports']:
+                if port['enabled'] == True:
                     mn_ports.append(port['of_port'])
-                for onos_switch in onos['switches']:
-                    if onos_switch['dpid'].replace(':','') == switch['dpid']:
+            for onos_switch in ports_json:
+                #print "Iterating through a new switch as seen by ONOS"
+                #print onos_switch
+                if onos_switch['device']['available'] == True:
+                    if onos_switch['device']['id'].replace(':','').replace("of", '') == mn_switch['dpid']:
                         for port in onos_switch['ports']:
-                            onos_ports.append(port['portNumber']) 
-                mn_ports.sort()
-                onos_ports.sort()
-                if mn_ports == onos_ports:
-                    pass #don't set results to true here as this is just one of many checks and it might override a failure
-                else: #the ports of this switch don't match
+                            if port['isEnabled']:
+                                #print "Iterating through available ports on the switch"
+                                #print port
+                                onos_ports.append(int(port['port'])) 
+            mn_ports.sort(key=float)
+            onos_ports.sort(key=float)
+            #print "\nPorts for Switch %s:" % (switch['name'])
+            #print "\tmn_ports[] = ", mn_ports
+            #print "\tonos_ports[] = ", onos_ports
+            
+            #NOTE:For OF1.3, the OFP_local port number is 0xfffffffe or 4294967294 instead of 0xfffe or 65534 in OF1.0,
+            #   ONOS topology sees the correct port number, however MN topology as read from line 151 of
+            #   https://github.com/ucb-sts/sts/blob/topology_refactoring2/sts/entities/teston_entities.py 
+            #   is 0xfffe which doesn't work correctly with OF1.3 switches.
+            
+            #NOTE: ONOS is abstracting port numbers to 64bit unsigned number(long). So we will be converting the 
+            #   OF reserved ports to these numbers
+
+
+            #TODO: handle other reserved port numbers besides LOCAL
+            for mn_port,onos_port in zip(mn_ports,onos_ports):
+                #print "mn == onos port?"
+                #print mn_port, onos_port
+                if mn_port == onos_port or (mn_port == 65534 and onos_port == long(uint64(-2))):
+                    continue
+                    #don't set results to true here as this is just one of many checks and it might override a failure
+                else:  #the ports of this switch don't match
                     port_results = main.FALSE
-                    main.log.report("ports in MN switch %s(%s) but not in ONOS:" % (switch['name'],switch['dpid'])) 
-                    main.log.report( str([port for port in mn_ports if port not in onos_ports]))
-                    main.log.report("ports in ONOS switch %s(%s) but not in MN:" % (switch['name'],switch['dpid']))
-                    main.log.report( str([port for port in onos_ports if port not in mn_ports]))
+                    break
+            if port_results == main.FALSE:
+                main.log.report("The list of ports for switch %s(%s) does not match:" % (mn_switch['name'], mn_switch['dpid']) )
+                main.log.report("mn_ports[] = " +  str(mn_ports))
+                main.log.report("onos_ports[] = " + str(onos_ports))
+        return port_results
 
 
+
+
+    def compare_links(self, topo, links_json):
+        '''
+        Compare mn and onos links
+        topo: sts TestONTopology object
+        links_json: parsed json object from the onos links api
+
+        This uses the sts TestONTopology object
+
+        '''
+        #FIXME: this does not look for extra links in ONOS, only checks that ONOS has what is in MN
+        import json
+        link_results = main.TRUE
+        output = {"switches":[]}
+        onos = links_json
+        for switch in topo.graph.switches: #iterate through the MN topology and pull out switches and and port info
+            # print "Iterating though switches as seen by Mininet"
+            # print switch
+            ports = []
+            for port in switch.ports.values():
+                #print port.hw_addr.toStr(separator = '')
+                ports.append({'of_port': port.port_no, 'mac': str(port.hw_addr).replace('\'',''), 'name': port.name})
+            output['switches'].append({"name": switch.name, "dpid": str(switch.dpid).zfill(16), "ports": ports })
         #######Links########
-        # iterate through MN links and check if and ONOS link exists in both directions
+
+        mn_links = [link for link in topo.patch_panel.network_links if (link.port1.enabled and link.port2.enabled)]
+        #print "mn_links:"
+        #print mn_links
+        if 2*len(mn_links) == len(onos):
+            link_results = main.TRUE
+        else:
+            link_results = main.FALSE
+            main.log.report("Mininet has %i bidirectional links and ONOS has %i unidirectional links" % (len(mn_links), len(onos) ))
+
+
+        # iterate through MN links and check if an ONOS link exists in both directions
         # NOTE: Will currently only show mn links as down if they are cut through STS. 
         #       We can either do everything through STS or wait for up_network_links 
         #       and down_network_links to be fully implemented.
-        for link in topo.patch_panel.network_links: 
+        for link in mn_links: 
             #print "Link: %s" % link
             #TODO: Find a more efficient search method
             node1 = None
@@ -861,6 +990,7 @@
             first_dir = main.FALSE
             second_dir = main.FALSE
             for switch in output['switches']:
+                #print "Switch: %s" % switch['name']
                 if switch['name'] == link.node1.name:
                     node1 = switch['dpid']
                     for port in switch['ports']:
@@ -875,62 +1005,91 @@
                             port2 = port['of_port'] 
                     if node1 is not None and node2 is not None:
                         break
-            # check onos link from node1 to node2
-            for onos_link in onos['links']:
-                if onos_link['src']['dpid'].replace(":",'') == node1 and onos_link['dst']['dpid'].replace(":",'') == node2:
-                    if onos_link['src']['portNumber'] == port1 and onos_link['dst']['portNumber'] == port2:
+
+
+            for onos_link in onos:
+                onos_node1 = onos_link['src']['device'].replace(":",'').replace("of", '')
+                onos_node2 = onos_link['dst']['device'].replace(":",'').replace("of", '')
+                onos_port1 = onos_link['src']['port']
+                onos_port2 = onos_link['dst']['port']
+
+                #print "Checking ONOS for link %s/%s -> %s/%s and" % (node1, port1, node2, port2)
+                #print "Checking ONOS for link %s/%s -> %s/%s" % (node2, port2, node1, port1)
+                # check onos link from node1 to node2
+                if str(onos_node1) == str(node1) and str(onos_node2) == str(node2):
+                    if int(onos_port1) == int(port1) and int(onos_port2) == int(port2):
                         first_dir = main.TRUE
                     else:
-                        main.log.report('the port numbers do not match for ' +str(link) + ' between ONOS and MN')
-                    #print node1, ' to ', node2
-                elif onos_link['src']['dpid'].replace(":",'') == node2 and onos_link['dst']['dpid'].replace(":",'') == node1:
-                    if onos_link['src']['portNumber'] == port2 and onos_link['dst']['portNumber'] == port1:
+                        main.log.report('The port numbers do not match for ' +str(link) +\
+                                ' between ONOS and MN. When cheking ONOS for link '+\
+                                '%s/%s -> %s/%s' % (node1, port1, node2, port2)+\
+                                ' ONOS has the values %s/%s -> %s/%s' %\
+                                (onos_node1, onos_port1, onos_node2, onos_port2))
+
+                # check onos link from node2 to node1
+                elif ( str(onos_node1) == str(node2) and str(onos_node2) == str(node1) ):
+                    if ( int(onos_port1) == int(port2) and int(onos_port2) == int(port1) ):
                         second_dir = main.TRUE
                     else:
-                        main.log.report('the port numbers do not match for ' +str(link) + ' between ONOS and MN')
-                    #print node2, ' to ', node1
+                        main.log.report('The port numbers do not match for ' +str(link) +\
+                                ' between ONOS and MN. When cheking ONOS for link '+\
+                                '%s/%s -> %s/%s' % (node2, port2, node1, port1)+\
+                                ' ONOS has the values %s/%s -> %s/%s' %\
+                                (onos_node2, onos_port2, onos_node1, onos_port1))
                 else:#this is not the link you're looking for
                     pass
             if not first_dir:
-                main.log.report('ONOS has issues with the link from '+str(link.node1.name) +"(dpid: "+ str(node1)+"):"+str(link.port1)+"(portNumber: "+str(port1)+")"+ ' to ' + str(link.node2.name) +"(dpid: "+ str(node2)+"):"+str(link.port2)+"(portNumber: "+str(port2)+")")
+                main.log.report('ONOS does not have the link %s/%s -> %s/%s' % (node1, port1, node2, port2))
             if not second_dir:
-                main.log.report('ONOS has issues with the link from '+str(link.node2.name) +"(dpid: "+ str(node2)+"):"+str(link.port2)+"(portNumber: "+str(port2)+")"+ ' to ' + str(link.node1.name) +"(dpid: "+ str(node1)+"):"+str(link.port1)+"(portNumber: "+str(port1)+")")
+                main.log.report('ONOS does not have the link %s/%s -> %s/%s' % (node2, port2, node1, port1))
             link_results = link_results and first_dir and second_dir
+        return link_results
+
+
+    def get_hosts(self):
+        '''
+        Returns a list of all hosts
+        Don't ask questions just use it
+        '''
+        self.handle.sendline("")
+        self.handle.expect("mininet>")
+        
+        self.handle.sendline("py [ host.name for host in net.hosts ]")
+        self.handle.expect("mininet>")
+
+        handle_py = self.handle.before
+        handle_py = handle_py.split("]\r\n",1)[1]
+        handle_py = handle_py.rstrip()
+
+        self.handle.sendline("")
+        self.handle.expect("mininet>")
+
+        host_str = handle_py.replace("]", "")
+        host_str = host_str.replace("'", "")
+        host_str = host_str.replace("[", "")
+        host_list = host_str.split(",")
+
+        return host_list 
+
+
+    def update(self):
+        '''
+        updates the port address and status information for each port in mn
+        '''
+        #TODO: Add error checking. currently the mininet command has no output
+        main.log.info("Updateing MN port information")
+        self.handle.sendline("")
+        self.handle.expect("mininet>")
+        
+        self.handle.sendline("update")
+        self.handle.expect("mininet>")
+
+        self.handle.sendline("")
+        self.handle.expect("mininet>")
+
+        return main.TRUE 
 
         
-        results =  switch_results and port_results and link_results
-#        if not results: #To print out both topologies
-#            main.log.error("Topology comparison failed, printing json objects, MN then ONOS")
-#            main.log.error(str(json.dumps(output, sort_keys=True,indent=4,separators=(',', ': '))))
-#            main.log.error('MN Links:')
-#            for link in topo.patch_panel.network_links: main.log.error(str("\tLink: %s" % link))
-#            main.log.error(str(json.dumps(onos, sort_keys=True,indent=4,separators=(',', ': '))))
-        return results
-
-
-    def links_status(self):
-        """
-        Returns list of links and their status
-        """
-        if self.handle :
-            cmd = "py 'Links: %s' % [item for sublist in [[(y[0].name, y[1].name, y[0].isUp() and y[1].isUp()) for y in x[0].connectionsTo(x[1])] for x in __import__('itertools').permutations(net.nameToNode.values(), 2) if x[0] != x[1] and x[0].connectionsTo(x[1])] for item in sublist]"
-            try:
-                response = self.execute(cmd=cmd,prompt="mininet>",timeout=10)
-                if not response:
-                  return None
-                for line in response.split('\n'):
-                  if line.startswith('Links:'):
-                    return eval(line[len("Links :"):])
-            except pexpect.EOF:
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
-            return response
-        else:
-            main.log.error("Connection failed to the node")
-
-
 
 if __name__ != "__main__":
     import sys
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index d6e839d..ffb5151 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -91,7 +91,10 @@
             return main.FALSE
         elif re.search("found multiple mininet",outputs):
             return main.ERROR
-        return main.TRUE
+        else:
+            print outputs
+            return main.TRUE
+
 
 
     def pingLong(self,**pingParams):
@@ -413,6 +416,15 @@
             main.cleanup()
             main.exit()
 
+    def run_optical_mn_script(self):
+        self.handle.sendline("")
+        self.handle.expect("\$")
+        self.handle.sendline("cd ~")
+        self.handle.expect("\$")
+        self.handle.sendline("sudo python optical.py")
+        self.handle.expect("\$")
+
+
     def del_switch(self,sw):
         self.handle.sendline("")
         self.handle.expect("\$")
@@ -421,6 +433,7 @@
         return main.TRUE
 
     def add_switch(self,sw):
+        #FIXME: Remove hardcoded number of ports
         self.handle.sendline("")
         self.handle.expect("\$")
         self.handle.sendline("sudo ovs-vsctl add-br "+sw)
@@ -472,32 +485,204 @@
             response = main.FALSE
         return response  
 
-    def get_flowTable(self,sw):
+    def get_flowTable(self, protoVersion, sw):
         self.handle.sendline("cd")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+        #self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+        print "cd expect status: " 
+        print self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
         #TODO: Write seperate versions of the function for this, possibly a string that tells it which switch is in use?
         #For 1.0 version of OVS
         #command = "sudo ovs-ofctl dump-flows " + sw + " | awk '{OFS=\",\" ; print $1 $6 $7 }' |sort -n -k1"
         #for 1.3 version of OVS
-        command = "sudo ovs-ofctl dump-flows " + sw + " | awk '{OFS=\",\" ; print $1 $3 $7 $8}' |sort -n -k1"
-        self.handle.sendline(command)
-        self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["NXST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before
-        return response 
+        #command = "sudo ovs-ofctl dump-flows " + sw + " | awk '{OFS=\",\" ; print $1 $3 $7 $8}' |sort -n -k1"
+        #NOTE: Use format to force consistent flow table output across versions
+        if protoVersion==1.0:
+            command = "sudo ovs-ofctl dump-flows " + sw + " -F OpenFlow10-table_id | awk '{OFS=\",\" ; print $1  $3  $6  $7  $8}' |sort -n -k1"
+            self.handle.sendline(command)
+            self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
+            self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
+            response = self.handle.before
+            #print "response=", response
+            return response
+        elif protoVersion==1.3:
+            command = "sudo ovs-ofctl dump-flows " + sw + " -O OpenFlow13  | awk '{OFS=\",\" ; print $1  $3  $6  $7}' |sort -n -k1" 
+            self.handle.sendline(command)
+            #print "ovs-vsctl Command sent status."
+            #self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
+            #print "sort return status: " 
+            #print self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
+            #print self.handle.before
+            self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
+            #print "OFPST_FLOW expected status: " 
+            #print self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
+            #print self.handle.before
+            response = self.handle.before
+            #print "response=", response
+            return response 
         
 
     def flow_comp(self,flow1,flow2):
+        #print "Inside flow compare function"
+        #print "Flow1 Table:"
+        #for flow in flow1:
+            #print flow1
+        #print "Flow2 Table"
+        #for flow in flow2:
+            #print flow2
+
         if flow1==flow2:
             return main.TRUE
         else:
             main.log.info("Flow tables do not match, printing tables:")
-            main.log.info("Flow Table 1:")
-            main.log.info(flow1)
-            main.log.info("Flow Table 2:")
-            main.log.info(flow2)
+            #main.log.info("Flow Table 1:")
+            #main.log.info(flow1)
+            #main.log.info("Flow Table 2:")
+            #main.log.info(flow2)
             return main.FALSE
 
+    def setIpTablesOUTPUT(self, dst_ip, dst_port, action='add', packet_type='tcp',rule='DROP'):
+        '''
+        Description:
+            add or remove iptables rule to DROP (default)  packets from specific IP and PORT
+        Usage:
+        * specify action ('add' or 'remove')
+          when removing, pass in the same argument as you would add. It will
+          delete that specific rule. 
+        * specify the destination ip to block with dst_ip 
+        * specify destination port to block to dst_port
+        * optional packet type to block (default tcp)
+        * optional iptables rule (default DROP)
+        WARNING:
+        * This function uses root privilege iptables command which may result in
+          unwanted network errors. USE WITH CAUTION
+        '''
+        import re
+        import time
+
+        #NOTE*********
+        #   The strict checking methods of this driver function is intentional
+        #   to discourage any misuse or error of iptables, which can cause
+        #   severe network errors
+        #*************
+
+        #NOTE: Sleep needed to give some time for rule to be added and registered
+        #      to the instance
+        time.sleep(5)
+
+        action_type = action.lower()
+        if action_type != 'add' and action_type !='remove':
+            main.log.error("Invalid action type. 'add' or 'remove' table rule")
+            if rule != 'DROP' and rule != 'ACCEPT' and rule != 'LOG':
+                #NOTE: Currently only supports rules DROP, ACCEPT, and LOG
+                main.log.error("Invalid rule. 'DROP' or 'ACCEPT' or 'LOG' only.")
+                return
+            return
+        else:
+
+            #If there is no existing rule in the iptables, we will see an 
+            #'iptables:'... message. We expect to see this message. 
+            #Otherwise, if there IS an existing rule, we will get the prompt
+            # back, hence why we expect $ for remove type. We want to remove
+            # an already existing rule
+
+            if action_type == 'add':
+                #NOTE: "iptables:" expect is a result of return from the command
+                #      iptables -C ...
+                #      Any changes by the iptables command return string 
+                #      will result in failure of the function. (deemed unlikely
+                #      at the time of writing this function)
+                #Check for existing rules on current input
+                self.handle.sendline("")
+                self.handle.expect("\$")
+                self.handle.sendline("sudo iptables -C OUTPUT -p "+str(packet_type)+
+                        " -d "+ str(dst_ip)+" --dport "+str(dst_port)+" -j "+str(rule))
+                i = self.handle.expect(["iptables:", "\$"])
+                print i
+                print self.handle.before
+                print "after: "
+                print self.handle.after
+
+            elif action_type == 'remove':
+                #Check for existing rules on current input
+                self.handle.sendline("")
+                self.handle.expect("\$")
+                self.handle.sendline("sudo iptables -C OUTPUT -p "+str(packet_type)+
+                        " -d "+ str(dst_ip)+" --dport "+str(dst_port)+" -j "+str(rule))
+                self.handle.expect("\$")
+            print "before: "
+            print self.handle.before
+            actual_string = self.handle.after
+            expect_string = "iptables:"
+            print "Actual String:"
+            print actual_string
+
+            if re.search(expect_string, actual_string):
+                match_result = main.TRUE
+            else:
+                match_result = main.FALSE
+            #If match_result is main.TRUE, it means there is no matching rule. 
+
+            #If tables does not exist and expected prompt is returned, go ahead and
+            #add iptables rule
+            if match_result == main.TRUE:
+                #Ensure action type is add
+                if action_type == 'add':
+                    #-A is the 'append' action of iptables
+                    action_add = '-A'
+                    try:
+                        self.handle.sendline("")
+                        self.handle.sendline("sudo iptables "+action_add+" OUTPUT -p "+str(packet_type)+
+                            " -d "+ str(dst_ip)+" --dport "+str(dst_port)+" -j "+str(rule))
+
+                        info_string = "Rules added to "+str(self.name)
+                        info_string += "iptable rule added to block IP: "+str(dst_ip)
+                        info_string += "Port: "+str(dst_port)+" Rule: "+str(rule)
+
+                        main.log.info(info_string)
+
+                        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+                    except pexpect.TIMEOUT:
+                        main.log.error(self.name + ": Timeout exception in setIpTables function")
+                    except:
+                        main.log.error( traceback.print_exc())
+                        main.cleanup()
+                        main.exit()
+                else:
+                    main.log.error("Given rule already exists, but attempted to add it")
+            #If match_result is 0, it means there IS a matching rule provided
+            elif match_result == main.FALSE:
+                #Ensure action type is remove
+                if action_type == 'remove':
+                    #-D is the 'delete' rule of iptables
+                    action_remove = '-D'
+                    try:
+                        self.handle.sendline("")
+                        #Delete a specific rule specified into the function
+                        self.handle.sendline("sudo iptables "+action_remove+" OUTPUT -p "+str(packet_type)+
+                            " -d "+ str(dst_ip)+" --dport "+str(dst_port)+" -j "+str(rule))
+
+                        info_string = "Rules removed from "+str(self.name)
+                        info_string += " iptables rule removed from blocking IP: "+str(dst_ip)
+                        info_string += " Port: "+str(dst_port)+" Rule: "+str(rule)
+
+                        main.log.info(info_string)
+
+                        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+                    except pexpect.TIMEOUT:
+                        main.log.error(self.name + ": Timeout exception in setIpTables function")
+                    except:
+                        main.log.error( traceback.print_exc())
+                        main.cleanup()
+                        main.exit()
+                else:
+                    main.log.error("Given rule does not exist, but attempted to remove it")
+            else:
+                #NOTE: If a bad usage of this function occurs, exit the entire test
+                main.log.error("Bad rule given for iptables. Exiting...")
+                main.cleanup()
+                main.exit()
+
+
 if __name__ != "__main__":
     import sys
     sys.modules[__name__] = RemoteMininetDriver()
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 40e4cf0..90514d0 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1,47 +1,44 @@
 #!/usr/bin/env python
-'''
-Created on 31-May-2013
-
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
-
-TestON is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-TestON is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with TestON. If not, see <http://www.gnu.org/licenses/>.
-
 
 '''
+This driver enters the onos> prompt to issue commands.
+
+Please follow the coding style demonstrated by existing 
+functions and document properly.
+
+If you are a contributor to the driver, please
+list your email here for future contact:
+
+jhall@onlab.us
+andrew@onlab.us
+shreya@onlab.us
+
+OCT 13 2014
+
+'''
+
+import sys
 import time
 import pexpect
-import struct, fcntl, os, sys, signal
 import re
-import json
 import traceback
-import urllib2
-from urllib2 import URLError, HTTPError
-from socket import timeout
-
+import os.path
+import pydoc
+import re
 sys.path.append("../")
 from drivers.common.clidriver import CLI
 
-URL_TIMEOUT = 10
-
 class OnosCliDriver(CLI):
-    
+
     def __init__(self):
+        '''
+        Initialize client 
+        '''
         super(CLI, self).__init__()
-        
+
     def connect(self,**connectargs):
         '''
-        Creates ssh handle for ONOS.
+        Creates ssh handle for ONOS cli.
         '''
         try:
             for key in connectargs:
@@ -52,10 +49,17 @@
                     self.home = self.options['home']
                     break
 
-            
-            self.name = self.options['name']
-            self.handle = super(OnosCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd, home = self.home)
 
+            self.name = self.options['name']
+            self.handle = super(OnosCliDriver,self).connect(
+                    user_name = self.user_name, 
+                    ip_address = self.ip_address,
+                    port = self.port, 
+                    pwd = self.pwd, 
+                    home = self.home)
+           
+            self.handle.sendline("cd "+ self.home)
+            self.handle.expect("\$")
             if self.handle:
                 return self.handle
             else :
@@ -73,432 +77,24 @@
             main.cleanup()
             main.exit()
 
-    def portKill(self, port):
-        try:
-            self.handle.sendline("")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            cmd = "sudo tcpkill -i eth0 port " + str(port) + " 2>/dev/null 1>/dev/null &"
-            self.handle.sendline(cmd)
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def endPortKill(self,port):
-        try:
-            self.handle.sendline("")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("sudo pkill tcpkill")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-        
-    def start(self, env = ''):
-        '''
-        Starts ONOS on remote machine.
-        Returns false if any errors were encountered.
-        '''
-        try:
-            self.handle.sendline("")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("cd "+self.home)
-            self.handle.sendline(env + "./onos.sh core start")
-            i=self.handle.expect(["STARTED","FAILED",pexpect.EOF,pexpect.TIMEOUT])
-            response = self.handle.before + str(self.handle.after)
-            if i==0:
-                j = self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT], timeout=60)
-                if re.search("Killed",response):
-                    main.log.warn(self.name + ": Killed existing process")
-                if j==0:
-                    main.log.info(self.name + ": ONOS Started ")
-                    return main.TRUE
-                elif j==1:
-                    main.log.error(self.name + ": EOF exception found")
-                    main.log.error(self.name + ":     " + self.handle.before)
-                    main.cleanup()
-                    main.exit()
-                elif j==2:
-                    main.log.info(self.name + ": ONOS NOT Started, stuck while waiting for it to start ")
-                    return main.FALSE
-                else:
-                    main.log.warn(self.name +": Unexpected response in start")
-                    return main.TRUE
-            elif i==1:
-                main.log.error(self.name + ": ONOS Failed to start")
-                return main.FALSE
-            elif i==2:
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
-            elif i==3:
-                main.log.error(self.name + ": ONOS timedout while starting")
-                return main.FALSE
-            else:
-                main.log.error(self.name + ": ONOS start  expect script missed something... ")
-            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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def start_all(self):
-        '''
-        starts ZK, RC, and ONOS
-        '''
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh start")
-        self.handle.expect("./onos.sh start")
-        self.handle.expect(["\$",pexpect.TIMEOUT])
-
-
-
-    def start_rest(self):
-        '''
-        Starts the rest server on ONOS.
-        '''
-        try:
-            self.handle.sendline("cd "+self.home)
-            response = self.execute(cmd= "./start-rest.sh start",prompt="\$",timeout=10)
-            if re.search("admin",response):
-                main.log.info(self.name + ": Rest Server Started Successfully")
-                time.sleep(5)
-                return main.TRUE
-            else :
-                main.log.warn(self.name + ": Failed to start Rest Server")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def status(self):
-        '''
-        Called onos.sh core status and returns TRUE/FALSE accordingly
-        '''
-        try:
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            self.handle.sendline("cd "+self.home)
-            response = self.execute(cmd="./onos.sh core status ",prompt="\d+\sinstance\sof\sonos\srunning",timeout=10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            if re.search("1\sinstance\sof\sonos\srunning",response):
-                return main.TRUE
-            elif re.search("0\sinstance\sof\sonos\srunning",response):
-                return main.FALSE
-            elif re.search("Expected\sPrompt\snot found\s,\sTime Out!!",response):
-                return main.ERROR
-            else :
-                main.log.warn(self.name + " WARNING: status recieved unknown response")
-                main.log.warn(response)
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-    def isup(self):
-        '''
-        A more complete check to see if ONOS is up and running properly.
-        First, it checks if the process is up.
-        Second, it reads the logs for "Exception: Connection refused"
-        Third, it makes sure the logs are actually moving.
-        returns TRUE/FALSE accordingly.
-        '''
-        try:
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            self.handle.sendline("cd "+self.home)
-            response = self.execute(cmd= "./onos.sh core status ",prompt="running",timeout=10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            tail1 = self.execute(cmd="tail " + self.home + "/onos-logs/onos.*.log",prompt="\$",timeout=10)
-            time.sleep(10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            tail2 = self.execute(cmd="tail " + self.home + "/onos-logs/onos.*.log",prompt="\$",timeout=10)
-            pattern = '(.*)1 instance(.*)'
-            pattern2 = '(.*)Exception: Connection refused(.*)'
-           # if utilities.assert_matches(expect=pattern,actual=response,onpass="ONOS process is running...",onfail="ONOS process not running..."):
-            running = self.execute(cmd="cat "+self.home+"/onos-logs/onos.*.log | grep 'Sending LLDP out on all ports'",prompt="\$",timeout=10) 
-            if re.search(pattern, response):
-                if running != "":
-                    main.log.info(self.name + ": ONOS process is running...")
-                    if tail1 == tail2:
-                        main.log.error(self.name + ": ONOS is frozen...")#logs aren't moving
-                        return main.FALSE
-                    elif re.search( pattern2,tail1 ):
-                        main.log.info(self.name + ": Connection Refused found in onos log")
-                        return main.FALSE
-                    elif re.search( pattern2,tail2 ):
-                        main.log.info(self.name + ": Connection Refused found in onos log")
-                        return main.FALSE
-                    else:
-                        main.log.info(self.name + ": Onos log is moving! It's looking good!")
-                        return main.TRUE
-                else:
-                    main.log.info(self.name + ": ONOS not yet sending out LLDP messages")
-                    return main.FALSE
-            else:
-                main.log.error(self.name + ": ONOS process not running...")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-    def rest_status(self):
-        '''
-        Checks if the rest server is running.
-        '''
-        try:
-            response = self.execute(cmd= self.home + "/start-rest.sh status ",prompt="running",timeout=10)
-            if re.search("rest\sserver\sis\srunning",response):
-                main.log.info(self.name + ": Rest Server is running")
-                return main.TRUE
-            elif re.search("rest\sserver\sis\snot\srunning",response):
-                main.log.warn(self.name + ": Rest Server is not Running")
-                return main.FALSE
-            else :
-                main.log.error(self.name + ": No response" +response)
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def stop_all(self):
-        '''
-        Runs ./onos.sh stop
-        '''
-        try:
-            self.handle.sendline("")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("cd "+self.home)
-            self.handle.sendline("./onos.sh stop")
-            self.handle.expect(["./onos.sh stop",pexpect.EOF,pexpect.TIMEOUT])
-            i=self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT],60)
-            result = self.handle.before
-            if re.search("Killed", result):
-                main.log.info(self.name + ": ONOS Killed Successfully")
-                return main.TRUE
-            else :
-                main.log.warn(self.name + ": ONOS wasn't running")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-       
-
-    def stop(self):
-        '''
-        Runs ./onos.sh core stop to stop ONOS
-        '''
-        try:
-            self.handle.sendline("")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("cd "+self.home)
-            self.handle.sendline("./onos.sh core stop")
-            self.handle.expect(["./onos.sh stop",pexpect.EOF,pexpect.TIMEOUT])
-            i=self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT],60)
-            result = self.handle.before
-            if re.search("Killed", result):
-                main.log.info(self.name + ": ONOS Killed Successfully")
-                return main.TRUE
-            else :
-                main.log.warn(self.name + ": ONOS wasn't running")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-#**********************************************************************************************
-#**********************************************************************************************
-# The purpose of comp_intents is to find if the high level intents have changed. preIntents
-# and postIntents should be the output of curl of the intents. preIntents being the original
-# and postIntents being the later. We are looking at the intents with the same id from both
-# and comparing the dst and src DPIDs and macs, and the state. If any of these are changed
-# we print that there are changes, then return a list of the intents that have changes`
-#**********************************************************************************************
-#**********************************************************************************************
-    def comp_intents(self,preIntents,postIntents):
-        import json
-        preDecoded = json.loads(preIntents)
-        postDecoded = json.loads(postIntents)
-        changes = []
-        if not preDecoded:
-            if postDecoded:
-                print "THERE ARE CHANGES TO THE HIGH LEVEL INTENTS!!!!"
-                return postDecoded
-        for k in preDecoded:
-            for l in postDecoded:
-                if l['id']==k['id']:
-                    if k['dstSwitchDpid']==l['dstSwitchDpid'] and k['srcMac']==l['srcMac'] and k['dstMac']==l['dstMac'] and k['srcSwitchDpid']==l['srcSwitchDpid'] and k['state']==l['state']:
-                        postDecoded.remove(l)
-                    else:
-                        changes.append(k)
-                        print ("THERE ARE CHANGES TO THE HIGH LEVEL INTENTS!!!")
-        return changes
-    
-#**********************************************************************************************
-#**********************************************************************************************
-# the purpose of comp_low is to find if the low level intents have changed. The main idea
-# is to determine if the path has changed. Again, like with the comp_intents function, the
-# pre and post Intents variables are the json dumps of wm/onos/intent/low. The variables
-# that will be compared are the state, and the path.
-#**********************************************************************************************
-#**********************************************************************************************
-    def comp_low(self, preIntents,postIntents):
-        import json
-        preDecoded = json.loads(preIntents)
-        postDecoded = json.loads(postIntents)
-        changes = []
-        if not preDecoded:
-            if postDecoded:
-                print "THERE ARE CHANGES TO THE LOW LEVEL INTENTS!!!"
-                return postDecoded
-        for k in preDecoded:
-            for l in postDecoded:
-                if l['id']==k['id']:
-                    if l['path']!=k['path']:
-                        changes.append(l)
-                        print "\n\n\n\nTHERE ARE CHANGES TO THE LOW LEVEL INTENTS!!!"
-                    else:
-                        if k['state']!=l['state']:
-                            changes.append(l)
-                            print "\n\n\n\nTHERE ARE CHANGES TO THE LOW LEVEL INTENTS!!!"
-                        else:
-                            print "NO CHANGES SO FAR\n\n\n"
-
-
-        return changes
-
-
-    def rest_stop(self):
-        '''
-        Runs ./start-rest.sh stop to stop ONOS rest server
-        '''
-        try:
-            response = self.execute(cmd= self.home + "/start-rest.sh stop ",prompt="killing",timeout=10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            if re.search("killing", response):
-                main.log.info(self.name + ": Rest Server Stopped")
-                return main.TRUE
-            else :
-                main.log.error(self.name + ": Failed to Stop, Rest Server is not Running")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-    def kill(self):
-        import re
-        try: 
-            self.handle.sendline("ps -ef |grep 'ONOS/conf/logback' |awk 'NR==1 {print $2}' |xargs sudo kill -9")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("ps -ef |grep 'ONOS/conf/logback' |wc -l")
-            self.handle.expect(["wc -l",pexpect.EOF,pexpect.TIMEOUT])
-            response = self.handle.after
-            if re.search("1",response):
-                return "ONOS Killed!"
-            else:
-                return "ERROR!!! ONOS MAY NOT HAVE BEEN KILLED PROPERLY!!!"
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.hane + ":    " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-
     def disconnect(self):
         '''
         Called when Test is complete to disconnect the ONOS handle.
         '''
         response = ''
         try:
+            self.handle.sendline("")
+            i = self.handle.expect(["onos>","\$"])
+            if i == 0:
+                self.handle.sendline("system:shutdown")
+                self.handle.expect("Confirm")
+                self.handle.sendline("yes")
+                self.handle.expect("\$")
+            self.handle.sendline("\n")
+            self.handle.expect("\$")
             self.handle.sendline("exit")
             self.handle.expect("closed")
+
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
             main.log.error(self.name + ":     " + self.handle.before)
@@ -506,1241 +102,1390 @@
             main.log.error(self.name + ": Connection failed to the host")
             response = main.FALSE
         return response
- 
-    def print_version(self):
+
+    def set_cell(self, cellname):
         '''
-        Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
-        '''
-        try:
-            self.handle.sendline("export TERM=xterm-256color")
-            self.handle.expect("xterm-256color")
-            self.handle.expect("\$")
-            self.handle.sendline("cd " + self.home + "; git log -1 --pretty=fuller --decorate=short | grep -A 5 \"commit\" --color=never; cd \.\.")
-            self.handle.expect("cd ..")
-            self.handle.expect("\$")
-            response=(self.name +": \n"+ str(self.handle.before + self.handle.after))
-            main.log.report(response)
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-    def get_version(self):
-        '''
-        Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
-        '''
-        try:
-            self.handle.sendline("export TERM=xterm-256color")
-            self.handle.expect("xterm-256color")
-            self.handle.expect("\$")
-            self.handle.sendline("cd " + self.home + "; git log -1 --pretty=fuller --decorate=short | grep -A 5 \"commit\" --color=never; cd \.\.")
-            self.handle.expect("cd ..")
-            self.handle.expect("\$")
-            response=(self.name +": \n"+ str(self.handle.before + self.handle.after))
-            lines=response.splitlines()
-            for line in lines:
-                print line
-            return lines[2]
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-
-#*********************************************************************
-#*********************************************************************
-# shortest_path is a command to find the shortest path between two 
-# switches. It is called using the IP, port, and source and 
-# destination dpids
-#*********************************************************************
-#*********************************************************************
-
-    def shortest_path(self,ONOSIP,ONOSPort,srcDPID,dstDPID):
-        main.log.report("Finding the shortest Path between "+str(srcDPID) + " to " + str(dstDPID))
-        url = "http://%s:%s/wm/onos/intent/path/switch/%s/shortest-path/%s"%(ONOSIP,ONOSPort,srcDPID,dstDPID)
-        parsed_result = []
-        try: 
-            response = urllib2.urlopen(url, timeout=URL_TIMEOUT)
-            result = response.read()
-            response.close()
-            if len(result) != 0:
-                parsed_result = json.loads(result)
-        except HTTPError as exc: 
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            # NOTE: exc.fp contains the object with the response payload
-            error_payload = json.loads(exc.fp.read())
-            print "  REST Error Code: %s" % (error_payload['code'])
-            print "  REST Error Summary: %s" % (error_payload['summary'])
-            print "  REST Error Description: %s" % (error_payload['formattedDescription'])
-            print "  HTTP Error Code: %s" % exc.code
-            print "  HTTP Error Reason: %s" % exc.reason
-        except URLError as exc: 
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            print "  URL Error Reason: %s" % exc.reason
-        except timeout as exc:
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            print "  URL Error Reason: %s" % exc.message
-            main.log.error("Socket timeout connecting to: %s", url)
-            return main.ERROR
-     
-        if len(parsed_result)==0:
-            return
-        result = json.dumps(parsed_result,indent=4)
-        print(str(result))
-        return result
-
-
-#*********************************************************************
-#*********************************************************************
-# show_intent is a command to show intents. 
-# Parameters include intentIP, intentPort, intentURL, and intent_id
-# Based on the url, it will show either high or low intents
-# If intent_id is left blank, it will show all high or all low intents
-# Else it will show the intent with the id
-#*********************************************************************
-#*********************************************************************
-
-
-
-    def show_intent(self,intentIP,intentPort=8080,intentURL="wm/onos/intent",intent_type="high",intent_id="all"):
-        main.log.report("Getting (an) intent(s)")
-        if intent_id=="all":
-            url = "http://%s:%s/%s/%s"%(intentIP,intentPort,intentURL,intent_type)
-        else:
-            url = "http://%s:%s/%s/%s/%s"%(intentIP,intentPort,intentURL,intent_type,intent_id)
-        print(url)
-        parsed_result = []
-        try:
-            response = urllib2.urlopen(url, timeout=URL_TIMEOUT)
-            result = response.read()
-            response.close()
-            if len(result) != 0:
-                parsed_result = json.loads(result)
-        except HTTPError as exc:
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            # NOTE: exc.fp contains the object with the response payload
-            error_payload = json.loads(exc.fp.read())
-            print "  REST Error Code: %s" % (error_payload['code'])
-            print "  REST Error Summary: %s" % (error_payload['summary'])
-            print "  REST Error Description: %s" % (error_payload['formattedDescription'])
-            print "  HTTP Error Code: %s" % exc.code
-            print "  HTTP Error Reason: %s" % exc.reason
-            return str(error_payload['code'])
-        except URLError as exc:
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            print "  URL Error Reason: %s" % exc.reason
-            return str(error_payload['code'])
-        except timeout as exc:
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            print "  URL Error Reason: %s" % exc.message
-            main.log.error("Socket timeout connecting to: %s", url)
-            return main.ERROR
+        Calls 'cell <name>' to set the environment variables on ONOSbench
         
-        if len(parsed_result)==0:
-            return
-        result = json.dumps(parsed_result,indent=4)
-        print(str(result))
-        return result
-
-
-#*********************************************************************
-#*********************************************************************
-# del_intent is to delete either all or some or one intents
-# if intent_id is left blank, it will delete all intents
-# else, intent_id should be of  the form "intent_id=1,2,3"
-#*********************************************************************
-#*********************************************************************
-
-    def del_intent(self,intentIP,intentPort=8080,intentURL="wm/onos/intent",intent_id="all"):
-        main.log.report("Deleting (an) intent(s)")
-        if intent_id=="all":
-            url = "http://%s:%s/%s/high"%(intentIP,intentPort,intentURL)
-        else:
-            url = "http://%s:%s/%s/high?%s"%(intentIP,intentPort,intentURL,intent_id)
-
-        print(url)
-
-        parsed_result = []
-        try:
-            request = urllib2.Request(url)
-            request.get_method = lambda: 'DELETE'
-            response = urllib2.urlopen(request, timeout=URL_TIMEOUT)
-            result = response.read()
-            response.close()
-            if len(result) != 0:
-                parsed_result = json.loads(result)
-                print(parsed_result)
-                return parsed_result
-            return main.TRUE
-        except HTTPError as exc:
-            print "ERROR:"
-            print "  REST DELETE URL: %s" % url
-            # NOTE: exc.fp contains the object with the response payload
-            error_payload = json.loads(exc.fp.read())
-            print "  REST Error Code: %s" % (error_payload['code'])
-            print "  REST Error Summary: %s" % (error_payload['summary'])
-            print "  REST Error Description: %s" % (error_payload['formattedDescription'])
-            print "  HTTP Error Code: %s" % exc.code
-            print "  HTTP Error Reason: %s" % exc.reason
-        except URLError as exc:
-            print "ERROR:"
-            print "  REST DELETE URL: %s" % url
-            print "  URL Error Reason: %s" % exc.reason
-        except timeout as exc:
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            print "  URL Error Reason: %s" % exc.message
-            main.log.error("Socket timeout connecting to: %s", url)
-            return main.ERROR
-        return main.ERROR
-
-#*********************************************************************
-#*********************************************************************
-# add_intent will add a single intent by using dpids and macs. 
-#*********************************************************************
-#*********************************************************************
-
-
-    def add_intent(self, intent_id,src_dpid,dst_dpid,src_mac,dst_mac,intentIP,intentPort=8080,intentURL="wm/onos/intent" , intent_type = 'SHORTEST_PATH', static_path=False, src_port=1,dst_port=1):
-        "CLI command callback: set intent"
-
-        intents = []
-        oper = {}
-        # Create the POST payload
-        oper['intentId'] = intent_id
-        oper['intentType'] = intent_type    # XXX: Hardcoded
-        oper['staticPath'] = static_path              # XXX: Hardcoded
-        oper['srcSwitchDpid'] = src_dpid
-        oper['srcSwitchPort'] = src_port
-        oper['dstSwitchDpid'] = dst_dpid
-        oper['dstSwitchPort'] = dst_port
-        oper['matchSrcMac'] = src_mac
-        oper['matchDstMac'] = dst_mac
-        intents.append(oper)
-        url = "http://%s:%s/%s/high"%(intentIP,intentPort,intentURL)
-        parsed_result = []
-        data_json = json.dumps(intents)
-        result = main.FALSE
-        try:
-            request = urllib2.Request(url,data_json)
-            request.add_header("Content-Type", "application/json")
-            response=urllib2.urlopen(request, timeout=URL_TIMEOUT)
-            result = response.read()
-            response.close()
-            if len(result) != 0:
-                parsed_result = json.loads(result)
-                return parsed_result
-            return main.TRUE
-        except HTTPError as exc:
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            # NOTE: exc.fp contains the object with the response payload
-            error_payload = json.loads(exc.fp.read())
-            print "  REST Error Code: %s" % (error_payload['code'])
-            print "  REST Error Summary: %s" % (error_payload['summary'])
-            print "  REST Error Description: %s" % (error_payload['formattedDescription'])
-            print "  HTTP Error Code: %s" % exc.code
-            print "  HTTP Error Reason: %s" % exc.reason
-            return "  HTTP Error Code: %s, Reason: %s" % exc.code, exc.reason
-        except URLError as exc:
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            print "  URL Error Reason: %s" % exc.reason
-            return "  HTTP Error Reason: %s" % exc.reason
-        except timeout as exc:
-            print "ERROR:"
-            print "  REST GET URL: %s" % url
-            print "  URL Error Reason: %s" % exc.message
-            main.log.error("Socket timeout connecting to: %s", url)
-            return main.ERROR
-        return main.ERROR
-
-
-
-    def add_intents(self):
-        main.log.info("Sending new intents to ONOS")
-        self.handle.sendline("cd "+self.home+ "/scripts")
-        self.handle.expect("scripts")
-        main.log.info("Adding intents")
-        self.handle.sendline("./pyintents.py")
-        self.handle.expect(["$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before
-        self.handle.sendline("cd "+self.home)
-        return main.TRUE
-
-    def rm_intents(self):
-        main.log.info("Deleteing Intents from ONOS")
-        self.handle.sendline("cd "+self.home+ "/scripts")
-        self.handle.expect("scripts")
-        main.log.info("Deleting Intnents")
-        self.handle.sendline("./rmpyintents.py")
-        self.handle.expect(["$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before
-        self.handle.sendline("cd "+self.home)
-        return main.TRUE
-        
-    def purge_intents(self):
-        main.log.info("Purging dead intents")
-        self.handle.sendline("cd "+self.home+ "/scripts")
-        self.handle.expect("scripts")
-        main.log.info("Sending Purge Intent Rest call to ONOS")
-        self.handle.sendline("./purgeintents.py")
-        self.handle.sendline("cd "+self.home)
-        return main.TRUE
-
-
-
-    def add_flow(self, testONip, user = "admin", password = "", flowDef = "/flowdef.txt"):
-        '''
-        Copies the flowdef file from TestStation -> ONOS machine
-        Then runs ./add_flow.py to add the flows to ONOS
+        Before issuing any cli commands, set the environment variable first.
         '''
         try:
-            main.log.info("Adding Flows...")
-            self.handle.sendline("scp %s@%s:%s /tmp/flowtmp" %(user,testONip,flowDef))
-            i=self.handle.expect(['[pP]assword:', '100%', pexpect.TIMEOUT],30)
-            if(i==0):
-                    self.handle.sendline("%s" %(password))
-                    self.handle.sendline("")
-                    self.handle.expect("100%")
-                    self.handle.expect("\$", 30)
-                    self.handle.sendline(self.home + "/web/add_flow.py -m onos -f /tmp/flowtmp")
-                    self.handle.expect("\$", 1000)
-                    main.log.info("Flows added")
-                    return main.TRUE
-
-            elif(i==1):
-                    self.handle.sendline("")
-                    self.handle.expect("\$", 10)
-                    self.handle.sendline( self.home + "/web/add_flow.py -m onos -f /tmp/flowtmp")
-                    self.handle.expect("\$", 1000)
-                    main.log.info("Flows added")
-                    return main.TRUE
-
-            elif(i==2):
-                    main.log.error("Flow Def file SCP Timed out...")
-                    return main.FALSE
-
+            if not cellname:
+                main.log.error("Must define cellname")
+                main.cleanup()
+                main.exit()
             else:
-                    main.log.error("Failed to add flows...")
-                    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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
+                self.handle.sendline("cell "+str(cellname))
+                #Expect the cellname in the ONOS_CELL variable.
+                #Note that this variable name is subject to change
+                #   and that this driver will have to change accordingly
+                self.handle.expect("ONOS_CELL="+str(cellname))
+                handle_before = self.handle.before
+                handle_after = self.handle.after
+                #Get the rest of the handle
+                self.handle.sendline("")
+                self.handle.expect("\$")
+                handle_more = self.handle.before
 
+                main.log.info("Cell call returned: "+handle_before+
+                        handle_after + handle_more)
 
-    def delete_flow(self, *delParams):
-        '''
-        Deletes a specific flow, a range of flows, or all flows.
-        '''
-        try:
-            if len(delParams)==1:
-                if str(delParams[0])=="all":
-                    main.log.info(self.name + ": Deleting ALL flows...")
-                    #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh all",prompt="done",timeout=150)
-                    self.handle.sendline(self.home + "/web/delete_flow.py all")
-                    self.handle.expect("delete_flow")
-                    self.handle.expect("\$",1000)
-                    main.log.info(self.name + ": Flows deleted")
-                else:
-                    main.log.info(self.name + ": Deleting flow "+str(delParams[0])+"...")
-                    #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh "+str(delParams[0]),prompt="done",timeout=150)
-                    #self.execute(cmd="\n",prompt="\$",timeout=60)
-                    self.handle.sendline(self.home +"/web/delete_flow.py %d" % int(delParams[0]))
-                    self.handle.expect("delete_flow")
-                    self.handle.expect("\$",60)
-                    main.log.info(self.name + ": Flow deleted")
-            elif len(delParams)==2:
-                 main.log.info(self.name + ": Deleting flows "+str(delParams[0])+" through "+str(delParams[1])+"...")
-                 #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh "+str(delParams[0])+" "+str(delParams[1]),prompt="done",timeout=150)
-                 #self.execute(cmd="\n",prompt="\$",timeout=60)
-                 self.handle.sendline(self.home + "/web/delete_flow.py %d %d" % (int(delParams[0]), int(delParams[1])))
-                 self.handle.expect("delete_flow")
-                 self.handle.expect("\$",600)
-                 main.log.info(self.name + ": Flows deleted")
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def check_flow(self):
-        '''
-        Calls the ./get_flow.py all and checks:
-        - If each FlowPath has at least one FlowEntry
-        - That there are no "NOT"s found
-        returns TRUE/FALSE
-        '''
-        try:
-            flowEntryDetect = 1
-            count = 0
-            self.handle.sendline("clear")
-            time.sleep(1)
-            self.handle.sendline(self.home + "/web/get_flow.py all")
-            self.handle.expect("get_flow")
-            for x in range(15):
-                i=self.handle.expect(['FlowPath','FlowEntry','NOT','\$',pexpect.TIMEOUT],timeout=180)
-                if i==0:
-                    count = count + 1
-                    if flowEntryDetect == 0:
-                        main.log.info(self.name + ": FlowPath without FlowEntry")
-                        return main.FALSE
-                    else:
-                        flowEntryDetect = 0
-                elif i==1:
-                    flowEntryDetect = 1
-                elif i==2:
-                    main.log.error(self.name + ": Found a NOT")
-                    return main.FALSE
-                elif i==3:
-                    if count == 0:
-                        main.log.info(self.name + ": There don't seem to be any flows here...")
-                        return main.FALSE
-                    else:
-                        main.log.info(self.name + ": All flows pass")
-                        main.log.info(self.name + ": Number of FlowPaths: "+str(count))
-                        return main.TRUE
-                elif i==4:
-                    main.log.error(self.name + ":Check_flow() - Command Timeout!")
-            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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def get_flow(self, *flowParams):
-        '''
-        Returns verbose output of ./get_flow.py
-        '''
-        try:
-            if len(flowParams)==1:
-                if str(flowParams[0])=="all":
-                    self.execute(cmd="\n",prompt="\$",timeout=60)
-                    main.log.info(self.name + ": Getting all flow data...")
-                    data = self.execute(cmd=self.home + "/scripts/TestON_get_flow.sh all",prompt="done",timeout=150)
-                    self.execute(cmd="\n",prompt="\$",timeout=60)
-                    return data
-                else:
-                    main.log.info(self.name + ": Retrieving flow "+str(flowParams[0])+" data...")
-                    data = self.execute(cmd=self.home +"/scripts/TestON_get_flow.sh "+str(flowParams[0]),prompt="done",timeout=150)
-                    self.execute(cmd="\n",prompt="\$",timeout=60)
-                    return data
-            elif len(flowParams)==5:
-                main.log.info(self.name + ": Retrieving flow installer data...")
-                data = self.execute(cmd=self.home + "/scripts/TestON_get_flow.sh "+str(flowParams[0])+" "+str(flowParams[1])+" "+str(flowParams[2])+" "+str(flowParams[3])+" "+str(flowParams[4]),prompt="done",timeout=150)
-                self.execute(cmd="\n",prompt="\$",timeout=60)
-                return data
-            elif len(flowParams)==4:
-                main.log.info(self.name + ": Retrieving flow endpoints...")
-                data = self.execute(cmd=self.home + "/scripts/TestON_get_flow.sh "+str(flowParams[0])+" "+str(flowParams[1])+" "+str(flowParams[2])+" "+str(flowParams[3]),prompt="done",timeout=150)
-                self.execute(cmd="\n",prompt="\$",timeout=60)
-                return data
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-# http://localhost:8080/wm/onos/topology/switches
-# http://localhost:8080/wm/onos/topology/links
-# http://localhost:8080/wm/onos/registry/controllers/json
-# http://localhost:8080/wm/onos/registry/switches/json"
-
-    def get_json(self, url):
-        '''
-        Helper functions used to parse the json output of a rest call
-        '''
-        try:
-            try:
-                command = "curl -s %s" % (url)
-                result = os.popen(command).read()
-                parsedResult = json.loads(result)
-            except:
-                print "REST IF %s has issue" % command
-                parsedResult = ""
-        
-            if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
-                print "REST %s returned code %s" % (command, parsedResult['code'])
-                parsedResult = ""
-            return parsedResult
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def num_switch(self,RestIP,RestPort="8080"):
-        url = "http://%s:%s/wm/onos/topology/switches" %(RestIP,RestPort)
-        parsedResult = self.get_json(url)
-        if parsedResult == "":
-            retcode = 1
-            return (retcode, "RestAPI has an issue")
-        url = "http://%s:%s/wm/onos/registry/switches/json" %(RestIP,RestPort)
-        registry = self.get_json(url)
-        if registry == "":
-            retcode = 1
-            return (retcode, "REST API has an Issue")
-        cnt = 0
-        active = 0
-        for s in parsedResult:
-            cnt +=1
-            if s['state']=="ACTIVE":
-                active+=1
-        return (cnt,active)
-
-
-    def check_switch(self,RestIP,correct_nr_switch, RestPort ="8080" ):
-        '''
-        Used by check_status
-        '''
-        try:
-            buf = ""
-            retcode = 0
-            url="http://%s:%s/wm/onos/topology/switches" % (RestIP, RestPort)
-            parsedResult = self.get_json(url)
-            if parsedResult == "":
-                retcode = 1
-                return (retcode, "Rest API has an issue")
-            url = "http://%s:%s/wm/onos/registry/switches/json" % (RestIP, RestPort)
-            registry = self.get_json(url)
-        
-            if registry == "":
-                retcode = 1
-                return (retcode, "Rest API has an issue")
-        
-            cnt = 0
-            active = 0
-
-            for s in parsedResult:
-                cnt += 1
-                if s['state'] == "ACTIVE":
-                   active += 1
-
-            buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
-            if correct_nr_switch != cnt:
-                buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
-                retcode = 1
-
-            if correct_nr_switch != active:
-                buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
-                retcode = 1
-        
-            return (retcode, buf)
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def num_link(self,RestIP,RestPort="8080"):
-        url = "http://%s:%s/wm/onos/topology/links" % (RestIP,RestPort)
-        parsedResult = self.get_json(url)
-        if parsedResult == "":
-            retcode = 1
-            return (retcode,"RestAPI has an issue")
-        intra = 0
-        for s in parsedResult:
-            intra+=1
-        return intra
-
-    def check_link(self,RestIP, nr_links, RestPort = "8080"):
-        '''
-        Used by check_status
-        '''
-        try:
-            buf = ""
-            retcode = 0
-        
-            url = "http://%s:%s/wm/onos/topology/links" % (RestIP, RestPort)
-            parsedResult = self.get_json(url)
-        
-            if parsedResult == "":
-                retcode = 1
-                return (retcode, "Rest API has an issue")
-        
-            buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
-            intra = 0
-            interlink=0
-        
-            for s in parsedResult:
-                intra = intra + 1
-        
-            if intra != nr_links:
-                buf += "link fail\n"
-                retcode = 1
-        
-            return (retcode, buf)
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def check_status_report(self, ip, numoswitch, numolink, port="8080"):
-        '''
-        Checks the number of swithes & links that ONOS sees against the supplied values.
-        Writes to the report log.
-        '''
-        try:
-            main.log.info(self.name + ": Making some rest calls...")
-            switch = self.check_switch(ip, int(numoswitch), port)
-            link = self.check_link(ip, int(numolink), port)
-            value = switch[0]
-            value += link[0]
-            main.log.report( self.name + ": \n-----\n%s%s-----\n" % ( switch[1], link[1]) )
-            if value != 0:
-                return main.FALSE
-            else:
-                # "PASS"
                 return main.TRUE
+
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error(self.name + ":    " + self.handle.before)
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
-
-    def check_status(self, ip, numoswitch, numolink, port = "8080"):
-        '''
-        Checks the number of swithes & links that ONOS sees against the supplied values.
-        Writes to the main log.
-        '''
-        try:
-            main.log.info(self.name + ": Making some rest calls...")
-            switch = self.check_switch(ip, int(numoswitch), port)
-            link = self.check_link(ip, int(numolink), port)
-            value = switch[0]
-            value += link[0]
-            main.log.info(self.name + ": \n-----\n%s%s-----\n" % ( switch[1], link[1]) )
-            if value != 0:
-                return main.FALSE
-            else:
-                # "PASS"
-                return main.TRUE
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def detailed_status(self, log_filename):
-        '''
-        Reports RUNNING, STARTING, STOPPED, FROZEN, ERROR (and reason)
-        '''
-        try:
-            process_up = False
-            self.execute(cmd="\n", prompt="\$", timeout=10)
-            self.handle.sendline("cd " + self.home)
-            response = self.execute(cmd="./onos.sh core status ",prompt="\d+\sinstance\sof\sonos\srunning",timeout=10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            if re.search("1\sinstance\sof\sonos\srunning",response):
-                process_up = True
-            elif re.search("0\sinstance\sof\sonos\srunning",response):
-                process_up = False
-                return 'STOPPED'
-            elif re.search("Expected\sPrompt\snot found\s,\sTime Out!!",response):
-                return "ERROR", "Time out on ./onos.sh core status"
-            else :
-                main.log.warn(self.name + " WARNING: status recieved unknown response")
-                main.log.warn(response)
-                return 'Error', "Unknown response: %s" % response
-            '''
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            tail1 = self.execute(cmd="tail " + self.home + "%s" % log_filename, prompt="\$", timeout=10)
-            time.sleep(10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            tail2 = self.execute(cmd="tail " + self.home + "%s" % log_filename, prompt="\$", timeout=10)
-            '''
-
-            pattern = '(.*)1 instance(.*)'
-            pattern2 = '(.*)Exception: Connection refused(.*)'
-            # if utilities.assert_matches(expect=pattern,actual=response,onpass="ONOS process is running...",onfail="ONOS process not running..."):
-            running = self.execute(cmd="cat " + self.home + " %s | grep 'Sending LLDP out on all ports'" % log_filename,prompt="\$",timeout=10)
-            if re.search(pattern, response):
-                if running == '':
-                  return 'STARTING',
-                else:
-                  return 'RUNNING'
-            else:
-                main.log.error(self.name + ": ONOS process not running...")
-                return 'STOPPED'
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def git_pull(self, comp1=""):
-        '''
-        Assumes that "git pull" works without login
         
-        This function will perform a git pull on the ONOS instance.
-        If used as git_pull("NODE") it will do git pull + NODE. This is
-        for the purpose of pulling from other nodes if necessary.
-
-        Otherwise, this function will perform a git pull in the 
-        ONOS repository. If it has any problems, it will return main.ERROR
-        If it successfully does a git_pull, it will return a 1.
-        If it has no updates, it will return a 0.
-
-        '''
-        try:
-            # main.log.info(self.name + ": Stopping ONOS")
-            #self.stop()
-            self.handle.sendline("cd " + self.home)
-            self.handle.expect("ONOS\$")
-            if comp1=="":
-                self.handle.sendline("git pull")
-            else:
-                self.handle.sendline("git pull " + comp1)
-           
-            uptodate = 0
-            i=self.handle.expect(['fatal',
-                'Username\sfor\s(.*):\s',
-                '\sfile(s*) changed,\s',
-                'Already up-to-date',
-                'Aborting',
-                'You\sare\snot\scurrently\son\sa\sbranch', 
-                'You\sasked\sme\sto\spull\swithout\stelling\sme\swhich\sbranch\syou',
-                'Pull\sis\snot\spossible\sbecause\syou\shave\sunmerged\sfiles',
-                pexpect.TIMEOUT],
-                timeout=300)
-            #debug
-           #main.log.report(self.name +": \n"+"git pull response: " + str(self.handle.before) + str(self.handle.after))
-            if i==0:
-                main.log.error(self.name + ": Git pull had some issue...")
-                return main.ERROR
-            elif i==1:
-                main.log.error(self.name + ": Git Pull Asking for username. ")
-                return main.ERROR
-            elif i==2:
-                main.log.info(self.name + ": Git Pull - pulling repository now")
-                self.handle.expect("ONOS\$", 120)
-                return 0
-            elif i==3:
-                main.log.info(self.name + ": Git Pull - Already up to date")
-                return 1
-            elif i==4:
-                main.log.info(self.name + ": Git Pull - Aborting... Are there conflicting git files?")
-                return main.ERROR
-            elif i==5:
-                main.log.info(self.name + ": Git Pull - You are not currently on a branch so git pull failed!")
-                return main.ERROR
-            elif i==6:
-                main.log.info(self.name + ": Git Pull - You have not configured an upstream branch to pull from. Git pull failed!")
-                return main.ERROR
-            elif i==7:
-                main.log.info(self.name + ": Git Pull - Pull is not possible because you have unmerged files.")
-                return main.ERROR
-            elif i==8:
-                main.log.error(self.name + ": Git Pull - TIMEOUT")
-                main.log.error(self.name + " Response was: " + str(self.handle.before))
-                return main.ERROR
-            else:
-                main.log.error(self.name + ": Git Pull - Unexpected response, check for pull errors")
-                return main.ERROR
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-#********************************************************           
-
-
-
-
-    def git_checkout(self, branch="onos13integration"):
-        '''
-        Assumes that "git pull" works without login
-        
-        This function will perform a git pull on the ONOS instance.
-        If used as git_pull("NODE") it will do git pull + NODE. This is
-        for the purpose of pulling from other nodes if necessary.
-
-        Otherwise, this function will perform a git pull in the 
-        ONOS repository. If it has any problems, it will return main.ERROR
-        If it successfully does a git_pull, it will return a 1.
-        If it has no updates, it will return a 0.
-
-        '''
-        try:
-            # main.log.info(self.name + ": Stopping ONOS")
-            #self.stop()
-            self.handle.sendline("cd " + self.home)
-            self.handle.expect("ONOS\$")
-            if branch != 'master':
-                #self.handle.sendline('git stash')
-                #self.handle.expect('ONOS\$')
-                #print "After issuing git stash cmnd: ", self.handle.before
-                cmd = "git checkout "+branch
-                print "checkout cmd = ", cmd
-                self.handle.sendline(cmd)
-                uptodate = 0
-                i=self.handle.expect(['fatal','Username\sfor\s(.*):\s','Already\son\s\'onos13integration\'','Switched\sto\sbranch\s\'onos13integration\'', pexpect.TIMEOUT],timeout=60)
-            else:
-                #self.handle.sendline('git stash apply')
-                #self.handle.expect('ONOS\$')
-                #print "After issuing git stash apply cmnd: ", self.handle.before
-                cmd = "git checkout "+branch
-                print "checkout cmd = ", cmd
-                self.handle.sendline(cmd)
-                uptodate = 0
-                switchedToMaster = 0
-                i=self.handle.expect(['fatal','Username\sfor\s(.*):\s','Already\son\s\'master\'','Switched\sto\sbranch\s\'master\'', pexpect.TIMEOUT],timeout=60)
- 
-
-            if i==0:
-                main.log.error(self.name + ": Git checkout had some issue...")
-                return main.ERROR
-            elif i==1:
-                main.log.error(self.name + ": Git checkout Asking for username!!! BADD!")
-                return main.ERROR
-            elif i==2:
-                main.log.info(self.name + ": Git Checkout %s : Already on this branch" %branch)
-                self.handle.expect("ONOS\$")
-                print "after checkout cmd = ", self.handle.before
-                switchedToMaster = 1
-                return 1
-            elif i==3:
-                main.log.info(self.name + ": Git checkout %s - Switched to this branch" %branch)
-                self.handle.expect("ONOS\$")
-                print "after checkout cmd = ", self.handle.before
-                switchedToMaster = 1
-                return 1
-            elif i==4:
-                main.log.error(self.name + ": Git Checkout- TIMEOUT")
-                main.log.error(self.name + " Response was: " + str(self.handle.before))
-                return main.ERROR
-            else:
-                main.log.error(self.name + ": Git Checkout - Unexpected response, check for pull errors")
-                return main.ERROR
-
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-#********************************************************     
-        self.handle.sendline("git branch")
-        self.handle.expect("ONOS\$")
-        print "git branch output = ", self.handle.before
-        print "*****************************************"
-        self.handle.sendline('cd\.\.') 
-        self.handle.expect("\$")
-
-
-
-
-
-
-
-
-    def git_compile(self):
-        '''
-        Compiles ONOS
-        First runs mvn clean then mvn compile
-        '''
-        try:
-            main.log.info(self.name + ": mvn clean")
-            self.handle.sendline("cd " + self.home)
-            self.handle.sendline("mvn clean")
-            while 1:
-                i=self.handle.expect(['There\sis\sinsufficient\smemory\sfor\sthe\sJava\sRuntime\sEnvironment\sto\scontinue','BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=30)
-                if i == 0:
-                    main.log.error(self.name + ":There is insufficient memory for the Java Runtime Environment to continue.")
-                    return main.FALSE
-                elif i == 1:
-                    main.log.error(self.name + ": Clean failure!")
-                    return main.FALSE
-                elif i == 2:
-                    main.log.info(self.name + ": Clean success!")
-                elif i == 3:
-                    main.log.info(self.name + ": Clean complete")
-                    break;
-                elif i == 4:
-                    main.log.error(self.name + ": mvn clean TIMEOUT!")
-                    return main.FALSE
-                else:
-                    main.log.error(self.name + ": unexpected response from mvn clean")
-                    return main.FALSE
-        
-            main.log.info(self.name + ": mvn compile")
-            self.handle.sendline("mvn compile")
-            while 1:
-                i=self.handle.expect(['There\sis\sinsufficient\smemory\sfor\sthe\sJava\sRuntime\sEnvironment\sto\scontinue','BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=60)
-                if i == 0:
-                    main.log.error(self.name + ":There is insufficient memory for the Java Runtime Environment to continue.")
-                    return main.FALSE
-                if i == 1:
-                    main.log.error(self.name + ": Build failure!")
-                    return main.FALSE
-                elif i == 2:
-                    main.log.info(self.name + ": Build success!")
-                elif i == 3:
-                    main.log.info(self.name + ": Build complete")
-                    self.handle.expect("\$", timeout=60)
-                    return main.TRUE
-                elif i == 4:
-                    main.log.error(self.name + ": mvn compile TIMEOUT!")
-                    return main.FALSE
-                else:
-                    main.log.error(self.name + ": unexpected response from mvn compile")
-                    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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def tcpdump(self, intf = "eth0"):
-        '''
-        Runs tpdump on an intferface and saves in onos-logs under the ONOS home directory
-        intf can be specified, or the default eth0 is used
-        '''
+    def start_onos_cli(self, ONOS_ip):
         try:
             self.handle.sendline("")
             self.handle.expect("\$")
-            self.handle.sendline("sudo tcpdump -n -i "+ intf + " -s0 -w " + self.home +"/onos-logs/tcpdump &")
-            i=self.handle.expect(['No\ssuch\device','listening\son',pexpect.TIMEOUT],timeout=10)
+
+            #Wait for onos start (-w) and enter onos cli
+            self.handle.sendline("onos -w "+str(ONOS_ip))
+            i = self.handle.expect([
+                    "onos>",
+                    pexpect.TIMEOUT],timeout=60)
+
             if i == 0:
-                main.log.error(self.name + ": tcpdump - No such device exists. tcpdump attempted on: " + intf)
-                return main.FALSE
-            elif i == 1:
-                main.log.info(self.name + ": tcpdump started on " + intf)
+                main.log.info(str(ONOS_ip)+" CLI Started successfully")
                 return main.TRUE
-            elif i == 2:
-                main.log.error(self.name + ": tcpdump command timed out! Check interface name, given interface was: " + intf)
-                return main.FALSE
             else:
-                main.log.error(self.name + ": tcpdump - unexpected response")
-            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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def kill_tcpdump(self):
-        '''
-        Kills any tcpdump processes running
-        '''
-        try:
-            self.handle.sendline("")
-            self.handle.expect("\$")
-            self.handle.sendline("sudo kill -9 `ps -ef | grep \"tcpdump -n\" | grep -v grep | awk '{print $2}'`")
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def find_host(self,RestIP,RestPort,RestAPI,hostMAC):
-        retcode = 0 # number of hosts found with given MAC
-        retswitch = [] # Switch DPID's of hosts found with MAC
-        retport = [] # Switch port connected to to hosts found with MAC
-        foundHost = []
-        try:
-            ##### device rest API is: 'host:8080/wm/onos/topology/switches' ###
-            url ="http://%s:%s%s" %(RestIP,RestPort,RestAPI)
-
-            try:
-                command = "curl -s %s" % (url)
-                result = os.popen(command).read()
-                parsedResult = json.loads(result)
-                # print parsedResult
-            except:
-                print "REST IF %s has issue" % command
-                parsedResult = ""
-
-            if parsedResult == "":
-                return (retcode, "Rest API has an error", retport)
-            else:
-                for host in enumerate(parsedResult):
-                    if (host[1] != []):
-                        try:
-                            foundHost = host[1]['mac']
-                        except:
-                            print "Error in detecting MAC address."
-                        if foundHost == hostMAC:
-                            for switch in enumerate(host[1]['attachmentPoints']):
-                                retswitch.append(switch[1]['dpid'])
-                                retport.append(switch[1]['portNumber'])
-                            retcode = retcode +1
-                            foundHost ='' 
-                '''
-                for switch in enumerate(parsedResult):
-                    for port in enumerate(switch[1]['ports']):
-                        if ( port[1]['hosts'] != [] ):
-                            try:
-                                foundHost = port[1]['hosts'][0]['ipv4addresses'][0]['ipv4']
-                            except:
-                                print "Error in detecting MAC address."
-                            if foundHost == hostMAC:
-                                retswitch.append(switch[1]['dpid'])
-                                retport.append(port[1]['desc'])
-                                retmac.append(port[1]['hosts'][0]['mac'])
-                                retcode = retcode +1
-                                foundHost =''
-                '''
-            return(retcode, retswitch, retport)
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def check_exceptions(self):
-        '''
-        Greps the logs for "xception"
-        '''
-        try:
-            output = ''
-            self.handle.sendline("")
-            i = self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            main.log.warn("first expect response: " +str(i))
-            self.handle.sendline("cd "+self.home+"/onos-logs")
-            i = self.handle.expect(["onos-logs\$",pexpect.EOF,pexpect.TIMEOUT])
-            main.log.warn("second expect response: " +str(i))
-
-            self.handle.sendline("zgrep \"xception\" *.log *.log.gz *.stderr")
-            #i = self.handle.expect(["\*.stdout",pexpect.EOF,pexpect.TIMEOUT])
-            #main.log.warn("third expect response: " +str(i))
-            print self.handle.before
-            print 
-            print self.handle.after
-            i = self.handle.expect(["ONOS/onos-logs\$",pexpect.EOF,pexpect.TIMEOUT],timeout=120)
-            main.log.warn("fourth expect response: " +str(i))
-            response = self.handle.before
-            print response
-            count = 0
-            print response
-            for line in response.splitlines():
-                if re.search("gzip: \*\.log\.gz:", line):
-                    #gzip complaining about file not found
-                    pass
-                elif re.search("log\.gz:",line):
-                    output+="Exceptions found in " + line + "\n"
-                    count +=1
-                elif re.search("log:", line):
-                    output +="Exceptions found in " + line + "\n"
-                    count +=1
-                elif re.search("std...:",line):
-                    output+="Exceptions found in " + line + "\n"
-                    count +=1
-                else:
-                    pass
-                    #these should be the old logs
-            main.log.report(str(count) + " Exceptions were found on "+self.name)
-            return output
-        except pexpect.TIMEOUT:
-            main.log.error(self.name + ": Timeout exception found in check_exceptions function")
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-    def block_peer(self, ip_address):
-        '''
-        Block traffic to the destination IP address.
-        '''
-        try:
-            for chain in ['INPUT', 'OUTPUT']:
-                check_block_cmd = "sudo iptables -L %s -n | grep \"DROP.*%s\"" % (chain, ip_address)
-                add_block_cmd = "sudo iptables -I %s 1 -s %s -j DROP" % (chain, ip_address)
-                response1 = self.execute(cmd=check_block_cmd,prompt="\$",timeout=10)
-                if ip_address in response1:
-                    main.log.error("Already blocked: %s" % response1)
+                #If failed, send ctrl+c to process and try again
+                main.log.info("Starting CLI failed. Retrying...")
+                self.handle.sendline("\x03")
+                self.handle.sendline("onos -w "+str(ONOS_ip))
+                i = self.handle.expect(["onos>",pexpect.TIMEOUT],
+                        timeout=30)
+                if i == 0:
                     return main.TRUE
-                response2 = self.execute(cmd=add_block_cmd,prompt="\$",timeout=10)
-                main.log.info("add_block_cmd: %s" % response2)
-                return main.TRUE
+                else:
+                    main.log.error("Connection to CLI "+\
+                        str(ONOS_ip)+" timeout")
+                    return main.FALSE
+
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error(self.name + ":    " + self.handle.before)
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
 
-    def unblock_peer(self, ip_address):
+    def sendline(self, cmd_str):
         '''
-        Unblock traffic to the destination IP address.
+        Send a completely user specified string to 
+        the onos> prompt. Use this function if you have 
+        a very specific command to send.
+        
+        Warning: There are no sanity checking to commands
+        sent using this method.
         '''
         try:
-            for chain in ['INPUT', 'OUTPUT']:
-                # To make sure all rules are deleted in case there were multiple
-                # installed in the iptables
-                max_iterations = 10
-                for i in range(max_iterations):
-                    check_block_cmd = "sudo iptables -L %s -n | grep \"DROP.*%s\"" % (chain, ip_address)
-                    remove_block_cmd = "sudo iptables -D %s -s %s -j DROP" % (chain, ip_address)
-                    response1 = self.execute(cmd=check_block_cmd,prompt="\$",timeout=10)
-                    if ip_address not in response1:
-                        main.log.warn("Already unblocked: %s" % response1)
-                        return main.TRUE
-                    response2 = self.execute(cmd=remove_block_cmd,prompt="\$",timeout=10)
-                    main.log.info("remove_block_cmd: %s" % response2)
-                return main.TRUE
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline(cmd_str)
+            self.handle.expect("onos>")
+
+            handle = self.handle.before
+            
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+            
+            handle += self.handle.before
+            handle += self.handle.after
+
+            main.log.info("Command sent.")
+            ansi_escape = re.compile(r'\x1b[^m]*m')
+            handle = ansi_escape.sub('', handle)
+
+            return handle
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error(self.name + ":    " + self.handle.before)
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
 
-
-    def unblock_all(self):
+    #IMPORTANT NOTE:
+    #For all cli commands, naming convention should match
+    #the cli command replacing ':' with '_'.
+    #Ex) onos:topology > onos_topology
+    #    onos:links    > onos_links
+    #    feature:list  > feature_list
+   
+    def add_node(self, node_id, ONOS_ip, tcp_port=""):
         '''
-        Remove all controller block rules
+        Adds a new cluster node by ID and address information.
+        Required:
+            * node_id
+            * ONOS_ip
+        Optional:
+            * tcp_port
         '''
         try:
-            unblock_cmd = "sudo iptables --flush"
-            response = self.execute(cmd=unblock_cmd,prompt="\$", timeout=10)
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("add-node "+
+                    str(node_id)+" "+
+                    str(ONOS_ip)+" "+
+                    str(tcp_port))
+            
+            i = self.handle.expect([
+                "Error",
+                "onos>" ])
+            
+            #Clear handle to get previous output
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            handle = self.handle.before
+
+            if i == 0:
+                main.log.error("Error in adding node")
+                main.log.error(handle)
+                return main.FALSE 
+            else:
+                main.log.info("Node "+str(ONOS_ip)+" added")
+                return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def remove_node(self, node_id):
+        '''
+        Removes a cluster by ID
+        Issues command: 'remove-node [<node-id>]'
+        Required:
+            * node_id
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("remove-node "+str(node_id))
+            self.handle.expect("onos>")
+
             return main.TRUE
+        
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error(self.name + ":    " + self.handle.before)
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
-        return main.ERROR
+
+    def nodes(self):
+        '''
+        List the nodes currently visible
+        Issues command: 'nodes'
+        Returns: entire handle of list of nodes
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("nodes")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            handle = self.handle.before
+
+            return handle
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def topology(self):
+        '''
+        Shows the current state of the topology
+        by issusing command: 'onos> onos:topology'
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+            #either onos:topology or 'topology' will work in CLI
+            self.handle.sendline("onos:topology")
+            self.handle.expect("onos>")
+
+            handle = self.handle.before
+
+            main.log.info("onos:topology returned: " +
+                    str(handle))
+            
+            return handle
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+       
+    def feature_install(self, feature_str):
+        '''
+        Installs a specified feature 
+        by issuing command: 'onos> feature:install <feature_str>'
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("feature:install "+str(feature_str))
+            self.handle.expect("onos>")
+
+            return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+       
+    def feature_uninstall(self, feature_str):
+        '''
+        Uninstalls a specified feature
+        by issuing command: 'onos> feature:uninstall <feature_str>'
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("feature:uninstall "+str(feature_str))
+            self.handle.expect("onos>")
+
+            return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+        
+    def devices(self, json_format=True, grep_str=""):
+        '''
+        Lists all infrastructure devices or switches
+        Optional argument:
+            * grep_str - pass in a string to grep
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+            
+            if json_format:
+                if not grep_str:
+                    self.handle.sendline("devices -j")
+                    self.handle.expect("devices -j")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("devices -j | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("devices -j | grep '"+str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                '''
+                handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
+                To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
+                In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
+                So we take off that escape sequence using
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle)
+                '''
+                #print "repr(handle) =", repr(handle)
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle)
+                #print "repr(handle1) = ", repr(handle1)
+                return handle1
+            else:
+                if not grep_str:
+                    self.handle.sendline("devices")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("devices | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                #print "handle =",handle
+                return handle
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def links(self, json_format=True, grep_str=""):
+        '''
+        Lists all core links
+        Optional argument:
+            * grep_str - pass in a string to grep
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+            
+            if json_format:
+                if not grep_str:
+                    self.handle.sendline("links -j")
+                    self.handle.expect("links -j")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("links -j | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("links -j | grep '"+str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                '''
+                handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
+                To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
+                In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
+                So we take off that escape sequence using 
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle) 
+                '''
+                #print "repr(handle) =", repr(handle)
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle)
+                #print "repr(handle1) = ", repr(handle1)
+                return handle1
+            else:
+                if not grep_str:
+                    self.handle.sendline("links")
+                    self.handle.expect("onos>")
+                    self.handle.sendline("")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("links | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                    self.handle.sendline("")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                #print "handle =",handle
+                return handle
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
+    def ports(self, json_format=True, grep_str=""):
+        '''
+        Lists all ports
+        Optional argument:
+            * grep_str - pass in a string to grep
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+            
+            if json_format:
+                if not grep_str:
+                    self.handle.sendline("ports -j")
+                    self.handle.expect("ports -j")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("ports -j | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("ports -j | grep '"+str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                '''
+                handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
+                To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
+                In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
+                So we take off that escape sequence using the following commads: 
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle) 
+                '''
+                #print "repr(handle) =", repr(handle)
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle)
+                #print "repr(handle1) = ", repr(handle1)
+                return handle1
+
+            else:
+                if not grep_str:
+                    self.handle.sendline("ports")
+                    self.handle.expect("onos>")
+                    self.handle.sendline("")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("ports | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                    self.handle.sendline("")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                #print "handle =",handle
+                return handle  
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
+    def roles(self, json_format=True, grep_str=""):
+        '''
+        Lists all devices and the controllers with roles assigned to them
+        Optional argument:
+            * grep_str - pass in a string to grep
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+            
+            if json_format:
+                if not grep_str:
+                    self.handle.sendline("roles -j")
+                    self.handle.expect("roles -j")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("roles -j | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("roles -j | grep '"+str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                '''
+                handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
+                To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
+                In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
+                So we take off that escape sequence using the following commads: 
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle) 
+                '''
+                #print "repr(handle) =", repr(handle)
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle)
+                #print "repr(handle1) = ", repr(handle1)
+                return handle1
+
+            else:
+                if not grep_str:
+                    self.handle.sendline("roles")
+                    self.handle.expect("onos>")
+                    self.handle.sendline("")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("roles | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                    self.handle.sendline("")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                #print "handle =",handle
+                return handle  
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def get_role(self, device_id):
+        '''
+        Given the a string containing the json representation of the "roles" cli command and a 
+        partial or whole device id, returns a json object containing the
+        roles output for the first device whose id contains "device_id"
+
+        Returns:
+        Dict of the role assignments for the given device or
+        None if not match
+        '''
+        try:
+            import json
+            if device_id == None:
+                return None
+            else:
+                raw_roles = self.roles()
+                roles_json = json.loads(raw_roles)
+                #search json for the device with id then return the device
+                for device in roles_json:
+                    #print device
+                    if str(device_id) in device['id']:
+                        return device
+            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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+    
+    def paths(self, src_id, dst_id):
+        '''
+        Returns string of paths, and the cost.
+        Issues command: onos:paths <src> <dst>
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("onos:paths "+
+                    str(src_id) + " " + str(dst_id))
+            i = self.handle.expect([
+                "Error",
+                "onos>"])
+            
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            handle = self.handle.before
+
+            if i == 0:
+                main.log.error("Error in getting paths")
+                return (handle, "Error")
+            else:
+                path = handle.split(";")[0]
+                cost = handle.split(";")[1]
+                return (path, cost)
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+    
+    def hosts(self, json_format=True, grep_str=""):
+        '''
+        Lists all discovered hosts 
+        Optional argument:
+            * grep_str - pass in a string to grep
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+            
+            if json_format:
+                if not grep_str:
+                    self.handle.sendline("hosts -j")
+                    self.handle.expect("hosts -j")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("hosts -j | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("hosts -j | grep '"+str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                '''
+                handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
+                To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
+                In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
+                So we take off that escape sequence using 
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle) 
+                '''
+                #print "repr(handle) =", repr(handle)
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle)
+                #print "repr(handle1) = ", repr(handle1)
+                return handle1
+            else:
+                if not grep_str:
+                    self.handle.sendline("hosts")
+                    self.handle.expect("onos>")
+                else:
+                    self.handle.sendline("hosts | grep '"+
+                        str(grep_str)+"'")
+                    self.handle.expect("onos>")
+                handle = self.handle.before
+                #print "handle =",handle
+                return handle
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def get_host(self, mac):
+        '''
+        Return the first host from the hosts api whose 'id' contains 'mac'
+        Note: mac must be a colon seperated mac address, but could be a partial mac address
+        Return None if there is no match
+        '''
+        import json
+        try:
+            if mac == None:
+                return None
+            else:
+                mac = mac
+                raw_hosts = self.hosts()
+                hosts_json = json.loads(raw_hosts)
+                #search json for the host with mac then return the device
+                for host in hosts_json:
+                    #print "%s in  %s?" % (mac, host['id'])
+                    if mac in host['id']:
+                        return host
+            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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
+    def get_hosts_id(self, host_list):
+        '''
+        Obtain list of hosts 
+        Issues command: 'onos> hosts'
+        
+        Required:
+            * host_list: List of hosts obtained by Mininet
+        IMPORTANT:
+            This function assumes that you started your
+            topology with the option '--mac'. 
+            Furthermore, it assumes that value of VLAN is '-1'
+        Description:
+            Converts mininet hosts (h1, h2, h3...) into 
+            ONOS format (00:00:00:00:00:01/-1 , ...)
+        '''
+        
+        try:
+            onos_host_list = []
+
+            for host in host_list:
+                host = host.replace("h", "")
+                host_hex = hex(int(host)).zfill(12)
+                host_hex = str(host_hex).replace('x','0')
+                i = iter(str(host_hex))
+                host_hex = ":".join(a+b for a,b in zip(i,i))
+                host_hex = host_hex + "/-1"
+                onos_host_list.append(host_hex) 
+
+            return onos_host_list 
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def add_host_intent(self, host_id_one, host_id_two):
+        '''
+        Required:
+            * host_id_one: ONOS host id for host1
+            * host_id_two: ONOS host id for host2
+        Description:
+            Adds a host-to-host intent (bidrectional) by
+            specifying the two hosts. 
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+            
+            self.handle.sendline("add-host-intent "+
+                    str(host_id_one) + " " + str(host_id_two))
+            self.handle.expect("onos>")
+
+            handle = self.handle.before
+            print "handle =", handle
+
+            main.log.info("Intent installed between "+
+                    str(host_id_one) + " and " + str(host_id_two))
+
+            return handle
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def add_optical_intent(self, ingress_device, egress_device):
+        '''
+        Required:
+            * ingress_device: device id of ingress device
+            * egress_device: device id of egress device
+        Optional:
+            TODO: Still needs to be implemented via dev side
+        ''' 
+        try:
+            self.handle.sendline("add-optical-intent "+
+                    str(ingress_device) + " " + str(egress_device))
+            self.handle.expect("add-optical-intent")
+            i = self.handle.expect([
+                "Error",
+                "onos>"])
+
+            handle = self.handle.before
+
+            #If error, return error message
+            if i == 0:
+                return handle
+            else:
+                return main.TRUE
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def add_point_intent(self, ingress_device, port_ingress,
+            egress_device, port_egress, ethType="", ethSrc="",
+            ethDst="", bandwidth="", lambda_alloc=False):
+        '''
+        Required:
+            * ingress_device: device id of ingress device
+            * egress_device: device id of egress device
+        Optional:
+            * ethType: specify ethType
+            * ethSrc: specify ethSrc (i.e. src mac addr)
+            * ethDst: specify ethDst (i.e. dst mac addr)
+            * bandwidth: specify bandwidth capacity of link
+            * lambda_alloc: if True, intent will allocate lambda 
+              for the specified intent
+        Description:
+            Adds a point-to-point intent (uni-directional) by
+            specifying device id's and optional fields
+
+        NOTE: This function may change depending on the 
+              options developers provide for point-to-point
+              intent via cli
+        '''
+        try:
+            cmd = ""
+
+            #If there are no optional arguments
+            if not ethType and not ethSrc and not ethDst\
+                    and not bandwidth and not lambda_alloc:
+                cmd = "add-point-intent "+\
+                        str(ingress_device) + "/" + str(port_ingress) + " " +\
+                        str(egress_device) + "/" + str(port_egress)
+       
+            else:
+                cmd = "add-point-intent "
+                
+                if ethType:
+                    cmd += " --ethType " + str(ethType)
+                if ethSrc:
+                    cmd += " --ethSrc " + str(ethSrc) 
+                if ethDst:    
+                    cmd += " --ethDst " + str(ethDst) 
+                if bandwidth:
+                    cmd += " --bandwidth " + str(bandwidth)
+                if lambda_alloc:
+                    cmd += " --lambda " 
+
+                cmd += " "+str(ingress_device) +\
+                    "/" + str(port_ingress) + " " +\
+                    str(egress_device) + "/" + str(port_egress) 
+
+            self.handle.sendline(cmd)
+            i = self.handle.expect([
+                "Error",
+                "onos>"])
+          
+            self.handle.sendline("intents")
+            self.handle.expect("onos>")
+            Intenthandle = self.handle.before
+
+            if i == 0:
+                main.log.error("Error in adding point-to-point intent")
+                return handle
+            else:
+                return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def remove_intent(self, intent_id):
+        '''
+        Remove intent for specified intent id
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("remove-intent "+str(intent_id))
+            i = self.handle.expect([
+                "Error",
+                "onos>"])
+           
+            handle = self.handle.before
+
+            if i == 0:
+                main.log.error("Error in removing intent")
+                return handle
+            else:
+                return handle 
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def intents(self, json_format = False):
+        '''
+        Optional:
+            * json_format: enable output formatting in json
+        Description:
+            Obtain intents currently installed 
+        '''
+        try:
+            if json_format:
+                self.handle.sendline("intents -j")
+                self.handle.expect("intents -j")
+                self.handle.expect("onos>")
+                handle = self.handle.before
+                
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle = ansi_escape.sub('', handle)
+            else:
+                self.handle.sendline("")
+                self.handle.expect("onos>")
+
+                self.handle.sendline("intents")
+                self.handle.expect("onos>")
+                handle = self.handle.before
+
+            return handle
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def flows(self, json_format = False):
+        '''
+        Optional:
+            * json_format: enable output formatting in json
+        Description:
+            Obtain flows currently installed 
+        '''
+        try:
+            if json_format:
+                self.handle.sendline("flows -j")
+                self.handle.expect("flows -j")
+                self.handle.expect("onos>")
+                handle = self.handle.before
+
+            else:
+                self.handle.sendline("")
+                self.handle.expect("onos>")
+                self.handle.sendline("flows")
+                self.handle.expect("onos>")
+                handle = self.handle.before
+
+            return handle
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def intents_events_metrics(self, json_format=True):
+        '''
+        Description:Returns topology metrics 
+        Optional:
+            * json_format: enable json formatting of output
+        '''
+        try:
+            if json_format:
+                self.handle.sendline("intents-events-metrics -j")
+                self.handle.expect("intents-events-metrics -j")
+                self.handle.expect("onos>")
+                
+                handle = self.handle.before
+              
+                #Some color thing that we want to escape
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle = ansi_escape.sub('', handle)
+            
+            else:
+                self.handle.sendline("intents-events-metrics")
+                self.handle.expect("intents-events-metrics")
+                self.handle.expect("onos>")
+                
+                handle = self.handle.before
+
+            return handle
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def topology_events_metrics(self, json_format=True):
+        '''
+        Description:Returns topology metrics 
+        Optional:
+            * json_format: enable json formatting of output
+        '''
+        try:
+            if json_format:
+                self.handle.sendline("topology-events-metrics -j")
+                self.handle.expect("topology-events-metrics -j")
+                self.handle.expect("onos>")
+                
+                handle = self.handle.before
+              
+                #Some color thing that we want to escape
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle = ansi_escape.sub('', handle)
+            
+            else:
+                self.handle.sendline("topology-events-metrics")
+                self.handle.expect("topology-events-metrics")
+                self.handle.expect("onos>")
+                
+                handle = self.handle.before
+
+            return handle
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    #Wrapper functions ****************
+    #Wrapper functions use existing driver
+    #functions and extends their use case.
+    #For example, we may use the output of
+    #a normal driver function, and parse it
+    #using a wrapper function
+
+    def get_all_intents_id(self):
+        '''
+        Description:
+            Obtain all intent id's in a list
+        '''
+        try:
+            #Obtain output of intents function
+            intents_str = self.intents()
+            all_intent_list = []
+            intent_id_list = []
+
+            #Parse the intents output for ID's
+            intents_list = [s.strip() for s in intents_str.splitlines()]
+            for intents in intents_list:
+                if "onos>" in intents:
+                    continue
+                elif "intents" in intents:
+                    continue
+                else:
+                    line_list = intents.split(" ")
+                    all_intent_list.append(line_list[0])
+            
+            all_intent_list = all_intent_list[1:-2]
+
+            for intents in all_intent_list:
+                if not intents:
+                    continue
+                else:
+                    intent_id_list.append(intents) 
+
+            return intent_id_list
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def get_all_devices_id(self):
+        '''
+        Use 'devices' function to obtain list of all devices
+        and parse the result to obtain a list of all device
+        id's. Returns this list. Returns empty list if no
+        devices exist
+        List is ordered sequentially 
+        
+        This function may be useful if you are not sure of the
+        device id, and wish to execute other commands using 
+        the ids. By obtaining the list of device ids on the fly,
+        you can iterate through the list to get mastership, etc.
+        '''
+        try:
+            #Call devices and store result string
+            devices_str = self.devices(json_format=False)
+            id_list = []
+            
+            if not devices_str:
+                main.log.info("There are no devices to get id from")
+                return id_list
+           
+            #Split the string into list by comma
+            device_list = devices_str.split(",")
+            #Get temporary list of all arguments with string 'id='
+            temp_list = [dev for dev in device_list if "id=" in dev]
+            #Split list further into arguments before and after string
+            # 'id='. Get the latter portion (the actual device id) and
+            # append to id_list
+            for arg in temp_list:
+                id_list.append(arg.split("id=")[1])
+            return id_list
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def get_all_nodes_id(self):
+        '''
+        Uses 'nodes' function to obtain list of all nodes
+        and parse the result of nodes to obtain just the
+        node id's. 
+        Returns:
+            list of node id's
+        '''
+        try:
+            nodes_str = self.nodes()
+            id_list = []
+
+            if not nodes_str:
+                main.log.info("There are no nodes to get id from")
+                return id_list
+
+            #Sample nodes_str output
+            #id=local, address=127.0.0.1:9876, state=ACTIVE *
+
+            #Split the string into list by comma
+            nodes_list = nodes_str.split(",")
+            temp_list = [node for node in nodes_list if "id=" in node]
+            for arg in temp_list:
+                id_list.append(arg.split("id=")[1])
+
+            return id_list
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def get_device(self, dpid=None):
+        '''
+        Return the first device from the devices api whose 'id' contains 'dpid'
+        Return None if there is no match
+        '''
+        import json
+        try:
+            if dpid == None:
+                return None
+            else:
+                dpid = dpid.replace(':', '')
+                raw_devices = self.devices()
+                devices_json = json.loads(raw_devices)
+                #search json for the device with dpid then return the device
+                for device in devices_json:
+                    #print "%s in  %s?" % (dpid, device['id'])
+                    if dpid in device['id']:
+                        return device
+            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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def check_status(self, ip, numoswitch, numolink, log_level="info"):
+        '''
+        Checks the number of swithes & links that ONOS sees against the 
+        supplied values. By default this will report to main.log, but the 
+        log level can be specifid.
+        
+        Params: ip = ip used for the onos cli
+                numoswitch = expected number of switches
+                numlink = expected number of links
+                log_level = level to log to. Currently accepts 'info', 'warn' and 'report'
+
+
+        log_level can
+
+        Returns: main.TRUE if the number of switchs and links are correct, 
+                 main.FALSE if the numer of switches and links is incorrect,
+                 and main.ERROR otherwise
+        '''
+
+        try:
+            topology = self.get_topology(ip)
+            if topology == {}:
+                return main.ERROR
+            output = ""
+            #Is the number of switches is what we expected
+            devices = topology.get('devices',False)
+            links = topology.get('links',False)
+            if devices == False or links == False:
+                return main.ERROR
+            switch_check = ( int(devices) == int(numoswitch) )
+            #Is the number of links is what we expected
+            link_check = ( int(links) == int(numolink) )
+            if (switch_check and link_check):
+                #We expected the correct numbers
+                output = output + "The number of links and switches match "\
+                        + "what was expected"
+                result = main.TRUE
+            else:
+                output = output + \
+                        "The number of links and switches does not match what was expected"
+                result = main.FALSE
+            output = output + "\n ONOS sees %i devices (%i expected) and %i links (%i expected)"\
+                    % ( int(devices), int(numoswitch), int(links), int(numolink) )
+            if log_level == "report":
+                main.log.report(output)
+            elif log_level == "warn":
+                main.log.warn(output)
+            else:
+                main.log.info(output)
+            return result 
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def device_role(self, device_id, onos_node, role="master"):
+        '''
+        Calls the device-role cli command.
+        device_id must be the id of a device as seen in the onos devices command
+        onos_node is the ip of one of the onos nodes in the cluster
+        role must be either master, standby, or none
+
+        Returns main.TRUE or main.FALSE based argument varification.
+            When device-role supports errors this should be extended to
+            support that output
+        '''
+        try:
+            #print "beginning device_role... \n\tdevice_id:" + device_id
+            #print "\tonos_node: " + onos_node
+            #print "\trole: "+ role
+            if role.lower() == "master" or \
+                    role.lower() == "standby" or \
+                    role.lower() == "none":
+                        self.handle.sendline("")
+                        self.handle.expect("onos>")
+                        self.handle.sendline("device-role " +
+                                str(device_id) + " " +
+                                str(onos_node) +  " " +
+                                str(role))
+                        i= self.handle.expect(["Error","onos>"])
+                        if i == 0:
+                            output = str(self.handle.before)
+                            self.handle.expect("onos>")
+                            output = output + str(self.handle.before)
+                            main.log.error(self.name + ": " +
+                                    output + '\033[0m')#end color output to escape any colours from the cli
+                            return main.ERROR
+                        self.handle.sendline("")
+                        self.handle.expect("onos>")
+                        return main.TRUE
+            else:
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
+    #***********************************
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
new file mode 100644
index 0000000..875707b
--- /dev/null
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -0,0 +1,1132 @@
+#!/usr/bin/env python
+
+'''
+This driver interacts with ONOS bench, the OSGi platform 
+that configures the ONOS nodes. (aka ONOS-next) 
+
+Please follow the coding style demonstrated by existing 
+functions and document properly.
+
+If you are a contributor to the driver, please
+list your email here for future contact:
+
+jhall@onlab.us
+andrew@onlab.us
+
+OCT 9 2014
+
+'''
+
+import sys
+import time
+import pexpect
+import re
+import traceback
+import os.path
+import pydoc
+sys.path.append("../")
+from drivers.common.clidriver import CLI
+
+class OnosDriver(CLI):
+
+    def __init__(self):
+        '''
+        Initialize client 
+        '''
+        super(CLI, self).__init__()
+
+    def connect(self,**connectargs):
+        '''
+        Creates ssh handle for ONOS "bench".
+        '''
+        try:
+            for key in connectargs:
+                vars(self)[key] = connectargs[key]
+            self.home = "~/ONOS"
+            for key in self.options:
+                if key == "home":
+                    self.home = self.options['home']
+                    break
+
+
+            self.name = self.options['name']
+            self.handle = super(OnosDriver,self).connect(
+                    user_name = self.user_name, 
+                    ip_address = self.ip_address,
+                    port = self.port, 
+                    pwd = self.pwd, 
+                    home = self.home)
+           
+            self.handle.sendline("cd "+ self.home)
+            self.handle.expect("\$")
+            if self.handle:
+                return self.handle
+            else :
+                main.log.info("NO ONOS HANDLE")
+                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:
+            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.error( traceback.print_exc() )
+            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.cleanup()
+            main.exit()
+
+    def disconnect(self):
+        '''
+        Called when Test is complete to disconnect the ONOS handle.
+        '''
+        response = ''
+        try:
+            self.handle.sendline("\n")
+            self.handle.expect("\$")
+            self.handle.sendline("exit")
+            self.handle.expect("closed")
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+        except:
+            main.log.error(self.name + ": Connection failed to the host")
+            response = main.FALSE
+        return response
+
+    def onos_package(self):
+        '''
+        Produce a self-contained tar.gz file that can be deployed
+        and executed on any platform with Java 7 JRE. 
+        '''
+        
+        try:
+            self.handle.sendline("onos-package")
+            self.handle.expect("onos-package")
+            self.handle.expect("tar.gz",timeout=10)
+            handle = str(self.handle.before)
+            main.log.info("onos-package command returned: "+
+                    handle)
+            #As long as the sendline does not time out, 
+            #return true. However, be careful to interpret
+            #the results of the onos-package command return
+            return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+        except:
+            main.log.error("Failed to package ONOS")
+            main.cleanup()
+            main.exit()
+
+    def onos_build(self):
+        '''
+        Use the pre defined script to build onos via mvn
+        '''
+        
+        try:
+            self.handle.sendline("onos-build")
+            self.handle.expect("onos-build")
+            i = self.handle.expect([
+                "BUILD SUCCESS",
+                "ERROR",
+                "BUILD FAILED"], timeout=120)
+            handle = str(self.handle.before)
+
+            main.log.info("onos-build command returned: "+
+                    handle)
+
+            if i == 0:
+                return main.TRUE
+            else:
+                return handle
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+        except:
+            main.log.error("Failed to build ONOS")
+            main.cleanup()
+            main.exit()
+
+    def clean_install(self):
+        '''
+        Runs mvn clean install in the root of the ONOS directory. 
+        This will clean all ONOS artifacts then compile each module 
+
+        Returns: main.TRUE on success 
+        On Failure, exits the test
+        '''
+        try:
+            main.log.info("Running 'mvn clean install' on " + str(self.name) + 
+                    ". This may take some time.") 
+            self.handle.sendline("cd "+ self.home)
+            self.handle.expect("\$")
+
+            self.handle.sendline("\n")
+            self.handle.expect("\$")
+            self.handle.sendline("mvn clean install")
+            self.handle.expect("mvn clean install")
+            while 1:
+                i=self.handle.expect([
+                    'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s\
+                            Runtime\sEnvironment\sto\scontinue',
+                    'BUILD\sFAILURE',
+                    'BUILD\sSUCCESS',
+                    'ONOS\$',
+                    pexpect.TIMEOUT],timeout=600)
+                if i == 0:
+                    main.log.error(self.name + ":There is insufficient memory \
+                            for the Java Runtime Environment to continue.")
+                    #return main.FALSE
+                    main.cleanup()
+                    main.exit()
+                if i == 1:
+                    main.log.error(self.name + ": Build failure!")
+                    #return main.FALSE
+                    main.cleanup()
+                    main.exit()
+                elif i == 2:
+                    main.log.info(self.name + ": Build success!")
+                elif i == 3:
+                    main.log.info(self.name + ": Build complete")
+                    #Print the build time
+                    for line in self.handle.before.splitlines():
+                        if "Total time:" in line:
+                            main.log.info(line)
+                    self.handle.sendline("\n")
+                    self.handle.expect("\$", timeout=60)
+                    return main.TRUE
+                elif i == 4:
+                    main.log.error(self.name + ": mvn clean install TIMEOUT!")
+                    #return main.FALSE
+                    main.cleanup()
+                    main.exit()
+                else:
+                    main.log.error(self.name + ": unexpected response from \
+                            mvn clean install")
+                    #return main.FALSE
+                    main.cleanup()
+                    main.exit()
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.error( traceback.print_exc() )
+            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.cleanup()
+            main.exit()
+
+    def git_pull(self, comp1=""):
+        '''
+        Assumes that "git pull" works without login
+        
+        This function will perform a git pull on the ONOS instance.
+        If used as git_pull("NODE") it will do git pull + NODE. This is
+        for the purpose of pulling from other nodes if necessary.
+
+        Otherwise, this function will perform a git pull in the 
+        ONOS repository. If it has any problems, it will return main.ERROR
+        If it successfully does a git_pull, it will return a 1 (main.TRUE)
+        If it has no updates, it will return 3.
+
+        '''
+        try:
+            # main.log.info(self.name + ": Stopping ONOS")
+            #self.stop()
+            self.handle.sendline("cd " + self.home)
+            self.handle.expect("ONOS\$")
+            if comp1=="":
+                self.handle.sendline("git pull")
+            else:
+                self.handle.sendline("git pull " + comp1)
+           
+            uptodate = 0
+            i=self.handle.expect(['fatal',
+                'Username\sfor\s(.*):\s',
+                '\sfile(s*) changed,\s',
+                'Already up-to-date',
+                'Aborting',
+                'You\sare\snot\scurrently\son\sa\sbranch', 
+                'You\sasked\sme\sto\spull\swithout\stelling\sme\swhich\sbranch\syou',
+                'Pull\sis\snot\spossible\sbecause\syou\shave\sunmerged\sfiles',
+                pexpect.TIMEOUT],
+                timeout=300)
+            #debug
+           #main.log.report(self.name +": DEBUG:  \n"+"git pull response: " + str(self.handle.before) + str(self.handle.after))
+            if i==0:
+                main.log.error(self.name + ": Git pull had some issue...")
+                return main.ERROR
+            elif i==1:
+                main.log.error(self.name + ": Git Pull Asking for username. ")
+                return main.ERROR
+            elif i==2:
+                main.log.info(self.name + ": Git Pull - pulling repository now")
+                self.handle.expect("ONOS\$", 120)
+                return main.TRUE # So that only when git pull is done, we do mvn clean compile
+            elif i==3:
+                main.log.info(self.name + ": Git Pull - Already up to date")
+                return i
+            elif i==4:
+                main.log.info(self.name + ": Git Pull - Aborting... Are there conflicting git files?")
+                return main.ERROR
+            elif i==5:
+                main.log.info(self.name + ": Git Pull - You are not currently on a branch so git pull failed!")
+                return main.ERROR
+            elif i==6:
+                main.log.info(self.name + ": Git Pull - You have not configured an upstream branch to pull from. Git pull failed!")
+                return main.ERROR
+            elif i==7:
+                main.log.info(self.name + ": Git Pull - Pull is not possible because you have unmerged files.")
+                return main.ERROR
+            elif i==8:
+                main.log.error(self.name + ": Git Pull - TIMEOUT")
+                main.log.error(self.name + " Response was: " + str(self.handle.before))
+                return main.ERROR
+            else:
+                main.log.error(self.name + ": Git Pull - Unexpected response, check for pull errors")
+                return main.ERROR
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.error( traceback.print_exc() )
+            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.cleanup()
+            main.exit()
+
+    def git_checkout(self, branch="master"):
+        '''
+        Assumes that "git pull" works without login
+        
+        This function will perform a git git checkout on the ONOS instance.
+        If used as git_checkout("branch") it will do git checkout of the "branch".
+
+        Otherwise, this function will perform a git checkout of the master
+        branch of the ONOS repository. If it has any problems, it will return 
+        main.ERROR. 
+        If the branch was already the specified branch, or the git checkout was 
+        successful then the function will return main.TRUE.
+
+        '''
+        try:
+            self.handle.sendline("cd " + self.home)
+            self.handle.expect("ONOS\$")
+            main.log.info(self.name + ": Checking out git branch: " + branch + "...")
+            cmd = "git checkout "+branch
+            self.handle.sendline(cmd)
+            self.handle.expect(cmd)
+            i=self.handle.expect(['fatal',
+                'Username\sfor\s(.*):\s',
+                'Already\son\s\'',
+                'Switched\sto\sbranch\s\'' + str(branch), 
+                pexpect.TIMEOUT,
+                'error: Your local changes to the following files would be overwritten by checkout:',
+                'error: you need to resolve your current index first'],timeout=60)
+
+            if i==0:
+                main.log.error(self.name + ": Git checkout had some issue...")
+                main.log.error(self.name + ":     " + self.handle.before)
+                return main.ERROR
+            elif i==1:
+                main.log.error(self.name + ": Git checkout asking for username."\
+                        +" Please configure your local git repository to be able "\
+                        +"to access your remote repository passwordlessly")
+                return main.ERROR
+            elif i==2:
+                main.log.info(self.name + ": Git Checkout %s : Already on this branch" %branch)
+                self.handle.expect("ONOS\$")
+                #main.log.info("DEBUG: after checkout cmd = "+ self.handle.before)
+                return main.TRUE
+            elif i==3:
+                main.log.info(self.name + ": Git checkout %s - Switched to this branch" %branch)
+                self.handle.expect("ONOS\$")
+                #main.log.info("DEBUG: after checkout cmd = "+ self.handle.before)
+                return main.TRUE
+            elif i==4:
+                main.log.error(self.name + ": Git Checkout- TIMEOUT")
+                main.log.error(self.name + " Response was: " + str(self.handle.before))
+                return main.ERROR
+            elif i==5:
+                self.handle.expect("Aborting")
+                main.log.error(self.name + ": Git checkout error: \n" + \
+                        "Your local changes to the following files would be overwritten by checkout:" + \
+                        str(self.handle.before))
+                self.handle.expect("ONOS\$")
+                return main.ERROR
+            elif i==6:
+                main.log.error(self.name + ": Git checkout error: \n" + \
+                        "You need to resolve your current index first:" + \
+                        str(self.handle.before))
+                self.handle.expect("ONOS\$")
+                return main.ERROR
+            else:
+                main.log.error(self.name + ": Git Checkout - Unexpected response, check for pull errors")
+                main.log.error(self.name + ":     " + self.handle.before)
+                return main.ERROR
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.error( traceback.print_exc() )
+            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.cleanup()
+            main.exit()
+
+    def get_version(self, report=False):
+        '''
+        Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
+        '''
+        try:
+            self.handle.sendline("export TERM=xterm-256color")
+            self.handle.expect("xterm-256color")
+            self.handle.expect("\$")
+            self.handle.sendline("\n")
+            self.handle.expect("\$")
+            self.handle.sendline("cd " + self.home + "; git log -1 --pretty=fuller --decorate=short | grep -A 6 \"commit\" --color=never")
+            self.handle.expect("--color=never")
+            self.handle.expect("\$")
+            response=(self.name +": \n"+ str(self.handle.before + self.handle.after))
+            self.handle.sendline("cd " + self.home)
+            self.handle.expect("\$")
+            lines=response.splitlines()
+            for line in lines:
+                print line
+            if report:
+                for line in lines[2:-1]:
+                    main.log.report(line)
+            return lines[2]
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.error( traceback.print_exc() )
+            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.cleanup()
+            main.exit()
+
+    def create_cell_file(self, bench_ip, file_name, mn_ip_addrs,
+            extra_feature_string, *onos_ip_addrs):
+        '''
+        Creates a cell file based on arguments
+        Required:
+            * Bench IP address (bench_ip)
+                - Needed to copy the cell file over
+            * File name of the cell file (file_name)
+            * Mininet IP address (mn_ip_addrs)
+                - Note that only 1 ip address is 
+                  supported currently
+            * ONOS IP addresses (onos_ip_addrs) 
+                - Must be passed in as last arguments
+        
+        NOTE: Assumes cells are located at:
+            ~/<self.home>/tools/test/cells/
+        '''
+        
+        #Variable initialization
+        cell_directory = 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
+        temp_directory = "/tmp/"
+        #Create the cell file in the directory for writing (w+)
+        cell_file = open(temp_directory+file_name , 'w+')
+       
+        comment = ""
+        comment_string = "#"+ comment
+        #Feature string is hardcoded environment variables
+        #That you may wish to use by default on startup.
+        #Note that you  may not want certain features listed
+        #on here.
+        core_feature_string = "export ONOS_FEATURES=webconsole,onos-api,"+\
+                "onos-cli,onos-openflow,onos-app-mobility,onos-app-tvue,"+\
+                "onos-app-proxyarp,"+extra_feature_string
+        mn_string = "export OCN="
+        onos_string = "export OC"
+        temp_count = 1
+   
+        #Create ONOS_NIC ip address prefix
+        temp_onos_ip = onos_ip_addrs[0] 
+        temp_list = []
+        temp_list = temp_onos_ip.split(".")
+        #Omit last element of list to format for NIC
+        temp_list = temp_list[:-1]
+        #Structure the nic string ip
+        nic_addr = ".".join(temp_list) + ".*"
+        onos_nic_string = "export ONOS_NIC="+nic_addr
+
+        try:
+            #Start writing to file
+            cell_file.write(onos_nic_string + "\n") 
+
+            for arg in onos_ip_addrs:
+                #For each argument in onos_ip_addrs, write to file
+                #Output should look like the following:
+                #   export OC1="10.128.20.11"
+                #   export OC2="10.128.20.12"
+                cell_file.write(onos_string + str(temp_count) +
+                        "=" + "\"" + arg + "\"" + "\n" )
+                temp_count = temp_count + 1
+            
+            cell_file.write(mn_string +"\""+ mn_ip_addrs +"\""+ "\n") 
+            cell_file.write(core_feature_string + "\n")
+            cell_file.close()
+
+            #We use os.system to send the command to TestON cluster
+            #to account for the case in which TestON is not located
+            #on the same cluster as the ONOS bench
+            #Note that even if TestON is located on the same cluster
+            #as ONOS bench, you must setup passwordless ssh
+            #between TestON and ONOS bench in order to automate the test.
+            os.system("scp "+temp_directory+file_name+
+                    " admin@"+bench_ip+":"+cell_directory)
+
+            return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name + ":::::::::")
+            main.log.error( traceback.print_exc() )
+            main.log.info(":::::::")
+            main.cleanup()
+            main.exit()
+
+    def set_cell(self, cellname):
+        '''
+        Calls 'cell <name>' to set the environment variables on ONOSbench
+        '''
+        try:
+            if not cellname:
+                main.log.error("Must define cellname")
+                main.cleanup()
+                main.exit()
+            else:
+                self.handle.sendline("cell "+str(cellname))
+                #Expect the cellname in the ONOS_CELL variable.
+                #Note that this variable name is subject to change
+                #   and that this driver will have to change accordingly
+                self.handle.expect("ONOS_CELL="+str(cellname))
+                handle_before = self.handle.before
+                handle_after = self.handle.after
+                #Get the rest of the handle
+                self.handle.sendline("")
+                self.handle.expect("\$")
+                handle_more = self.handle.before
+
+                main.log.info("Cell call returned: "+handle_before+
+                        handle_after + handle_more)
+
+                return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def verify_cell(self):
+        '''
+        Calls 'onos-verify-cell' to check for cell installation
+        '''
+        #TODO: Add meaningful expect value
+
+        try:
+            #Clean handle by sending empty and expecting $
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("onos-verify-cell")
+            self.handle.expect("\$")
+            handle_before = self.handle.before
+            handle_after = self.handle.after
+            #Get the rest of the handle
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            handle_more = self.handle.before
+
+            main.log.info("Verify cell returned: "+handle_before+
+                    handle_after + handle_more)
+
+            return main.TRUE
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def onos_cli(self, ONOS_ip, cmdstr):
+        '''
+        Uses 'onos' command to send various ONOS CLI arguments.
+        Required:
+            * ONOS_ip: specify the ip of the cell machine
+            * cmdstr: specify the command string to send
+        
+        This function is intended to expose the entire karaf 
+        CLI commands for ONOS. Try to use this function first
+        before attempting to write a ONOS CLI specific driver
+        function. 
+        You can see a list of available 'cmdstr' arguments 
+        by starting onos, and typing in 'onos' to enter the
+        onos> CLI. Then, type 'help' to see the list of
+        available commands. 
+        '''
+        try:
+            if not ONOS_ip:
+                main.log.error("You must specify the IP address")
+                return main.FALSE
+            if not cmdstr:
+                main.log.error("You must specify the command string")
+                return main.FALSE
+
+            cmdstr = str(cmdstr)
+            self.handle.sendline("")
+            self.handle.expect("\$")
+
+            self.handle.sendline("onos -w " + ONOS_ip + " " + cmdstr)
+            self.handle.expect("\$")
+
+            handle_before = self.handle.before
+            print "handle_before = ", self.handle.before
+            handle_after = str(self.handle.after)
+            
+            #self.handle.sendline("")
+            #self.handle.expect("\$")
+            #handle_more = str(self.handle.before)
+
+            main.log.info("Command sent successfully")
+
+            #Obtain return handle that consists of result from 
+            #the onos command. The string may need to be 
+            #configured further. 
+            #return_string = handle_before + handle_after
+            return_string = handle_before
+            print "return_string = ", return_string
+            return return_string
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def onos_install(self, options="-f", node = ""):
+        '''
+        Installs ONOS bits on the designated cell machine.
+        If -f option is provided, it also forces an uninstall. 
+        Presently, install also includes onos-push-bits and 
+        onos-config within.
+        The node option allows you to selectively only push the jar 
+        files to certain onos nodes
+
+        Returns: main.TRUE on success and main.FALSE on failure
+        '''
+        try:
+            self.handle.sendline("onos-install " + options + " " + node)
+            self.handle.expect("onos-install ")
+            #NOTE: this timeout may need to change depending on the network and size of ONOS
+            i=self.handle.expect(["Network\sis\sunreachable",
+                "onos\sstart/running,\sprocess",
+                pexpect.TIMEOUT],timeout=60)
+
+            if i == 0:
+                main.log.warn("Network is unreachable")
+                return main.FALSE
+            elif i == 1:
+                main.log.info("ONOS was installed on " + node + " and started")
+                return main.TRUE
+            elif i == 2: 
+                main.log.info("Installation of ONOS on " + node + " timed out")
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def onos_start(self, node_ip):
+        '''
+        Calls onos command: 'onos-service [<node-ip>] start'
+        This command is a remote management of the ONOS upstart daemon
+        '''
+
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("onos-service "+str(node_ip)+
+                " start")
+            i = self.handle.expect([
+                "Job\sis\salready\srunning",
+                "start/running",
+                "Unknown\sinstance",
+                pexpect.TIMEOUT],timeout=120)
+
+            if i == 0:
+                main.log.info("Service is already running")
+                return main.TRUE
+            elif i == 1:
+                main.log.info("ONOS service started")
+                return main.TRUE
+            else:
+                main.log.error("ONOS service failed to start")
+                main.cleanup()
+                main.exit()
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def onos_stop(self, node_ip):
+        '''
+        Calls onos command: 'onos-service [<node-ip>] stop'
+        This command is a remote management of the ONOS upstart daemon
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("onos-service "+str(node_ip)+
+                " stop")
+            i = self.handle.expect([
+                "stop/waiting",
+                "Unknown\sinstance",
+                pexpect.TIMEOUT],timeout=60)
+
+            if i == 0:
+                main.log.info("ONOS service stopped")
+                return main.TRUE
+            elif i == 1:
+                main.log.info("Unknown ONOS instance specified: "+
+                        str(node_ip))
+                return main.FALSE
+            else:
+                main.log.error("ONOS service failed to stop")
+                return main.FALSE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def onos_uninstall(self):
+        '''
+        Calls the command: 'onos-uninstall'
+        Uninstalls ONOS from the designated cell machine, stopping 
+        if needed
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("onos-uninstall")
+            self.handle.expect("\$")
+
+            main.log.info("ONOS cell machine was uninstalled")
+            #onos-uninstall command does not return any text
+            return main.TRUE
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def onos_kill(self, node_ip):
+        '''
+        Calls the command: 'onos-kill [<node-ip>]'
+        "Remotely, and unceremoniously kills the ONOS instance running on
+        the specified cell machine" - Tom V
+        '''
+        
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("onos-kill " + str(node_ip))
+            i = self.handle.expect([
+                "\$",
+                "No\sroute\sto\shost",
+                "password:",
+                pexpect.TIMEOUT], timeout=20)
+            
+            if i == 0:
+                main.log.info("ONOS instance "+str(node_ip)+" was killed")
+                return main.TRUE
+            elif i == 1:
+                main.log.info("No route to host")
+                return main.FALSE
+            elif i == 2:
+                main.log.info("Passwordless login for host: "+str(node_ip)+
+                        " not configured")
+                return main.FALSE
+            else:
+                main.log.info("ONOS instasnce was not killed")
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def onos_start_network(self, mntopo):
+        '''
+        Calls the command 'onos-start-network [<mininet-topo>]
+        "remotely starts the specified topology on the cell's 
+        mininet machine against all controllers configured in the
+        cell." 
+        * Specify mininet topology file name for mntopo
+        * Topo files should be placed at:
+          ~/<your-onos-directory>/tools/test/topos
+        
+        NOTE: This function will take you to the mininet prompt
+        '''
+        try:
+            if not mntopo:
+                main.log.error("You must specify a topo file to execute")
+                return main.FALSE
+            
+            mntopo = str(mntopo)
+            self.handle.sendline("")
+            self.handle.expect("\$")
+
+            self.handle.sendline("onos-start-network " + mntopo)
+            self.handle.expect("mininet>")
+            main.log.info("Network started, entered mininet prompt")
+
+            #TODO: Think about whether return is necessary or not
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
+    def isup(self, node = ""):
+        '''
+        Run's onos-wait-for-start which only returns once ONOS is at run 
+        level 100(ready for use)
+
+        Returns: main.TRUE if ONOS is running and main.FALSE on timeout
+        '''
+        try:
+            self.handle.sendline("onos-wait-for-start " + node )
+            self.handle.expect("onos-wait-for-start")
+            #NOTE: this timeout is arbitrary"
+            i = self.handle.expect(["\$", pexpect.TIMEOUT], timeout = 300)
+            if i == 0:
+                main.log.info(self.name + ": " + node + " is up")
+                return main.TRUE
+            elif i == 1:
+                #NOTE: since this function won't return until ONOS is ready,
+                #   we will kill it on timeout
+                self.handle.sendline("\003")    #Control-C
+                self.handle.expect("\$")
+                return main.FALSE
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
+    def get_topology(self,topology_output):
+        '''
+        parses the onos:topology output
+        Returns: a topology dict populated by the key values found in 
+                 the cli command.
+        '''
+
+        try:
+            #call the cli to get the topology summary
+            #cmdstr = "onos:topology"
+            #cli_result = self.onos_cli(ip, cmdstr)
+            #print "cli_result = ", cli_result
+
+            #Parse the output
+            topology = {}
+            #for line in cli_result.split("\n"):
+            for line in topology_output.splitlines():
+                if not line.startswith("time="):
+                    continue
+                #else
+                print line
+                for var in line.split(","):
+                    #print "'"+var+"'"
+                    #print "'"+var.strip()+"'"
+                    key, value = var.strip().split("=")
+                    topology[key] = value
+            print "topology = ", topology
+            devices = topology.get('devices', False)
+            print "devices = ", devices
+            links = topology.get('links', False)
+            print "links = ", links
+            clusters = topology.get('clusters', False)
+            print "clusters = ", clusters
+            paths = topology.get('paths', False)
+            print "paths = ", paths
+
+            return topology
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+    
+   
+
+    def check_status(self, topology_result, numoswitch, numolink, log_level="info"):
+        '''
+        Checks the number of swithes & links that ONOS sees against the 
+        supplied values. By default this will report to main.log, but the 
+        log level can be specifid.
+        
+        Params: ip = ip used for the onos cli
+                numoswitch = expected number of switches
+                numlink = expected number of links
+                log_level = level to log to. Currently accepts 'info', 'warn' and 'report'
+
+
+        log_level can
+
+        Returns: main.TRUE if the number of switchs and links are correct, 
+                 main.FALSE if the numer of switches and links is incorrect,
+                 and main.ERROR otherwise
+        '''
+
+        try:
+            topology = self.get_topology(topology_result)
+            if topology == {}:
+                return main.ERROR
+            output = ""
+            #Is the number of switches is what we expected
+            devices = topology.get('devices',False)
+            links = topology.get('links',False)
+            if devices == False or links == False:
+                return main.ERROR
+            switch_check = ( int(devices) == int(numoswitch) )
+            #Is the number of links is what we expected
+            link_check = ( int(links) == int(numolink) )
+            if (switch_check and link_check):
+                #We expected the correct numbers
+                output = output + "The number of links and switches match "\
+                        + "what was expected"
+                result = main.TRUE
+            else:
+                output = output + \
+                        "The number of links and switches does not match what was expected"
+                result = main.FALSE
+            output = output + "\n ONOS sees %i devices (%i expected) and %i links (%i expected)"\
+                    % ( int(devices), int(numoswitch), int(links), int(numolink) )
+            if log_level == "report":
+                main.log.report(output)
+            elif log_level == "warn":
+                main.log.warn(output)
+            else:
+                main.log.info(output)
+            return result 
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def tshark_pcap(self, interface, dir_file):
+        '''
+        Capture all packet activity and store in specified
+        directory/file
+
+        Required:
+            * interface: interface to capture
+            * dir: directory/filename to store pcap
+        '''
+        self.handle.sendline("")
+        self.handle.expect("\$")
+
+        self.handle.sendline("tshark -i "+str(interface)+
+                " -t e -w "+str(dir_file))
+        self.handle.expect("Capturing on")
+
+        main.log.info("Tshark started capturing files on "+
+                str(interface)+ " and saving to directory: "+
+                str(dir_File))
+
+
+    def run_onos_topo_cfg(self):
+        '''
+         On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
+            which starts the rest and copies the json file to the onos instance
+        '''
+        self.handle.sendline("")
+        self.handle.expect("\$")
+        self.handle.sendline("cd ~/ONOS/tools/test/bin")
+        self.handle.expect("/bin$")
+        self.handle.sendline("./onos-topo-cfg")
+        self.handle.expect("{}admin@onosTestBench")
+        self.handle.sendline("cd ~")
+        self.handle.expect("\$")
+
+
+    def tshark_grep(self, grep, directory, interface='eth0'):
+        '''
+        Required:
+            * grep string 
+            * directory to store results
+        Optional:
+            * interface - default: eth0
+        Description:
+            Uses tshark command to grep specific group of packets
+            and stores the results to specified directory.
+            The timestamp is hardcoded to be in epoch 
+        '''
+        self.handle.sendline("")
+        self.handle.expect("\$")
+        self.handle.sendline("")
+        self.handle.sendline("tshark -i "+str(interface)+
+                " -t e | grep --line-buffered \""+str(grep)+"\" >"+directory+" &")
+        self.handle.sendline("\r")
+        self.handle.expect("Capturing on")
+        self.handle.sendline("\r")
+        self.handle.expect("\$")
+
+    def tshark_stop(self):
+        '''
+        Removes wireshark files from /tmp and kills all tshark processes
+        '''
+        #Remove all pcap from previous captures
+        self.execute(cmd="sudo rm /tmp/wireshark*")
+        self.handle.sendline("")
+        self.handle.sendline("sudo kill -9 `ps -ef | grep \"tshark -i\" |"+
+                " grep -v grep | awk '{print $2}'`")
+        self.handle.sendline("")
+        main.log.info("Tshark stopped")
+
+    def ptpd(self, args):
+        '''
+        Initiate ptp with user-specified args.
+        Required:
+            * args: specify string of args after command
+              'sudo ptpd'
+        '''
+        try:
+            self.handle.sendline("sudo ptpd "+str(args))
+            i = self.handle.expect([
+                "Multiple",
+                "Error",
+                "\$"])
+            self.handle.expect("\$")
+
+            if i == 0:
+                handle = self.handle.before
+                main.log.info("ptpd returned an error: "+
+                    str(handle))
+                return handle
+            elif i == 1:
+                handle = self.handle.before
+                main.log.error("ptpd returned an error: "+
+                    str(handle))
+                return handle
+            else:
+                return main.TRUE
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
diff --git a/TestON/drivers/common/cli/onossanityclidriver.py b/TestON/drivers/common/cli/onossanityclidriver.py
deleted file mode 100644
index 24502ae..0000000
--- a/TestON/drivers/common/cli/onossanityclidriver.py
+++ /dev/null
@@ -1,1193 +0,0 @@
-#!/usr/bin/env python
-'''
-'''
-
-import pexpect
-import struct
-import fcntl
-import os
-import signal
-import re
-import sys
-import core.teston
-import time
-import json
-import traceback
-import requests
-
-sys.path.append("../")
-from drivers.common.clidriver import CLI
-
-class onossanityclidriver(CLI):
-    '''
-    '''
-    def __init__(self):
-        super(CLI, self).__init__()
-
-    def connect(self,**connectargs):
-        '''
-        Creates ssh handle for ONOS.
-        '''
-        try:
-            for key in connectargs:
-                vars(self)[key] = connectargs[key]
-            self.home = "~/ONOS"
-            for key in self.options:
-                if key == "home":
-                    self.home = self.options['home']
-                    break
-
-            
-            self.name = self.options['name']
-            self.handle = super(onossanityclidriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd, home = self.home)
-
-            if self.handle:
-                return self.handle
-            else :
-                main.log.info("NO ONOS HANDLE")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()   
- 
-    def start(self):
-        '''
-        Starts ONOS on remote machine.
-        Returns false if any errors were encountered.
-        '''
-        try:
-            self.handle.sendline("")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("cd "+self.home)
-            self.handle.sendline("./onos.sh zk start") 
-	    self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("./onos.sh rc deldb")
-	    self.handle.sendline("y")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-	    #Send a confirmation to delete ramcloud
-	    #self.handle.sendline("y")
-	    main.log.info("Ramcloud db deleted")
-            #self.handle.sendline("./onos.sh zk start")
-            #Check if zookeeper is running
-            #delete database ./onos.sh rc deldb
-            #main.log.info(self.name + ": ZooKeeper Started Separately")
-            time.sleep(2) 
-	    self.handle.sendline("./onos.sh start")
-            i=self.handle.expect(["STARTED","FAILED","running",pexpect.EOF,pexpect.TIMEOUT])
-            if i==0:
-                    main.log.info(self.name + ": ZooKeeper, Ramcloud and ONOS Started ")
-                    return main.TRUE
-            elif i==1:
-                main.log.error(self.name + ": Failed to start")
-                return main.FALSE
-	    elif i==2:
-		main.log.info(self.name + ": Already running, so Restarting ONOS")
-		self.handle.sendline("./onos.sh restart")
-		j=self.handle.expect(["STARTED","FAILED",pexpect.EOF,pexpect.TIMEOUT])
-		if j==0:
-		    main.log.info(self.name + ": ZooKeeper, Ramcloud and ONOS Started ")
-		    return main.TRUE
-		else:
-		    main.log.error(self.name + ": ONOS Failed to Start")
-            elif i==3:
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-	    elif i==2:
-		main.log.info(self.name + ": Already running, so Restarting ONOS")
-		self.handle.sendline("./onos.sh restart")
-		j=self.handle.expect(["STARTED","FAILED",pexpect.EOF,pexpect.TIMEOUT])
-		if j==0:
-		    main.log.info(self.name + ": ZooKeeper, Ramcloud and ONOS Started ")
-		    return main.TRUE
-		elif j==1:
-		    main.log.error(self.name + ": ONOS Failed to Start")
-		    main.log.info(self.name + ": cleaning up and exiting...")
-		    main.cleanup()
-		    main.exit()
-		elif j==2: 
-		    main.log.error(self.name + ": EOF exception found")
-		    main.log.error(self.name + ":    " + self.handle.before)
-		    main.log.info(self.name + ": cleaning up and exiting...")
-		    main.cleanup()
-		    main.exit() 
-            elif i==3:
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
-            elif i==4:
-                main.log.error(self.name + ": ONOS timedout while starting")
-                return main.FALSE
-            else:
-                main.log.error(self.name + ": ONOS start  expect script missed something... ")
-            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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-    
-    def status(self):
-        '''
-        Calls onos.sh core status and returns TRUE/FALSE accordingly
-        '''
-        try:
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            self.handle.sendline("cd "+self.home)
-            response = self.execute(cmd="./onos.sh core status ",prompt="\d+\sinstance\sof\sonos\srunning",timeout=10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            if re.search("1\sinstance\sof\sonos\srunning",response):
-                return main.TRUE
-            elif re.search("0\sinstance\sof\sonos\srunning",response):
-                return main.FALSE
-            else :
-                main.log.info( self.name + " WARNING: status recieved unknown response")
-		main.log.info( self.name + " For details: check onos core status manually")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def zk_status(self):
-        '''
-        Calls the zookeeper status and returns TRUE if it has an assigned Mode to it. 
-        '''
-        try:
-	    self.execute(cmd="\n",prompt="\$",timeout=10)
-            self.handle.sendline("cd "+self.home)
-	    self.handle.sendline("./onos.sh zk status")
-	    i=self.handle.expect(["standalone","Error",pexpect.EOF,pexpect.TIMEOUT])
-            if i==0: 
-	        main.log.info(self.name + ": Zookeeper is running.") 
-                return main.TRUE
-            elif i==1:
-	        main.log.error(self.name + ": Error with zookeeper") 
-                main.log.info(self.name + ": Directory used: "+self.home)
-		return main.FALSE
-	    elif i==3:
-		main.log.error(self.name + ": Zookeeper timed out")
-		main.log.info(self.name + ": Directory used: "+self.home)
-		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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()	
-
-    def rcs_status(self):
-        '''
-        This Function will return the Status of the RAMCloud Server
-        '''
-        main.log.info(self.name + ": Getting RC-Server Status")
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh rc-server status")
-        self.handle.expect(["onos.sh rc-server status",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-
-        if re.search("0\sRAMCloud\sserver\srunning", response) :
-            main.log.info(self.name+": RAMCloud not running")
-            return main.TRUE
-        elif re.search("1\sRAMCloud\sserver\srunning",response):
-            main.log.warn(self.name+": RAMCloud Running")
-            return main.TRUE
-        else:
-            main.log.info( self.name+":  WARNING: status recieved unknown response")
-            return main.FALSE
-            
-    def rcc_status(self):
-        '''
-        This Function will return the Status of the RAMCloud Coord
-        '''
-        main.log.info(self.name + ": Getting RC-Coord Status")
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh rc-coord status")
-        i=self.handle.expect(["onos.sh rc-coord status",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-        #return response
-        
-        if re.search("0\sRAMCloud\scoordinator\srunning", response) :
-            main.log.warn(self.name+": RAMCloud Coordinator not running")
-            return main.TRUE
-        elif re.search("1\sRAMCloud\scoordinator\srunning", response):
-            main.log.info(self.name+": RAMCloud Coordinator Running")
-            return main.TRUE
-        else:
-            main.log.warn( self.name+": coordinator status recieved unknown response")
-            return main.FALSE
-
-    def stop(self):
-        '''
-        Runs ./onos.sh core stop to stop ONOS
-        '''
-        try:
-            self.handle.sendline("")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("cd "+self.home)
-            self.handle.sendline("./onos.sh stop")
-            i=self.handle.expect(["Stop",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT], 60)
-            result = self.handle.before
-            if re.search("Killed", result):
-                main.log.info(self.name + ": ONOS Killed Successfully")
-                return main.TRUE
-            else :
-                main.log.warn(self.name + ": ONOS wasn't running")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def start_rest(self):
-        '''
-        Starts the rest server on ONOS.
-        '''
-        try:
-            self.handle.sendline("cd "+self.home)
-            response = self.execute(cmd= "./start-rest.sh start",prompt="\$",timeout=10)
-            if re.search(self.user_name,response):
-                main.log.info(self.name + ": Rest Server Started Successfully")
-                time.sleep(5)
-                return main.TRUE
-            else :
-                main.log.warn(self.name + ": Failed to start Rest Server")
-		main.log.info(self.name + ": Directory used: "+self.home )
-		main.log.info(self.name + ": Rest server response: "+response)
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def rest_stop(self):
-        '''
-        Runs ./start-rest.sh stop to stop ONOS rest server
-        '''
-        try:
-            response = self.execute(cmd= self.home + "./start-rest.sh stop ",prompt="killing",timeout=10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            if re.search("killing", response):
-                main.log.info(self.name + ": Rest Server Stopped")
-                return main.TRUE
-            else :
-                main.log.error(self.name + ": Failed to Stop, Rest Server is not Running")
-		main.log.info(self.name + ": Directory used: "+self.home)
-		main.log.info(self.name + ": Rest server response: " + response)
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def rest_status(self):
-        '''
-        Checks if the rest server is running.
-        '''
-        #this function does not capture the status response correctly...
-        #when cmd is executed, the prompt expected should be a string containing
-        #status message, but instead returns the user@user$ Therefore prompt="running"
-        #was changed to prompt="\$"
-        try:
-            response = self.execute(cmd= self.home + "./start-rest.sh status ",prompt="\$",timeout=10)
-            if re.search(self.user_name,response):
-                main.log.info(self.name + ": Rest Server is running")
-                return main.TRUE
-            elif re.search("rest\sserver\sis\snot\srunning",response):
-                main.log.warn(self.name + ": Rest Server is not Running")
-                return main.FALSE
-            else :
-                main.log.error(self.name + ": No response" +response)
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def disconnect(self):
-        '''
-        Called when Test is complete to disconnect the ONOS handle.
-        '''
-        response = ''
-        try:
-            self.handle.sendline("exit")
-            self.handle.expect("closed")
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-        except:
-            main.log.error(self.name + ": Connection failed to the host")
-            response = main.FALSE
-        return response
- 
-    def print_version(self):
-        '''
-        Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
-        '''
-        try:
-            self.handle.sendline("export TERM=xterm-256color")
-            self.handle.expect("xterm-256color")
-            self.handle.expect("\$")
-            self.handle.sendline("cd " + self.home + "; git log -1 --pretty=fuller | grep -A 5 \"commit\"; cd \.\.")
-            self.handle.expect("cd ..")
-            self.handle.expect("\$")
-            response=(self.name +": \n"+ str(self.handle.before + self.handle.after))
-            main.log.report(response)
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-    def get_version(self):
-        '''
-        Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
-        '''
-        try:
-            self.handle.sendline("export TERM=xterm-256color")
-            self.handle.expect("xterm-256color")
-            self.handle.expect("\$")
-            self.handle.sendline("cd " + self.home + "; git log -1 --pretty=fuller | grep -A 5 \"commit\"; cd \.\.")
-            self.handle.expect("cd ..")
-            self.handle.expect("\$")
-            response=(self.name +": \n"+ str(self.handle.before + self.handle.after))
-            lines=response.splitlines()
-            for line in lines:
-                print line
-            return lines[2]
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def add_flow(self, intentFile, path):
-	try:
-            main.log.info("add_flow running...")
-	    main.log.info("using directory: "+path) 
-            time.sleep(10)
-            self.handle.sendline("cd " + path)
-            self.handle.expect("tests")
-            self.handle.sendline("./"+intentFile)
-            time.sleep(10)
-            self.handle.sendline("cd "+self.home)
-            return main.TRUE
-	except pexepct.EOF:
-	    main.log.error(self.name + ": EOF exception found")
-	    main.log.error(self.name + ":    " + self.handle.before)
-	    main.cleanup()
-	    main.exit()
-	except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-	    main.log.error( traceback.print_exc() )	       
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-	    main.cleanup()
-	    main.exit()
-
-    def delete_flow(self, intentFile, path):
-	try:
-            main.log.info("delete_flow running...")
-	    main.log.info("using directory: " + path)
-	    main.log.info("using file: " + intentFile)
-            self.handle.sendline("cd " + path)
-            self.handle.expect("tests")
-            self.handle.sendline("./" + intentFile)
-            time.sleep(10)
-            self.handle.sendline("cd "+self.home)
-            return main.TRUE
-	except pexepct.EOF:
-	    main.log.error(self.name + ": EOF exception found")
-	    main.log.error(self.name + ":    " + self.handle.before)
-	    main.cleanup()
-	    main.exit()
-	except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-	    main.log.error( traceback.print_exc() )	       
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-	    main.cleanup()
-	    main.exit()	
-
-    def check_flow(self):
-        '''
-        Calls the ./get_flow.py all and checks:
-        - If each FlowPath has at least one FlowEntry
-        - That there are no "NOT"s found
-        returns TRUE/FALSE
-        '''
-        try:
-            flowEntryDetect = 1
-            count = 0
-            self.handle.sendline("clear")
-            time.sleep(1)
-            self.handle.sendline(self.home + "/web/get_flow.py all")
-            self.handle.expect("get_flow")
-            while 1:
-                i=self.handle.expect(['FlowPath','FlowEntry','NOT','\$',pexpect.TIMEOUT],timeout=180)
-                if i==0:
-                    count = count + 1
-                    if flowEntryDetect == 0:
-                        main.log.info(self.name + ": FlowPath without FlowEntry")
-                        return main.FALSE
-                    else:
-                        flowEntryDetect = 0
-                elif i==1:
-                    flowEntryDetect = 1
-                elif i==2:
-                    main.log.error(self.name + ": Found a NOT")
-                    return main.FALSE
-                elif i==3:
-                    if count == 0:
-                        main.log.info(self.name + ": There don't seem to be any flows here...")
-                        return main.FALSE
-                    else:
-                        main.log.info(self.name + ": All flows pass")
-                        main.log.info(self.name + ": Number of FlowPaths: "+str(count))
-                        return main.TRUE
-                elif i==4:
-                    main.log.error(self.name + ":Check_flow() - Command Timeout!")
-            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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def get_flow(self, *flowParams):
-        '''
-        Returns verbose output of ./get_flow.py
-        '''
-        try:
-            if len(flowParams)==1:
-                if str(flowParams[0])=="all":
-                    self.execute(cmd="\n",prompt="\$",timeout=60)
-                    main.log.info(self.name + ": Getting all flow data...")
-                    data = self.execute(cmd=self.home + "/scripts/TestON_get_flow.sh all",prompt="done",timeout=150)
-                    self.execute(cmd="\n",prompt="\$",timeout=60)
-                    return data
-                else:
-                    main.log.info(self.name + ": Retrieving flow "+str(flowParams[0])+" data...")
-                    data = self.execute(cmd=self.home +"/scripts/TestON_get_flow.sh "+str(flowParams[0]),prompt="done",timeout=150)
-                    self.execute(cmd="\n",prompt="\$",timeout=60)
-                    return data
-            elif len(flowParams)==5:
-                main.log.info(self.name + ": Retrieving flow installer data...")
-                data = self.execute(cmd=self.home + "/scripts/TestON_get_flow.sh "+str(flowParams[0])+" "+str(flowParams[1])+" "+str(flowParams[2])+" "+str(flowParams[3])+" "+str(flowParams[4]),prompt="done",timeout=150)
-                self.execute(cmd="\n",prompt="\$",timeout=60)
-                return data
-            elif len(flowParams)==4:
-                main.log.info(self.name + ": Retrieving flow endpoints...")
-                data = self.execute(cmd=self.home + "/scripts/TestON_get_flow.sh "+str(flowParams[0])+" "+str(flowParams[1])+" "+str(flowParams[2])+" "+str(flowParams[3]),prompt="done",timeout=150)
-                self.execute(cmd="\n",prompt="\$",timeout=60)
-                return data
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-# http://localhost:8080/wm/onos/ng/switches/json
-# http://localhost:8080/wm/onos/ng/links/json
-# http://localhost:8080/wm/onos/registry/controllers/json
-# http://localhost:8080/wm/onos/registry/switches/json"
-
-    def get_json(self, url):
-        '''
-        Helper functions used to parse the json output of a rest call
-        '''
-        try:
-            try:
-                command = "curl -s %s" % (url)
-                result = os.popen(command).read()
-                parsedResult = json.loads(result)
-            except:
-                print "REST IF %s has issue" % command
-                parsedResult = ""
-        
-            if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
-                print "REST %s returned code %s" % (command, parsedResult['code'])
-                parsedResult = ""
-            return parsedResult
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def check_switch(self,RestIP,correct_nr_switch, RestPort ="8080" ):
-        '''
-        Used by check_status
-        '''
-        try:
-            buf = ""
-            retcode = 0
-            url="http://%s:%s/wm/onos/topology/switches" % (RestIP, RestPort)
-            parsedResult = self.get_json(url)
-            if parsedResult == "":
-                retcode = 1
-                return (retcode, "Rest API has an issue")
-            url = "http://%s:%s/wm/onos/registry/switches" % (RestIP, RestPort)
-            registry = self.get_json(url)
-        
-            if registry == "":
-                retcode = 1
-                return (retcode, "Rest API has an issue")
-        
-            cnt = 0
-            active = 0
-
-            for s in parsedResult:
-                cnt += 1
-                if s['state'] == "ACTIVE":
-                   active += 1
-
-            buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
-            if correct_nr_switch != cnt:
-                buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
-                retcode = 1
-
-            if correct_nr_switch != active:
-                buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
-                retcode = 1
-        
-            return (retcode, buf)
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def check_link(self,RestIP, nr_links, RestPort = "8080"):
-        '''
-        Used by check_status
-        '''
-        try:
-            buf = ""
-            retcode = 0
-        
-            url = "http://%s:%s/wm/onos/topology/links" % (RestIP, RestPort)
-            parsedResult = self.get_json(url)
-        
-            if parsedResult == "":
-                retcode = 1
-                return (retcode, "Rest API has an issue")
-        
-            buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
-            intra = 0
-            interlink=0
-        
-            for s in parsedResult:
-                intra = intra + 1
-        
-            if intra != nr_links:
-                buf += "link fail\n"
-                retcode = 1
-        
-            return (retcode, buf)
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def check_status_report(self, ip, numoswitch, numolink, port="8080"):
-        '''
-        Checks the number of swithes & links that ONOS sees against the supplied values.
-        Writes to the report log.
-        '''
-        try:
-            main.log.info(self.name + ": Making some rest calls...")
-            switch = self.check_switch(ip, int(numoswitch), port)
-            link = self.check_link(ip, int(numolink), port)
-            value = switch[0]
-            value += link[0]
-            main.log.report( self.name + ": \n-----\n%s%s-----\n" % ( switch[1], link[1]) )
-            if value != 0:
-                return main.FALSE
-            else:
-                # "PASS"
-                return main.TRUE
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def check_status(self, ip, numoswitch, numolink, port = "8080"):
-        '''
-        Checks the number of swithes & links that ONOS sees against the supplied values.
-        Writes to the main log.
-        '''
-        try:
-            main.log.info(self.name + ": Making some rest calls...")
-            switch = self.check_switch(ip, int(numoswitch), port)
-            link = self.check_link(ip, int(numolink), port)
-            value = switch[0]
-            value += link[0]
-            main.log.info(self.name + ": \n-----\n%s%s-----\n" % ( switch[1], link[1]) )
-            if value != 0:
-                return main.FALSE
-            else:
-                # "PASS"
-                return main.TRUE
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
- 
-    def check_for_no_exceptions(self):
-        '''
-        TODO: Rewrite
-        Used by CassndraCheck.py to scan ONOS logs for Exceptions
-        '''
-        try:
-            self.handle.sendline("dsh 'grep Exception ~/ONOS/onos-logs/onos.*.log'")
-            self.handle.expect("\$ dsh")
-            self.handle.expect("\$")
-            output = self.handle.before
-            main.log.info(self.name + ": " + output )
-            if re.search("Exception",output):
-                return main.FALSE
-            else :
-                return main.TRUE
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-    def git_pull(self, comp1=""):
-        '''
-        Assumes that "git pull" works without login
-        
-        This function will perform a git pull on the ONOS instance.
-        If used as git_pull("NODE") it will do git pull + NODE. This is
-        for the purpose of pulling from other nodes if necessary.
-
-        Otherwise, this function will perform a git pull in the 
-        ONOS repository. If it has any problems, it will return main.ERROR
-        If it successfully does a git_pull, it will return a 1.
-        If it has no updates, it will return a 0.
-
-        '''
-        try:
-            main.log.info(self.name + ": Stopping ONOS")
-            self.stop()
-            self.handle.sendline("cd " + self.home)
-            self.handle.expect("ONOS\$")
-            if comp1=="":
-                self.handle.sendline("git pull")
-            else:
-                self.handle.sendline("git pull " + comp1)
-           
-            uptodate = 0
-            i=self.handle.expect(['fatal','Username\sfor\s(.*):\s','Unpacking\sobjects',pexpect.TIMEOUT,'Already up-to-date','Aborting'],timeout=1800)
-            #debug
-           #main.log.report(self.name +": \n"+"git pull response: " + str(self.handle.before) + str(self.handle.after))
-            if i==0:
-                main.log.error(self.name + ": Git pull had some issue...")
-                return main.ERROR
-            elif i==1:
-                main.log.error(self.name + ": Git Pull Asking for username!!! BADD!")
-                return main.ERROR
-            elif i==2:
-                main.log.info(self.name + ": Git Pull - pulling repository now")
-                self.handle.expect("ONOS\$", 120)
-                return 0
-            elif i==3:
-                main.log.error(self.name + ": Git Pull - TIMEOUT")
-                return main.ERROR
-            elif i==4:
-                main.log.info(self.name + ": Git Pull - Already up to date")
-                return 1
-            elif i==5:
-                main.log.info(self.name + ": Git Pull - Aborting... Are there conflicting git files?")
-                return main.ERROR
-            else:
-                main.log.error(self.name + ": Git Pull - Unexpected response, check for pull errors")
-                return main.ERROR
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-#********************************************************           
-
-
-    def git_compile(self):
-        '''
-        Compiles ONOS
-        First runs mvn clean then mvn compile
-        '''
-        try:
-            main.log.info(self.name + ": mvn clean")
-            self.handle.sendline("cd " + self.home)
-            self.handle.sendline("mvn clean")
-            while 1:
-                i=self.handle.expect(['There\sis\sinsufficient\smemory\sfor\sthe\sJava\sRuntime\sEnvironment\sto\scontinue','BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=30)
-                if i == 0:
-                    main.log.error(self.name + ":There is insufficient memory for the Java Runtime Environment to continue.")
-                    return main.FALSE
-                elif i == 1:
-                    main.log.error(self.name + ": Clean failure!")
-                    return main.FALSE
-                elif i == 2:
-                    main.log.info(self.name + ": Clean success!")
-                elif i == 3:
-                    main.log.info(self.name + ": Clean complete")
-                    break;
-                elif i == 4:
-                    main.log.error(self.name + ": mvn clean TIMEOUT!")
-                    return main.FALSE
-                else:
-                    main.log.error(self.name + ": unexpected response from mvn clean")
-                    return main.FALSE
-        
-            main.log.info(self.name + ": mvn compile")
-            self.handle.sendline("mvn compile")
-            while 1:
-                i=self.handle.expect(['There\sis\sinsufficient\smemory\sfor\sthe\sJava\sRuntime\sEnvironment\sto\scontinue','BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=60)
-                if i == 0:
-                    main.log.error(self.name + ":There is insufficient memory for the Java Runtime Environment to continue.")
-                    return main.FALSE
-                if i == 1:
-                    main.log.error(self.name + ": Build failure!")
-                    return main.FALSE
-                elif i == 2:
-                    main.log.info(self.name + ": Build success!")
-                    return main.TRUE
-                elif i == 3:
-                    main.log.info(self.name + ": Build complete")
-                    return main.TRUE
-                elif i == 4:
-                    main.log.error(self.name + ": mvn compile TIMEOUT!")
-                    return main.FALSE
-                else:
-                    main.log.error(self.name + ": unexpected response from mvn compile")
-                    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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def tcpdump(self, intf = "eth0"):
-        '''
-        Runs tpdump on an intferface and saves in onos-logs under the ONOS home directory
-        intf can be specified, or the default eth0 is used
-        '''
-        try:
-            self.handle.sendline("")
-            self.handle.expect("\$")
-            self.handle.sendline("sudo tcpdump -n -i "+ intf + " -s0 -w " + self.home +"/onos-logs/tcpdump &")
-            i=self.handle.expect(['No\ssuch\device','listening\son',pexpect.TIMEOUT],timeout=10)
-            if i == 0:
-                main.log.error(self.name + ": tcpdump - No such device exists. tcpdump attempted on: " + intf)
-                return main.FALSE
-            elif i == 1:
-                main.log.info(self.name + ": tcpdump started on " + intf)
-                return main.TRUE
-            elif i == 2:
-                main.log.error(self.name + ": tcpdump command timed out! Check interface name, given interface was: " + intf)
-                return main.FALSE
-            else:
-                main.log.error(self.name + ": tcpdump - unexpected response")
-            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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def kill_tcpdump(self):
-        '''
-        Kills any tcpdump processes running
-        '''
-        try:
-            self.handle.sendline("")
-            self.handle.expect("\$")
-            self.handle.sendline("sudo kill -9 `ps -ef | grep \"tcpdump -n\" | grep -v grep | awk '{print $2}'`")
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def find_host(self,RestIP,RestPort,RestAPI,hostIP):
-        retcode = 0
-        retswitch = []
-        retport = []
-        retmac = []
-        foundIP = []
-        try:
-            ##### device rest API is: 'host:8080/wm/onos/ng/switches/json' ###
-            url ="http://%s:%s%s" %(RestIP,RestPort,RestAPI)
-            print url
-
-            try:
-                command = "curl -s %s" % (url)
-                result = os.popen(command).read()
-                parsedResult = json.loads(result)
-                print parsedResult
-            except:
-                print "REST IF %s has issue" % command
-                parsedResult = ""
-
-            if parsedResult == "":
-                return (retcode, "Rest API has an error", retport, retmac)
-            else:
-                for switch in enumerate(parsedResult):
-                    #print switch
-                    for port in enumerate(switch[1]['ports']):
-                        if ( port[1]['devices'] != [] ):
-                            try:
-                                foundIP = port[1]['devices'][0]['ipv4addresses'][0]['ipv4']
-                            except:
-                                print "Error in detecting IP address."
-                            if foundIP == hostIP:
-                                retswitch.append(switch[1]['dpid'])
-                                retport.append(port[1]['desc'])
-                                retmac.append(port[1]['devices'][0]['mac'])
-                                retcode = retcode +1
-                                foundIP =''
-            return(retcode, retswitch, retport, retmac)
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-#Perf test related functions
-
-    def addPerfFlows(self, flowdef, numflows):
-        main.log.info("ADD_FLOW RUNNING!!!! ")
-        startTime=time.time()
-        self.execute(cmd="/home/admin/ONOS/scripts"+"/add_"+str(numflows)+".py",prompt="\$",timeout=10)
-        elapsedTime=time.time()-startTime
-        main.log.info("AddFlows script run time: " + str(elapsedTime) + " seconds")
-        time.sleep(15)
-        return main.TRUE
-
-    def removePerfFlows(self, flowdef, numflows):
-        main.log.info("REMOVE_FLOW RUNNING!!!! ")
-        startTime=time.time()
-        self.execute(cmd="/home/admin/ONOS/scripts"+"/remove_"+str(numflows)+".py",prompt="\$",timeout=10)
-        elapsedTime=time.time()-startTime
-        main.log.info("RemoveFlows script run time: " + str(elapsedTime) + " seconds")
-        time.sleep(15)
-        return main.TRUE
-
-    def start_tshark(self,flowtype, numflows):
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.execute(cmd='''rm /tmp/wireshark*''')
-        self.handle.sendline("y")
-        self.handle.expect("\$")
-        self.execute(cmd='''tshark -i lo -t e | grep --color=auto CSM | grep --color=auto -E 'Flow|Barrier' > /tmp/tdump_'''+flowtype+"_"+str(numflows)+".txt &",prompt="Capturing",timeout=10)
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        main.log.info("TSHARK STARTED!!!")
-        return main.TRUE
-
-    def stop_tshark(self):
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo kill -9 `ps -ef | grep \"tshark -i\" | grep -v grep | awk '{print $2}'`")
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        main.log.info("TSHARK STOPPED!!!")
-        return main.TRUE
-
-    def generateFlows(self, flowdef, flowtype, numflows, ip):
-        main.log.info("GENERATE FLOWS RUNNING!!!")
-        #main.log.info("Test" + flowdef+"/"+flowtype+"_"+str(numflows)+".py")
-        f = open(flowdef+"/"+flowtype+"_"+str(numflows)+".py", 'w')
-        f.write('''#! /usr/bin/python\n''')
-        f.write('import json\n')
-        f.write('import requests\n')
-        f.write('''url = 'http://'''+ip+''':8080/wm/onos/datagrid/add/intents/json'\n''')
-        f.write('''headers = {'Content-type': 'application/json', 'Accept': 'application/json'}\n''') 
-        
-        intents = []
-        idx = 0
-        for i in range(6,(numflows+6)):
-	    mac3 = idx / 255
-	    mac4 = idx % 255
-	    str_mac3 = "%0.2x" % mac3
-	    str_mac4 = "%0.2x" % mac4
-	    srcMac = '00:01:'+str_mac3+':'+str_mac4+':00:00'
-	    dstMac = '00:02:'+str_mac3+':'+str_mac4+':00:00'
-	    srcSwitch = '00:00:00:00:00:00:10:00'
-	    dstSwitch = '00:00:00:00:00:00:10:00'
-	    srcPort = 1
-	    dstPort = 2
-	
-	    intent = {'intent_id': '%d' %(i),'intent_type':'shortest_intent_type','intent_op':flowtype,'srcSwitch':srcSwitch,'srcPort':srcPort,'srcMac':srcMac,'dstSwitch':dstSwitch,'dstPort':dstPort,'dstMac':dstMac}
-	    intents.append(intent)
-	    idx = idx + 1
-        f.write('''s=''')
-        f.write(json.dumps(intents, sort_keys = True))
-        f.write('''\nr = requests.post(url, data=json.dumps(s), headers = headers)''')
-        #f.flush()
-        #subprocess.Popen(flowdef, stdout=f, stderr=f, shell=True)
-        #f.close()
-        os.system("chmod a+x "+flowdef+"/"+flowtype+"_"+str(numflows)+".py")
-        
-        return main.TRUE
-    
-    def getFile(self, numflows, ip, directory, flowparams):
-        main.log.info("GETTING FILES FROM TEST STATION: "+str(ip))
-        #for i in range(0,3):
-        print str(numflows) + " "+str(flowparams[numflows])
-        self.handle.sendline("scp admin@10.128.7.7:/home/admin/TestON/tests/OnosFlowPerf/add_"+str(flowparams[numflows])+".py admin@10.128.5.51:/home/admin/ONOS/scripts/" )
-            
-        self.handle.sendline("scp admin@10.128.7.7:/home/admin/TestON/tests/OnosFlowPerf/remove_"+str(flowparams[numflows])+".py admin@10.128.5.51:/home/admin/ONOS/scripts/" ) 
-
-        return main.TRUE
-
-    def printPerfResults(self, flowtype, numflows, stime):
-        import datetime  
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        for (i,j) in zip(numflows,stime):
-            startTime=datetime.datetime.fromtimestamp(j)
-            tshark_file=open("/tmp/tdump_"+flowtype+"_"+str(i)+".txt",'r')
-            allFlowmods=tshark_file.readlines()
-            time.sleep(5)
-            firstFlowmod=allFlowmods[0]
-            lastBarrierReply=allFlowmods[-1]
-            #self.handle.sendline("")
-            #self.handle.expect("\$")
-            #self.handle.sendline("head -1 /tmp/tdump_"+flowtype+"_"+str(i)+".txt")
-            #self.handle.expect("\(CSM\)")
-            #firstFlowmod=self.handle.before
-            #firstFlowmod=self.execute(cmd="head -1 /tmp/tdump_"+flowtype+"_"+str(i)+".txt",prompt="\$",timeout=10)
-            #lastBarrierReply=self.execute(cmd="tail -n 1 /tmp/tdump_"+flowtype+"_"+str(i)+".txt",prompt="\$",timeout=10)
-            firstFlowmodSplit=firstFlowmod.split()
-            firstFlowmodTS=datetime.datetime.fromtimestamp(float(firstFlowmodSplit[0]))
-            lastBarrierSplit=lastBarrierReply.split()
-            lastBarrierTS=datetime.datetime.fromtimestamp(float(lastBarrierSplit[0]))
-            main.log.report("Number of Flows: " + str(i))
-            #main.log.info("Add Flow Start Time: " + str(startTime))
-            main.log.report("First Flow mod seen after: " + str(float(datetime.timedelta.total_seconds(firstFlowmodTS-startTime)*1000))+"ms")
-            main.log.report("Last Barrier Reply seen after: " + str(float(datetime.timedelta.total_seconds(lastBarrierTS-startTime)*1000))+"ms\n")
-            main.log.report("Total Flow Setup Delay(from first flowmod): " + str(float(datetime.timedelta.total_seconds(lastBarrierTS-firstFlowmodTS)*1000))+"ms")
-            main.log.report("Total Flow Setup Delay(from start): " + str(float(datetime.timedelta.total_seconds(lastBarrierTS-startTime)*1000))+"ms\n")
-            main.log.report("Flow Setup Rate (using first flowmod TS): " + str(int(1000/datetime.timedelta.total_seconds(lastBarrierTS-firstFlowmodTS)))+" flows/sec")
-            main.log.report("Flow Setup Rate (using start time): " + str(int(1000/datetime.timedelta.total_seconds(lastBarrierTS-startTime)))+" flows/sec")
-            print "*****************************************************************"
-            #main.log.info("first: " + str(firstFlowmod))
-            #main.log.info(firstFlowmodSplit)
-            #main.log.info("last: " + str(lastBarrierReply))
-            tshark_file.close()
-        return main.TRUE
-
-    def isup(self):
-        '''
-        A more complete check to see if ONOS is up and running properly.
-        First, it checks if the process is up.
-        Second, it reads the logs for "Exception: Connection refused"
-        Third, it makes sure the logs are actually moving.
-        returns TRUE/FALSE accordingly.
-        '''
-        try:
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            self.handle.sendline("cd "+self.home)
-            response = self.execute(cmd= "./onos.sh core status ",prompt="running",timeout=10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            tail1 = self.execute(cmd="tail " + self.home + "/onos-logs/onos.*.log",prompt="\$",timeout=10)
-            time.sleep(10)
-            self.execute(cmd="\n",prompt="\$",timeout=10)
-            tail2 = self.execute(cmd="tail " + self.home + "/onos-logs/onos.*.log",prompt="\$",timeout=10)
-            pattern = '(.*)1 instance(.*)'
-            patternUp = 'Sending LLDP out'
-            pattern2 = '(.*)Exception: Connection refused(.*)'
-           # if utilities.assert_matches(expect=pattern,actual=response,onpass="ONOS process is running...",onfail="ONOS process not running..."):
-            
-            if re.search(pattern, response):
-                if re.search(patternUp,tail2):
-                    main.log.info(self.name + ": ONOS process is running...")
-                    if tail1 == tail2:
-                        main.log.error(self.name + ": ONOS is frozen...")#logs aren't moving
-                        return main.FALSE
-                    elif re.search( pattern2,tail1 ):
-                        main.log.info(self.name + ": Connection Refused found in onos log")
-                        return main.FALSE
-                    elif re.search( pattern2,tail2 ):
-                        main.log.info(self.name + ": Connection Refused found in onos log")
-                        return main.FALSE
-                    else:
-                        main.log.info(self.name + ": Onos log is moving! It's looking good!")
-                        return main.TRUE
-                else:
-                    main.log.info(self.name + ": ONOS not yet sending out LLDP messages")
-                    return main.FALSE
-            else:
-                main.log.error(self.name + ": ONOS process not running...")
-                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:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-    def sendline(self, cmd):
-        self.handle.sendline(cmd)
diff --git a/TestON/drivers/common/cli/ramcloudclidriver.py b/TestON/drivers/common/cli/ramcloudclidriver.py
deleted file mode 100644
index 5b19508..0000000
--- a/TestON/drivers/common/cli/ramcloudclidriver.py
+++ /dev/null
@@ -1,289 +0,0 @@
-#!/usr/bin/env python
-'''
-Created on 31-May-2013
-
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
-
-
-    TestON is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
-
-    TestON is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.        
-
-
-RamCloudCliDriver is the basic driver which will handle the RamCloud server functions
-'''
-
-import pexpect
-import struct
-import fcntl
-import os
-import signal
-import re
-import sys
-import core.teston
-import time
-
-sys.path.append("../")
-from drivers.common.clidriver import CLI
-
-class RamCloudCliDriver(CLI):
-    '''
-RamCloudCliDriver is the basic driver which will handle the RamCloud server functions
-    '''
-    def __init__(self):
-        super(CLI, self).__init__()
-        self.handle = self
-        self.wrapped = sys.modules[__name__]
-
-    def connect(self, **connectargs):
-        # Here the main is the TestON instance after creating all the log handles.
-        self.port = None
-        for key in connectargs:
-            vars(self)[key] = connectargs[key]       
-        self.home = "~/ONOS"
-        for key in self.options:
-           if key == "ONOShome":
-               self.home = self.options['ONOShome']
-               break
-
-        
-        self.name = self.options['name']
-        self.handle = super(RamCloudCliDriver, self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd, home = self.home)
-        
-        self.ssh_handle = self.handle
-        if self.handle :
-            return main.TRUE
-        else :
-            main.log.error(self.name+": Connection failed to the host "+self.user_name+"@"+self.ip_address) 
-            main.log.error(self.name+": Failed to connect to the Onos system")
-            return main.FALSE
-
-    def kill_serv(self):
-        import re
-        try: 
-            self.handle.sendline("ps -ef |grep 'master/server' |awk 'NR==1 {print $2}' |xargs sudo kill -9")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("ps -ef |grep 'master/server' |wc -l")
-            self.handle.expect(["wc -l",pexpect.EOF,pexpect.TIMEOUT])
-            response = self.handle.after
-            if re.search("1",response):
-                return "RAMCloud Server Killed!"
-            else:
-                return "ERROR!!! RAMCLOUd SERVER MAY NOT HAVE BEEN KILLED PROPERLY!!!"
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.hane + ":    " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit() 
-   
-    def kill_coord(self):
-        import re
-        try: 
-            self.handle.sendline("ps -ef |grep 'master/coordinator' |awk 'NR==1 {print $2}' |xargs sudo kill -9")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("ps -ef |grep 'master/coordinator' |wc -l")
-            self.handle.expect(["wc -l",pexpect.EOF,pexpect.TIMEOUT])
-            response = self.handle.after
-            if re.search("1",response):
-                return "RAMCloud Coordinator Killed!"
-            else:
-                return "ERROR!!! RAMCLOUD COORDINATOR MAY NOT HAVE BEEN KILLED PROPERLY!!!"
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.hane + ":    " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-   
- 
-    def start_serv(self):
-        '''
-        This Function will start RamCloud Servers
-        '''
-        main.log.info(self.name+": Starting RAMCloud Server" )
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh rc-server start")
-        self.handle.expect(["onos.sh rc-server start",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-        #print ("RESPONSE IS: "+response)
-        time.sleep(5)
-        if re.search("Killed\sexisting\sprocess", response):
-            main.log.info(self.name + ": Previous RAMCloud killed. ")
-            if re.search("Starting\sRAMCloud\sserver",response):
-                main.log.info(self.name + ": RAMCloud Server Started")
-                return main.TRUE
-            else:
-                main.log.info(self.name + ": Failed to start RAMCloud Server"+response)
-                return main.FALSE
-        elif re.search("Starting\sRAMCloud\sserver",response):
-            main.log.info(self.name + ": RAMCloud Server Started")
-            return main.TRUE
-        else:
-            main.log.info(self.name + ": Failed to start RAMCloud Server"+response)
-            return main.FALSE
-
- 
-    def start_coor(self):
-        '''
-        This Function will start RamCloud
-        '''
-        main.log.info(self.name+": Starting RAMCloud Coordinator" )
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh rc-coord start")
-        self.handle.expect(["onos.sh rc-coord start",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-        if re.search("Starting\sRAMCloud\scoordinator\s", response):
-            if re.search("Killed\sexisting\sprocess", response):
-                main.log.warn(self.name+": Process was already running, killing existing process")
-            main.log.info(self.name+": RAMCloud Coordinator Started ")
-            return main.TRUE
-        else:
-            main.log.error(self.name+": Failed to start RAMCloud Coordinator"+ response)
-            return main.FALSE
-
-    def status_serv(self):
-        '''
-        This Function will return the Status of the RAMCloud
-        '''
-        main.log.info(self.name + ": Getting RC-Server Status")
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh rc-server status")
-        self.handle.expect(["onos.sh rc-server status",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-
-        if re.search("0\sRAMCloud\sserver\srunning", response) :
-            main.log.info(self.name+": RAMCloud not running")
-            return main.FALSE
-        elif re.search("1\sRAMCloud\sserver\srunning",response):
-            main.log.warn(self.name+": RAMCloud Running")
-            return main.TRUE
-        else:
-            main.log.info( self.name+":  WARNING: status recieved unknown response")
-            return main.FALSE
-            
-    def status_coor(self):
-        '''
-        This Function will return the Status of the RAMCloud
-        '''
-        main.log.info(self.name + ": Getting RC-Coord Status")
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh rc-coord status")
-        i=self.handle.expect(["onos.sh rc-coord status",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-        #return response
-        
-        if re.search("0\sRAMCloud\scoordinator\srunning", response) :
-            main.log.warn(self.name+": RAMCloud Coordinator not running")
-            return main.FALSE
-        elif re.search("1\sRAMCloud\scoordinator\srunning", response):
-            main.log.info(self.name+": RAMCloud Coordinator Running")
-            return main.TRUE
-        else:
-            main.log.warn( self.name+": coordinator status recieved unknown response")
-            return main.FALSE
-
-    def stop_serv(self):
-        '''
-        This Function will stop the RAMCloud if it is Running
-        '''
-        main.log.info(self.name + ": Stopping RC-Server")
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh rc-server stop")
-        self.handle.expect(["onos.sh rc-server stop",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-        if re.search("Killed\sexisting\sprocess",response):
-            main.log.info("RAMCloud Server Stopped")
-            return main.TRUE
-        else:
-            main.log.warn(self.name+": RAMCloud is not Running")
-            return main.FALSE
-
-    def del_db(self):
-        '''
-        This function will clean out the database
-        '''
-        main.log.info(self.name + ": Deleting RC Database")
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh rc deldb")
-        self.handle.expect(["\[y/N\]",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("y")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-        if re.search("DONE",response) or re.search("Terminated",response):
-            main.log.info("RAMCloud Database Cleaned")
-            return main.TRUE
-        else:
-            main.log.warn("Something wrong in Cleaning Database")
-            main.log.warn(self.handle.before)
-            return main.FALSE
-           
-
-    def stop_coor(self):
-        '''
-        This Function will stop the RAMCloud if it is Running
-        ''' 
-        main.log.info(self.name + ": Stopping RC-Coord")
-        self.handle.sendline("")
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline( "./onos.sh rc-coord stop")
-        self.handle.expect(["onos.sh rc-coord stop",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before + self.handle.after
-        if re.search("Killed\sexisting\sprocess",response):
-            main.log.info(self.name+": RAMCloud Coordinator Stopped")
-            return main.TRUE
-        else:
-            main.log.warn(self.name+": RAMCloud was not Running")
-            return main.FALSE
- 
-    def disconnect(self):
-        ''' 
-        Called at the end of the test to disconnect the ssh handle. 
-        ''' 
-        response = ''
-        if self.handle:
-            self.handle.sendline("exit")
-            self.handle.expect(["closed",pexpect.EOF,pexpect.TIMEOUT])
-        else :
-            main.log.error("Connection failed to the host when trying to disconnect from RAMCloud component")
-            response = main.FALSE
-        return response 
diff --git a/TestON/drivers/common/cli/ramcloudclidriver.py.wip b/TestON/drivers/common/cli/ramcloudclidriver.py.wip
deleted file mode 100644
index 6a961ee..0000000
--- a/TestON/drivers/common/cli/ramcloudclidriver.py.wip
+++ /dev/null
@@ -1,151 +0,0 @@
-#!/usr/bin/env python
-'''
-Created on 31-May-2013
-
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
-
-
-    TestON is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
-
-    TestON is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.        
-
-
-CassandraCliDriver is the basic driver which will handle the Cassandra functions
-'''
-
-import pexpect
-import struct
-import fcntl
-import os
-import signal
-import re
-import sys
-import core.teston
-import time
-
-sys.path.append("../")
-from drivers.common.clidriver import CLI
-
-class CassandraCliDriver(CLI):
-    '''
-    CassandraCliDriver is the basic driver which will handle the Cassandra's functions
-    '''
-    def __init__(self):
-        super(CLI, self).__init__()
-        self.handle = self
-        self.wrapped = sys.modules[__name__]
-
-    def connect(self, **connectargs):
-        # Here the main is the TestON instance after creating all the log handles.
-        self.port = None
-        for key in connectargs:
-            vars(self)[key] = connectargs[key]       
-        
-        self.name = self.options['name']
-        self.handle = super(CassandraCliDriver, self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
-        
-        self.ssh_handle = self.handle
-        if self.handle :
-            #self.start()
-            return main.TRUE
-        else :
-            main.log.error("Connection failed to the host "+self.user_name+"@"+self.ip_address) 
-            main.log.error("Failed to connect to the Onos system")
-            return main.FALSE
-   
- 
-    def start(self):
-        '''
-        This Function will start the Cassandra
-        '''
-        main.log.info( "Starting Cassandra" )
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("~/ONOS/start-cassandra.sh start")
-        self.handle.expect("start-cassandra.sh start")
-        self.handle.expect("\$")
-        response = self.handle.before + self.handle.after
-        time.sleep(5)
-        if re.search("Starting\scassandra(.*)", response):
-            main.log.info("Cassandra Started ")
-            return main.TRUE
-        else:
-            main.log.error("Failed to start Cassandra"+ response)
-            return main.FALSE
-        
-    def status(self):
-        '''
-        This Function will return the Status of the Cassandra
-        '''
-        time.sleep(5)
-        self.execute(cmd="\r",prompt="\$",timeout=10)
-        response = self.execute(cmd="~/ONOS/start-cassandra.sh status ",prompt="\d+\sinstance\sof\scassandra\srunning(.*)",timeout=10)
-        
-
-        self.execute(cmd="\r",prompt="\$",timeout=10)
-        return response
-        
-        if re.search("0\sinstance\sof\scassandra\srunning(.*)") :
-            main.log.info("Cassandra not running")
-            return main.TRUE
-        elif re.search("1\sinstance\sof\scassandra\srunning(.*)"):
-            main.log.warn("Cassandra Running")
-            return main.TRUE
-            
-    def stop(self):
-        '''
-        This Function will stop the Cassandra if it is Running
-        ''' 
-        self.execute(cmd="\r",prompt="\$",timeout=10)
-        time.sleep(5)
-        response = self.execute(cmd="~/ONOS/start-cassandra.sh stop ",prompt="Killed\sexisting\sprosess(.*)",timeout=10)
-        self.execute(cmd="\r",prompt="\$",timeout=10)
-        if re.search("Killed\sexisting\sprosess(.*)",response):
-            main.log.info("Cassandra Stopped")
-            return main.TRUE
-        else:
-            main.log.warn("Cassndra is not Running")
-            return main.FALSE
-            
-    def disconnect(self):
-        ''' 
-        Called at the end of the test to disconnect the ssh handle. 
-        ''' 
-        response = ''
-        if self.handle:
-            self.handle.sendline("exit")
-            self.handle.expect("closed")
-        else :
-            main.log.error("Connection failed to the host")
-            response = main.FALSE
-        return response 
-
-    def isup(self):
-        '''
-        A more complete status check of cassandra.
-        Tries 5 times to call start-cassandra.sh status
-        returns TRUE if it sees four occurances of both Up, and Normal 
-        '''
-        tries = 5
-        main.log.info("trying %i times" % tries )
-        for i in range(tries):
-            self.execute(cmd="\r",prompt="\$",timeout=10)
-            self.handle.sendline("")
-            self.handle.expect("\$") 
-            self.handle.sendline("~/ONOS/start-cassandra.sh status")
-            self.handle.expect("sh status") 
-            self.handle.expect("\$") 
-            result = self.handle.before + self.handle.after 
-            pattern = '(.*)Up(.*)Normal(.*)\n(.*)Up(.*)Normal(.*)\n(.*)Up(.*)Normal(.*)\n(.*)Up(.*)Normal(.*)'
-            if re.search(pattern, result): 
-                return main.TRUE
-        return main.FALSE
diff --git a/TestON/drivers/common/cli/sdnipclidriver.py b/TestON/drivers/common/cli/sdnipclidriver.py
deleted file mode 100644
index 58dfb03..0000000
--- a/TestON/drivers/common/cli/sdnipclidriver.py
+++ /dev/null
@@ -1,73 +0,0 @@
-import time
-import pexpect
-import struct, fcntl, os, sys, signal
-import sys
-import re
-import json
-sys.path.append("../")
-from drivers.common.clidriver import CLI
-
-
-class SDNIPCliDriver(CLI):
-
-    def __init__(self):
-        super(CLI, self).__init__()
-
-    def connect(self, **connectargs):
-        for key in connectargs:
-            vars(self)[key] = connectargs[key]
-
-        self.name = self.options['name']
-        self.handle = super(SDNIPCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
-
-        if self.handle:
-            return self.handle
-        else :
-            main.log.info("NO HANDLE")
-            return main.FALSE
-    
-    def check_routes(self, brand, ip, user, pw):
-        self.handle.sendline("")
-        self.handle.expect("\$")    
-        main.log.info("Connecting to Pronto switch")
-        child = pexpect.spawn("telnet " + ip)
-        i = child.expect(["login:", "CLI#",pexpect.TIMEOUT])
-        if i == 0:
-            main.log.info("Username and password required. Passing login info.")
-            child.sendline(user)
-            child.expect("Password:")
-            child.sendline(pw)
-            child.expect("CLI#")
-        main.log.info("Logged in, getting flowtable.")
-        child.sendline("flowtable brief")
-        for t in range (9):
-            t2 = 9 - t
-            main.log.info("\r" + str(t2))
-            sys.stdout.write("\033[F")
-            time.sleep(1)
-        time.sleep(10)
-        main.log.info("Scanning flowtable")
-        child.expect("Flow table show")
-        count = 0
-        while 1:
-            i = child.expect(['17\d\.\d{1,3}\.\d{1,3}\.\d{1,3}','CLI#',pexpect.TIMEOUT])
-            if i == 0:
-                count = count + 1
-            elif i == 1:
-                a ="Pronto flows: " + str(count) + "\nDone\n"
-                main.log.info(a)
-                break
-            else:
-                break
-        return count
-    def disconnect(self):
-        '''
-        Called when Test is complete to disconnect the Quagga handle.  
-        '''
-        response = ''
-        try:
-            self.handle.close()
-        except:
-            main.log.error("Connection failed to the host")
-            response = main.FALSE
-        return response
diff --git a/TestON/drivers/common/cli/zookeeperclidriver.py b/TestON/drivers/common/cli/zookeeperclidriver.py
deleted file mode 100644
index 9a35366..0000000
--- a/TestON/drivers/common/cli/zookeeperclidriver.py
+++ /dev/null
@@ -1,197 +0,0 @@
-#!/usr/bin/env python
-'''
-Created on 31-May-2013
-
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
-
-
-    TestON is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
-
-    TestON is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.        
-
-
-ZookeeperCliDriver is the basic driver which will handle the Zookeeper functions
-'''
-
-import pexpect
-import struct
-import fcntl
-import os
-import signal
-import re
-import sys
-import core.teston
-import time
-
-sys.path.append("../")
-from drivers.common.clidriver import CLI
-
-class ZookeeperCliDriver(CLI):
-    '''
-    ZookeeperCliDriver is the basic driver which will handle the Zookeeper's functions
-    '''
-    def __init__(self):
-        super(CLI, self).__init__()
-        self.handle = self
-        self.wrapped = sys.modules[__name__]
-
-    def kill(self):
-        import re
-        try: 
-            self.handle.sendline("ps -ef |grep 'zookeeper.log.dir' |awk 'NR==1 {print $2}' |xargs sudo kill -9")
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.sendline("ps -ef |grep 'zookeeper.log.dir' |wc -l")
-            self.handle.expect(["wc -l",pexpect.EOF,pexpect.TIMEOUT])
-            response = self.handle.after
-            if re.search("1",response):
-                return "Zookeeper Killed!"
-            else:
-                return "ERROR!!! ZOOKEEPER MAY NOT HAVE BEEN KILLED PROPERLY!!!"
-        except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.hane + ":    " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
-            main.cleanup()
-            main.exit()
-
-
-
-    def connect(self, **connectargs):
-        # Here the main is the TestON instance after creating all the log handles.
-        self.port = None
-        for key in connectargs:
-            vars(self)[key] = connectargs[key]       
-        self.home = "~/ONOS"
-        self.zkhome = "~/zookeeper-3.4.6"
-        self.clustername = "sanity-rc-onos"
-        #self.home = "~/zookeeper-3.4.5"
-        for key in self.options:
-            if key == "home":
-                self.home = self.options['home']
-                break
-        
-        self.name = self.options['name']
-        self.handle = super(ZookeeperCliDriver, self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd, home = self.home)
-        
-        self.ssh_handle = self.handle
-        if self.handle :
-            return main.TRUE
-        else :
-            main.log.error("Connection failed to the host "+self.user_name+"@"+self.ip_address) 
-            main.log.error(self.name + ": Failed to connect to Zookeeper")
-            return main.FALSE
-   
- 
-    def start(self):
-        '''
-        This Function will start the Zookeeper
-        '''
-        main.log.info(self.name + ": Starting Zookeeper" )
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("cd "+self.home)
-        self.handle.sendline("./onos.sh zk start")
-        self.handle.expect("zk start") 
-        self.handle.expect("\$")
-        response = self.handle.before + self.handle.after 
-        if re.search("STARTED", response):
-            main.log.info(self.name + ": Zookeeper Started ")
-            return main.TRUE
-        elif re.search("running", response):
-            main.log.warn(self.name +": zookeeper ... already running")
-            return main.TRUE
-        else:
-            main.log.error(self.name + ": Failed to start Zookeeper"+ response)
-            return main.FALSE
-        
-    def status(self):
-        '''
-        This Function will return the Status of the Zookeeper 
-        '''
-        self.execute(cmd="\n",prompt="\$",timeout=10)
-        self.handle.sendline("cd "+self.home)
-        response = self.execute(cmd="./onos.sh zk status ",prompt="JMX",timeout=10)
-        response=self.handle.after
-        self.execute(cmd="\n",prompt="\$",timeout=10)
-        return self.handle.before + self.handle.after
-        
-    def stop(self):
-        '''
-        This Function will stop the Zookeeper if it is Running
-        ''' 
-        self.execute(cmd="\n",prompt="\$",timeout=10)
-        time.sleep(1)
-        self.handle.sendline("cd "+self.home)
-        response = self.execute(cmd="./onos.sh zk stop ",prompt="$",timeout=10)
-        if re.search("stopping",response):
-            main.log.info(self.name + ": Zookeeper Stopped")
-            return main.TRUE
-        else:
-            main.log.warn(self.name + ": No zookeeper to stop")
-            return main.FALSE
-            
-    def disconnect(self):
-        ''' 
-        Called at the end of the test to disconnect the ZK handle 
-        ''' 
-        response = ''
-        if self.handle:
-            self.handle.sendline("exit")
-            self.handle.expect("closed")
-        else :
-            main.log.error(self.name + ": Connection failed to the host")
-            response = main.FALSE
-        return response 
-   
-#**********************************************************************************************
-#**********************************************************************************************
-# findMaster is used to determine the master controller of a switch. 
-# it uses the switchList which is a json dict, and finds the first controller of 
-# each switch
-#**********************************************************************************************
-#**********************************************************************************************
-
-
-    def findMaster(self, switchDPID, switchList):
-        import json
-        decoded = json.loads(switchList)
-        if switchList=="":
-            return "NO CONTROLLERS FOUND"
-        for k in decoded.iteritems():
-            k2 = json.dumps(k)
-            if re.search(switchDPID,k2):
-                k3 = k2.split(',')
-                k4 = k3[1].split()
-                k5 = k4[1].split('"')
-                return k5[1]
-        return "NO CONTROLLERS FOUND"
-
-    def isup(self):
-        '''
-        Calls the zookeeper status and returns TRUE if it has an assigned Mode to it. 
-        '''
-        self.execute(cmd="\n",prompt="\$",timeout=10)
-        response = self.execute(cmd=self.home + "/onos.sh zk status ",prompt="Mode",timeout=10)
-        pattern = '(.*)Mode(.*)'
-        if re.search(pattern, response): 
-	    main.log.info(self.name + ": Zookeeper is up.") 
-            return main.TRUE
-        else:
-	    main.log.info(self.name + ": Zookeeper is down.") 
-            return main.FALSE
-
-
diff --git a/TestON/drivers/common/clidriver.py_back b/TestON/drivers/common/clidriver.py_back
deleted file mode 100644
index 0406e48..0000000
--- a/TestON/drivers/common/clidriver.py_back
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/usr/bin/env python
-'''
-Created on 24-Oct-2012
-    
-@authors: Anil Kumar (anilkumar.s@paxterrasolutions.com),
-          Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
-
-
-    TestON is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
-
-    TestON is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.		
-
-
-          
-'''
-import pexpect
-import struct, fcntl, os, sys, signal
-import sys, re
-sys.path.append("../")
-
-from drivers.component import Component
-class CLI(Component):
-    '''
-        This will define common functions for CLI included.
-    '''
-    def __init__(self):
-        super(Component, self).__init__()
-        
-    def connect(self,**connectargs):
-        '''
-           Connection will establish to the remote host using ssh.
-           It will take user_name ,ip_address and password as arguments<br>
-           and will return the handle. 
-        '''
-        for key in connectargs:
-            vars(self)[key] = connectargs[key]
-
-        connect_result = super(CLI, self).connect()
-        ssh_newkey = 'Are you sure you want to continue connecting'
-        refused = "ssh: connect to host "+self.ip_address+" port 22: Connection refused"
-        if self.port:
-            self.handle =pexpect.spawn('ssh -p '+self.port+' '+self.user_name+'@'+self.ip_address,maxread=50000)
-        else :
-            self.handle =pexpect.spawn('ssh -X '+self.user_name+'@'+self.ip_address,maxread=50000)
-
-        self.handle.logfile = self.logfile_handler
-        i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT,refused,'>|#|$'],120)
-
-        if i==0:
-            main.log.info("ssh key confirmation received, send yes")
-            self.handle.sendline('yes')
-            i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF])
-        if i==1:
-            main.log.info("ssh connection asked for password, gave password")
-            self.handle.sendline(self.pwd)
-            self.handle.expect('>|#|$')
-
-        elif i==2:
-            main.log.error("Connection timeout")
-            return main.FALSE
-        elif i==3: #timeout
-            main.log.error("No route to the Host "+self.user_name+"@"+self.ip_address)
-            return main.FALSE
-        elif i==4:
-            main.log.error("ssh: connect to host "+self.ip_address+" port 22: Connection refused")
-            return main.FALSE
-        elif i==5:
-            main.log.info("Password not required logged in")
-
-        self.handle.sendline("\r")
-        self.handle.expect('>|#|$', 2)
-        return self.handle
-
-    
-    def disconnect(self):
-        result = super(CLI, self).disconnect(self)
-        result = main.TRUE
-        #self.execute(cmd="exit",timeout=120,prompt="(.*)")
-    
-    
-    def execute(self, **execparams):
-        '''
-        It facilitates the command line execution of a given command. It has arguments as :
-        cmd => represents command to be executed,
-        prompt => represents expect command prompt or output,
-        timeout => timeout for command execution,
-        more => to provide a key press if it is on.
-
-        It will return output of command exection.
-        '''
-
-        result = super(CLI, self).execute(self)
-        defaultPrompt = '.*[$>\#]'
-        args = utilities.parse_args(["CMD", "TIMEOUT", "PROMPT", "MORE"], **execparams)
-        expectPrompt = args["PROMPT"] if args["PROMPT"] else defaultPrompt
-        self.LASTRSP = ""
-        timeoutVar = args["TIMEOUT"] if args["TIMEOUT"] else 10
-        cmd = ''
-        if args["CMD"]:
-            cmd = args["CMD"]
-        else :
-            return 0
-        if args["MORE"] == None:
-            args["MORE"] = " "
-        self.handle.sendline(cmd)
-        self.lastCommand = cmd
-        index = self.handle.expect([expectPrompt, "--More--", 'Command not found.', pexpect.TIMEOUT,"^:$"], timeout = timeoutVar)
-        if index == 0:
-            self.LASTRSP = self.LASTRSP + self.handle.before + self.handle.after
-            main.log.info("Executed :"+str(cmd)+" \t\t Expected Prompt '"+ str(expectPrompt)+"' Found")
-        elif index == 1:
-            self.LASTRSP = self.LASTRSP + self.handle.before
-            self.handle.send(args["MORE"])
-            main.log.info("Found More screen to go , Sending a key to proceed")
-            indexMore = self.handle.expect(["--More--", expectPrompt], timeout = timeoutVar)
-            while indexMore == 0:
-                main.log.info("Found anoother More screen to go , Sending a key to proceed")
-                self.handle.send(args["MORE"])
-                indexMore = self.handle.expect(["--More--", expectPrompt], timeout = timeoutVar)
-                self.LASTRSP = self.LASTRSP + self.handle.before
-        elif index ==2:
-            main.log.error("Command not found")
-            self.LASTRSP = self.LASTRSP + self.handle.before
-        elif index ==3:
-            main.log.error("Expected Prompt not found , Time Out!!") 
-            main.log.error( expectPrompt ) 
-            return "Expected Prompt not found , Time Out!!"
-        
-        elif index == 4:
-            self.LASTRSP = self.LASTRSP + self.handle.before
-            #self.handle.send(args["MORE"])
-            self.handle.sendcontrol("D")
-            main.log.info("Found More screen to go , Sending a key to proceed")
-            indexMore = self.handle.expect(["^:$", expectPrompt], timeout = timeoutVar)
-            while indexMore == 0:
-                main.log.info("Found anoother More screen to go , Sending a key to proceed")
-                self.handle.sendcontrol("D")
-                indexMore = self.handle.expect(["^:$", expectPrompt], timeout = timeoutVar)
-                self.LASTRSP = self.LASTRSP + self.handle.before
-        
-        main.last_response = self.remove_contol_chars(self.LASTRSP)
-        return self.LASTRSP
-    
-    def remove_contol_chars(self,response):
-        #RE_XML_ILLEGAL = '([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])|([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])'%(unichr(0xd800),unichr(0xdbff),unichr(0xdc00),unichr(0xdfff),unichr(0xd800),unichr(0xdbff),unichr(0xdc00),unichr(0xdfff),unichr(0xd800),unichr(0xdbff),unichr(0xdc00),unichr(0xdfff))  
-        #response = re.sub(RE_XML_ILLEGAL, "\n", response) 
-        response = re.sub(r"[\x01-\x1F\x7F]", "", response)
-        #response = re.sub(r"\[\d+\;1H", "\n", response)
-        response = re.sub(r"\[\d+\;\d+H", "", response)
-        return response
-        
-    def runAsSudoUser(self,handle,pwd,default):
-        
-        i = handle.expect([".ssword:*",default, pexpect.EOF])
-        if i==0:
-            handle.sendline(pwd)
-            handle.sendline("\r")
-
-        if i==1:
-            handle.expect(default)
-        
-        if i==2:
-            main.log.error("Unable to run as Sudo user")
-            
-        return handle
-        
-    def onfail(self):
-        if main.componentDictionary[self.name].has_key('onfail'):
-            commandList = main.componentDictionary[self.name]['onfail'].split(",")
-            for command in commandList :
-                response = self.execute(cmd=command,prompt="(.*)",timeout=120)
-
-    def secureCopy(self,user_name, ip_address,filepath, pwd,dst_path):
-        
-        #scp openflow@192.168.56.101:/home/openflow/sample /home/paxterra/Desktop/
-
-        '''
-           Connection will establish to the remote host using ssh.
-           It will take user_name ,ip_address and password as arguments<br>
-           and will return the handle. 
-        '''
-        ssh_newkey = 'Are you sure you want to continue connecting'
-        refused = "ssh: connect to host "+ip_address+" port 22: Connection refused"
-        self.handle =pexpect.spawn('scp '+user_name+'@'+ip_address+':'+filepath+' '+dst_path)
-        i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT,refused],120)
-        
-        if i==0:    
-            main.log.info("ssh key confirmation received, send yes")
-            self.handle.sendline('yes')
-            i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF])
-        if i==1:
-            main.log.info("ssh connection asked for password, gave password")
-            self.handle.sendline(pwd)
-            #self.handle.expect(user_name)
-            
-        elif i==2:
-            main.log.error("Connection timeout")
-            pass
-        elif i==3: #timeout
-            main.log.error("No route to the Host "+user_name+"@"+ip_address)
-            return main.FALSE
-        elif i==4:
-            main.log.error("ssh: connect to host "+ip_address+" port 22: Connection refused")
-            return main.FALSE
-
-        self.handle.sendline("\r")
-        
-        return self.handle
-    
diff --git a/TestON/drivers/common/clidriver.py_new b/TestON/drivers/common/clidriver.py_new
deleted file mode 100644
index 9db8f6f..0000000
--- a/TestON/drivers/common/clidriver.py_new
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/usr/bin/env python
-'''
-Created on 24-Oct-2012
-    
-@authors: Anil Kumar (anilkumar.s@paxterrasolutions.com),
-          Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
-
-
-    TestON is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
-
-    TestON is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.		
-
-
-          
-'''
-import pexpect
-import struct, fcntl, os, sys, signal
-import sys, re
-sys.path.append("../")
-
-from drivers.component import Component
-class CLI(Component):
-    '''
-        This will define common functions for CLI included.
-    '''
-    def __init__(self):
-        super(Component, self).__init__()
-        
-    def connect(self,**connectargs):
-        '''
-           Connection will establish to the remote host using ssh.
-           It will take user_name ,ip_address and password as arguments<br>
-           and will return the handle. 
-        '''
-        for key in connectargs:
-            vars(self)[key] = connectargs[key]
-
-        connect_result = super(CLI, self).connect()
-        ssh_newkey = 'Are you sure you want to continue connecting'
-        refused = "ssh: connect to host "+self.ip_address+" port 22: Connection refused"
-        if self.port:
-            self.handle =pexpect.spawn('ssh -p '+self.port+' '+self.user_name+'@'+self.ip_address,maxread=50000)
-        else :
-            self.handle =pexpect.spawn('ssh -X '+self.user_name+'@'+self.ip_address,maxread=50000)
-
-        self.handle.logfile = self.logfile_handler
-        i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT,refused,'>|#|\$'],120)
-
-        if i==0:
-            main.log.info("ssh key confirmation received, send yes")
-            self.handle.sendline('yes')
-            i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF])
-        if i==1:
-            main.log.info("ssh connection asked for password, gave password")
-            self.handle.sendline(self.pwd)
-            self.handle.expect('>|#|\$')
-
-        elif i==2:
-            main.log.error("Connection timeout")
-            return main.FALSE
-        elif i==3: #timeout
-            main.log.error("No route to the Host "+self.user_name+"@"+self.ip_address)
-            return main.FALSE
-        elif i==4:
-            main.log.error("ssh: connect to host "+self.ip_address+" port 22: Connection refused")
-            return main.FALSE
-        elif i==5:
-            main.log.info("Password not required logged in")
-
-        self.handle.sendline("\n")
-        self.handle.expect('>|#|\$', 2)
-        return self.handle
-
-    
-    def disconnect(self):
-        result = super(CLI, self).disconnect(self)
-        result = main.TRUE
-        #self.execute(cmd="exit",timeout=120,prompt="(.*)")
-    
-    
-    def execute(self, **execparams):
-        '''
-        It facilitates the command line execution of a given command. It has arguments as :
-        cmd => represents command to be executed,
-        prompt => represents expect command prompt or output,
-        timeout => timeout for command execution,
-        more => to provide a key press if it is on.
-
-        It will return output of command exection.
-        '''
-
-        result = super(CLI, self).execute(self)
-        defaultPrompt = '.*[\$>\#]'
-        args = utilities.parse_args(["CMD", "TIMEOUT", "PROMPT", "MORE"], **execparams)
-        expectPrompt = args["PROMPT"] if args["PROMPT"] else defaultPrompt
-        self.LASTRSP = ""
-        timeoutVar = args["TIMEOUT"] if args["TIMEOUT"] else 10
-        cmd = ''
-        if args["CMD"]:
-            cmd = args["CMD"]
-        else :
-            return 0
-        if args["MORE"] == None:
-            args["MORE"] = " "
-        self.handle.sendline(cmd)
-        self.lastCommand = cmd
-        index = self.handle.expect([expectPrompt, "--More--", 'Command not found.', pexpect.TIMEOUT,"^:$"], timeout = timeoutVar)
-        if index == 0:
-            self.LASTRSP = self.LASTRSP + self.handle.before + self.handle.after
-            main.log.info("Executed :"+str(cmd)+" \t\t Expected Prompt '"+ str(expectPrompt)+"' Found")
-        elif index == 1:
-            self.LASTRSP = self.LASTRSP + self.handle.before
-            self.handle.send(args["MORE"])
-            main.log.info("Found More screen to go , Sending a key to proceed")
-            indexMore = self.handle.expect(["--More--", expectPrompt], timeout = timeoutVar)
-            while indexMore == 0:
-                main.log.info("Found anoother More screen to go , Sending a key to proceed")
-                self.handle.send(args["MORE"])
-                indexMore = self.handle.expect(["--More--", expectPrompt], timeout = timeoutVar)
-                self.LASTRSP = self.LASTRSP + self.handle.before
-        elif index ==2:
-            main.log.error("Command not found")
-            self.LASTRSP = self.LASTRSP + self.handle.before
-        elif index ==3:
-            main.log.error("Expected Prompt not found , Time Out!!") 
-            main.log.error( expectPrompt ) 
-            return "Expected Prompt not found , Time Out!!"
-        
-        elif index == 4:
-            self.LASTRSP = self.LASTRSP + self.handle.before
-            #self.handle.send(args["MORE"])
-            self.handle.sendcontrol("D")
-            main.log.info("Found More screen to go , Sending a key to proceed")
-            indexMore = self.handle.expect(["^:$", expectPrompt], timeout = timeoutVar)
-            while indexMore == 0:
-                main.log.info("Found anoother More screen to go , Sending a key to proceed")
-                self.handle.sendcontrol("D")
-                indexMore = self.handle.expect(["^:$", expectPrompt], timeout = timeoutVar)
-                self.LASTRSP = self.LASTRSP + self.handle.before
-        
-        main.last_response = self.remove_contol_chars(self.LASTRSP)
-        return self.LASTRSP
-    
-    def remove_contol_chars(self,response):
-        #RE_XML_ILLEGAL = '([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])|([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])'%(unichr(0xd800),unichr(0xdbff),unichr(0xdc00),unichr(0xdfff),unichr(0xd800),unichr(0xdbff),unichr(0xdc00),unichr(0xdfff),unichr(0xd800),unichr(0xdbff),unichr(0xdc00),unichr(0xdfff))  
-        #response = re.sub(RE_XML_ILLEGAL, "\n", response) 
-        response = re.sub(r"[\x01-\x1F\x7F]", "", response)
-        #response = re.sub(r"\[\d+\;1H", "\n", response)
-        response = re.sub(r"\[\d+\;\d+H", "", response)
-        return response
-        
-    def runAsSudoUser(self,handle,pwd,default):
-        
-        i = handle.expect([".ssword:*",default, pexpect.EOF])
-        if i==0:
-            handle.sendline(pwd)
-            handle.sendline("\n")
-
-        if i==1:
-            handle.expect(default)
-        
-        if i==2:
-            main.log.error("Unable to run as Sudo user")
-            
-        return handle
-        
-    def onfail(self):
-        if main.componentDictionary[self.name].has_key('onfail'):
-            commandList = main.componentDictionary[self.name]['onfail'].split(",")
-            for command in commandList :
-                response = self.execute(cmd=command,prompt="(.*)",timeout=120)
-
-    def secureCopy(self,user_name, ip_address,filepath, pwd,dst_path):
-        
-        #scp openflow@192.168.56.101:/home/openflow/sample /home/paxterra/Desktop/
-
-        '''
-           Connection will establish to the remote host using ssh.
-           It will take user_name ,ip_address and password as arguments<br>
-           and will return the handle. 
-        '''
-        ssh_newkey = 'Are you sure you want to continue connecting'
-        refused = "ssh: connect to host "+ip_address+" port 22: Connection refused"
-        self.handle =pexpect.spawn('scp '+user_name+'@'+ip_address+':'+filepath+' '+dst_path)
-        i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT,refused],120)
-        
-        if i==0:    
-            main.log.info("ssh key confirmation received, send yes")
-            self.handle.sendline('yes')
-            i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF])
-        if i==1:
-            main.log.info("ssh connection asked for password, gave password")
-            self.handle.sendline(pwd)
-            #self.handle.expect(user_name)
-            
-        elif i==2:
-            main.log.error("Connection timeout")
-            pass
-        elif i==3: #timeout
-            main.log.error("No route to the Host "+user_name+"@"+ip_address)
-            return main.FALSE
-        elif i==4:
-            main.log.error("ssh: connect to host "+ip_address+" port 22: Connection refused")
-            return main.FALSE
-
-        self.handle.sendline("\n")
-        
-        return self.handle
-    
diff --git a/TestON/tests/CassandraCheck/.OnosSanity.py.swp b/TestON/tests/CassandraCheck/.OnosSanity.py.swp
deleted file mode 100644
index ac9cdc3..0000000
--- a/TestON/tests/CassandraCheck/.OnosSanity.py.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/CassandraCheck/CassandraCheck.params b/TestON/tests/CassandraCheck/CassandraCheck.params
deleted file mode 100644
index ef3c9ba..0000000
--- a/TestON/tests/CassandraCheck/CassandraCheck.params
+++ /dev/null
@@ -1,9 +0,0 @@
-<PARAMS>
-    <testcases>3</testcases>
-    <Iterations>2</Iterations>
-    <WaitTime>20</WaitTime>
-    <TargetTime>20</TargetTime>
-    <RestIP>10.128.4.11</RestIP>
-    <NR_Switches>405</NR_Switches>
-    <NR_Links>802</NR_Links>
-</PARAMS>      
diff --git a/TestON/tests/CassandraCheck/CassandraCheck.py b/TestON/tests/CassandraCheck/CassandraCheck.py
deleted file mode 100644
index a05662c..0000000
--- a/TestON/tests/CassandraCheck/CassandraCheck.py
+++ /dev/null
@@ -1,71 +0,0 @@
-
-class CassandraCheck:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")
-        data =  main.Cassandra1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")
-        main.ONOS1.start()
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS5.start()
-        main.ONOS6.start()
-        main.ONOS7.start()
-        main.ONOS8.start()
-        data = main.ONOS1.isup()
-        if data == main.FALSE:
-            main.log.info("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5)
-            data = main.ONOS1.isup()
-        #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        topoview = main.TRUE
-        if topoview == main.TRUE & data == main.TRUE :
-            data = main.TRUE
-        else:
-            data = main.FALSE
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running and has full view of topology",onfail="ONOS didn't start or has fragmented view of topology...")
-
-    def CASE2(self,main) :
-        '''
-        Second case is to stress adding and removing flows to see if it can crash any cassandras
-        '''
-        import time
-        main.case("Adding and deleting flows")
-        main.step("Adding 1008 flows") 
-        #main.ONOS1.add_flow("~/flowdef_files/flowdef_3node_1008.txt")
-        main.ONOS1.add_flow("~/flowdef_files/flowdef_3node_1008.txt")
-        time.sleep(30)
-        main.ONOS1.delete_flow("all") 
-        main.ONOS1.check_for_no_exceptions()
-        test = main.Cassandra1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Cassandra is still good",onfail="Something broke on Cassandra")
- 
-    def CASE3(self,main) :
-        '''
-        Merely testing if a specific driver call works
-        '''
-        main.case("Checking for exceptions") 
-        main.step("Step 1") 
-        test = main.ONOS1.check_for_no_exceptions()
-        utilities.assert_equals(expect=main.TRUE,actual=test)
-
diff --git a/TestON/tests/CassandraCheck/CassandraCheck.topo b/TestON/tests/CassandraCheck/CassandraCheck.topo
deleted file mode 100644
index db65096..0000000
--- a/TestON/tests/CassandraCheck/CassandraCheck.topo
+++ /dev/null
@@ -1,133 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOS1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>4</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-        </ONOS4>
-        <ONOS5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-        </ONOS5>
-        <ONOS6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS6>
-        <ONOS7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-        </ONOS7>
-        <ONOS8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-        </ONOS8>
-
-
-        <Zookeeper1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Cassandra1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Mininet2>
-            <host>10.128.6.2</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet2>
-        <Mininet3>
-            <host>10.128.6.3</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet3>
-        <Mininet4>
-            <host>10.128.6.4</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet4>
-        <Mininet5>
-            <host>10.128.6.5</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet5>
-        <Mininet6>
-            <host>10.128.6.6</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet6>
-        <Mininet7>
-            <host>10.128.6.7</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet7>
-        <Mininet8>
-            <host>10.128.6.8</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet8>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/CassandraCheck/__init__.py b/TestON/tests/CassandraCheck/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/CassandraCheck/__init__.py
+++ /dev/null
diff --git a/TestON/tests/DpctlTest/.svn/entries b/TestON/tests/DpctlTest/.svn/entries
deleted file mode 100644
index f53a109..0000000
--- a/TestON/tests/DpctlTest/.svn/entries
+++ /dev/null
@@ -1,171 +0,0 @@
-9
-
-dir
-65
-svn://192.168.150.61/OpenFlow/tests/DpctlTest
-svn://192.168.150.61/OpenFlow
-
-
-
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-8b1d8634-a80c-44fc-ab7b-cc53e6f68013
-
-
-
-
-
-
-0
-
-DpctlTest.params
-file
-
-
-
-
-2012-12-05T16:07:55.000000Z
-f26374a423ae2d318acb7462c3887802
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1079
-
-DpctlTest.py
-file
-
-
-
-
-2012-12-05T16:50:35.000000Z
-f646c2327db5ac1937b062abb72b7943
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2966
-
-DpctlTest.topo
-file
-
-
-
-
-2012-12-05T16:07:55.000000Z
-39ca1852c671338b5e06a86718cb6e66
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-728
-
-__init__.py
-file
-
-
-
-
-2012-12-05T16:07:55.000000Z
-d41d8cd98f00b204e9800998ecf8427e
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-
diff --git a/TestON/tests/DpctlTest/.svn/format b/TestON/tests/DpctlTest/.svn/format
deleted file mode 100644
index ec63514..0000000
--- a/TestON/tests/DpctlTest/.svn/format
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.params.svn-base b/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.params.svn-base
deleted file mode 100644
index bfd1819..0000000
--- a/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.params.svn-base
+++ /dev/null
@@ -1,37 +0,0 @@
-[PARAMS]
-    'testcases' = '[1,2]'
-    'mail' = 'anilkumar.s@paxterrasolutions.com,paxweb@paxterrasolutions.com'
-    #'log_dir' = '/home/user/Desktop/openflow_logs/'
-    [[CASE1]]
-        'tcpip' = '127.0.0.1'
-        'tcpport' = '6634'
-        'destination' = 'h2'
-        [[[STEP1]]]
-            'tcpip' = '127.0.0.1'
-            'tcpport' = '6634'
-            'inport' = '1'
-            'timeout' = '360'
-            'action' = 'output:2'
-        [[[STEP2]]]
-            'tcpip' = '127.0.0.1'
-            'tcpport' = '6634'
-            'inport' = '2'
-            'timeout' = '360'
-            'action' = 'output:3'
-    [[CASE2]]
-        'tcpip' = '127.0.0.1'
-        'tcpport' = '6634'
-        'destination' = 'h2'
-        [[[STEP1]]]
-            'tcpip' = '127.0.0.1'
-            'tcpport' = '6634'
-            'inport' = '1'
-            'timeout' = '360'
-            'action' = 'output:2'
-        [[[STEP2]]]
-            'tcpip' = '127.0.0.1'
-            'tcpport' = '6634'
-            'inport' = '2'
-            'timeout' = '360'
-            'action' = 'output:3'
-        
diff --git a/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.py.svn-base b/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.py.svn-base
deleted file mode 100644
index f5e7cde..0000000
--- a/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.py.svn-base
+++ /dev/null
@@ -1,55 +0,0 @@
-class DpctlTest:
-    '''
-    Testing of the some basic Dpctl functions included here
-    '''
-    
-    def __init__(self):
-        self.default = ""
-                
-    def CASE1(self,main):
-        '''
-        Test to add the flow configuration by using dpctl and ping the host 
-        '''
-        main.case("DPCTL ping host ")
-        main.step("adding flow for host2 ")
-        main.DPCTL1.addFlow(tcpip=main.params['CASE1']['STEP1']['tcpip'],
-                            tcpport=main.params['CASE1']['STEP1']['tcpport'],
-                            inport=main.params['CASE1']['STEP1']['inport'],
-                            timeout=main.params['CASE1']['STEP1']['timeout'],
-                            action=main.params['CASE1']['STEP1']['action'])
-        main.step("adding another flow for host3")
-        main.DPCTL1.addFlow(tcpip=main.params['CASE1']['STEP2']['tcpip'],
-                            tcpport=main.params['CASE1']['STEP2']['tcpport'],
-                            inport=main.params['CASE1']['STEP2']['inport'],
-                            timeout=main.params['CASE1']['STEP2']['timeout'],
-                            action=main.params['CASE1']['STEP2']['action'])
-        main.step("Ping from h2 to h3")
-        result = main.Mininet1.pingHost(src=main.componentDictionary['DPCTL1']['src'],
-                                        target=main.componentDictionary['DPCTL1']['target'],
-                                        controller=main.componentDictionary['DPCTL1']['controller'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Show flow executed",onfail="Show flow execution Failed")
-
-
-    def CASE2(self,main):
-        '''
-        Test to add the flow configuration by using dpctl and show the flow using dpctl  
-        '''
-        main.case("DPCTL show flow ")
-        main.step("adding flow for host2")
-
-        main.DPCTL1.addFlow(tcpip=main.params['CASE2']['STEP1']['tcpip'],
-                            tcpport=main.params['CASE2']['STEP1']['tcpport'],
-                            inport=main.params['CASE2']['STEP1']['inport'],
-                            timeout=main.params['CASE2']['STEP1']['timeout'],
-                            action=main.params['CASE2']['STEP1']['action'])
-        main.step("adding flow for host3")
-        main.DPCTL1.addFlow(tcpip=main.params['CASE2']['STEP2']['tcpip'],
-                            tcpport=main.params['CASE2']['STEP2']['tcpport'],
-                            inport=main.params['CASE2']['STEP2']['inport'],
-                            timeout=main.params['CASE2']['STEP2']['timeout'],
-                            action=main.params['CASE2']['STEP2']['action'])
-        main.step("Execute Show flow ")
-        result = main.DPCTL1.showFlow(tcpip=main.params['CASE2']['tcpip'],tcpport=main.params['CASE2']['tcpport'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Show flow executed",onfail="Show flow execution Failed")
-            
-
diff --git a/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.topo.svn-base b/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.topo.svn-base
deleted file mode 100644
index 77e2591..0000000
--- a/TestON/tests/DpctlTest/.svn/text-base/DpctlTest.topo.svn-base
+++ /dev/null
@@ -1,24 +0,0 @@
-[TOPOLOGY]    
-
-    [[COMPONENT]]
-        [[["Mininet1"]]]
-            'host' = '192.168.56.101'
-            'user' = 'openflow'
-            'password' = 'openflow'
-            'type' = "Mininet"
-            [[[["COMPONENTS"]]]]
-                # Specify the Option for mininet
-                'topo' = 'single'
-                'topocount' = '3'
-                'switch' = 'ovsk'
-                'controller' = 'remote'
-        [[["DPCTL1"]]]
-            'host' = '192.168.56.101'
-            'user' = 'openflow'
-            'password' = 'openflow'
-            'test_target' = '1'
-            'type' = 'DPCTL'
-            'src' = 'h2'
-            'target' = 'h3'
-            'controller' = 'c1'
-            [[[["COMPONENTS"]]]]
diff --git a/TestON/tests/DpctlTest/.svn/text-base/__init__.py.svn-base b/TestON/tests/DpctlTest/.svn/text-base/__init__.py.svn-base
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/DpctlTest/.svn/text-base/__init__.py.svn-base
+++ /dev/null
diff --git a/TestON/tests/DpctlTest/DpctlTest.ospk b/TestON/tests/DpctlTest/DpctlTest.ospk
deleted file mode 100644
index c0fd5ff..0000000
--- a/TestON/tests/DpctlTest/DpctlTest.ospk
+++ /dev/null
@@ -1,19 +0,0 @@
-CASE 1
-    NAME "DPCTL Ping Host"
-    STEP "Adding flow for host2"
-    ON DPCTL1 DO addFlow USING tcpip AS STEP["tcpip"], tcpport AS STEP["tcpport"], inport AS STEP["inport"] , timeout AS STEP["timeout"], action AS STEP["action"]
-    STEP "Adding Another Flow for Host3"
-    ON DPCTL1 DO addFlow USING tcpip AS STEP["tcpip"], tcpport AS STEP["tcpport"], inport AS STEP["inport"] , timeout AS STEP["timeout"], action AS STEP["action"]
-    STEP "Ping From h2 to h3"
-    ON Mininet1 DO pingHost USING src AS TOPO["DPCTL1"]["src"], target AS TOPO["DPCTL1"]["target"], controller AS TOPO["DPCTL1"]["controller"] AND STORE LAST_RESULT IN result 
-    ASSERT result EQUALS main.TRUE ONPASS "Ping Successful" ONFAIL "Ping failed"
-
-CASE 2
-    NAME "DPCTL Show Flow"
-    STEP "Adding flow for host2"
-    ON DPCTL1 DO addFlow USING tcpip AS STEP["tcpip"], tcpport AS STEP["tcpport"], inport AS STEP["inport"] , timeout AS STEP["timeout"], action AS STEP["action"]
-    STEP "Adding Another Flow for Host3"
-    ON DPCTL1 DO addFlow USING tcpip AS STEP["tcpip"], tcpport AS STEP["tcpport"], inport AS STEP["inport"] , timeout AS STEP["timeout"], action AS STEP["action"]
-    STEP "Execute Show Flow"
-    ON DPCTL1 DO showFlow USING tcpip AS CASE["tcpip"], tcpport AS CASE["tcpport"] AND STORE LAST_RESULT IN result
-    ASSERT result EQUALS main.TRUE ONPASS "SHOW FLOW IS EXECUTED" ONFAIL "Show Flow Execution failed"    
diff --git a/TestON/tests/DpctlTest/DpctlTest.params b/TestON/tests/DpctlTest/DpctlTest.params
deleted file mode 100644
index 0cf79e8..0000000
--- a/TestON/tests/DpctlTest/DpctlTest.params
+++ /dev/null
@@ -1,42 +0,0 @@
-<PARAMS>
-    <testcases> [1,2] </testcases>
-    <mail> paxweb@paxterrasolutions.com </mail>
-    <CASE1>
-        <tcpip> 127.0.0.1</tcpip>
-        <tcpport> 6634 </tcpport>
-        <destination> h2 </destination>
-        <STEP1>
-            <tcpip> 127.0.0.1 </tcpip>
-            <tcpport> 6634 </tcpport>
-            <inport> 1 </inport>
-            <timeout> 360 </timeout>
-            <action> output:2 </action>
-        </STEP1>
-        <STEP2>
-            <tcpip> 127.0.0.1 </tcpip>
-            <tcpport> 6634 </tcpport>
-            <inport> 2 </inport>
-            <timeout> 360 </timeout>
-            <action> output:3 </action>
-        </STEP2>     
-    </CASE1>
-    <CASE2>
-        <tcpip> 127.0.0.1</tcpip>
-        <tcpport> 6634 </tcpport>
-        <destination> h2 </destination>
-        <STEP1>
-            <tcpip> 127.0.0.1 </tcpip>
-            <tcpport> 6634 </tcpport>
-            <inport> 1 </inport>
-            <timeout> 360 </timeout>
-            <action> output:2 </action>
-        </STEP1>
-        <STEP2>
-            <tcpip> 127.0.0.1 </tcpip>
-            <tcpport> 6634 </tcpport>
-            <inport> 2 </inport>
-            <timeout> 360 </timeout>
-            <action> output:3 </action>
-        </STEP2>     
-    </CASE2>
-</PARAMS>        
\ No newline at end of file
diff --git a/TestON/tests/DpctlTest/DpctlTest.py b/TestON/tests/DpctlTest/DpctlTest.py
deleted file mode 100644
index 6a8403a..0000000
--- a/TestON/tests/DpctlTest/DpctlTest.py
+++ /dev/null
@@ -1,42 +0,0 @@
-'''
-	
- *   TestON is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 2 of the License, or
- *   (at your option) any later version.
-
- *   TestON is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
-
-
-'''
-class DpctlTest :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-
-        main.case("DPCTL Ping Host")
-        main.step("Adding flow for host2")
-        main.DPCTL1.addFlow(tcpip=main.params['CASE1']['STEP1']['tcpip'], tcpport=main.params['CASE1']['STEP1']['tcpport'], inport=main.params['CASE1']['STEP1']['inport'], timeout=main.params['CASE1']['STEP1']['timeout'], action=main.params['CASE1']['STEP1']['action'])
-        main.step("Adding Another Flow for Host3")
-        main.DPCTL1.addFlow(tcpip=main.params['CASE1']['STEP2']['tcpip'], tcpport=main.params['CASE1']['STEP2']['tcpport'], inport=main.params['CASE1']['STEP2']['inport'], timeout=main.params['CASE1']['STEP2']['timeout'], action=main.params['CASE1']['STEP2']['action'])
-        main.step("Ping From h2 to h3")
-        main.Mininet1.pingHost(src=main.componentDictionary['DPCTL1']['src'], target=main.componentDictionary['DPCTL1']['target'], controller=main.componentDictionary['DPCTL1']['controller'])
-        result  = main.last_result
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Ping Successful",onfail="Ping failed")
-    
-    def CASE2(self,main) :
-
-        main.case("DPCTL Show Flow")
-        main.step("Adding flow for host2")
-        main.DPCTL1.addFlow(tcpip=main.params['CASE2']['STEP1']['tcpip'], tcpport=main.params['CASE2']['STEP1']['tcpport'], inport=main.params['CASE2']['STEP1']['inport'], timeout=main.params['CASE2']['STEP1']['timeout'], action=main.params['CASE2']['STEP1']['action'])
-        main.step("Adding Another Flow for Host3")
-        main.DPCTL1.addFlow(tcpip=main.params['CASE2']['STEP2']['tcpip'], tcpport=main.params['CASE2']['STEP2']['tcpport'], inport=main.params['CASE2']['STEP2']['inport'], timeout=main.params['CASE2']['STEP2']['timeout'], action=main.params['CASE2']['STEP2']['action'])
-        main.step("Execute Show Flow")
-        main.DPCTL1.showFlow(tcpip=main.params['CASE2']['tcpip'], tcpport=main.params['CASE2']['tcpport'])
-        result = main.last_result
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="SHOW FLOW IS EXECUTED",onfail="Show Flow Execution failed")
diff --git a/TestON/tests/DpctlTest/DpctlTest.topo b/TestON/tests/DpctlTest/DpctlTest.topo
deleted file mode 100644
index 565a71a..0000000
--- a/TestON/tests/DpctlTest/DpctlTest.topo
+++ /dev/null
@@ -1,30 +0,0 @@
-<TOPOLOGY>    
-
-    <COMPONENT>
-        <Mininet1>
-            <host> 192.168.56.101 </host>
-            <user> openflow </user>
-            <password> openflow </password>
-            <type> MininetCliDriver </type>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <topo> single </topo>
-                <topocount> 3 </topocount>
-                <switch> ovsk </switch>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-        <DPCTL1>
-            <host> 192.168.56.101 </host>
-            <user> openflow </user>
-            <password> openflow </password>
-            <test_target> 1</test_target>
-            <type> DpctlCliDriver </type>
-            <src> h2 </src>
-            <target> h3 </target>
-            <controller> c1 </controller>
-            <COMPONENTS>
-            </COMPONENTS>
-        </DPCTL1>
-    </COMPONENT>
-</TOPOLOGY>
\ No newline at end of file
diff --git a/TestON/tests/DpctlTest/__init__.py b/TestON/tests/DpctlTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/DpctlTest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/FVProtoSlicing/FVProtoSlicing.ospk b/TestON/tests/FVProtoSlicing/FVProtoSlicing.ospk
deleted file mode 100644
index 5ac413f..0000000
--- a/TestON/tests/FVProtoSlicing/FVProtoSlicing.ospk
+++ /dev/null
@@ -1,43 +0,0 @@
-CASE 1
-    NAME "Verifying SSH protocol based slicing" 
-    
-    STEP "Deleting the flowspace by using 'removeFlowSpace'"
-    STORE ON FlowVisor DO removeFlowSpace USING "all" IN removeflowspace_result
-    ASSERT removeflowspace_result EQUALS main.TRUE ONPASS "Removed FlowSpace Successfully" ONFAIL "Failed to remove FlowSpace" 
-    
-    STEP "Showing the connected devices by USING 'listDevices'"
-    STORE ON FlowVisor DO listDevices IN listdevices_result
-    ASSERT listdevices_result EQUALS main.TRUE ONPASS "Listed devices Successfully" ONFAIL "Failed to list the devices" 
-    
-    STEP "Adding FlowSpace"
-    STORE ON FlowVisor DO addFlowSpace USING "any 100 dl_type=0x806,dl_src=9e:f5:8b:78:c3:93,nw_dst=10.128.4.6 Slice:SSH=4" IN addflowspace_result_1
-    ASSERT addflowspace_result_1 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor DO addFlowSpace USING "any 100 dl_type=0x806,dl_src=d2:df:f1:53:d4:49,nw_dst=10.128.4.5 Slice:SSH=4" IN addflowspace_result_2
-    ASSERT addflowspace_result_2 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor DO addFlowSpace USING "any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.6,tp_dst=22 Slice:SSH=4" IN addflowspace_result_3
-    ASSERT addflowspace_result_3 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor DO addFlowSpace USING "any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.5,tp_dst=22 Slice:SSH=4" IN addflowspace_result_4
-    ASSERT addflowspace_result_4 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor DO addFlowSpace USING "any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.6,tp_src=22 Slice:SSH=4" IN addflowspace_result_5
-    ASSERT addflowspace_result_5 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor DO addFlowSpace USING "any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.5,tp_src=22 Slice:SSH=4" IN addflowspace_result_6
-    ASSERT addflowspace_result_6 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-        
-    STEP "Showing the flowSpace USING 'listFlowSpace'"
-    STORE ON FlowVisor DO listFlowSpace IN listflowspace_result
-    ASSERT listflowspace_result EQUALS main.TRUE ONPASS "FlowSpace Listed successfully" ONFAIL "Failed to listthe FlowSpace"
-     
-    STEP "Verifying the Slice, by checking SSH is happening to the destination or not"
-    STORE ON Pax_DPVM1 DO SSH USING user_name AS CASE['destination_username'],ip_address AS CASE['destination_host'], pwd AS CASE['destination_password'], port AS CASE['destination_port'], options AS TOPO['Pax_DPVM1']['COMPONENTS'] IN ssh_result
-    ASSERT ssh_result EQUALS main.TRUE ONPASS "Remote host connected throgh SSH " ONFAIL "Failed to connect remote host throgh SSH" 
-    
-    STEP " Showcasing the Parsing the response in required format"
-    STORE "<ipaddress>10.128.4.2</ipaddress><username>paxterra</username><password>paxterra</password><port>22</port><location>Bangalore</location>" IN myOutput 
-    PARSE myOutput AS table INTO myVar
-    INFO <myVar>
-    
\ No newline at end of file
diff --git a/TestON/tests/FVProtoSlicing/FVProtoSlicing.params b/TestON/tests/FVProtoSlicing/FVProtoSlicing.params
deleted file mode 100644
index cb5cb60..0000000
--- a/TestON/tests/FVProtoSlicing/FVProtoSlicing.params
+++ /dev/null
@@ -1,18 +0,0 @@
-<PARAMS>
-    <testcases> [1]</testcases>
-    <mail> anil4haart@gmail.com,paxweb@paxterrasolutions.com</mail>
-    <CASE1>
-    
-        <dl_type> 0x800 </dl_type> 
-        <nw_proto> 6 </nw_proto>
-        <nw_src> 10.0.0.2 </nw_src>
-        <tp_dst> 22 </tp_dst>
-        <slice> SSH </slice> 
-        <permissions> 4 </permissions>
-        
-        <destination_host> 10.128.4.6 </destination_host>
-        <destination_username> paxterra </destination_username>
-        <destination_password> 0nLab_gu3st </destination_password>
-        <destination_port> 22 </destination_port>
-    </CASE1>
-</PARAMS>
diff --git a/TestON/tests/FVProtoSlicing/FVProtoSlicing.py b/TestON/tests/FVProtoSlicing/FVProtoSlicing.py
deleted file mode 100644
index db94822..0000000
--- a/TestON/tests/FVProtoSlicing/FVProtoSlicing.py
+++ /dev/null
@@ -1,63 +0,0 @@
-'''
-	
- *   TestON is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 2 of the License, or
- *   (at your option) any later version.
-
- *   TestON is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
-
-
-'''
-class FVProtoSlicing :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-
-        main.case("Verifying SSH protocol based slicing")
-    
-        main.step("Deleting the flowspace by using 'removeFlowSpace'")
-        removeflowspace_result = main.FlowVisor.removeFlowSpace("all")
-        utilities.assert_equals(expect=main.TRUE,actual=removeflowspace_result,onpass="Removed FlowSpace Successfully",onfail="Failed to remove FlowSpace")
-    
-        main.step("Showing the connected devices by USING 'listDevices'")
-        listdevices_result = main.FlowVisor.listDevices()
-        utilities.assert_equals(expect=main.TRUE,actual=listdevices_result,onpass="Listed devices Successfully",onfail="Failed to list the devices")
-    
-        main.step("Adding FlowSpace")
-        addflowspace_result_1 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x806,dl_src=9e:f5:8b:78:c3:93,nw_dst=10.128.4.6 Slice:SSH=4")
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_1,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_2 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x806,dl_src=d2:df:f1:53:d4:49,nw_dst=10.128.4.5 Slice:SSH=4")
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_2,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_3 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.6,tp_dst=22 Slice:SSH=4")
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_3,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_4 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.5,tp_dst=22 Slice:SSH=4")
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_4,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_5 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.6,tp_src=22 Slice:SSH=4")
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_5,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_6 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.5,tp_src=22 Slice:SSH=4")
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_6,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        main.step("Showing the flowSpace USING 'listFlowSpace'")
-        listflowspace_result = main.FlowVisor.listFlowSpace()
-        utilities.assert_equals(expect=main.TRUE,actual=listflowspace_result,onpass="FlowSpace Listed successfully",onfail="Failed to listthe FlowSpace")
-    
-        main.step("Verifying the Slice, by checking SSH is happening to the destination or not")
-        ssh_result = main.Pax_DPVM1.SSH(user_name=main.params['CASE1']['destination_username'],ip_address=main.params['CASE1']['destination_host'], pwd=main.params['CASE1']['destination_password'], port=main.params['CASE1']['destination_port'], options=main.componentDictionary['Pax_DPVM1']['COMPONENTS'])
-        utilities.assert_equals(expect=main.TRUE,actual=ssh_result,onpass="Remote host connected throgh SSH ",onfail="Failed to connect remote host throgh SSH")
-    
-        main.step(" Showcasing the Parsing the response in required format")
-        myOutput  = "<ipaddress>10.128.4.2</ipaddress><username>paxterra</username><password>paxterra</password><port>22</port><location>Bangalore</location>"
-        myVar= main.response_parser(myOutput,"table")
-        main.log.info(myVar)
-    
diff --git a/TestON/tests/FVProtoSlicing/FVProtoSlicing.topo b/TestON/tests/FVProtoSlicing/FVProtoSlicing.topo
deleted file mode 100644
index 69cf9c2..0000000
--- a/TestON/tests/FVProtoSlicing/FVProtoSlicing.topo
+++ /dev/null
@@ -1,98 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-              
-        <HPSwitch1>
-            <remote_user_name> Paxterra </remote_user_name>
-            <remote_ip_address>24.6.49.222</remote_ip_address>
-            <remote_port>6500</remote_port>
-            <remote_pwd>0nLab_gu3st</remote_pwd>
-            
-            <host>10.254.1.253</host>
-            <user> Paxterra </user>
-            <password>0nLab_gu3st</password>
-            <type>HPSwitchCliDriver</type>
-            <COMPONENTS>
-            <console_port> 5 </console_port>
-            </COMPONENTS>
-               
-        </HPSwitch1> 
-           
-        <HPSwitch2>
-            <remote_user_name> Paxterra </remote_user_name>
-            <remote_ip_address>24.6.49.222</remote_ip_address>
-            <remote_port>6500</remote_port>
-            <remote_pwd>0nLab_gu3st</remote_pwd>
-            
-            <host>10.254.1.253</host>
-            <user> Paxterra </user>
-            <password>0nLab_gu3st</password>
-            <type>HPSwitchCliDriver</type>
-            <COMPONENTS>
-            <console_port> 2 </console_port>
-            </COMPONENTS>
-               
-        </HPSwitch2> 
- 
-        <FlowVisor>
-            <remote_user_name> Paxterra </remote_user_name>
-            <remote_ip_address>24.6.49.222</remote_ip_address>
-            <remote_port>6500</remote_port>
-            <remote_pwd>0nLab_gu3st</remote_pwd>
-            <host>10.128.4.2</host>
-            <user> paxterra </user>
-            <fvadmin_pwd></fvadmin_pwd>
-            <password>0nLab_gu3st</password>
-            <type>FlowVisorCliDriver</type>
-            <COMPONENTS>
-            </COMPONENTS>
-               
-        </FlowVisor>   
-        
-        <POX2>
-            <remote_user_name> Paxterra </remote_user_name>
-            <remote_ip_address>24.6.49.222</remote_ip_address>
-            <remote_port>6500</remote_port>
-            <remote_pwd>0nLab_gu3st</remote_pwd>           
-            <host> 10.128.4.3 </host>
-            <user>  paxterra </user>
-            <password> 0nLab_gu3st </password>
-            <type> RemotePoxDriver </type>
-            <COMPONENTS>
-                <pox_lib_location> /home/paxterra/pox/  </pox_lib_location>
-                <samples.of_tutorial></samples.of_tutorial>
-            </COMPONENTS>
-        </POX2>
-        
-        <Pax_DPVM1>
-            <remote_user_name> Paxterra </remote_user_name>
-            <remote_ip_address>24.6.49.222</remote_ip_address>
-            <remote_port>6500</remote_port>
-            <remote_pwd>0nLab_gu3st</remote_pwd>
-            <host>10.128.4.5</host>
-            <user> paxterra </user>
-            <password>0nLab_gu3st</password>
-            <type>RemoteVMDriver</type>
-            <COMPONENTS>
-            <name> Pax_DPVM2 </name>
-            </COMPONENTS>
-               
-        </Pax_DPVM1>
-        
-        <Pax_DPVM2>
-            <remote_user_name> Paxterra </remote_user_name>
-            <remote_ip_address>24.6.49.222</remote_ip_address>
-            <remote_port>6500</remote_port>
-            <remote_pwd>0nLab_gu3st</remote_pwd>
-            <host>10.128.4.6</host>
-            <user> paxterra </user>
-            <password>0nLab_gu3st</password>
-            <type>RemoteVMDriver</type>
-            <COMPONENTS>
-            <name> Pax_DPVM2 </name>
-            </COMPONENTS>
-               
-        </Pax_DPVM2>
-               
-    </COMPONENT>
-    
-</TOPOLOGY>
diff --git a/TestON/tests/FVProtoSlicing/__init__.py b/TestON/tests/FVProtoSlicing/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/FVProtoSlicing/__init__.py
+++ /dev/null
diff --git a/TestON/tests/FuncNext/FuncNext.params b/TestON/tests/FuncNext/FuncNext.params
new file mode 100755
index 0000000..34d8a56
--- /dev/null
+++ b/TestON/tests/FuncNext/FuncNext.params
@@ -0,0 +1,43 @@
+<PARAMS>
+    
+    <testcases>1,4,5,7,3</testcases>
+
+    #Environment variables
+    <ENV>
+        <cellName>driver_test</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.60.11</ip1>
+        <port1>6633</port1>
+    </CTRL>
+
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+
+    <timers>
+        <LinkDiscovery>5</LinkDiscovery>
+        <SwitchDiscovery>31</SwitchDiscovery>
+    </timers>
+
+</PARAMS>
diff --git a/TestON/tests/FuncNext/FuncNext.py b/TestON/tests/FuncNext/FuncNext.py
new file mode 100755
index 0000000..c0b96d2
--- /dev/null
+++ b/TestON/tests/FuncNext/FuncNext.py
@@ -0,0 +1,608 @@
+
+#Testing the basic functionality of ONOS Next
+#For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep(1)
+class FuncNext:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        onos-install -f
+        onos-wait-for-start
+        '''
+        
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        
+        main.case("Setting up test environment")
+        
+        main.step("Git checkout and pull master and get version")
+        main.ONOSbench.git_checkout("master")
+        git_pull_result = main.ONOSbench.git_pull()
+        print "git_pull_result = ", git_pull_result
+        version_result = main.ONOSbench.get_version()
+
+        if git_pull_result == 2:
+            main.step("Using mvn clean & install")
+            clean_install_result = main.ONOSbench.clean_install()
+            #clean_install_result = main.TRUE
+
+        main.step("Applying cell variable to environment")
+        cell_result1 = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+        cell_result2 = main.ONOS2.set_cell(cell_name)
+        #verify_result = main.ONOS2.verify_cell()
+        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+        
+        cell_result = cell_result1 and cell_result2
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        #main.step("Creating a cell")
+        #cell_create_result = main.ONOSbench.create_cell_file(**************)
+
+        main.step("Installing ONOS package")
+        onos_install_result = main.ONOSbench.onos_install()
+        onos1_isup = main.ONOSbench.isup()
+   
+        main.step("Starting ONOS service")
+        start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+        case1_result = (package_result and\
+                cell_result and verify_result and onos_install_result and\
+                onos1_isup and start_result )
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+    def CASE11(self, main):
+        '''
+        Cleanup sequence:
+        onos-service <node_ip> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+        
+        '''
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Cleaning up test environment")
+
+        main.step("Testing ONOS kill function")
+        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
+
+        main.step("Stopping ONOS service")
+        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
+
+        main.step("Uninstalling ONOS service") 
+        uninstall_result = main.ONOSbench.onos_uninstall()
+
+    def CASE3(self, main):
+        '''
+        Test 'onos' command and its functionality in driver
+        '''
+        
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Testing 'onos' command")
+
+        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        cmdstr1 = "system:name"
+        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
+        main.log.info("onos command returned: "+cmd_result1)
+
+        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        cmdstr2 = "onos:topology"
+        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result2)
+
+
+
+    def CASE4(self, main):
+        import re
+        import time
+        main.case("Pingall Test")
+        main.step("Assigning switches to controllers")
+        for i in range(1,29):
+            if i ==1:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=2 and i<5:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=5 and i<8:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=8 and i<18:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=18 and i<28:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            else:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+        Switch_Mastership = main.TRUE
+        for i in range (1,29):
+            if i==1:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=2 and i<5:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=5 and i<8:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=8 and i<18:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=18 and i<28:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            else:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is" + str(response))
+                if re.search("tcp:" +ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+
+        if Switch_Mastership == main.TRUE:
+            main.log.report("MasterControllers assigned correctly")
+        utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
+                onpass="MasterControllers assigned correctly")
+        '''
+        for i in range (1,29):
+            main.Mininet1.assign_sw_controller(sw=str(i),count=5,
+                    ip1=ONOS1_ip,port1=ONOS1_port,
+                    ip2=ONOS2_ip,port2=ONOS2_port,
+                    ip3=ONOS3_ip,port3=ONOS3_port,
+                    ip4=ONOS4_ip,port4=ONOS4_port,
+                    ip5=ONOS5_ip,port5=ONOS5_port)
+        '''
+        #REACTIVE FWD test
+
+        main.step("Get list of hosts from Mininet")
+        host_list = main.Mininet1.get_hosts()
+        main.log.info(host_list)
+
+        main.step("Get host list in ONOS format")
+        host_onos_list = main.ONOS2.get_hosts_id(host_list)
+        main.log.info(host_onos_list)
+        #time.sleep(5)
+
+        #We must use ping from hosts we want to add intents from 
+        #to make the hosts talk
+        #main.Mininet2.handle.sendline("\r")
+        #main.Mininet2.handle.sendline("h4 ping 10.1.1.1 -c 1 -W 1")
+        #time.sleep(3)
+        #main.Mininet2.handle.sendline("h5 ping 10.1.1.1 -c 1 -W 1")
+        #time.sleep(5)
+        
+        main.step("Pingall")
+        ping_result = main.FALSE
+        while ping_result == main.FALSE:
+            time1 = time.time()
+            ping_result = main.Mininet1.pingall()
+            time2 = time.time()
+            print "Time for pingall: %2f seconds" % (time2 - time1)
+      
+        #Start onos cli again because u might have dropped out of onos prompt to the shell prompt
+        #if there was no activity
+        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+
+        main.step("Get hosts")
+        main.ONOS2.handle.sendline("hosts")
+        main.ONOS2.handle.expect("onos>")
+        hosts = main.ONOS2.handle.before
+        main.log.info(hosts)
+
+        main.step("Get all devices id")
+        devices_id_list = main.ONOS2.get_all_devices_id()
+        main.log.info(devices_id_list)
+        
+        #ONOS displays the hosts in hex format unlike mininet which does in decimal format
+        #So take care while adding intents
+        
+        main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1") 
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
+
+ 
+        
+        print "_____________________________________________________________________________________"
+        ''' 
+        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018", 1, "of:0000000000003008", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009", 1, "of:0000000000006019", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019", 1, "of:0000000000003009", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+        
+        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010", 1, "of:0000000000006020", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020", 1, "of:0000000000003010", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011", 1, "of:0000000000006021", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021", 1, "of:0000000000003011", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012", 1, "of:0000000000006022", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022", 1, "of:0000000000003012", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013", 1, "of:0000000000006023", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023", 1, "of:0000000000003013", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014", 1, "of:0000000000006024", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024", 1, "of:0000000000003014", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015", 1, "of:0000000000006025", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025", 1, "of:0000000000003015", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016", 1, "of:0000000000006026", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026", 1, "of:0000000000003016", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+        
+        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017", 1, "of:0000000000006027", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027", 1, "of:0000000000003017", 1)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+
+        print("_______________________________________________________________________________________")
+        '''
+
+        #Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
+        main.log.info("onos-app-fwd uninstalled")
+
+        #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+        #So sleep for 15s
+        time.sleep(15)
+        
+        flowHandle = main.ONOS2.flows()
+        print "flowHandle = ", flowHandle
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        #while i<10:
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Intents have not ben installed correctly. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Intents have been installed correctly")
+            
+        case4_result = Switch_Mastership and Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case4_result,
+                onpass="Pingall Test successful",
+                onfail="Pingall Test NOT successful")
+
+    def CASE5(self,main) :
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+        deviceResult = main.ONOS2.devices()
+        linksResult = main.ONOS2.links()
+        portsResult = main.ONOS2.ports()
+        print "**************"
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        Topology_Check = main.TRUE
+        main.step("Compare ONOS Topology to MN Topology")
+        devices_json = main.ONOS2.devices()
+        links_json = main.ONOS2.links()
+        ports_json = main.ONOS2.ports()
+        print "devices_json= ", devices_json
+        
+        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
+        print "***********************"
+        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
+        print "***********************"
+        result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
+            
+        result = result1 and result2 and result3
+        print "***********************"
+        if result == main.TRUE:
+            main.log.report("ONOS"+ " Topology matches MN Topology")
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+            onpass="ONOS" + " Topology matches MN Topology",
+            onfail="ONOS" + " Topology does not match MN Topology")
+        Topology_Check = Topology_Check and result
+        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
+            onpass="Topology checks passed", onfail="Topology checks failed")
+    
+
+    def CASE7 (self,main):
+       
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        link_sleep = int(main.params['timers']['LinkDiscovery'])
+
+        main.log.report("Killing a link to ensure that link discovery is consistent")
+        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
+        main.step("Start continuous pings")
+       
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+
+        main.step("Determine the current number of switches and links")
+        topology_output = main.ONOS2.topology()
+        topology_result = main.ONOS1.get_topology(topology_output)
+        activeSwitches = topology_result['devices']
+        links = topology_result['links']
+        print "activeSwitches = ", type(activeSwitches)
+        print "links = ", type(links)
+        main.log.info("Currently there are %s switches and %s links"  %(str(activeSwitches), str(links)))
+
+        main.step("Kill Link between s3 and s28")
+        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        time.sleep(link_sleep)
+        topology_output = main.ONOS2.topology()
+        Link_Down = main.ONOS1.check_status(topology_output,activeSwitches,str(int(links)-2))
+        if Link_Down == main.TRUE:
+            main.log.report("Link Down discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link Down discovered properly",
+                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+        
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        time.sleep(link_sleep)
+        topology_output = main.ONOS2.topology()
+        Link_Up = main.ONOS1.check_status(topology_output,activeSwitches,str(links))
+        if Link_Up == main.TRUE:
+            main.log.report("Link up discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up discovered properly",
+                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+
+
+
+
+        main.step("Compare ONOS Topology to MN Topology")
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+        Topology_Check = main.TRUE
+        devices_json = main.ONOS2.devices()
+        links_json = main.ONOS2.links()
+        ports_json = main.ONOS2.ports()
+        print "devices_json= ", devices_json
+        
+        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
+        print "***********************"
+        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
+        print "***********************"
+        result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
+            
+        result = result1 and result2 and result3
+        print "***********************"
+        if result == main.TRUE:
+            main.log.report("ONOS"+ " Topology matches MN Topology")
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+            onpass="ONOS" + " Topology matches MN Topology",
+            onfail="ONOS" + " Topology does not match MN Topology")
+        Topology_Check = Topology_Check and result
+        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
+            onpass="Topology checks passed", onfail="Topology checks failed")
+    
+        result = Link_Down and Link_Up and Topology_Check
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Link failure is discovered correctly",
+                onfail="Link Discovery failed")
+
+
+
diff --git a/TestON/tests/FuncNext/FuncNext.topo b/TestON/tests/FuncNext/FuncNext.topo
new file mode 100755
index 0000000..444c605
--- /dev/null
+++ b/TestON/tests/FuncNext/FuncNext.topo
@@ -0,0 +1,61 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.60.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1>
+            <host>10.128.60.10</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.60.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <Mininet1>
+            <host>10.128.9.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.9.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/FvtTest/__init__.py b/TestON/tests/FuncNext/__init__.py
similarity index 100%
copy from TestON/tests/FvtTest/__init__.py
copy to TestON/tests/FuncNext/__init__.py
diff --git a/TestON/tests/FvtTest/.svn/entries b/TestON/tests/FvtTest/.svn/entries
deleted file mode 100644
index b51d7ac..0000000
--- a/TestON/tests/FvtTest/.svn/entries
+++ /dev/null
@@ -1,171 +0,0 @@
-9
-
-dir
-65
-svn://192.168.150.61/OpenFlow/tests/PoxTest
-svn://192.168.150.61/OpenFlow
-
-
-
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-8b1d8634-a80c-44fc-ab7b-cc53e6f68013
-
-
-
-
-
-
-0
-
-PoxTest.params
-file
-
-
-
-
-2012-12-05T16:08:24.000000Z
-e79bef68fc6f00acd8bf2028a7e2cab0
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-326
-
-PoxTest.py
-file
-
-
-
-
-2012-12-05T16:08:24.000000Z
-4a2b2aaeb2a2eeed4b70f1adebca7231
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-637
-
-PoxTest.topo
-file
-
-
-
-
-2012-12-05T16:08:24.000000Z
-827eb99b5a13c33d371ffc6aca740464
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-805
-
-__init__.py
-file
-
-
-
-
-2012-12-05T16:08:24.000000Z
-d41d8cd98f00b204e9800998ecf8427e
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-
diff --git a/TestON/tests/FvtTest/.svn/format b/TestON/tests/FvtTest/.svn/format
deleted file mode 100644
index ec63514..0000000
--- a/TestON/tests/FvtTest/.svn/format
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/TestON/tests/FvtTest/.svn/text-base/PoxTest.params.svn-base b/TestON/tests/FvtTest/.svn/text-base/PoxTest.params.svn-base
deleted file mode 100644
index bbadcaa..0000000
--- a/TestON/tests/FvtTest/.svn/text-base/PoxTest.params.svn-base
+++ /dev/null
@@ -1,12 +0,0 @@
-[PARAMS]
-    'testcases' = '[1]'
-    'mail' = 'anilkumar.s@paxterrasolutions.com,paxweb@paxterrasolutions.com'
-    #'log_dir' = '/home/user/Desktop/openflow_logs/'
-    [[CASE1]]
-        'destination' = 'h2'
-        'src' = 'h2'
-        'target'= 'h3'
-        'controller' = 'c1'
-        [[[STEP1]]]
-            'host' = 'h2'
-
diff --git a/TestON/tests/FvtTest/.svn/text-base/PoxTest.py.svn-base b/TestON/tests/FvtTest/.svn/text-base/PoxTest.py.svn-base
deleted file mode 100644
index 49e63af..0000000
--- a/TestON/tests/FvtTest/.svn/text-base/PoxTest.py.svn-base
+++ /dev/null
@@ -1,15 +0,0 @@
-class PoxTest:
-    '''
-    Testing Basic Pox Functionalities
-    '''
-    def __init__(self):
-        self.default = ""
-
-    def CASE1(self,main):
-        main.case("Checking the control flow of POX")
-        main.step("Checking the host reachability using pingHost ")
-        
-        result = main.Mininet1.pingHost(src=main.params['CASE1']['src'],
-                                        target=main.params['CASE1']['target'],
-                                        controller=main.params['CASE1']['controller'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Ping executed successfully",onfail="Ping Failed")
diff --git a/TestON/tests/FvtTest/.svn/text-base/PoxTest.topo.svn-base b/TestON/tests/FvtTest/.svn/text-base/PoxTest.topo.svn-base
deleted file mode 100644
index b4560cb..0000000
--- a/TestON/tests/FvtTest/.svn/text-base/PoxTest.topo.svn-base
+++ /dev/null
@@ -1,25 +0,0 @@
-[TOPOLOGY]
-
-    [[COMPONENT]]
-        [[["Mininet1"]]]
-            'host' = '192.168.56.101'
-            'user' = 'openflow'
-            'password' = 'openflow'
-            'type' = "Mininet"
-            [[[["COMPONENTS"]]]]
-                # Specify the Option for mininet
-                'topo' = 'single'
-                'topocount' = '3'
-                'switch' = 'ovsk'
-                'controller' = 'remote'
-        [[["POX2"]]]
-            'host' = '192.168.56.101'
-            'user' = 'openflow'
-            'password' = 'openflow'
-            'type' = 'POX'
-            'test_target' = '1'
-            'no-cli' = '1' #or '0' if want to run in cli mode
-            [[[["COMPONENTS"]]]]
-                'pox_lib_location' = "/home/openflow/pox/"
-                [[[[["samples.of_tutorial"]]]]]
-
diff --git a/TestON/tests/FvtTest/.svn/text-base/__init__.py.svn-base b/TestON/tests/FvtTest/.svn/text-base/__init__.py.svn-base
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/FvtTest/.svn/text-base/__init__.py.svn-base
+++ /dev/null
diff --git a/TestON/tests/FvtTest/FvtTest.ospk b/TestON/tests/FvtTest/FvtTest.ospk
deleted file mode 100644
index 36af331..0000000
--- a/TestON/tests/FvtTest/FvtTest.ospk
+++ /dev/null
@@ -1,20 +0,0 @@
-CASE 1
-
-    NAME "Checking FVT"
-    STEP "Checking the FVT"
-    STORE ON FVT DO simplePacket USING "SRC_MAC_FOR_CTL0_0" IN pkt
-    in_port = 3
-    STORE ON FVT DO genPacketIn USING in_port AS in_port, pkt AS pkt IN msg
-    snd_list = ["switch", 0, msg]
-    exp_list = [["controller", 0, msg]]
-    STORE ON FVT DO ofmsgSndCmp USING snd_list , exp_list , xid_ignore AS True, hdr_only AS True IN res
-    ASSERT res EQUALS True ONPASS "Received expected message" ONFAIL "Received unexpected message"
-
-    COMMENT "Packet_in for controller1"
-    STORE ON FVT DO simplePacket USING "SRC_MAC_FOR_CTL1_0" IN pkt
-    in_port = 3
-    STORE ON FVT DO genPacketIn USING in_port AS in_port, pkt AS pkt IN msg
-    snd_list = ["switch", 0, msg]
-    exp_list = [["controller", 1, msg]]
-    STORE ON FVT DO ofmsgSndCmp USING snd_list , exp_list , xid_ignore AS True IN res
-    ASSERT res EQUALS True ONPASS "Received expected message" ONFAIL "Received unexpected message"
diff --git a/TestON/tests/FvtTest/FvtTest.params b/TestON/tests/FvtTest/FvtTest.params
deleted file mode 100644
index dfff20e..0000000
--- a/TestON/tests/FvtTest/FvtTest.params
+++ /dev/null
@@ -1,13 +0,0 @@
-<PARAMS>
-    <testcases> [1]</testcases>
-    <mail> anil4haart@gmail.com,paxweb@paxterrasolutions.com</mail>
-    <CASE1>
-        <destination> h2</destination>
-        <src>h2</src>
-        <target> h3 </target>
-        <controller> c1 </controller>
-        <STEP1>
-            <host> h2</host>
-        </STEP1> 
-    </CASE1>
-</PARAMS>
diff --git a/TestON/tests/FvtTest/FvtTest.py b/TestON/tests/FvtTest/FvtTest.py
deleted file mode 100644
index 678cdaa..0000000
--- a/TestON/tests/FvtTest/FvtTest.py
+++ /dev/null
@@ -1,40 +0,0 @@
-'''
-	
- *   TestON is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 2 of the License, or
- *   (at your option) any later version.
-
- *   TestON is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
-
-
-'''
-class FvtTest :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-
-    
-        main.case("Checking FVT")
-        main.step("Checking the FVT")
-        pkt = main.FVT.simplePacket("SRC_MAC_FOR_CTL0_0")
-        in_port = 3
-        msg = main.FVT.genPacketIn(in_port=in_port, pkt=pkt)
-        snd_list = ["switch", 0, msg]
-        exp_list = [["controller", 0, msg]]
-        res = main.FVT.ofmsgSndCmp(snd_list , exp_list , xid_ignore=True, hdr_only=True)
-        utilities.assert_equals(expect=True,actual=res,onpass="Received expected message",onfail="Received unexpected message")
-    
-        #Packet_in for controller1
-        pkt = main.FVT.simplePacket("SRC_MAC_FOR_CTL1_0")
-        in_port = 3
-        msg = main.FVT.genPacketIn(in_port=in_port, pkt=pkt)
-        snd_list = ["switch", 0, msg]
-        exp_list = [["controller", 1, msg]]
-        res = main.FVT.ofmsgSndCmp(snd_list , exp_list , xid_ignore=True)
-        utilities.assert_equals(expect=True,actual=res,onpass="Received expected message",onfail="Received unexpected message")
diff --git a/TestON/tests/FvtTest/FvtTest.topo b/TestON/tests/FvtTest/FvtTest.topo
deleted file mode 100644
index aa440e4..0000000
--- a/TestON/tests/FvtTest/FvtTest.topo
+++ /dev/null
@@ -1,13 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <FVT>
-            <host>192.168.56.101</host>
-            <user> openflow</user>
-            <password> openflow</password>
-            <type>FvtApiDriver</type>
-            <COMPONENTS>
-            </COMPONENTS>   
-        </FVT>        
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/HATest1/HATest1.params b/TestON/tests/HATest1/HATest1.params
deleted file mode 100644
index 7ccd409..0000000
--- a/TestON/tests/HATest1/HATest1.params
+++ /dev/null
@@ -1,50 +0,0 @@
-<PARAMS>
-    <testcases>2,3,4,5,6</testcases>
-    <CTRL>
-        <ip1>10.128.9.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.9.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.9.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.9.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-        <ip5>10.128.9.5</ip5>
-        <port5>6633</port5>
-        <restPort5>8080</restPort5>
-        <switchURL>/wm/onos/registry/switches/json</switchURL>
-        <intentHighURL>/wm/onos/intent/high</intentHighURL>
-        <intentLowURL>/wm/onos/intent/log</intentLowURL>
-    </CTRL>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <INTENTS>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTS>
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/HATest1/HATest1.py b/TestON/tests/HATest1/HATest1.py
deleted file mode 100644
index 91d5b96..0000000
--- a/TestON/tests/HATest1/HATest1.py
+++ /dev/null
@@ -1,293 +0,0 @@
-
-class HATest1:
-
-    global topology
-    global masterSwitchList
-    global highIntentList
-    global lowIntentList
-    global flowTable
-    def __init__(self) :
-        self.default = ''
-
-    '''
-    CASE1 is to close any existing instances of ONOS, clean out the 
-    RAMCloud database, and start up ONOS instances. 
-    '''
-    def CASE1(self,main) :
-        main.case("Initial Startup")
-        main.step("Stop ONOS")
-        if not main.ONOS1.status():
-            main.ONOS1.stop_all()
-        if not main.ONOS1.status():
-            main.ONOS2.stop_all()
-        if not main.ONOS1.status():
-            main.ONOS3.stop_all()
-        if not main.ONOS1.status():
-            main.ONOS4.stop_all()
-        main.ONOS1.stop_rest()
-        main.ONOS2.stop_rest()
-        main.ONOS3.stop_rest()
-        main.ONOS4.stop_rest()
-        result = main.ONOS1.status() or main.ONOS2.status() \
-                or main.ONOS3.status() or main.ONOS4.status()
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="ONOS stopped successfully",onfail="ONOS WAS NOT KILLED PROPERLY")
-        main.step("Startup Zookeeper")
-        main.ZK1.start()
-        main.ZK2.start()
-        main.ZK3.start()
-        main.ZK4.start()
-        result = main.ZK1.isup() and main.ZK2.isup()\
-                and main.ZK3.isup() and main.ZK4.isup
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Zookeeper started successfully",onfail="ZOOKEEPER FAILED TO START")
-        main.step("Cleaning RC Database and Starting All")
-        main.RC1.deldb()
-        main.RC2.deldb()
-        main.RC3.deldb()
-        main.RC4.deldb()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS1.start_rest()
-        main.step("Testing Startup")
-        result1 = main.ONOS1.rest_status()
-        vm1 = main.RC1.status_coor and main.RC1.status_serv and \
-                main.ONOS1.isup()
-        vm2 = main.RC2.status_coor and main.ONOS2.isup()
-        vm3 = main.RC3.status_coor and main.ONOS3.isup()
-        vm4 = main.RC4.status_coor and main.ONOS4.isup()
-        result = result1 and vm1 and vm2 and vm3 and vm4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Everything started successfully",onfail="EVERYTHING FAILED TO START")
-
-    '''
-    CASE2
-    '''
-    def CASE2(self,main) :
-        import time
-        import json
-        import re
-        main.log.report("Assigning Controllers")
-        main.case("Assigning Controllers")
-        main.step("Assign Master Controllers")
-        for i in range(1,28):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip5'],port1=main.params['CTRL']['port5'])
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        
-        result = main.TRUE
-        for i in range (1,28):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip5'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-        utilities.assert_equals(expect = main.TRUE,actual=result,onpass="MasterControllers assigned correctly")
-
-    def CASE3(self,main) :
-        import time
-        import json
-        import re
-        main.case("Adding Intents")
-        intentIP = main.params['CTRL']['ip1']
-        intentPort=main.params['INTENTS']['intentPort']
-        intentURL=main.params['INTENTS']['intentURL']
-        count = 1
-        for i in range(8,18):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            srcDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-            dstDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-        count = 1
-        i = 8
-        result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping ==main.FALSE and count <9:
-                count+=1
-                i = 8
-                result = main.FALSE
-                main.log.info("Ping FAILED! Making attempt number "+str(count) + "in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.info("PINGS FAILED! MAX RETRIES REACHED!")
-                i=19
-                result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping passed!")
-                i+=1
-                result = main.TRUE
-            else:
-                main.log.info("ERROR!!")
-                result = main.ERROR
-        if result==main.FALSE:
-            main.log.info("INTENTS HAVE NOT BEEN INSTALLED CORRECTLY!! EXITING!!!")
-            main.cleanup()
-            main.exit()
-        
-
-    def CASE4(self,main) :
-        import time
-        from subprocess import Popen, PIPE
-        main.case("Setting up and Gathering data for current state")
-        main.step("Get the current In-Memory Topology on each ONOS Instance")
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip'+str(count)) in main.params['CTRL']:
-                temp = temp+(getattr(main,('ONOS'+str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count+=1
-            else:
-                break
-        topo_result = main.TRUE
-        for n in range(1,count):
-            temp_result = main.Mininet1.compare_topo(ctrls,main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-
-        main.step("Get the Mastership of each switch")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['apiPort']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        global masterSwitchList1
-        masterSwitchList1 = stdout
-
-        main.step("Get the High Level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['apiPort']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        global highIntentList1
-        highIntentList1 = stdout
-        
-        main.step("Get the Low level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['apiPort']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        global lowIntentList1
-        lowIntentList1= stdout
-        
-        main.step("Get the OF Table entries")
-        
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-
-    def CASE5(self,main) :
-        main.case("MAIN COMPONENT FAILURE AND SCENARIO SPECIFIC TESTS")
-        
-
-    def CASE6(self,main) :
-        import os
-        main.case("Running ONOS Constant State Tests")
-        main.step("Get the current In-Memory Topology on each ONOS Instance and Compare it to the Topology before component failure")
-
-        main.step("Get the Mastership of each switch and compare to the Mastership before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['apiPort']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        result = main.TRUE
-        for i in range(1,28):
-            if main.ZK1.findMaster(switchDPID="s"+str(i),switchList=masterSwitchList1)==main.ZK1.findMaster(switchDPID="s"+str(i),switchList=stdout):
-                result = result and main.TRUE
-            else:
-                result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Mastership of Switches was not changed",onfail="MASTERSHIP OF SWITCHES HAS CHANGED!!!")
-
-        main.step("Get the High Level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['apiPort']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_intents(preIntents=highIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE HIGH LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to High level Intents",onfail="CHANGES WERE MADE TO HIGH LEVEL INTENTS")
-
-        main.step("Get the Low level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['apiPort']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_low(preIntents=lowIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE LOW LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to Low level Intents",onfail="CHANGES WERE MADE TO LOW LEVEL INTENTS")
-
-
-        main.step("Get the OF Table entries and compare to before component failure")
-        
-        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-
-
-
-
-
diff --git a/TestON/tests/HATest1/HATest1.topo b/TestON/tests/HATest1/HATest1.topo
deleted file mode 100644
index 9ccdb17..0000000
--- a/TestON/tests/HATest1/HATest1.topo
+++ /dev/null
@@ -1,183 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <ZK1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK1>
-
-        <ZK2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK2>
-
-        <ZK3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK3>
-       
-        <ZK4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK4>
-
-        <ZK5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK5>
-
-        <RC1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-
-        <RC5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC5>
-
-        <ONOS1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <Mininet1>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/HATestONOS/HATestONOS.params b/TestON/tests/HATestONOS/HATestONOS.params
deleted file mode 100644
index 6952d1b..0000000
--- a/TestON/tests/HATestONOS/HATestONOS.params
+++ /dev/null
@@ -1,50 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,8</testcases>
-    <CTRL>
-        <ip1>10.128.9.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.9.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.9.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.9.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-        <ip5>10.128.9.5</ip5>
-        <port5>6633</port5>
-        <restPort5>8080</restPort5>
-        <switchURL>/wm/onos/registry/switches/json</switchURL>
-        <intentHighURL>/wm/onos/intent/high</intentHighURL>
-        <intentLowURL>/wm/onos/intent/low</intentLowURL>
-    </CTRL>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <INTENTS>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTS>
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/HATestONOS/HATestONOS.py b/TestON/tests/HATestONOS/HATestONOS.py
deleted file mode 100644
index ff9c7b3..0000000
--- a/TestON/tests/HATestONOS/HATestONOS.py
+++ /dev/null
@@ -1,458 +0,0 @@
-
-class HATestONOS:
-
-    global topology
-    global masterSwitchList
-    global highIntentList
-    global lowIntentList
-    global flows
-    flows = []
-
-    def __init__(self) :
-        self.default = ''
-
-    '''
-    CASE1 is to close any existing instances of ONOS, clean out the 
-    RAMCloud database, and start up ONOS instances. 
-    '''
-    def CASE1(self,main) :
-        main.case("Initial Startup")
-        main.step("Stop ONOS")
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.ONOS5.stop_all()
-        main.ONOS1.stop_rest()
-        main.ONOS2.stop_rest()
-        main.ONOS3.stop_rest()
-        main.ONOS4.stop_rest()
-        main.ONOS5.stop_rest()
-        result = main.ONOS1.status() or main.ONOS2.status() \
-                or main.ONOS3.status() or main.ONOS4.status() or main.ONOS5.status()
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="ONOS stopped successfully",onfail="ONOS WAS NOT KILLED PROPERLY")
-        main.step("Startup Zookeeper")
-        main.ZK1.start()
-        main.ZK2.start()
-        main.ZK3.start()
-        main.ZK4.start()
-        main.ZK5.start()
-        result = main.ZK1.isup() and main.ZK2.isup()\
-                and main.ZK3.isup() and main.ZK4.isup() and main.ZK5.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Zookeeper started successfully",onfail="ZOOKEEPER FAILED TO START")
-        main.step("Cleaning RC Database and Starting All")
-        main.RC1.del_db()
-        main.RC2.del_db()
-        main.RC3.del_db()
-        main.RC4.del_db()
-        main.RC5.del_db()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS5.start_all()
-       # main.ONOS1.start_rest()
-        main.step("Testing Startup")
-        result1 = main.ONOS1.rest_status()
-        vm1 = main.RC1.status_coor and main.RC1.status_serv and \
-                main.ONOS1.isup()
-        vm2 = main.RC2.status_coor and main.ONOS2.isup()
-        vm3 = main.RC3.status_coor and main.ONOS3.isup()
-        vm4 = main.RC4.status_coor and main.ONOS4.isup()
-        vm5 = main.RC5.status_coor and main.ONOS5.isup()
-        result = result1 and vm1 and vm2 and vm3 and vm4 and vm5
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Everything started successfully",onfail="EVERYTHING FAILED TO START")
-
-    '''
-    CASE2
-    '''
-    def CASE2(self,main) :
-        import time
-        import json
-        import re
-        main.log.report("Assigning Controllers")
-        main.case("Assigning Controllers")
-        main.step("Assign Master Controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip5'],port1=main.params['CTRL']['port5'])
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        
-        result = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip5'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-
-        utilities.assert_equals(expect = main.TRUE,actual=result,onpass="MasterControllers assigned correctly")
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-
-    def CASE3(self,main) :
-        import time
-        import json
-        import re
-        main.case("Adding Intents")
-        intentIP = main.params['CTRL']['ip1']
-        intentPort=main.params['INTENTS']['intentPort']
-        intentURL=main.params['INTENTS']['intentURL']
-        count = 1
-        for i in range(8,18):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            srcDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-            dstDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-        count = 1
-        i = 8
-        result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping ==main.FALSE and count <9:
-                count+=1
-                i = 8
-                result = main.FALSE
-                main.log.info("Ping FAILED! Making attempt number "+str(count) + "in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.info("PINGS FAILED! MAX RETRIES REACHED!")
-                i=19
-                result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping passed!")
-                i+=1
-                result = main.TRUE
-            else:
-                main.log.info("ERROR!!")
-                result = main.ERROR
-        if result==main.FALSE:
-            main.log.info("INTENTS HAVE NOT BEEN INSTALLED CORRECTLY!! EXITING!!!")
-            main.cleanup()
-            main.exit()
-        
-
-    def CASE4(self,main) :
-        import time
-        from subprocess import Popen, PIPE
-        main.case("Setting up and Gathering data for current state")
-        main.step("Get the current In-Memory Topology on each ONOS Instance")
-
-        '''
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip'+str(count)) in main.params['CTRL']:
-                temp = temp+(getattr(main,('ONOS'+str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count+=1
-            else:
-                break
-        topo_result = main.TRUE
-
-        for n in range(1,count):
-            temp_result = main.Mininet1.compare_topo(ctrls,main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-        '''
-        '''
-        main.step("Get the Mastership of each switch")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        global masterSwitchList1
-        masterSwitchList1 = stdout
-        '''
-
-        main.step("Get the High Level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        global highIntentList1
-        highIntentList1 = stdout
-        
-        main.step("Get the Low level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        global lowIntentList1
-        lowIntentList1= stdout
-        
-        main.step("Get the OF Table entries")
-        global flows
-        flows=[]
-        for i in range(1,29):
-            flows.append(main.Mininet2.get_flowTable("s"+str(i)))
-
-        
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-
-    def CASE5(self,main) :
-        import re
-        from random import randint
-        main.case("MAIN COMPONENT FAILURE AND SCENARIO SPECIFIC TESTS")
-        main.step("ONOS CORE Failure!")
-        kill = randint(1,4)
-        if kill==1:
-            main.ONOS2.kill()
-        elif kill==2:
-            main.ONOS2.kill()
-        elif kill==3:
-            main.ONOS3.kill()
-        elif kill==4:
-            main.ONOS4.kill()
-        else:
-            main.ONOS5.kill()
-
-        kill2 = randint(1,5)
-        if kill2==kill:
-            if kill2==5:
-                main.ONOS4.kill()
-            elif kill2==1:
-                main.ONOS3.kill()
-            else:
-                main.ONOS5.kill()
-        else:
-            if kill2==1:
-                main.ONOS5.kill()
-            elif kill2==2:
-                main.ONOS2.kill()
-            elif kill2==3:
-                main.ONOS3.kill()
-            elif kill2==4:
-                main.ONOS4.kill()
-            else:
-                main.ONOS5.kill()
-        time.sleep(10)
-        main.step("Get the Mastership of each switch")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        global masterSwitchList1
-        masterSwitchList1 = stdout
-  
-
-
-    def CASE6(self,main) :
-        import os
-        main.case("Running ONOS Constant State Tests")
-        main.step("Get the current In-Memory Topology on each ONOS Instance and Compare it to the Topology before component failure")
-
-        main.step("Get the Mastership of each switch and compare to the Mastership before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        result = main.TRUE
-        for i in range(1,29):
-            switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
-            switchDPID = switchDPID[:2]+":"+switchDPID[2:4]+":"+switchDPID[4:6]+":"+switchDPID[6:8]+":"+switchDPID[8:10]+":"+switchDPID[10:12]+":"+switchDPID[12:14]+":"+switchDPID[14:]
-            master1 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)
-            master2 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout)
-            if main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)==main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout):
-                result = result and main.TRUE
-            else:
-                result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Mastership of Switches was not changed",onfail="MASTERSHIP OF SWITCHES HAS CHANGED!!!")
-        result1 = result
-
-        main.step("Get the High Level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_intents(preIntents=highIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE HIGH LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to High level Intents",onfail="CHANGES WERE MADE TO HIGH LEVEL INTENTS")
-        result2 = result
-
-        main.step("Get the Low level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_low(preIntents=lowIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE LOW LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to Low level Intents",onfail="CHANGES WERE MADE TO LOW LEVEL INTENTS")
-        result3 = result
-
-
-        main.step("Get the OF Table entries and compare to before component failure")
-        result = main.TRUE
-        flows2=[]
-        for i in range(27):
-            flows2.append(main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            result = result and main.Mininet2.flow_comp(flow1=flows[i], flow2=main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            if result == main.FALSE:
-                main.log.info("DIFFERENCES IN FLOW TABLES FOR SWITCH "+str(i))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes in the flow tables",onfail="CHANGES IN THE FLOW TABLES!!")
-        result4 = result
-        
-        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result5 = not result
-        result = result1 and result2 and result3 and result4 and result5
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Constant State Tests Passed", onfail="CONSTANT STATE TESTS FAILED!!")
-
-    def CASE7 (self,main):
-        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches, %s are active, and %s links" %(number,active,links))
-
-        main.step("Kill Link between s3 and s28")
-        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
-        time.sleep(5)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,str(int(links)-2))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link Down discovered properly",onfail="LINKS NOT DISCOVERED PROPERLY")
-        result1 = result
-        result = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-
-        main.step("Check for loss in pings when Link is brought down")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result2 = result
-        result = result1 and not result2
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link failure is discovered correctly and no traffic is lost!",onfail="Link Discovery failed or traffic was dropped!!!")
-    
-    def CASE8 (self, main) :
-        import time
-        main.case("Killing a switch to ensure switch discovery is working properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches, %s are active, and %s links" %(number,active,links))
-    
-        main.step("Kill s28 ")
-        main.Mininet2.del_switch("s28")
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],str(int(active)-1),str(int(links)-4))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-
-        main.step("Add back s28")
-        main.Mininet2.add_switch("s28")
-        main.Mininet1.assign_sw_controller(sw="28",ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        main.Mininet1.assign_sw_controller(sw="28",count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,links)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-        result1=result
-
-        main.step("Checking for Traffic Loss")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result = not result and result1
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovered Correctly and No Loss of traffic",onfail="Switch discovery failed or there was loss of traffic")
diff --git a/TestON/tests/HATestONOS/HATestONOS.topo b/TestON/tests/HATestONOS/HATestONOS.topo
deleted file mode 100644
index 9ccdb17..0000000
--- a/TestON/tests/HATestONOS/HATestONOS.topo
+++ /dev/null
@@ -1,183 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <ZK1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK1>
-
-        <ZK2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK2>
-
-        <ZK3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK3>
-       
-        <ZK4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK4>
-
-        <ZK5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK5>
-
-        <RC1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-
-        <RC5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC5>
-
-        <ONOS1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <Mininet1>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/HATestONOS2/HATestONOS2.params b/TestON/tests/HATestONOS2/HATestONOS2.params
deleted file mode 100644
index 6952d1b..0000000
--- a/TestON/tests/HATestONOS2/HATestONOS2.params
+++ /dev/null
@@ -1,50 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,8</testcases>
-    <CTRL>
-        <ip1>10.128.9.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.9.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.9.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.9.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-        <ip5>10.128.9.5</ip5>
-        <port5>6633</port5>
-        <restPort5>8080</restPort5>
-        <switchURL>/wm/onos/registry/switches/json</switchURL>
-        <intentHighURL>/wm/onos/intent/high</intentHighURL>
-        <intentLowURL>/wm/onos/intent/low</intentLowURL>
-    </CTRL>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <INTENTS>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTS>
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/HATestONOS2/HATestONOS2.py b/TestON/tests/HATestONOS2/HATestONOS2.py
deleted file mode 100644
index 861d282..0000000
--- a/TestON/tests/HATestONOS2/HATestONOS2.py
+++ /dev/null
@@ -1,429 +0,0 @@
-
-class HATestONOS2:
-
-    global topology
-    global masterSwitchList
-    global highIntentList
-    global lowIntentList
-    global flows
-    flows = []
-
-    def __init__(self) :
-        self.default = ''
-
-    '''
-    CASE1 is to close any existing instances of ONOS, clean out the 
-    RAMCloud database, and start up ONOS instances. 
-    '''
-    def CASE1(self,main) :
-        main.case("Initial Startup")
-        main.step("Stop ONOS")
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.ONOS5.stop_all()
-        main.ONOS1.stop_rest()
-        main.ONOS2.stop_rest()
-        main.ONOS3.stop_rest()
-        main.ONOS4.stop_rest()
-        main.ONOS5.stop_rest()
-        result = main.ONOS1.status() or main.ONOS2.status() \
-                or main.ONOS3.status() or main.ONOS4.status() or main.ONOS5.status()
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="ONOS stopped successfully",onfail="ONOS WAS NOT KILLED PROPERLY")
-        main.step("Startup Zookeeper")
-        main.ZK1.start()
-        main.ZK2.start()
-        main.ZK3.start()
-        main.ZK4.start()
-        main.ZK5.start()
-        result = main.ZK1.isup() and main.ZK2.isup()\
-                and main.ZK3.isup() and main.ZK4.isup() and main.ZK5.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Zookeeper started successfully",onfail="ZOOKEEPER FAILED TO START")
-        main.step("Cleaning RC Database and Starting All")
-        main.RC1.del_db()
-        main.RC2.del_db()
-        main.RC3.del_db()
-        main.RC4.del_db()
-        main.RC5.del_db()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS5.start_all()
-       # main.ONOS1.start_rest()
-        main.step("Testing Startup")
-        result1 = main.ONOS1.rest_status()
-        vm1 = main.RC1.status_coor and main.RC1.status_serv and \
-                main.ONOS1.isup()
-        vm2 = main.RC2.status_coor and main.ONOS2.isup()
-        vm3 = main.RC3.status_coor and main.ONOS3.isup()
-        vm4 = main.RC4.status_coor and main.ONOS4.isup()
-        vm5 = main.RC5.status_coor and main.ONOS5.isup()
-        result = result1 and vm1 and vm2 and vm3 and vm4 and vm5
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Everything started successfully",onfail="EVERYTHING FAILED TO START")
-
-    '''
-    CASE2
-    '''
-    def CASE2(self,main) :
-        import time
-        import json
-        import re
-        main.log.report("Assigning Controllers")
-        main.case("Assigning Controllers")
-        main.step("Assign Master Controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip5'],port1=main.params['CTRL']['port5'])
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        
-        result = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip5'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-
-        utilities.assert_equals(expect = main.TRUE,actual=result,onpass="MasterControllers assigned correctly")
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-
-    def CASE3(self,main) :
-        import time
-        import json
-        import re
-        main.case("Adding Intents")
-        intentIP = main.params['CTRL']['ip1']
-        intentPort=main.params['INTENTS']['intentPort']
-        intentURL=main.params['INTENTS']['intentURL']
-        count = 1
-        for i in range(8,18):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            srcDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-            dstDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-        count = 1
-        i = 8
-        result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping ==main.FALSE and count <9:
-                count+=1
-                i = 8
-                result = main.FALSE
-                main.log.info("Ping FAILED! Making attempt number "+str(count) + "in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.info("PINGS FAILED! MAX RETRIES REACHED!")
-                i=19
-                result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping passed!")
-                i+=1
-                result = main.TRUE
-            else:
-                main.log.info("ERROR!!")
-                result = main.ERROR
-        if result==main.FALSE:
-            main.log.info("INTENTS HAVE NOT BEEN INSTALLED CORRECTLY!! EXITING!!!")
-            main.cleanup()
-            main.exit()
-        
-
-    def CASE4(self,main) :
-        import time
-        from subprocess import Popen, PIPE
-        main.case("Setting up and Gathering data for current state")
-        main.step("Get the current In-Memory Topology on each ONOS Instance")
-
-        '''
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip'+str(count)) in main.params['CTRL']:
-                temp = temp+(getattr(main,('ONOS'+str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count+=1
-            else:
-                break
-        topo_result = main.TRUE
-
-        for n in range(1,count):
-            temp_result = main.Mininet1.compare_topo(ctrls,main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-        '''
-        main.step("Get the Mastership of each switch")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        global masterSwitchList1
-        masterSwitchList1 = stdout
-
-        main.step("Get the High Level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        global highIntentList1
-        highIntentList1 = stdout
-        
-        main.step("Get the Low level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        global lowIntentList1
-        lowIntentList1= stdout
-        
-        main.step("Get the OF Table entries")
-        global flows
-        flows=[]
-        for i in range(1,29):
-            flows.append(main.Mininet2.get_flowTable("s"+str(i)))
-
-        
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-
-    def CASE5(self,main) :
-        import re
-        from random import randint
-        main.case("MAIN COMPONENT FAILURE AND SCENARIO SPECIFIC TESTS")
-        main.step("ONOS CORE All - Failure!")
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.ONOS5.stop()
-        time.sleep(2)
-        main.ONOS1.start()
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS5.start()
-        if main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup():
-            main.log.info("ONOS BACK UP!")
-            result = main.TRUE
-        else:
-            main.log.info("ONOS DID NOT COME BACK UP!!!")
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="ONOS has been brought back up!",onfail = "ONOS HAS FAILED TO RESTART!")
-
-    def CASE6(self,main) :
-        import os
-        main.case("Running ONOS Constant State Tests")
-        main.step("Get the current In-Memory Topology on each ONOS Instance and Compare it to the Topology before component failure")
-
-        main.step("Get the Mastership of each switch and compare to the Mastership before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        result = main.TRUE
-        for i in range(1,29):
-            switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
-            switchDPID = switchDPID[:2]+":"+switchDPID[2:4]+":"+switchDPID[4:6]+":"+switchDPID[6:8]+":"+switchDPID[8:10]+":"+switchDPID[10:12]+":"+switchDPID[12:14]+":"+switchDPID[14:]
-            master1 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)
-            master2 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout)
-            if main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)==main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout):
-                result = result and main.TRUE
-            else:
-                result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Mastership of Switches was not changed",onfail="MASTERSHIP OF SWITCHES HAS CHANGED!!!")
-
-        main.step("Get the High Level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_intents(preIntents=highIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE HIGH LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to High level Intents",onfail="CHANGES WERE MADE TO HIGH LEVEL INTENTS")
-
-        main.step("Get the Low level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_low(preIntents=lowIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE LOW LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to Low level Intents",onfail="CHANGES WERE MADE TO LOW LEVEL INTENTS")
-
-
-        main.step("Get the OF Table entries and compare to before component failure")
-        result = main.TRUE
-        flows2=[]
-        for i in range(27):
-            flows2.append(main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            result = result and main.Mininet2.flow_comp(flow1=flows[i], flow2=main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            if result == main.FALSE:
-                main.log.info("DIFFERENCES IN FLOW TABLES FOR SWITCH "+str(i))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes in the flow tables",onfail="CHANGES IN THE FLOW TABLES!!")
-        
-        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-
-    def CASE7 (self,main):
-        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches, %s are active, and %s links" %(number,active,links))
-
-        main.step("Kill Link between s3 and s28")
-        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
-        time.sleep(5)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,str(int(links)-2))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link Down discovered properly",onfail="LINKS NOT DISCOVERED PROPERLY")
-        result1 = result
-        result = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-
-        main.step("Check for loss in pings when Link is brought down")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result2 = result
-        result = result1 and not result2
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link failure is discovered correctly and no traffic is lost!",onfail="Link Discovery failed or traffic was dropped!!!")
-    
-    def CASE8 (self, main) :
-        import time
-        main.case("Killing a switch to ensure switch discovery is working properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches, %s are active, and %s links" %(number,active,links))
-    
-        main.step("Kill s28 ")
-        main.Mininet2.del_switch("s28")
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],str(int(active)-1),str(int(links)-4))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-
-        main.step("Add back s28")
-        main.Mininet2.add_switch("s28")
-        main.Mininet1.assign_sw_controller(sw="28",ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        main.Mininet1.assign_sw_controller(sw="28",count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,links)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-        result1=result
-
-        main.step("Checking for Traffic Loss")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result = not result and result1
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovered Correctly and No Loss of traffic",onfail="Switch discovery failed or there was loss of traffic")
diff --git a/TestON/tests/HATestONOS2/HATestONOS2.topo b/TestON/tests/HATestONOS2/HATestONOS2.topo
deleted file mode 100644
index 9ccdb17..0000000
--- a/TestON/tests/HATestONOS2/HATestONOS2.topo
+++ /dev/null
@@ -1,183 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <ZK1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK1>
-
-        <ZK2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK2>
-
-        <ZK3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK3>
-       
-        <ZK4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK4>
-
-        <ZK5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK5>
-
-        <RC1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-
-        <RC5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC5>
-
-        <ONOS1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <Mininet1>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/HATestRCS/HATestRCS.params b/TestON/tests/HATestRCS/HATestRCS.params
deleted file mode 100644
index 6952d1b..0000000
--- a/TestON/tests/HATestRCS/HATestRCS.params
+++ /dev/null
@@ -1,50 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,8</testcases>
-    <CTRL>
-        <ip1>10.128.9.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.9.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.9.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.9.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-        <ip5>10.128.9.5</ip5>
-        <port5>6633</port5>
-        <restPort5>8080</restPort5>
-        <switchURL>/wm/onos/registry/switches/json</switchURL>
-        <intentHighURL>/wm/onos/intent/high</intentHighURL>
-        <intentLowURL>/wm/onos/intent/low</intentLowURL>
-    </CTRL>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <INTENTS>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTS>
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/HATestRCS/HATestRCS.py b/TestON/tests/HATestRCS/HATestRCS.py
deleted file mode 100644
index 80413f8..0000000
--- a/TestON/tests/HATestRCS/HATestRCS.py
+++ /dev/null
@@ -1,446 +0,0 @@
-
-class HATestRCS:
-
-    global topology
-    global masterSwitchList
-    global highIntentList
-    global lowIntentList
-    global flows
-    flows = []
-
-    def __init__(self) :
-        self.default = ''
-
-    '''
-    CASE1 is to close any existing instances of ONOS, clean out the 
-    RAMCloud database, and start up ONOS instances. 
-    '''
-    def CASE1(self,main) :
-
-        main.case("Initial Startup")
-        main.step("Stop ONOS")
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.ONOS5.stop_all()
-        main.ONOS1.stop_rest()
-        main.ONOS2.stop_rest()
-        main.ONOS3.stop_rest()
-        main.ONOS4.stop_rest()
-        main.ONOS5.stop_rest()
-        result = main.ONOS1.status() or main.ONOS2.status() \
-                or main.ONOS3.status() or main.ONOS4.status() or main.ONOS5.status()
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="ONOS stopped successfully",onfail="ONOS WAS NOT KILLED PROPERLY")
-        main.step("Startup Zookeeper")
-        main.ZK1.start()
-        main.ZK2.start()
-        main.ZK3.start()
-        main.ZK4.start()
-        main.ZK5.start()
-        result = main.ZK1.isup() and main.ZK2.isup()\
-                and main.ZK3.isup() and main.ZK4.isup() and main.ZK5.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Zookeeper started successfully",onfail="ZOOKEEPER FAILED TO START")
-        main.step("Cleaning RC Database and Starting All")
-        main.RC1.del_db()
-        main.RC2.del_db()
-        main.RC3.del_db()
-        main.RC4.del_db()
-        main.RC5.del_db()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS5.start_all()
-       # main.ONOS1.start_rest()
-        main.step("Testing Startup")
-        result1 = main.ONOS1.rest_status()
-        vm1 = main.RC1.status_coor and main.RC1.status_serv and \
-                main.ONOS1.isup()
-        vm2 = main.RC2.status_coor and main.ONOS2.isup()
-        vm3 = main.RC3.status_coor and main.ONOS3.isup()
-        vm4 = main.RC4.status_coor and main.ONOS4.isup()
-        vm5 = main.RC5.status_coor and main.ONOS5.isup()
-        result = result1 and vm1 and vm2 and vm3 and vm4 and vm5
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Everything started successfully",onfail="EVERYTHING FAILED TO START")
-
-    '''
-    CASE2
-    '''
-    def CASE2(self,main) :
-        import time
-        import json
-        import re
-        main.log.report("Assigning Controllers")
-        main.case("Assigning Controllers")
-        main.step("Assign Master Controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip5'],port1=main.params['CTRL']['port5'])
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        
-        result = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip5'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-
-        utilities.assert_equals(expect = main.TRUE,actual=result,onpass="MasterControllers assigned correctly")
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-
-    def CASE3(self,main) :
-        import time
-        import json
-        import re
-        main.case("Adding Intents")
-        intentIP = main.params['CTRL']['ip1']
-        intentPort=main.params['INTENTS']['intentPort']
-        intentURL=main.params['INTENTS']['intentURL']
-        count = 1
-        for i in range(8,18):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            srcDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-            dstDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-        count = 1
-        i = 8
-        result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping ==main.FALSE and count <9:
-                count+=1
-                i = 8
-                result = main.FALSE
-                main.log.info("Ping FAILED! Making attempt number "+str(count) + "in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.info("PINGS FAILED! MAX RETRIES REACHED!")
-                i=19
-                result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping passed!")
-                i+=1
-                result = main.TRUE
-            else:
-                main.log.info("ERROR!!")
-                result = main.ERROR
-        if result==main.FALSE:
-            main.log.info("INTENTS HAVE NOT BEEN INSTALLED CORRECTLY!! EXITING!!!")
-            main.cleanup()
-            main.exit()
-        
-
-    def CASE4(self,main) :
-        import time
-        from subprocess import Popen, PIPE
-        main.case("Setting up and Gathering data for current state")
-        main.step("Get the current In-Memory Topology on each ONOS Instance")
-
-        '''
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip'+str(count)) in main.params['CTRL']:
-                temp = temp+(getattr(main,('ONOS'+str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count+=1
-            else:
-                break
-        topo_result = main.TRUE
-
-        for n in range(1,count):
-            temp_result = main.Mininet1.compare_topo(ctrls,main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-        '''
-        main.step("Get the Mastership of each switch")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        global masterSwitchList1
-        masterSwitchList1 = stdout
-
-        main.step("Get the High Level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        global highIntentList1
-        highIntentList1 = stdout
-        
-        main.step("Get the Low level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        global lowIntentList1
-        lowIntentList1= stdout
-        
-        main.step("Get the OF Table entries")
-        global flows
-        flows=[]
-        for i in range(1,29):
-            flows.append(main.Mininet2.get_flowTable("s"+str(i)))
-
-        
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-
-    def CASE5(self,main) :
-        import re
-        from random import randint
-        main.case("MAIN COMPONENT FAILURE AND SCENARIO SPECIFIC TESTS")
-        main.step("RC CORE Failure!")
-        kill = randint(1,4)
-        if kill==1:
-            main.RC1.stop_serv()
-        elif kill==2:
-            main.RC2.stop_serv()
-        elif kill==3:
-            main.RC3.stop_serv()
-        elif kill==4:
-            main.RC4.stop_serv()
-        else:
-            main.RC5.stop_serv()
-
-        kill2 = randint(1,5)
-        if kill2==kill:
-            if kill2==5:
-                main.RC4.stop_serv()
-            elif kill2==1:
-                main.RC3.stop_serv()
-            else:
-                main.RC5.stop_serv()
-        else:
-            if kill2==1:
-                main.RC1.stop_serv()
-            elif kill2==2:
-                main.RC2.stop_serv()
-            elif kill2==3:
-                main.RC3.stop_serv()
-            elif kill2==4:
-                main.RC4.stop_serv()
-            else:
-                main.RC5.stop_serv()
-        time.sleep(10)
-  
-
-
-    def CASE6(self,main) :
-        import os
-        main.case("Running ONOS Constant State Tests")
-        main.step("Get the current In-Memory Topology on each ONOS Instance and Compare it to the Topology before component failure")
-
-        main.step("Get the Mastership of each switch and compare to the Mastership before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        result = main.TRUE
-        for i in range(1,29):
-            switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
-            switchDPID = switchDPID[:2]+":"+switchDPID[2:4]+":"+switchDPID[4:6]+":"+switchDPID[6:8]+":"+switchDPID[8:10]+":"+switchDPID[10:12]+":"+switchDPID[12:14]+":"+switchDPID[14:]
-            master1 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)
-            master2 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout)
-            if main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)==main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout):
-                result = result and main.TRUE
-            else:
-                result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Mastership of Switches was not changed",onfail="MASTERSHIP OF SWITCHES HAS CHANGED!!!")
-
-        main.step("Get the High Level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_intents(preIntents=highIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE HIGH LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to High level Intents",onfail="CHANGES WERE MADE TO HIGH LEVEL INTENTS")
-
-        main.step("Get the Low level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_low(preIntents=lowIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE LOW LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to Low level Intents",onfail="CHANGES WERE MADE TO LOW LEVEL INTENTS")
-
-
-        main.step("Get the OF Table entries and compare to before component failure")
-        result = main.TRUE
-        flows2=[]
-        for i in range(27):
-            flows2.append(main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            result = result and main.Mininet2.flow_comp(flow1=flows[i], flow2=main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            if result == main.FALSE:
-                main.log.info("DIFFERENCES IN FLOW TABLES FOR SWITCH "+str(i))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes in the flow tables",onfail="CHANGES IN THE FLOW TABLES!!")
-        
-        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-
-    def CASE7 (self,main):
-        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches, %s are active, and %s links" %(number,active,links))
-
-        main.step("Kill Link between s3 and s28")
-        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
-        time.sleep(5)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,str(int(links)-2))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link Down discovered properly",onfail="LINKS NOT DISCOVERED PROPERLY")
-        result1 = result
-        result = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-
-        main.step("Check for loss in pings when Link is brought down")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result2 = result
-        result = result1 and not result2
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link failure is discovered correctly and no traffic is lost!",onfail="Link Discovery failed or traffic was dropped!!!")
-    
-    def CASE8 (self, main) :
-        import time
-        main.case("Killing a switch to ensure switch discovery is working properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches, %s are active, and %s links" %(number,active,links))
-    
-        main.step("Kill s28 ")
-        main.Mininet2.del_switch("s28")
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],str(int(active)-1),str(int(links)-4))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-
-        main.step("Add back s28")
-        main.Mininet2.add_switch("s28")
-        main.Mininet1.assign_sw_controller(sw="28",ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        main.Mininet1.assign_sw_controller(sw="28",count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,links)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-        result1=result
-
-        main.step("Checking for Traffic Loss")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result = not result and result1
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovered Correctly and No Loss of traffic",onfail="Switch discovery failed or there was loss of traffic")
diff --git a/TestON/tests/HATestRCS/HATestRCS.topo b/TestON/tests/HATestRCS/HATestRCS.topo
deleted file mode 100644
index 9ccdb17..0000000
--- a/TestON/tests/HATestRCS/HATestRCS.topo
+++ /dev/null
@@ -1,183 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <ZK1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK1>
-
-        <ZK2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK2>
-
-        <ZK3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK3>
-       
-        <ZK4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK4>
-
-        <ZK5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK5>
-
-        <RC1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-
-        <RC5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC5>
-
-        <ONOS1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <Mininet1>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/HATestSuite/__init.py__ b/TestON/tests/HATestSuite/__init.py__
deleted file mode 100644
index 8d1c8b6..0000000
--- a/TestON/tests/HATestSuite/__init.py__
+++ /dev/null
@@ -1 +0,0 @@
- 
diff --git a/TestON/tests/HATestTemplate/HATest1.params b/TestON/tests/HATestTemplate/HATest1.params
deleted file mode 100644
index 4d405f9..0000000
--- a/TestON/tests/HATestTemplate/HATest1.params
+++ /dev/null
@@ -1,50 +0,0 @@
-<PARAMS>
-    <testcases>2,3,4,5,6</testcases>
-    <CTRL>
-        <ip1>10.128.9.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.9.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.9.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.9.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-        <ip5>10.128.9.5</ip5>
-        <port5>6633</port5>
-        <restPort5>8080</restPort5>
-        <switchURL>/wm/onos/registry/switches/json</switchURL>
-        <intentHighURL>/wm/onos/intent/high</intentHighURL>
-        <intentLowURL>/wm/onos/intent/low</intentLowURL>
-    </CTRL>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <INTENTS>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTS>
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/HATestTemplate/HATest1.py b/TestON/tests/HATestTemplate/HATest1.py
deleted file mode 100644
index 92b4965..0000000
--- a/TestON/tests/HATestTemplate/HATest1.py
+++ /dev/null
@@ -1,382 +0,0 @@
-
-class HATest1:
-
-    global topology
-    global masterSwitchList
-    global highIntentList
-    global lowIntentList
-    global flows
-    flows = []
-
-    def __init__(self) :
-        self.default = ''
-
-    '''
-    CASE1 is to close any existing instances of ONOS, clean out the 
-    RAMCloud database, and start up ONOS instances. 
-    '''
-    def CASE1(self,main) :
-        main.case("Initial Startup")
-        main.step("Stop ONOS")
-        if not main.ONOS1.status():
-            main.ONOS1.stop_all()
-        if not main.ONOS1.status():
-            main.ONOS2.stop_all()
-        if not main.ONOS1.status():
-            main.ONOS3.stop_all()
-        if not main.ONOS1.status():
-            main.ONOS4.stop_all()
-        main.ONOS1.stop_rest()
-        main.ONOS2.stop_rest()
-        main.ONOS3.stop_rest()
-        main.ONOS4.stop_rest()
-        result = main.ONOS1.status() or main.ONOS2.status() \
-                or main.ONOS3.status() or main.ONOS4.status()
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="ONOS stopped successfully",onfail="ONOS WAS NOT KILLED PROPERLY")
-        main.step("Startup Zookeeper")
-        main.ZK1.start()
-        main.ZK2.start()
-        main.ZK3.start()
-        main.ZK4.start()
-        result = main.ZK1.isup() and main.ZK2.isup()\
-                and main.ZK3.isup() and main.ZK4.isup
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Zookeeper started successfully",onfail="ZOOKEEPER FAILED TO START")
-        main.step("Cleaning RC Database and Starting All")
-        main.RC1.deldb()
-        main.RC2.deldb()
-        main.RC3.deldb()
-        main.RC4.deldb()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS1.start_rest()
-        main.step("Testing Startup")
-        result1 = main.ONOS1.rest_status()
-        vm1 = main.RC1.status_coor and main.RC1.status_serv and \
-                main.ONOS1.isup()
-        vm2 = main.RC2.status_coor and main.ONOS2.isup()
-        vm3 = main.RC3.status_coor and main.ONOS3.isup()
-        vm4 = main.RC4.status_coor and main.ONOS4.isup()
-        result = result1 and vm1 and vm2 and vm3 and vm4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Everything started successfully",onfail="EVERYTHING FAILED TO START")
-
-    '''
-    CASE2
-    '''
-    def CASE2(self,main) :
-        import time
-        import json
-        import re
-        main.log.report("Assigning Controllers")
-        main.case("Assigning Controllers")
-        main.step("Assign Master Controllers")
-        for i in range(1,28):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip5'],port1=main.params['CTRL']['port5'])
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        
-        result = main.TRUE
-        for i in range (1,28):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip5'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-        utilities.assert_equals(expect = main.TRUE,actual=result,onpass="MasterControllers assigned correctly")
-
-    def CASE3(self,main) :
-        import time
-        import json
-        import re
-        main.case("Adding Intents")
-        intentIP = main.params['CTRL']['ip1']
-        intentPort=main.params['INTENTS']['intentPort']
-        intentURL=main.params['INTENTS']['intentURL']
-        count = 1
-        for i in range(8,18):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            srcDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-            dstDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-        count = 1
-        i = 8
-        result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping ==main.FALSE and count <9:
-                count+=1
-                i = 8
-                result = main.FALSE
-                main.log.info("Ping FAILED! Making attempt number "+str(count) + "in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.info("PINGS FAILED! MAX RETRIES REACHED!")
-                i=19
-                result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping passed!")
-                i+=1
-                result = main.TRUE
-            else:
-                main.log.info("ERROR!!")
-                result = main.ERROR
-        if result==main.FALSE:
-            main.log.info("INTENTS HAVE NOT BEEN INSTALLED CORRECTLY!! EXITING!!!")
-            main.cleanup()
-            main.exit()
-        
-
-    def CASE4(self,main) :
-        import time
-        from subprocess import Popen, PIPE
-        main.case("Setting up and Gathering data for current state")
-        main.step("Get the current In-Memory Topology on each ONOS Instance")
-
-        '''
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip'+str(count)) in main.params['CTRL']:
-                temp = temp+(getattr(main,('ONOS'+str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count+=1
-            else:
-                break
-        topo_result = main.TRUE
-
-        for n in range(1,count):
-            temp_result = main.Mininet1.compare_topo(ctrls,main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-        '''
-
-        main.step("Get the Mastership of each switch")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        global masterSwitchList1
-        masterSwitchList1 = stdout
-
-        main.step("Get the High Level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        global highIntentList1
-        highIntentList1 = stdout
-        
-        main.step("Get the Low level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        global lowIntentList1
-        lowIntentList1= stdout
-        
-        main.step("Get the OF Table entries")
-        global flows
-        flows=[]
-        for i in range(1,28):
-            print main.Mininet2.get_flowTable("s"+str(i))
-            flows.append(main.Mininet2.get_flowTable("s"+str(i)))
-
-        
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-
-    def CASE5(self,main) :
-        import re
-        main.case("MAIN COMPONENT FAILURE AND SCENARIO SPECIFIC TESTS")
-        main.step("Zookeeper Server Failure!")
-        result = main.TRUE
-        master1 = main.ZK1.status()
-        print master1
-        if re.search("leader",master1):
-            main.ZK1.stop()
-            main.log.info("ZK1 was Master and Killed! Also Killing ZK2")
-            main.ZK2.stop()
-            time.sleep(10)
-            if re.search("leader",main.ZK3.status()) or re.search("leader",main.ZK4.status()) or re.search("leader",main.ZK5.status()):
-                result = main.TRUE
-                main.log.info("New Leader Elected")
-            else:
-                result = main.FALSE
-                main.log.info("NO NEW ZK LEADER ELECTED!!!")
-        else:
-            master2 = main.ZK2.status()
-            if re.search("leader",master2):
-                main.ZK2.stop()
-                main.log.info("ZK2 was Master and Killed! Also Killing ZK3")
-                main.ZK3.stop()
-                time.sleep(10)
-                if re.search("leader",main.ZK1.status()) or re.search("leader",main.ZK4.status()) or re.search("leader",main.ZK5.status()):
-                    result = main.TRUE
-                    main.log.info("New Leader Elected")
-                else:
-                    result = main.FALSE
-                    main.log.info("NO NEW ZK LEADER ELECTED!!!")
-            else:
-                master3 = main.ZK3.status()
-                if re.search("leader",master3):
-                    main.ZK3.stop()
-                    main.log.info("ZK3 was Master and Killed! Also Killing ZK4")
-                    main.ZK4.stop()
-                    time.sleep(10)
-                    if re.search("leader",main.ZK1.status()) or re.search("leader",main.ZK2.status()) or re.search("leader",main.ZK5.status()):
-                        result = main.TRUE
-                        main.log.info("New Leader Elected")
-                    else:
-                        result = main.FALSE
-                        main.log.info("NO NEW ZK LEADER ELECTED!!!")
-                else:
-                    master4 = main.ZK4.status()
-                    if re.search("leader",master4):
-                        main.ZK4.stop()
-                        main.log.info("ZK4 was Master and Killed! Also Killing ZK5")
-                        main.ZK5.stop()
-                        time.sleep(10)
-                        if re.search("leader",main.ZK1.status()) or re.search("leader",main.ZK2.status()) or re.search("leader",main.ZK3.status()):
-                            result = main.TRUE
-                            main.log.info("New Leader Elected")
-                        else:
-                            result = main.FALSE
-                            main.log.info("NO NEW ZK LEADER ELECTED!!!")
-                    else:
-                        main.ZK5.stop()
-                        main.log.info("ZK5 was Master and Killed! Also Killing ZK1")
-                        main.ZK1.stop()
-                        time.sleep(10)
-                        if re.search("leader",main.ZK3.status()) or re.search("leader",main.ZK4.status()) or re.search("leader",main.ZK2.status()):
-                            result = main.TRUE
-                            main.log.info("New Leader Elected")
-                        else:
-                            result = main.FALSE
-                            main.log.info("NO NEW ZK LEADER ELECTED!!!")
-
-
-    def CASE6(self,main) :
-        import os
-        main.case("Running ONOS Constant State Tests")
-        main.step("Get the current In-Memory Topology on each ONOS Instance and Compare it to the Topology before component failure")
-
-        main.step("Get the Mastership of each switch and compare to the Mastership before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        result = main.TRUE
-        for i in range(1,28):
-            if main.ZK1.findMaster(switchDPID="s"+str(i),switchList=masterSwitchList1)==main.ZK1.findMaster(switchDPID="s"+str(i),switchList=stdout):
-                result = result and main.TRUE
-            else:
-                result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Mastership of Switches was not changed",onfail="MASTERSHIP OF SWITCHES HAS CHANGED!!!")
-
-        main.step("Get the High Level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_intents(preIntents=highIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE HIGH LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to High level Intents",onfail="CHANGES WERE MADE TO HIGH LEVEL INTENTS")
-
-        main.step("Get the Low level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_low(preIntents=lowIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE LOW LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to Low level Intents",onfail="CHANGES WERE MADE TO LOW LEVEL INTENTS")
-
-
-        main.step("Get the OF Table entries and compare to before component failure")
-        result = main.TRUE
-        flows2=[]
-        for i in range(27):
-            flows2.append(main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            result = result and main.Mininet2.flow_comp(flow1=flows[i], flow2=main.Mininet2.get_flowTable(sw="s"+str(i+1)))   
-            print flows[i]
-            print flows2[i]
-            if result == main.FALSE:
-                main.log.info("DIFFERENCES IN FLOW TABLES FOR SWITCH "+str(i))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes in the flow tables",onfail="CHANGES IN THE FLOW TABLES!!")
-        
-        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-
-
-
-
-
diff --git a/TestON/tests/HATestTemplate/HATest1.topo b/TestON/tests/HATestTemplate/HATest1.topo
deleted file mode 100644
index 9ccdb17..0000000
--- a/TestON/tests/HATestTemplate/HATest1.topo
+++ /dev/null
@@ -1,183 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <ZK1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK1>
-
-        <ZK2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK2>
-
-        <ZK3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK3>
-       
-        <ZK4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK4>
-
-        <ZK5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK5>
-
-        <RC1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-
-        <RC5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC5>
-
-        <ONOS1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <Mininet1>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/HATestZK/HATestZK.params b/TestON/tests/HATestZK/HATestZK.params
deleted file mode 100644
index 24f1a29..0000000
--- a/TestON/tests/HATestZK/HATestZK.params
+++ /dev/null
@@ -1,52 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,8</testcases>
-    <CTRL>
-        <ip1>10.128.11.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.11.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.11.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.11.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-        <ip5>10.128.11.5</ip5>
-        <port5>6633</port5>
-        <restPort5>8080</restPort5>
-        <switchURL>/wm/onos/registry/switches/json</switchURL>
-        <intentHighURL>/wm/onos/intent/high</intentHighURL>
-        <intentLowURL>/wm/onos/intent/low</intentLowURL>
-    </CTRL>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <INTENTS>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTS>
-    <TESTONUSER>admin</TESTONUSER>
-    <TESTONIP>10.128.11.11</TESTONIP>
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/HATestZK/HATestZK.py b/TestON/tests/HATestZK/HATestZK.py
deleted file mode 100644
index 2f8c462..0000000
--- a/TestON/tests/HATestZK/HATestZK.py
+++ /dev/null
@@ -1,525 +0,0 @@
-'''
-Description: This case is to ensure that in the event of Zookeeper failures (including the leader node)
-the cluster should continue to function properly by the passing of Zookeeper functionality to the 
-remaining nodes. In this test, a quorum of the Zookeeper instances must be kept alive.
-
-'''
-class HATestZK:
-
-
-    def __init__(self) :
-        self.default = ''
-
-    '''
-    CASE1 is to close any existing instances of ONOS, clean out the 
-    RAMCloud database, and start up ONOS instances. 
-    '''
-    def CASE1(self,main) :
-        main.case("Initial Startup")
-        main.step("Stop ONOS")
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.ONOS5.stop_all()
-        main.ONOS1.stop_rest()
-        main.ONOS2.stop_rest()
-        main.ONOS3.stop_rest()
-        main.ONOS4.stop_rest()
-        main.ONOS5.stop_rest()
-        result = main.ONOS1.status() or main.ONOS2.status() \
-                or main.ONOS3.status() or main.ONOS4.status() or main.ONOS5.status()
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="ONOS stopped successfully",onfail="ONOS WAS NOT KILLED PROPERLY")
-        main.step("Startup Zookeeper")
-        main.ZK1.start()
-        main.ZK2.start()
-        main.ZK3.start()
-        main.ZK4.start()
-        main.ZK5.start()
-        result = main.ZK1.isup() and main.ZK2.isup()\
-                and main.ZK3.isup() and main.ZK4.isup() and main.ZK5.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Zookeeper started successfully",onfail="ZOOKEEPER FAILED TO START")
-        main.step("Cleaning RC Database and Starting All")
-        main.RC1.del_db()
-        main.RC2.del_db()
-        main.RC3.del_db()
-        main.RC4.del_db()
-        main.RC5.del_db()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS5.start_all()
-        main.ONOS1.start_rest()
-        main.step("Testing Startup")
-        result1 = main.ONOS1.rest_status()
-        vm1 = main.RC1.status_coor and main.RC1.status_serv and \
-                main.ONOS1.isup()
-        vm2 = main.RC2.status_coor and main.ONOS2.isup()
-        vm3 = main.RC3.status_coor and main.ONOS3.isup()
-        vm4 = main.RC4.status_coor and main.ONOS4.isup()
-        vm5 = main.RC5.status_coor and main.ONOS5.isup()
-        result = result1 and vm1 and vm2 and vm3 and vm4 and vm5
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Everything started successfully",onfail="EVERYTHING FAILED TO START")
-        if result==main.FALSE:
-            main.cleanup()
-            main.exit()
-
-    '''
-    CASE2
-    '''
-    def CASE2(self,main) :
-        import time
-        import json
-        import re
-        main.log.report("Assigning Controllers")
-        main.case("Assigning Controllers")
-        main.step("Assign Master Controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip5'],port1=main.params['CTRL']['port5'])
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        
-        result = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip5'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-
-        utilities.assert_equals(expect = main.TRUE,actual=result,onpass="MasterControllers assigned correctly")
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-
-    def CASE3(self,main) :
-        import time
-        import json
-        import re
-        main.case("Adding Intents")
-        intentIP = main.params['CTRL']['ip1']
-        intentPort=main.params['INTENTS']['intentPort']
-        intentURL=main.params['INTENTS']['intentURL']
-        count = 1
-        for i in range(8,18):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            srcDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-            dstDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-        count = 1
-        i = 8
-        result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping ==main.FALSE and count <9:
-                count+=1
-                i = 8
-                result = main.FALSE
-                main.log.info("Ping FAILED! Making attempt number "+str(count) + "in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.info("PINGS FAILED! MAX RETRIES REACHED!")
-                i=19
-                result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping passed!")
-                i+=1
-                result = main.TRUE
-            else:
-                main.log.info("ERROR!!")
-                result = main.ERROR
-        if result==main.FALSE:
-            main.log.info("INTENTS HAVE NOT BEEN INSTALLED CORRECTLY!! EXITING!!!")
-            main.cleanup()
-            main.exit()
-        
-
-    def CASE4(self,main) :
-        import time
-        from subprocess import Popen, PIPE
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        main.case("Setting up and Gathering data for current state")
-
-        main.step("Get the Mastership of each switch")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        global masterSwitchList1
-        masterSwitchList1 = stdout
-
-        main.step("Get the High Level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        global highIntentList1
-        highIntentList1 = stdout
-        
-        main.step("Get the Low level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        global lowIntentList1
-        lowIntentList1= stdout
-        
-        main.step("Get the OF Table entries")
-        global flows
-        flows=[]
-        for i in range(1,29):
-            flows.append(main.Mininet2.get_flowTable("s"+str(i)))
-
-        
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Create TestONTopology object")
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        global MNTopo 
-        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-        MNTopo = Topo
-
-        main.step("Compare ONOS Topology to MN Topology")
-        for n in range(1,5):
-            result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            utilities.assert_equals(expect=main.TRUE,actual=result,onpass="ONOS" + str(n) + " Topology matches MN Topology",onfail="ONOS" + str(n) + " Topology does not match MN Topology")
-
-
-    def CASE5(self,main) :
-        import re
-        main.case("MAIN COMPONENT FAILURE AND SCENARIO SPECIFIC TESTS")
-        main.step("Zookeeper Server Failure!")
-        result = main.TRUE
-        master1 = main.ZK1.status()
-        print master1
-        if re.search("leader",master1):
-            main.ZK1.kill()
-            main.log.info("ZK1 was Master and Killed! Also Killing ZK2")
-            main.ZK2.kill()
-            time.sleep(10)
-            if re.search("leader",main.ZK3.status()) or re.search("leader",main.ZK4.status()) or re.search("leader",main.ZK5.status()):
-                result = main.TRUE
-                main.log.info("New Leader Elected")
-            else:
-                result = main.FALSE
-                main.log.info("NO NEW ZK LEADER ELECTED!!!")
-        else:
-            master2 = main.ZK2.status()
-            if re.search("leader",master2):
-                main.ZK2.kill()
-                main.log.info("ZK2 was Master and Killed! Also Killing ZK3")
-                main.ZK3.kill()
-                time.sleep(10)
-                if re.search("leader",main.ZK1.status()) or re.search("leader",main.ZK4.status()) or re.search("leader",main.ZK5.status()):
-                    result = main.TRUE
-                    main.log.info("New Leader Elected")
-                else:
-                    result = main.FALSE
-                    main.log.info("NO NEW ZK LEADER ELECTED!!!")
-            else:
-                master3 = main.ZK3.status()
-                if re.search("leader",master3):
-                    main.ZK3.kill()
-                    main.log.info("ZK3 was Master and Killed! Also Killing ZK4")
-                    main.ZK4.kill()
-                    time.sleep(10)
-                    if re.search("leader",main.ZK1.status()) or re.search("leader",main.ZK2.status()) or re.search("leader",main.ZK5.status()):
-                        result = main.TRUE
-                        main.log.info("New Leader Elected")
-                    else:
-                        result = main.FALSE
-                        main.log.info("NO NEW ZK LEADER ELECTED!!!")
-                else:
-                    master4 = main.ZK4.status()
-                    if re.search("leader",master4):
-                        main.ZK4.kill()
-                        main.log.info("ZK4 was Master and Killed! Also Killing ZK5")
-                        main.ZK5.kill()
-                        time.sleep(10)
-                        if re.search("leader",main.ZK1.status()) or re.search("leader",main.ZK2.status()) or re.search("leader",main.ZK3.status()):
-                            result = main.TRUE
-                            main.log.info("New Leader Elected")
-                        else:
-                            result = main.FALSE
-                            main.log.info("NO NEW ZK LEADER ELECTED!!!")
-                    else:
-                        main.ZK5.kill()
-                        main.log.info("ZK5 was Master and Killed! Also Killing ZK1")
-                        main.ZK1.kill()
-                        time.sleep(10)
-                        if re.search("leader",main.ZK3.status()) or re.search("leader",main.ZK4.status()) or re.search("leader",main.ZK2.status()):
-                            result = main.TRUE
-                            main.log.info("New Leader Elected")
-                        else:
-                            result = main.FALSE
-                            main.log.info("NO NEW ZK LEADER ELECTED!!!")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="New Leader was Elected!",onfail="NO NEW LEADER WAS ELECTED!!!!")
-
-
-
-    def CASE6(self,main) :
-        import os
-        main.case("Running ONOS Constant State Tests")
-        main.step("Get the current In-Memory Topology on each ONOS Instance and Compare it to the Topology before component failure")
-
-        #NOTE: Expected behavior for this case is for switchs to change mastership to another 
-        #      controller if the current controller's zk client loses connection with the ZK controller
-        #
-        #main.step("Get the Mastership of each switch and compare to the Mastership before component failure")
-        #(stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        #result = main.TRUE
-        #for i in range(1,29):
-        #    switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
-        #    switchDPID = switchDPID[:2]+":"+switchDPID[2:4]+":"+switchDPID[4:6]+":"+switchDPID[6:8]+":"+switchDPID[8:10]+":"+switchDPID[10:12]+":"+switchDPID[12:14]+":"+switchDPID[14:]
-        #    master1 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)
-        #    master2 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout)
-        #    if master1 == master2:
-        #    #if main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)==main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout):
-        #        result = result and main.TRUE
-        #    else:
-        #        result = main.FALSE
-        #utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Mastership of Switches was not changed",onfail="MASTERSHIP OF SWITCHES HAS CHANGED!!!")
-        #result1 = result
-
-        main.step("Get the High Level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_intents(preIntents=highIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE HIGH LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to High level Intents",onfail="CHANGES WERE MADE TO HIGH LEVEL INTENTS")
-        result2=result
-
-        main.step("Get the Low level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_low(preIntents=lowIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE LOW LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to Low level Intents",onfail="CHANGES WERE MADE TO LOW LEVEL INTENTS")
-        result3=result
-
-
-        main.step("Get the OF Table entries and compare to before component failure")
-        result = main.TRUE
-        flows2=[]
-        for i in range(27):
-            flows2.append(main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            result = result and main.Mininet2.flow_comp(flow1=flows[i], flow2=main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            if result == main.FALSE:
-                main.log.info("DIFFERENCES IN FLOW TABLES FOR SWITCH "+str(i))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes in the flow tables",onfail="CHANGES IN THE FLOW TABLES!!")
-        result4 = result
-        
-        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
-        main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP'])
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result5=not result
-
-        main.step("Check that ONOS Topology is consistent with MN Topology")
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-
-        result6 = main.TRUE
-        for n in range(1,5):
-            result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            utilities.assert_equals(expect=main.TRUE,actual=result,onpass="ONOS" + str(n) + " Topology matches MN Topology",onfail="ONOS" + str(n) + " Topology does not match MN Topology")
-            result6 = result6 and result
-
-
-        result = result1 and result2 and result3 and result4 and result5 and result6
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Constant State Tests Passed!",onfail="CONSTANT STATE TESTS FAILED!!")
-
-    def CASE7 (self,main):
-        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches %s of which are active, and %s links" %(number,active,links))
-        
-        main.step("Kill Link between s3 and s28")
-        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,str(int(links)-2))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link Down discovered properly",onfail="LINKS NOT DISCOVERED PROPERLY")
-        result1 = result
-        result = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-
-        main.step("Check for loss in pings when Link is brought down")
-        main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP'])
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result2 = not result
-        result = result1 and  result2
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link failure is discovered correctly and no traffic is lost!",onfail="Link Discovery failed or traffic was dropped!!!")
-        
-
-    
-    def CASE8 (self, main) :
-        import time
-        main.case("Killing a switch to ensure switch discovery is working properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches %s of which are active, and %s links" %(number,active,links))
-        
-        main.step("Kill s28 ")
-        main.Mininet2.del_switch("s28")
-        time.sleep(45)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],str(int(active)-1),str(int(links)-4))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-
-        main.step("Add back s28")
-        main.Mininet2.add_switch("s28")
-        main.Mininet1.assign_sw_controller(sw="28",ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        main.Mininet1.assign_sw_controller(sw="28",count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-        time.sleep(45)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,links)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-        result1=result
-
-        main.step("Checking for Traffic Loss")
-        main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP'])
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result = not result and result1
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovered Correctly and No Loss of traffic",onfail="Switch discovery failed or there was loss of traffic")
-
-# Authored by James Lee
-# Just wanted to see how many people were paying attention here.
-# Elayne Boosler once said "I have six locks on my door all in a row
-# When I go out, I lock every other one. I figure no matter how long 
-# somebody stands there picking the locks, they are always locking three"
-
diff --git a/TestON/tests/HATestZK/HATestZK.topo b/TestON/tests/HATestZK/HATestZK.topo
deleted file mode 100644
index cecffad..0000000
--- a/TestON/tests/HATestZK/HATestZK.topo
+++ /dev/null
@@ -1,183 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <ZK1>
-            <host>10.128.11.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK1>
-
-        <ZK2>
-            <host>10.128.11.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK2>
-
-        <ZK3>
-            <host>10.128.11.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK3>
-       
-        <ZK4>
-            <host>10.128.11.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK4>
-
-        <ZK5>
-            <host>10.128.11.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK5>
-
-        <RC1>
-            <host>10.128.11.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.11.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.11.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.11.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-
-        <RC5>
-            <host>10.128.11.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC5>
-
-        <ONOS1>
-            <host>10.128.11.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.11.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.11.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.11.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.11.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <Mininet1>
-            <host>10.128.11.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.11.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/HATestZK/__init__.py b/TestON/tests/HATestZK/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/HATestZK/__init__.py
+++ /dev/null
diff --git a/TestON/tests/HATestZK2/HATestZK2.params b/TestON/tests/HATestZK2/HATestZK2.params
deleted file mode 100644
index 6952d1b..0000000
--- a/TestON/tests/HATestZK2/HATestZK2.params
+++ /dev/null
@@ -1,50 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,8</testcases>
-    <CTRL>
-        <ip1>10.128.9.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.9.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.9.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.9.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-        <ip5>10.128.9.5</ip5>
-        <port5>6633</port5>
-        <restPort5>8080</restPort5>
-        <switchURL>/wm/onos/registry/switches/json</switchURL>
-        <intentHighURL>/wm/onos/intent/high</intentHighURL>
-        <intentLowURL>/wm/onos/intent/low</intentLowURL>
-    </CTRL>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <INTENTS>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTS>
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/HATestZK2/HATestZK2.py b/TestON/tests/HATestZK2/HATestZK2.py
deleted file mode 100644
index 31db5f9..0000000
--- a/TestON/tests/HATestZK2/HATestZK2.py
+++ /dev/null
@@ -1,459 +0,0 @@
-
-class HATestZK2:
-
-    global topology
-    global masterSwitchList
-    global highIntentList
-    global lowIntentList
-    global flows
-    flows = []
-
-    def __init__(self) :
-        self.default = ''
-
-    '''
-    CASE1 is to close any existing instances of ONOS, clean out the 
-    RAMCloud database, and start up ONOS instances. 
-    '''
-    def CASE1(self,main) :
-        main.case("Initial Startup")
-        main.step("Stop ONOS")
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.ONOS5.stop_all()
-        main.ONOS1.stop_rest()
-        main.ONOS2.stop_rest()
-        main.ONOS3.stop_rest()
-        main.ONOS4.stop_rest()
-        main.ONOS5.stop_rest()
-        result = main.ONOS1.status() or main.ONOS2.status() \
-                or main.ONOS3.status() or main.ONOS4.status() or main.ONOS5.status()
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="ONOS stopped successfully",onfail="ONOS WAS NOT KILLED PROPERLY")
-        main.step("Startup Zookeeper")
-        main.ZK1.start()
-        main.ZK2.start()
-        main.ZK3.start()
-        main.ZK4.start()
-        main.ZK5.start()
-        result = main.ZK1.isup() and main.ZK2.isup()\
-                and main.ZK3.isup() and main.ZK4.isup() and main.ZK5.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Zookeeper started successfully",onfail="ZOOKEEPER FAILED TO START")
-        main.step("Cleaning RC Database and Starting All")
-        main.RC1.del_db()
-        main.RC2.del_db()
-        main.RC3.del_db()
-        main.RC4.del_db()
-        main.RC5.del_db()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS5.start_all()
-       # main.ONOS1.start_rest()
-        main.step("Testing Startup")
-        result1 = main.ONOS1.rest_status()
-        vm1 = main.RC1.status_coor and main.RC1.status_serv and \
-                main.ONOS1.isup()
-        vm2 = main.RC2.status_coor and main.ONOS2.isup()
-        vm3 = main.RC3.status_coor and main.ONOS3.isup()
-        vm4 = main.RC4.status_coor and main.ONOS4.isup()
-        vm5 = main.RC5.status_coor and main.ONOS5.isup()
-        result = result1 and vm1 and vm2 and vm3 and vm4 and vm5
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Everything started successfully",onfail="EVERYTHING FAILED TO START")
-        if result==main.FALSE:
-            main.cleanup()
-            main.exit()
-
-    '''
-    CASE2
-    '''
-    def CASE2(self,main) :
-        import time
-        import json
-        import re
-        main.log.report("Assigning Controllers")
-        main.case("Assigning Controllers")
-        main.step("Assign Master Controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip5'],port1=main.params['CTRL']['port5'])
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        
-        result = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip5'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +main.params['CTRL']['ip1'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-
-        utilities.assert_equals(expect = main.TRUE,actual=result,onpass="MasterControllers assigned correctly")
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-
-    def CASE3(self,main) :
-        import time
-        import json
-        import re
-        main.case("Adding Intents")
-        intentIP = main.params['CTRL']['ip1']
-        intentPort=main.params['INTENTS']['intentPort']
-        intentURL=main.params['INTENTS']['intentURL']
-        count = 1
-        for i in range(8,18):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            srcDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-            dstDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:60:' +str(i+10)
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-        count = 1
-        i = 8
-        result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping ==main.FALSE and count <9:
-                count+=1
-                i = 8
-                result = main.FALSE
-                main.log.info("Ping FAILED! Making attempt number "+str(count) + "in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.info("PINGS FAILED! MAX RETRIES REACHED!")
-                i=19
-                result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping passed!")
-                i+=1
-                result = main.TRUE
-            else:
-                main.log.info("ERROR!!")
-                result = main.ERROR
-        if result==main.FALSE:
-            main.log.info("INTENTS HAVE NOT BEEN INSTALLED CORRECTLY!! EXITING!!!")
-            main.cleanup()
-            main.exit()
-        
-
-    def CASE4(self,main) :
-        import time
-        from subprocess import Popen, PIPE
-        main.case("Setting up and Gathering data for current state")
-        main.step("Get the current In-Memory Topology on each ONOS Instance")
-
-        '''
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip'+str(count)) in main.params['CTRL']:
-                temp = temp+(getattr(main,('ONOS'+str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count+=1
-            else:
-                break
-        topo_result = main.TRUE
-
-        for n in range(1,count):
-            temp_result = main.Mininet1.compare_topo(ctrls,main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-        '''
-
-        main.step("Get the Mastership of each switch")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        global masterSwitchList1
-        masterSwitchList1 = stdout
-
-        main.step("Get the High Level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        global highIntentList1
-        highIntentList1 = stdout
-        
-        main.step("Get the Low level Intents")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        global lowIntentList1
-        lowIntentList1= stdout
-        
-        main.step("Get the OF Table entries")
-        global flows
-        flows=[]
-        for i in range(1,29):
-            flows.append(main.Mininet2.get_flowTable("s"+str(i)))
-
-        
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-
-    def CASE5(self,main) :
-        import re
-        main.case("MAIN COMPONENT FAILURE AND SCENARIO SPECIFIC TESTS")
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        
-        main.step("Zookeeper Server Failure!")
-        main.ZK1.stop()
-        main.ZK2.stop()
-        main.ZK3.stop()
-        main.ZK4.stop()
-        main.ZK5.stop()
-        main.Mininet2.del_switch("s1")
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],str(int(active)-1),str(int(links)-2))
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="Registry is no longer active",onfail="Registry is still being updated")
-
-        main.step("Restart Zookeeper")
-        main.ZK1.start()
-        main.ZK2.start()
-        main.ZK3.start()
-        main.ZK4.start()
-        main.ZK5.start()
-        time.sleep(10) # Time for Zookeeper to reboot
-        master1=main.ZK1.status()
-        master2=main.ZK2.status()
-        master3=main.ZK3.status()
-        master4=main.ZK4.status()
-        master5=main.ZK5.status()
-        if re.search("leader",master1) or re.search("leader",master2) or re.search("leader",master3) or re.search("leader",master4) or re.search("leader",master5):
-            main.log.info("New ZK Leader Elected")
-        else:
-            main.log.info("NO NEW ZK LEADER ELECTED!!!")
-        main.step("Add back s1")
-        main.Mininet2.add_switch("s1")
-        main.Mininet1.assign_sw_controller(sw="1",ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        main.Mininet1.assign_sw_controller(sw="1",count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-        time.sleep(31)
-
-
-    def CASE6(self,main) :
-        import os
-        main.case("Running ONOS Constant State Tests")
-        main.step("Get the current In-Memory Topology on each ONOS Instance and Compare it to the Topology before component failure")
-
-        main.step("Get the Mastership of each switch and compare to the Mastership before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['switchURL']],stdout=PIPE).communicate()
-        result = main.TRUE
-        for i in range(1,29):
-            switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
-            switchDPID = switchDPID[:2]+":"+switchDPID[2:4]+":"+switchDPID[4:6]+":"+switchDPID[6:8]+":"+switchDPID[8:10]+":"+switchDPID[10:12]+":"+switchDPID[12:14]+":"+switchDPID[14:]
-            master1 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)
-            master2 = main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout)
-            if main.ZK1.findMaster(switchDPID=switchDPID,switchList=masterSwitchList1)==main.ZK1.findMaster(switchDPID=switchDPID,switchList=stdout):
-                result = result and main.TRUE
-            else:
-                result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Mastership of Switches was not changed",onfail="MASTERSHIP OF SWITCHES HAS CHANGED!!!")
-        result1 = result
-
-        main.step("Get the High Level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentHighURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_intents(preIntents=highIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE HIGH LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to High level Intents",onfail="CHANGES WERE MADE TO HIGH LEVEL INTENTS")
-        result2=result
-
-        main.step("Get the Low level Intents and compare to before component failure")
-        (stdout,stderr)=Popen(["curl",main.params['CTRL']['ip1']+":"+main.params['CTRL']['restPort1']+main.params['CTRL']['intentLowURL']],stdout=PIPE).communicate()
-        changesInIntents=main.ONOS1.comp_low(preIntents=lowIntentList1,postIntents=stdout)
-        if not changesInIntents:
-            result = main.TRUE
-        else:
-            main.log.info("THERE WERE CHANGES TO THE LOW LEVEL INTENTS! CHANGES WERE: "+str(changesInIntents))
-            result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes to Low level Intents",onfail="CHANGES WERE MADE TO LOW LEVEL INTENTS")
-        result3=result
-
-
-        main.step("Get the OF Table entries and compare to before component failure")
-        result = main.TRUE
-        flows2=[]
-        for i in range(27):
-            flows2.append(main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            result = result and main.Mininet2.flow_comp(flow1=flows[i], flow2=main.Mininet2.get_flowTable(sw="s"+str(i+1)))
-            if result == main.FALSE:
-                main.log.info("DIFFERENCES IN FLOW TABLES FOR SWITCH "+str(i))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No changes in the flow tables",onfail="CHANGES IN THE FLOW TABLES!!")
-        result4 = result
-        
-        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result5=not result
-        result = result1 and result2 and result3 and result4 and result5
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Constant State Tests Passed!",onfail="CONSTANT STATE TESTS FAILED!!")
-
-    def CASE7 (self,main):
-        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches, %s are active, and %s links" %(number,active,links))
-        
-        main.step("Kill Link between s3 and s28")
-        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,str(int(links)-2))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link Down discovered properly",onfail="LINKS NOT DISCOVERED PROPERLY")
-        result1 = result
-        result = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-
-        main.step("Check for loss in pings when Link is brought down")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result2 = result
-        result = result1 and not result2
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="Link failure is discovered correctly and no traffic is lost!",onfail="Link Discovery failed or traffic was dropped!!!")
-        
-
-    
-    def CASE8 (self, main) :
-        import time
-        main.case("Killing a switch to ensure switch discovery is working properly")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Determine the current number of switches and links")
-        (number,active)=main.ONOS1.num_switch(RestIP=main.params['CTRL']['ip1'])
-        links = main.ONOS1.num_link(RestIP=main.params['CTRL']['ip1'])
-        main.log.info("Currently there are %s switches, %s are active, and %s links" %(number,active,links))
-        
-        main.step("Kill s28 ")
-        main.Mininet2.del_switch("s28")
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],str(int(active)-1),str(int(links)-4))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-
-        main.step("Add back s28")
-        main.Mininet2.add_switch("s28")
-        main.Mininet1.assign_sw_controller(sw="28",ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        main.Mininet1.assign_sw_controller(sw="28",count=5,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5']) 
-        time.sleep(31)
-        result = main.ONOS1.check_status_report(main.params['CTRL']['ip1'],active,links)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovery is Working",onfail="Switch Discovery FAILED TO WORK PROPERLY!")
-        result1=result
-
-        main.step("Checking for Traffic Loss")
-        main.Mininet2.pingKill()
-        result = main.FALSE
-        for i in range(8,18):
-            result = result or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
-        if result==main.TRUE:
-            main.log.info("LOSS IN THE PINGS!")
-        elif result == main.ERROR:
-            main.log.info("There are multiple mininet process running!!")
-        else:
-            main.log.info("No Loss in the pings!")
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="No Loss of connectivity!",onfail="LOSS OF CONNECTIVITY")
-        result = not result and result1
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switch Discovered Correctly and No Loss of traffic",onfail="Switch discovery failed or there was loss of traffic")
-
diff --git a/TestON/tests/HATestZK2/HATestZK2.topo b/TestON/tests/HATestZK2/HATestZK2.topo
deleted file mode 100644
index 9ccdb17..0000000
--- a/TestON/tests/HATestZK2/HATestZK2.topo
+++ /dev/null
@@ -1,183 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <ZK1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK1>
-
-        <ZK2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK2>
-
-        <ZK3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK3>
-       
-        <ZK4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK4>
-
-        <ZK5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ZK5>
-
-        <RC1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-
-        <RC5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC5>
-
-        <ONOS1>
-            <host>10.128.9.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.9.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.9.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.9.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.9.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <Mininet1>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.params b/TestON/tests/IntentPerfNext/IntentPerfNext.params
new file mode 100644
index 0000000..7e1de77
--- /dev/null
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.params
@@ -0,0 +1,44 @@
+<PARAMS>
+    <testcases>1,2</testcases>
+
+    <ENV>
+        <cellName>intent_perf_test</cellName>
+    </ENV>
+
+    <GIT>
+        #autoPull 'on' or 'off'
+        <autoPull>off</autoPull>
+        <checkout>master</checkout>
+    </GIT>
+
+    <CTRL>
+        <user>admin</user>
+        <ip1>10.128.174.1</ip1>
+        <port1>6633</port1>
+        <ip2>10.128.174.2</ip2>
+        <port2>6633</port2>
+        <ip3>10.128.174.3</ip3>
+        <port3>6633</port3>
+    </CTRL>
+
+    <MN>
+        <ip1>10.128.10.90</ip1>
+        <ip2>10.128.10.91</ip2>
+    </MN>
+
+    <BENCH>
+        <ip>10.128.174.10</ip>
+    </BENCH>
+
+    <TEST>
+        #Number of times to iterate each case
+        <numIter>5</numIter>
+    </TEST>
+
+    <JSON>
+        <submittedTime>intentSubmittedTimestamp</submittedTime>
+        <installedTime>intentInstalledTimestamp</installedTime>
+        <wdRequestTime>intentWithdrawRequestedTimestamp</wdRequestTime>
+        <withdrawnTime>intentWithdrawnTimestamp</withdrawnTime>
+    </JSON>
+</PARAMS>
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.py b/TestON/tests/IntentPerfNext/IntentPerfNext.py
new file mode 100644
index 0000000..2fb22dc
--- /dev/null
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.py
@@ -0,0 +1,218 @@
+#Intent Performance Test for ONOS-next
+#
+#andrew@onlab.us
+#
+#November 5, 2014
+
+class IntentPerfNext:
+    def __init__(self):
+        self.default = ""
+
+    def CASE1(self, main):
+        '''
+        ONOS startup sequence
+        '''
+
+        import time
+
+        cell_name = main.params['ENV']['cellName']
+
+        git_pull = main.params['GIT']['autoPull']
+        checkout_branch = main.params['GIT']['checkout']
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        
+        MN1_ip = main.params['MN']['ip1']
+        BENCH_ip = main.params['BENCH']['ip']
+    
+        main.case("Setting up test environment")
+
+        main.step("Creating cell file")
+        cell_file_result = main.ONOSbench.create_cell_file(
+                BENCH_ip, cell_name, MN1_ip, "onos-core",
+                ONOS1_ip, ONOS2_ip, ONOS3_ip)
+
+        main.step("Applying cell file to environment")
+        cell_apply_result = main.ONOSbench.set_cell(cell_name)
+        verify_cell_result = main.ONOSbench.verify_cell()
+
+        main.step("Git checkout and pull "+checkout_branch)
+        if git_pull == 'on':
+            checkout_result = \
+                main.ONOSbench.git_checkout(checkout_branch)
+            pull_result = main.ONOSbench.git_pull()
+           
+            #If you used git pull, auto compile
+            main.step("Using onos-build to compile ONOS")
+            build_result = main.ONOSbench.onos_build()
+        else:
+            checkout_result = main.TRUE
+            pull_result = main.TRUE
+            build_result = main.TRUE
+            main.log.info("Git pull skipped by configuration")
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
+        install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
+        install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
+
+        main.step("Set cell for ONOScli env")
+        main.ONOS1cli.set_cell(cell_name)
+        main.ONOS2cli.set_cell(cell_name)
+        main.ONOS3cli.set_cell(cell_name)
+
+        time.sleep(5)
+
+        main.step("Start onos cli")
+        cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
+        cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
+        cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
+
+        main.step("Enable metrics feature")
+        main.ONOS1cli.feature_install("onos-app-metrics")
+        main.ONOS2cli.feature_install("onos-app-metrics")
+        main.ONOS3cli.feature_install("onos-app-metrics")
+
+        utilities.assert_equals(expect=main.TRUE,
+                actual = cell_file_result and cell_apply_result and\
+                         verify_cell_result and checkout_result and\
+                         pull_result and build_result and\
+                         install1_result and install2_result and\
+                         install3_result,
+                onpass="ONOS started successfully",
+                onfail="Failed to start ONOS")
+
+    def CASE2(self, main):
+        '''
+        Single intent add latency
+
+        '''
+        import time
+        import json
+        import requests
+        import os
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+
+        #number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+
+        #Timestamp keys for json metrics output
+        submit_time = main.params['JSON']['submittedTime']
+        install_time = main.params['JSON']['installedTime']
+        wdRequest_time = main.params['JSON']['wdRequestTime']
+        withdrawn_time = main.params['JSON']['withdrawnTime']
+
+        devices_json_str = main.ONOS1cli.devices()
+        devices_json_obj = json.loads(devices_json_str)
+
+        device_id_list = []
+
+        #Obtain device id list in ONOS format.
+        #They should already be in order (1,2,3,10,11,12,13, etc)
+        for device in devices_json_obj:
+            device_id_list.append(device['id'])
+
+        intent_add_lat_list = []
+
+        for i in range(0, int(num_iter)):
+            #add_point_intent(ingr_device, ingr_port, 
+            #                 egr_device, egr_port)
+            main.ONOS1cli.add_point_intent(
+                device_id_list[0], 2,
+                device_id_list[2], 1)
+        
+            #Allow some time for intents to propagate
+            time.sleep(5)
+
+            #Obtain metrics from ONOS 1, 2, 3
+            intents_json_str_1 = main.ONOS1cli.intents_events_metrics()
+            intents_json_str_2 = main.ONOS2cli.intents_events_metrics()
+            intents_json_str_3 = main.ONOS3cli.intents_events_metrics()
+
+            intents_json_obj_1 = json.loads(intents_json_str_1)
+            intents_json_obj_2 = json.loads(intents_json_str_2)
+            intents_json_obj_3 = json.loads(intents_json_str_3)
+
+            #Parse values from the json object
+            intent_submit_1 = \
+                    intents_json_obj_1[submit_time]['value']
+            intent_submit_2 = \
+                    intents_json_obj_2[submit_time]['value']
+            intent_submit_3 = \
+                    intents_json_obj_3[submit_time]['value']
+
+            intent_install_1 = \
+                    intents_json_obj_1[install_time]['value']
+            intent_install_2 = \
+                    intents_json_obj_2[install_time]['value']
+            intent_install_3 = \
+                    intents_json_obj_3[install_time]['value']
+
+            intent_install_lat_1 = \
+                    int(intent_install_1) - int(intent_submit_1)
+            intent_install_lat_2 = \
+                    int(intent_install_2) - int(intent_submit_2)
+            intent_install_lat_3 = \
+                    int(intent_install_3) - int(intent_submit_3)
+            
+            intent_install_lat_avg = \
+                    (intent_install_lat_1 + 
+                     intent_install_lat_2 +
+                     intent_install_lat_3 ) / 3
+
+            main.log.info("Intent add latency avg for iteration "+str(i)+
+                    ": "+str(intent_install_lat_avg))
+
+            if intent_install_lat_avg > 0.0 and \
+               intent_install_lat_avg < 1000:
+                intent_add_lat_list.append(intent_install_lat_avg)
+            else:
+                main.log.info("Intent add latency exceeded "+
+                        "threshold. Skipping iteration "+str(i))
+
+            time.sleep(3)
+            
+            #TODO: Possibly put this in the driver function
+            main.log.info("Removing intents for next iteration")
+            json_temp = \
+                    main.ONOS1cli.intents(json_format=True)
+            json_obj_intents = json.loads(json_temp)
+            if json_obj_intents:
+                for intents in json_obj_intents:
+                    temp_id = intents['id']
+                    main.ONOS1cli.remove_intent(temp_id)
+                    main.log.info("Removing intent id: "+
+                        str(temp_id))
+                    main.ONOS1cli.remove_intent(temp_id)
+            else:
+                main.log.info("Intents were not installed correctly")
+
+            time.sleep(5)
+
+        intent_add_lat_min = min(intent_add_lat_list)
+        intent_add_lat_max = max(intent_add_lat_list)
+        intent_add_lat_avg = sum(intent_add_lat_list) /\
+                             len(intent_add_lat_list)
+        #END ITERATION FOR LOOP
+        main.log.report("Single intent add latency - \n"+
+                "Min: "+str(intent_add_lat_min)+" ms\n"+
+                "Max: "+str(intent_add_lat_max)+" ms\n"+
+                "Avg: "+str(intent_add_lat_avg)+" ms\n")
+
+
+    def CASE3(self, main):
+        '''
+        CASE3 coming soon
+        '''
+
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.topo b/TestON/tests/IntentPerfNext/IntentPerfNext.topo
new file mode 100644
index 0000000..fbde0e1
--- /dev/null
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.topo
@@ -0,0 +1,73 @@
+<TOPOLOGY>
+    <COMPONENT>
+        
+        <ONOSbench>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1cli>
+
+        <ONOS2cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2cli>
+        
+        <ONOS3cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3cli>
+
+        <ONOS1>
+            <host>10.128.174.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <Mininet1>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+                <arg1> --custom topo-intentFlower.py </arg1>
+                <arg2> --arp --mac --topo mytopo</arg2>
+                <arg3> </arg3>
+                <controller> remote,ip=10.128.174.1 </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/JamesTest/JamesTest.params b/TestON/tests/JamesTest/JamesTest.params
deleted file mode 100644
index be749b4..0000000
--- a/TestON/tests/JamesTest/JamesTest.params
+++ /dev/null
@@ -1,84 +0,0 @@
-<PARAMS>
-    <testcases>2,3,66</testcases>
-    <tcpdump> 
-        <intf>eth0</intf>
-        <port>port 6633</port>
-        <filename>~/packet_captures/Sanity.pcap</filename>
-    </tcpdump>
-    <CASE1>       
-        <destination>h6</destination>
-        <target>h40</target>
-    </CASE1>       
-    <PING>
-        <source1>h7</source1>
-        <target1>h32</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <PING>
-        <source1>h6</source1>
-        <source2>h7</source2>
-        <source3>h8</source3>
-        <source4>h9</source4>
-        <source5>h10</source5>
-        <source6>h11</source6>
-        <source7>h12</source7>
-        <source8>h13</source8>
-        <source9>h14</source9>
-        <source10>h15</source10>
-        <target1>10.0.0.16</target1>
-        <target2>10.0.0.17</target2>
-        <target3>10.0.0.18</target3>
-        <target4>10.0.0.19</target4>
-        <target5>10.0.0.20</target5>
-        <target6>10.0.0.21</target6>
-        <target7>10.0.0.22</target7>
-        <target8>10.0.0.23</target8>
-        <target9>10.0.0.24</target9>
-        <target10>10.0.0.25</target10>
-    </PING>
-    <INTENTREST>
-        <intentIP>10.128.4.151</intentIP>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTREST>
-    <RestIP>10.128.4.151</RestIP>
-    <RestIP2>10.128.4.152</RestIP2>
-    <RestIP3>10.128.4.153</RestIP3>
-    <RestIP4>10.128.4.154</RestIP4>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.4.151</restIP1>
-	<restIP2>10.128.4.152</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/onos/topology/hosts</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/JamesTest/JamesTest.py b/TestON/tests/JamesTest/JamesTest.py
deleted file mode 100644
index dcb03f3..0000000
--- a/TestON/tests/JamesTest/JamesTest.py
+++ /dev/null
@@ -1,1100 +0,0 @@
-
-class JamesTest :
-
-
-
-    def __init__(self) :
-        self.default = ''
-
-#        def print_hello_world(self,main):
-#            print("hello world")
-#*****************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        main.case("Initial setup")
-        main.step("Stop ONOS")
-        import time
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-#        main.print_hello_world()
-        main.ONOS4.stop_all()
-        main.ONOS2.stop_rest()
-        main.ONOS1.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS2.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS3.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS4.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")        
-        main.step("Start tcpdump on mn")
-#        main.Mininet2.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
-        main.step("Start ONOS")
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        time.sleep(1)
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        main.log.report("Pulling latest code from github to all nodes")
-        for i in range(2):
-            uptodate = main.ONOS1.git_pull()
-            main.ONOS2.git_pull()
-            main.ONOS3.git_pull()
-            main.ONOS4.git_pull()
-            ver1 = main.ONOS1.get_version()
-            ver2 = main.ONOS4.get_version()
-            if ver1==ver2:
-                break
-            elif i==1:
-                main.ONOS2.git_pull("ONOS1 master")
-                main.ONOS3.git_pull("ONOS1 master")
-                main.ONOS4.git_pull("ONOS1 master")
-        if uptodate==0:
-       # if 1:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-            main.ONOS4.git_compile()
-        main.ONOS1.print_version()    
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS2.start_rest()
-        test= main.ONOS2.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")   
-        data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() and main.RamCloud4.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-            time.sleep(5)
-            data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() and main.RamCloud4.status_serv()
-            
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                #main.log.report("Something is funny... restarting ONOS")
-                #main.ONOS1.stop()
-                time.sleep(3)
-                #main.ONOS1.start()
-                #time.sleep(5) 
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-        time.sleep(20)
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(2)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
-        time.sleep(10)
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        from subprocess import Popen, PIPE
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        masterSwitches = []
-        masterSwitches2 = []
-        hello = main.Mininet2.checkForLoss(fileName='/tmp/ping.h10')
-        if hello==main.FALSE:
-            main.log.info("CRAP")
-        else:
-            main.log.info("YAY")
-        for i in range(25): 
-            if i < 15:
-                j=i+1
-            else:
-                j=i+16
-            (stdout, stderr) = Popen(["curl",main.params['RESTCALL']['restIP1']+":"+main.params['RESTCALL']['restPort']+"/wm/onos/registry/switches/json"],stdout=PIPE).communicate()
-            switchDPID1 = main.Mininet1.getSwitchDPID(switch="s"+str(j))
-            sDPID1 = str(switchDPID1)
-            switchDPID2 = sDPID1[:2]+":"+sDPID1[2:4]+":"+sDPID1[4:6]+":"+sDPID1[6:8]+":"+sDPID1[8:10]+":"+sDPID1[10:12]+":"+sDPID1[12:14]+":"+sDPID1[14:]
-            master=main.Zookeeper1.findMaster(switchDPID = switchDPID2, switchList=stdout)
-            masterSwitches.append("s"+str(j)+" " + master)
-
-        for i in range(25): 
-            if i < 15:
-                j=i+1
-            else:
-                j=i+16
-            print j
-            (stdout, stderr) = Popen(["curl",main.params['RESTCALL']['restIP1']+":"+main.params['RESTCALL']['restPort']+"/wm/onos/registry/switches/json"],stdout=PIPE).communicate()
-            switchDPID1 = main.Mininet1.getSwitchDPID(switch="s"+str(j))
-            sDPID1 = str(switchDPID1)
-            switchDPID2 = sDPID1[:2]+":"+sDPID1[2:4]+":"+sDPID1[4:6]+":"+sDPID1[6:8]+":"+sDPID1[8:10]+":"+sDPID1[10:12]+":"+sDPID1[12:14]+":"+sDPID1[14:]
-            master=main.Zookeeper1.findMaster(switchDPID = switchDPID2, switchList=stdout)
-            masterSwitches2.append("s"+str(j)+" " + master)
-       
-
-
-
-        print masterSwitches
-        print "\n\n\n"
-        print masterSwitches2
-        print masterSwitches == masterSwitches2
-        #main.ONOS1.delete_flow("all")
-        strtTime = time.time()
-        main.ONOS1.rm_intents()
-        (stdout,stderr) = Popen(["curl",main.params['RESTCALL']['restIP1']+":"+main.params['RESTCALL']['restPort']+"/wm/onos/intent/high"],stdout=PIPE).communicate()
-        intent1 = stdout
-        print intent1 + "\n\n\n Intent 1 \n\n\n"
-        main.ONOS1.add_intents()
-        time.sleep(2)
-        (stdout,stderr) = Popen(["curl",main.params['RESTCALL']['restIP1']+":"+main.params['RESTCALL']['restPort']+"/wm/onos/intent/high"],stdout=PIPE).communicate()
-        intent2 = stdout
-        print intent2 + "\n\n\n Intent 2 \n\n\n"
-        changesMade = main.ONOS1.comp_intents(preIntents=intent1,postIntents=intent2)
-        print changesMade
-        if not changesMade:
-            print "Intents were Constant"
-            print changesMade
-       # main.ONOS1.add_flow(main.params['FLOWDEF']['testONip'],main.params['FLOWDEF']['user'],main.params['FLOWDEF']['password'],main.params['FLOWDEF']['flowDef'])
-        main.case("Checking flows")
-       
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 9:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==9:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=5)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=5)
-        main.step("Check that the pings are going") 
-        result = main.Mininet2.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source10'])
-        time.sleep(20)
-        main.Mininet2.pingKill()
-        if main.Mininet2.checkForLoss(fileName="/tmp/ping.h10"):
-            main.log.info("LOSS FOUND!!!")
-        else:
-            main.log.info("No Loss of Packets!!!")
-
-
-         
-        
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-    def CASE41(self,main) :
-        main.log.report("Testing Removal")
-        time.sleep(10)
-        main.ONOS2.stop()
-        time.sleep(10)
-        main.ONOS3.stop()
-        time.sleep(10)
-        main.ONOS4.stop()
-        time.sleep(15)
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-        main.ONOS2.start() 
-        main.ONOS3.start()
-        main.ONOS4.start() 
-        time.sleep(20)
-
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-                time.sleep(1)
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-        time.sleep(10)
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1='s1',END2='s3',OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-        time.sleep(10) 
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        data = main.Mininet1.link(END1='s1',END2='s3',OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 5
-        t_restwait = 5
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-        main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host mac = " + mac + ";  attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0]))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac  addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            result1 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result1 = main.FALSE
-
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result2 = main.FALSE
-         
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result3 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result4 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result4 = main.FALSE
-        time.sleep(20)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus ==1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout")
-        elif Reststatus>1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout(multiple found)")
-        elif Reststatus==0:
-            main.log.report("\t PASSED - Device cleared after timeout")
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-# Run a pure ping test. 
-
-    def CASE31(self, main):
-        main.log.report("Performing Ping Test")        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            strtTime = time.time()
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-    def CASE66(self, main):
-        main.log.report("Checking ONOS logs for exceptions")
-        count = 0
-        check1 = main.ONOS1.check_exceptions()
-        main.log.report("Exceptions in ONOS1 logs: \n" + check1)
-        check2 = main.ONOS2.check_exceptions()
-        main.log.report("Exceptions in ONOS2 logs: \n" + check2)
-        check3 = main.ONOS3.check_exceptions()
-        main.log.report("Exceptions in ONOS3 logs: \n" + check3)
-        check4 = main.ONOS4.check_exceptions()
-        main.log.report("Exceptions in ONOS4 logs: \n" + check4)
-        result = main.TRUE
-        if (check1 or check2 or check3 or check4):
-            result = main.FALSE
-            count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs")
-        main.Mininet2.stop_tcpdump()
-
-
-    def CASE8(self,main) :
-        main.log.report("Testing Removal of Zookeeper")
-        main.Zookeeper2.stop()
-        main.Zookeeper3.stop()
-        main.Zookeeper4.stop()
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-        main.Zookeeper2.start() 
-        main.Zookeeper3.start()
-        main.Zookeeper4.start() 
-        time.sleep(10)
-
-
-    def CASE67(self, main) :
-        main.case("Flapping link s1-s2")
-        main.log.report("Toggling of link s1-s2 multiple times")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])))
-            else:
-                break
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-           
-#*****************************************************************************************
-#*****************************************************************************************
-# CASE101:
-# This case is designed to test the intents framework
-# It will cover Installation, Deletion, Rerouting, and Calling of Intents
-#*****************************************************************************************
-#*****************************************************************************************
-
-
-    def CASE101(self,main) :
-        import time
-        import json
-        import re
-        main.case("Testing the Intent Framework of ONOS")
-        
-#*****************************************************************************************
-#*****************************************************************************************
-# The first part of CASE 101 will be assigning the master controllers to the switches
-# and to check that each one is assigned correctly. 
-#*****************************************************************************************
-#*****************************************************************************************
-        main.step("Assigning Master Controllers to the Switches and check")
-        for i in range(25):
-            if i<3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=3 and i<5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port1'])
-            elif i>=5 and i<15:
-                j=j+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port1'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port1'])
-        result = main.TRUE
-        for i in range(25):
-            if i<3:
-                j=i+1
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                print("Response is " + str(response))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response) :
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=3 and i<5:
-                j=i+1
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response) :
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<15:
-                j=j+1
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response) :
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                j=i+16
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response) :
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            print(result)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Master Controllers assigned Properly",onfail="FAILED TO ASSIGN MASTER CONTROLLERS!")
-
-#*****************************************************************************************
-#*****************************************************************************************
-# Assign all controllers to the switches as backups. Run a get-controller on each
-# switch to ensure that all controllers have been assigned properly to its switches
-#*****************************************************************************************
-#*****************************************************************************************
-        main.step("Assigning all Controllers as Backups to Switches and Check")
-        for i in range(25):
-            if i<15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        result = main.TRUE
-        time.sleep(5)
-        for i in range(25):
-            if i<15:
-                j=i+1
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response) and re.search("tcp:"+main.params['CTRL']['ip2'],response) and re.search("tcp:"+main.params['CTRL']['ip3'],response) and re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                j=i+16
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response) and re.search("tcp:"+main.params['CTRL']['ip2'],response) and re.search("tcp:"+main.params['CTRL']['ip3'],response) and re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Controllers assigned properly to all switches",onfail="FAILED TO ASSIGN CONTROLLERS PROPERLY!")
-
-
-        
-#*****************************************************************************************
-#*****************************************************************************************
-# Installation of Intents. This part will run run a forloop and add an intent from 
-# h6 to h31, h7 to h32, etc and the other way as well, h31 to h6, h32 to h7, etc.
-# then Check by dumping the flows on SW2 and check for flows going bidirectionally.
-#*****************************************************************************************
-#*****************************************************************************************
-        main.step("Install intents and Check for Installation of Flows")
-        intentIP = main.params['INTENTREST']['intentIP']
-        intentPort=main.params['INTENTREST']['intentPort']
-        intentURL=main.params['INTENTREST']['intentURL']
-        count = 1
-        for i in range(6,16):
-            time.sleep(1)
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            #srcDPID=str(i)
-            #dstDPID=str(i+10)
-            srcDPID = '00:00:00:00:00:00:10:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:20:' +str(i+25)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count +=1
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            #srcDPID=str(i)
-            #dstDPID=str(i+10)
-            dstDPID = '00:00:00:00:00:00:10:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:20:' +str(i+25)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-            count+=1
-        main.ONOS1.show_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-        result = main.TRUE
-        response = main.Mininet1.check_flows(sw="s1")
-        print(response)
-        for i in range(6,16):
-            if re.search("dl_src=00:00:00:00:00:"+''.join('%02x'%i),response) and re.search("dl_src=00:00:00:00:00:"+''.join('%02x'%(i+10)),response) and re.search("dl_dst=00:00:00:00:00:"+''.join('%02x'%i),response) and re.search("dl_dst=00:00:00:00:00:"+''.join('%02x'%(i+10)),response):   
-                result = result and main.TRUE
-            else:
-                result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flows added Properly",onfail="Flows were not added properly")
- 
-#*****************************************************************************************
-#*****************************************************************************************
-# This step will run a ping test from h6 to h31, h7 to h32, etc as an End to End test
-# All of these pings should run through. 
-#*****************************************************************************************
-#*****************************************************************************************
-        main.step("Ping Test as End to End Test that the Intents were Correctly Installed")
-        main.log.report("Performing Ping Test")        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            strtTime = time.time()
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        
-#*****************************************************************************************
-#*****************************************************************************************
-# Removing a single intent. Then check to ensure that intent was found by calling
-# show_intent. Then check that flows are removed by pinging. 
-#*****************************************************************************************
-#*****************************************************************************************
-        main.step("Delete a single intent and ensure that flows are deleted")
-        main.ONOS1.del_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL,intent_id="intent_id=10")
-        time.sleep(2)
-        response = main.ONOS1.show_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL,intent_id=10)
-        if re.search("INTENT_NOT_FOUND",response):
-            main.log.report("Intent Removed Properly!")
-        else:
-            main.log.report("ERROR REMOVING INTENT")
-        main.log.report("Performing Ping Test")        
-        count = 1
-        for count in range(4):
-            ping = main.Mininet1.pingHost(src="h10",target="h35")
-            if ping==main.FALSE and count == 3:
-                main.log.info("Ping failed as expected. Intent Deleted")
-                result = main.TRUE
-            elif ping == main.TRUE:
-                main.log.error("Intent was not deleted correctly")
-                result = main.FALSE
-            else:
-                main.log.info("So far so good, attempting "+str(2-count) + " more times")
-        if result == main.TRUE:
-            main.log.report("\tIntent Deleted!")
-        else:
-            main.log.report("\tINTENT FAILED TO BE DELETED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Intent Deleted Properly - Step Passed",onfail="INTENT NOT DELETED - STEP FAILED")
-        #main.ONOS1.del_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-        main.ONOS1.add_intent(intent_id=str(10),src_dpid="00:00:00:00:00:00:10:67",dst_dpid="00:00:00:00:00:32:21:10",src_mac="00:00:00:01:11:11",dst_mac="00:12:12:12:12:12",intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-
-
-
-#*****************************************************************************************
-#*****************************************************************************************
-# Delete all intents, and ensure that all flows were deleted
-# Will delete, then call for intents.
-# Lastly try a ping test to check that all flows are deleted. 
-#*****************************************************************************************
-#*****************************************************************************************
-        main.step("Deleting all flows and check that they are all gone")
-
-
-#*****************************************************************************************
-#*****************************************************************************************
-# Install a bad intent. Then, ensure that we are able to get rid of it
-# Installing an intent as ID=200, from a random dpid/mac to random dpid/mac. Then, 
-# check to make sure the intent is there, then delete it and ensure that it is gone
-#*****************************************************************************************
-#*****************************************************************************************
-
-
-        main.step("Installing incorrect intent and checking for deletion")
-        main.ONOS1.add_intent(intent_id=str(200),src_dpid="00:00:00:00:00:00:45:67",dst_dpid="00:00:00:00:00:32:21:10",src_mac="00:00:00:01:11:11",dst_mac="00:12:12:12:12:12",intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-        main.ONOS1.show_intent(intent_id=str(200),intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-        main.ONOS1.del_intent(intent_id="intent_id=200",intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-        time.sleep(2)
-        response = main.ONOS1.show_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL,intent_id=200)
-        if re.search("INTENT_NOT_FOUND",response):
-            main.log.report("Intent Removed Properly!")
-        else:
-            main.log.report("ERROR REMOVING INTENT")
-        
-
-
-    def CASE10(self, main) :
-        import time
-        time.sleep(600)
diff --git a/TestON/tests/JamesTest/JamesTest.topo b/TestON/tests/JamesTest/JamesTest.topo
deleted file mode 100644
index 3bfaa2f..0000000
--- a/TestON/tests/JamesTest/JamesTest.topo
+++ /dev/null
@@ -1,153 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <RamCloud1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud1>
-
-        <RamCloud2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud2>
-       
-        <RamCloud3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud3>
-       
-        <RamCloud4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud4>
-
-        <ONOS1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/JamesTest/RCOnosSanity4nodesJ.params.normal b/TestON/tests/JamesTest/RCOnosSanity4nodesJ.params.normal
deleted file mode 100644
index f644d9f..0000000
--- a/TestON/tests/JamesTest/RCOnosSanity4nodesJ.params.normal
+++ /dev/null
@@ -1,62 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,31,6,7,6,7,4,6,7,6,7,5,6,7,6,7,41,6,7,6,7,5,6,7,6,7,66</testcases>
-    <tcpdump> 
-        <intf>eth0</intf>
-        <port>port 6633</port>
-        <filename>~/packet_captures/Sanity.pcap</filename>
-    </tcpdump>
-    <CASE1>       
-        <destination>h6</destination>
-        <target>h40</target>
-    </CASE1>       
-    <PING>
-        <source1>h7</source1>
-        <target1>h32</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <INTENTREST>
-        <intentIP>10.128.4.151</intentIP>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent/high</intentURL>
-    </INTENTREST>
-    <RestIP>10.128.4.151</RestIP>
-    <RestIP2>10.128.4.152</RestIP2>
-    <RestIP3>10.128.4.153</RestIP3>
-    <RestIP4>10.128.4.154</RestIP4>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.4.151</restIP1>
-	<restIP2>10.128.4.152</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/onos/topology/hosts</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/JamesTest/__init__.py b/TestON/tests/JamesTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/JamesTest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/JamesTest/intentsHigh.txt b/TestON/tests/JamesTest/intentsHigh.txt
deleted file mode 100644
index 2d0136d..0000000
--- a/TestON/tests/JamesTest/intentsHigh.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{"id":"1:21","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:36","srcPortNumber":"1","srcMac":"00:00:00:00:00:15","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:11","dstPortNumber":"1","dstMac":"00:00:00:00:00:0b","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954989518098","setState, oldState:CREATED, newState:INST_REQ, time:342954990247919","setState, oldState:INST_REQ, newState:INST_ACK, time:342955016855087","setState, oldState:INST_ACK, newState:INST_ACK, time:342955029936391"]},{"id":"1:12","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:12","srcPortNumber":"1","srcMac":"00:00:00:00:00:0c","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:37","dstPortNumber":"1","dstMac":"00:00:00:00:00:16","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955001880348","setState, oldState:CREATED, newState:INST_REQ, time:342955001942196","setState, oldState:INST_REQ, newState:INST_ACK, time:342955066469194"]},{"id":"1:13","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:13","srcPortNumber":"1","srcMac":"00:00:00:00:00:0d","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:38","dstPortNumber":"1","dstMac":"00:00:00:00:00:17","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955037009378","setState, oldState:CREATED, newState:INST_REQ, time:342955057204350","setState, oldState:INST_REQ, newState:INST_ACK, time:342955109843115"]},{"id":"1:22","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:37","srcPortNumber":"1","srcMac":"00:00:00:00:00:16","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:12","dstPortNumber":"1","dstMac":"00:00:00:00:00:0c","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955017825966","setState, oldState:CREATED, newState:INST_REQ, time:342955020827141","setState, oldState:INST_REQ, newState:INST_ACK, time:342955036958151","setState, oldState:INST_ACK, newState:INST_ACK, time:342955067089568"]},{"id":"1:23","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:38","srcPortNumber":"1","srcMac":"00:00:00:00:00:17","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:13","dstPortNumber":"1","dstMac":"00:00:00:00:00:0d","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955078657886","setState, oldState:CREATED, newState:INST_REQ, time:342955078719125","setState, oldState:INST_REQ, newState:INST_ACK, time:342955151788326","setState, oldState:INST_ACK, newState:INST_ACK, time:342955172199848"]},{"id":"1:10","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:10","srcPortNumber":"1","srcMac":"00:00:00:00:00:0a","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:35","dstPortNumber":"1","dstMac":"00:00:00:00:00:14","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954934875925","setState, oldState:CREATED, newState:INST_REQ, time:342954934944636","setState, oldState:INST_REQ, newState:INST_ACK, time:342954962841723"]},{"id":"1:24","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:39","srcPortNumber":"1","srcMac":"00:00:00:00:00:18","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:14","dstPortNumber":"1","dstMac":"00:00:00:00:00:0e","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955193091906","setState, oldState:CREATED, newState:INST_REQ, time:342955193170354","setState, oldState:INST_REQ, newState:INST_ACK, time:342955217289973","setState, oldState:INST_ACK, newState:INST_ACK, time:342955240396703"]},{"id":"1:11","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:11","srcPortNumber":"1","srcMac":"00:00:00:00:00:0b","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:36","dstPortNumber":"1","dstMac":"00:00:00:00:00:15","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954970890675","setState, oldState:CREATED, newState:INST_REQ, time:342954972623090","setState, oldState:INST_REQ, newState:INST_ACK, time:342954990005267"]},{"id":"1:25","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:40","srcPortNumber":"1","srcMac":"00:00:00:00:00:19","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:15","dstPortNumber":"1","dstMac":"00:00:00:00:00:0f","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955219610331","setState, oldState:CREATED, newState:INST_REQ, time:342955229618793","setState, oldState:INST_REQ, newState:INST_ACK, time:342955255256696","setState, oldState:INST_ACK, newState:INST_ACK, time:342955321503127"]},{"id":"1:16","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:31","srcPortNumber":"1","srcMac":"00:00:00:00:00:10","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:06","dstPortNumber":"1","dstMac":"00:00:00:00:00:06","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954777534217","setState, oldState:CREATED, newState:INST_REQ, time:342954777610189","setState, oldState:INST_REQ, newState:INST_ACK, time:342954799456100","setState, oldState:INST_ACK, newState:INST_ACK, time:342954805786438"]},{"id":"1:17","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:32","srcPortNumber":"1","srcMac":"00:00:00:00:00:11","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:07","dstPortNumber":"1","dstMac":"00:00:00:00:00:07","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954818753786","setState, oldState:CREATED, newState:INST_REQ, time:342954818825415","setState, oldState:INST_REQ, newState:INST_ACK, time:342954837494403","setState, oldState:INST_ACK, newState:INST_ACK, time:342954849744029"]},{"id":"1:14","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:14","srcPortNumber":"1","srcMac":"00:00:00:00:00:0e","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:39","dstPortNumber":"1","dstMac":"00:00:00:00:00:18","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955119250545","setState, oldState:CREATED, newState:INST_REQ, time:342955119327278","setState, oldState:INST_REQ, newState:INST_ACK, time:342955212539535"]},{"id":"1:15","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:15","srcPortNumber":"1","srcMac":"00:00:00:00:00:0f","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:40","dstPortNumber":"1","dstMac":"00:00:00:00:00:19","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955206543145","setState, oldState:CREATED, newState:INST_REQ, time:342955206598632","setState, oldState:INST_REQ, newState:INST_ACK, time:342955244230667"]},{"id":"1:8","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:08","srcPortNumber":"1","srcMac":"00:00:00:00:00:08","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:33","dstPortNumber":"1","dstMac":"00:00:00:00:00:12","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954840432768","setState, oldState:CREATED, newState:INST_REQ, time:342954841963557","setState, oldState:INST_REQ, newState:INST_ACK, time:342954885578977"]},{"id":"1:7","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:07","srcPortNumber":"1","srcMac":"00:00:00:00:00:07","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:32","dstPortNumber":"1","dstMac":"00:00:00:00:00:11","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954794382192","setState, oldState:CREATED, newState:INST_REQ, time:342954794456241","setState, oldState:INST_REQ, newState:INST_ACK, time:342954829521040"]},{"id":"1:6","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:06","srcPortNumber":"1","srcMac":"00:00:00:00:00:06","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:31","dstPortNumber":"1","dstMac":"00:00:00:00:00:10","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954756676678","setState, oldState:CREATED, newState:INST_REQ, time:342954756754118","setState, oldState:INST_REQ, newState:INST_ACK, time:342954791322748"]},{"id":"1:20","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:35","srcPortNumber":"1","srcMac":"00:00:00:00:00:14","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:10","dstPortNumber":"1","dstMac":"00:00:00:00:00:0a","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954950472615","setState, oldState:CREATED, newState:INST_REQ, time:342954950548932","setState, oldState:INST_REQ, newState:INST_ACK, time:342954969685306","setState, oldState:INST_ACK, newState:INST_ACK, time:342954977191044"]},{"id":"1:9","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:09","srcPortNumber":"1","srcMac":"00:00:00:00:00:09","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:34","dstPortNumber":"1","dstMac":"00:00:00:00:00:13","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954887372916","setState, oldState:CREATED, newState:INST_REQ, time:342954887444460","setState, oldState:INST_REQ, newState:INST_ACK, time:342954945549202"]},{"id":"1:19","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:34","srcPortNumber":"1","srcMac":"00:00:00:00:00:13","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:09","dstPortNumber":"1","dstMac":"00:00:00:00:00:09","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954916765288","setState, oldState:CREATED, newState:INST_REQ, time:342954918481103","setState, oldState:INST_REQ, newState:INST_ACK, time:342954943450046","setState, oldState:INST_ACK, newState:INST_ACK, time:342954959114541"]},{"id":"1:18","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:33","srcPortNumber":"1","srcMac":"00:00:00:00:00:12","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:08","dstPortNumber":"1","dstMac":"00:00:00:00:00:08","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954872490248","setState, oldState:CREATED, newState:INST_REQ, time:342954874209159","setState, oldState:INST_REQ, newState:INST_ACK, time:342954915646785","setState, oldState:INST_ACK, newState:INST_ACK, time:342954927676302"]}]
\ No newline at end of file
diff --git a/TestON/tests/JonTest/JonTest.params b/TestON/tests/JonTest/JonTest.params
new file mode 100755
index 0000000..4bb85e6
--- /dev/null
+++ b/TestON/tests/JonTest/JonTest.params
@@ -0,0 +1,18 @@
+<PARAMS>
+    
+    <testcases>1,4,3,7,8,9,7,8</testcases>
+    
+    <Git>True</Git>
+    #Environment variables
+    <ENV>
+        <cellName>multi</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.30.11</ip1>
+        <port1>6633</port1>
+        <ip2>10.128.30.12</ip2>
+        <port2>6633</port2>
+    </CTRL>
+
+</PARAMS>
diff --git a/TestON/tests/JonTest/JonTest.py b/TestON/tests/JonTest/JonTest.py
new file mode 100755
index 0000000..8e53fd2
--- /dev/null
+++ b/TestON/tests/JonTest/JonTest.py
@@ -0,0 +1,431 @@
+
+#Testing the basic functionality of ONOS Next
+#For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+
+class JonTest:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        onos-install -f
+        onos-wait-for-start
+        '''
+        import time
+        
+        PULL_CODE = False
+        if main.params['Git'] == 'True':
+            PULL_CODE = True
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS2_port = main.params['CTRL']['port2']
+        
+        main.case("Setting up test environment")
+        
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        #cell_result = main.ONOSbench.set_cell("temp_cell_2")
+        verify_result = main.ONOSbench.verify_cell()
+
+        if PULL_CODE:
+            main.step("Git checkout and pull master")
+            #main.log.report("Skipping git pull")
+            main.ONOSbench.git_checkout("master")
+            git_pull_result = main.ONOSbench.git_pull()
+            main.log.report(main.ONOSbench.get_version())
+
+            main.step("Using mvn clean & install")
+            clean_install_result = main.FALSE
+            if git_pull_result == main.TRUE:
+                clean_install_result = main.ONOSbench.clean_install()
+            else:
+                main.log.report("did not pull new code so skipping mvn clean install")
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
+        onos2_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS2_ip)
+        onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+        onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+   
+        main.step("Starting ONOS service")
+        start_result = main.TRUE
+        #start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+        main.ONOScli1.start_onos_cli(ONOS1_ip)
+        main.ONOScli2.start_onos_cli(ONOS2_ip)
+
+        case1_result = (clean_install_result and package_result and\
+                cell_result and verify_result and onos1_install_result and\
+                onos2_install_result and onos1_isup and onos2_isup )
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+
+    def CASE11(self, main):
+        '''
+        Cleanup sequence:
+        onos-service <node_ip> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+        
+        '''
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Cleaning up test environment")
+
+        main.step("Testing ONOS kill function")
+        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
+
+        main.step("Stopping ONOS service")
+        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
+
+        main.step("Uninstalling ONOS service") 
+        uninstall_result = main.ONOSbench.onos_uninstall()
+
+    def CASE3(self, main):
+        '''
+        Test 'onos' command and its functionality in driver
+        '''
+        
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Testing 'onos' command")
+
+        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        cmdstr1 = "system:name"
+        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
+        main.log.info("onos command returned: "+cmd_result1)
+
+        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        cmdstr2 = "onos:topology"
+        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result2)
+        
+        main.step("Testing check_status")
+        check_status_results = main.FALSE
+        topology_result = main.ONOScli1.topology()
+        check_status_results =  main.ONOSbench.check_status(topology_result, 4, 6)
+        main.log.info("Results of check_status " + str(check_status_results))
+
+        main.step("Sending command 'onos -w <onos-ip> bundle:list'")
+        cmdstr3 = "bundle:list"
+        cmd_result3 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr3)
+        main.log.info("onos command returned: "+cmd_result3)
+        case3_result = (cmd_result1 and cmd_result2 and\
+                check_status_results and cmd_result3 )
+        utilities.assert_equals(expect=main.TRUE, actual=case3_result,
+                onpass="Test case 3 successful",
+                onfail="Test case 3 NOT successful")
+
+    def CASE4(self, main):
+        import re
+        import time
+        main.case("Pingall Test(No intents are added)")
+        main.step("Assigning switches to controllers")
+        for i in range(1,5): #1 to (num of switches +1)
+            main.Mininet1.assign_sw_controller(sw=str(i),count=2, 
+                    ip1=ONOS1_ip, port1=ONOS1_port,
+                    ip2=ONOS2_ip, port2=ONOS2_port)
+
+        switch_mastership = main.TRUE
+        for i in range (1,5):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            print("Response is " + str(response))
+            if re.search("tcp:"+ONOS1_ip,response):
+                switch_mastership = switch_mastership and main.TRUE
+            else:
+                switch_mastership = main.FALSE
+
+
+        #REACTIVE FWD test
+        main.step("Pingall")
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % (time2 - time1)
+      
+        case4_result = switch_mastership and ping_result
+        utilities.assert_equals(expect=main.TRUE, actual=case4_result,
+                onpass="Pingall Test successful",
+                onfail="Pingall Test NOT successful")
+
+    def CASE5(self, main):
+        '''
+        Test the ONOS-cli functionality
+        
+        Below are demonstrations of what the 
+        ONOS cli driver functions can be used for.
+        '''
+        import time
+        import json
+
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        
+        main.case("Testing the ONOS-cli")
+        
+        main.step("Set cell for ONOS-cli environment")
+        main.ONOScli.set_cell(cell_name)
+
+        main.step("Start ONOS-cli")
+        main.ONOScli.start_onos_cli(ONOS1_ip)
+
+        main.step("issue command: onos:topology")
+        topology_obj = main.ONOScli.topology()
+
+        main.step("issue various feature:install <str> commands")
+        #main.ONOScli.feature_install("onos-app-fwd")
+        #main.ONOScli.feature_install("onos-rest")
+
+        main.step("Add a bad node")
+        node_result = main.ONOScli.add_node("111", "10.128.20.")
+        if node_result == main.TRUE:
+            main.log.info("Node successfully added")
+
+        main.step("Add a correct node")
+        node_result = main.ONOScli.add_node("111", "10.128.20.12")
+
+        main.step("Assign switches and list devices")
+        for i in range(1,8):
+            main.Mininet1.handle.sendline("sh ovs-vsctl set-controller s"+str(i)+
+                    " tcp:10.128.20.11")
+            main.Mininet1.handle.expect("mininet>")
+        #Need to sleep to allow switch add processing
+        time.sleep(5)
+        list_result = main.ONOScli.devices()
+        main.log.info(list_result)
+
+        main.step("Get all devices id")
+        devices_id_list = main.ONOScli.get_all_devices_id()
+        main.log.info(devices_id_list)
+
+        main.step("Get path and cost between device 1 and 7")
+        (path, cost) = main.ONOScli.paths(devices_id_list[0], devices_id_list[6])
+        main.log.info("Path: "+str(path))
+        main.log.info("Cost: "+str(cost))
+
+        main.step("Get nodes currently visible")
+        nodes_str = main.ONOScli.nodes()
+        main.log.info(nodes_str)
+
+        main.step("Get all nodes id's")
+        node_id_list = main.ONOScli.get_all_nodes_id()
+        main.log.info(node_id_list)
+
+        main.step("Set device "+str(devices_id_list[0])+" to role: standby")
+        device_role_result = main.ONOScli.device_role(
+                devices_id_list[0], node_id_list[0], "standby")
+        if device_role_result == main.TRUE:
+            main.log.report("Device role successfully set")
+
+        main.step("Revert device role to master")
+        device_role = main.ONOScli.device_role(
+                devices_id_list[0], node_id_list[0], "master")
+
+        main.step("Check devices / role again")
+        dev_result = main.ONOScli.devices()
+        main.log.info(dev_result)
+       
+        #Sample steps to push intents ***********
+        # * Obtain host id in ONOS format 
+        # * Push intents
+        main.step("Get list of hosts from Mininet")
+        host_list = main.Mininet2.get_hosts()
+        main.log.info(host_list)
+
+        main.step("Get host list in ONOS format")
+        host_onos_list = main.ONOScli.get_hosts_id(host_list)
+        main.log.info(host_onos_list)
+
+        main.step("Ensure that reactive forwarding is installed")
+        feature_result = main.ONOScli.feature_install("onos-app-fwd")
+
+        time.sleep(5)
+
+        main.Mininet2.handle.sendline("\r")
+        main.Mininet2.handle.sendline("h4 ping h5 -c 1")
+
+        time.sleep(5)
+
+        main.step("Get hosts")
+        main.ONOScli.handle.sendline("hosts")
+        main.ONOScli.handle.expect("onos>")
+        hosts = main.ONOScli.handle.before
+        main.log.info(hosts)
+
+        main.step("Install host-to-host-intents between h4 and h5")
+        intent_install = main.ONOScli.add_host_intent(
+                host_onos_list[3], host_onos_list[4])
+        main.log.info(intent_install)
+
+        main.step("Uninstall reactive forwarding to test host-to-host intent")
+        main.ONOScli.feature_uninstall("onos-app-fwd")
+
+        main.step("Get intents installed on ONOS")
+        get_intent_result = main.ONOScli.intents()
+        main.log.info(get_intent_result)
+        #****************************************
+
+
+    def CASE7(self, main):
+        '''
+        Test compare topo functions
+        '''
+        import sys
+        sys.path.append("/home/admin/sts") # Trying to remove some dependancies, #FIXME add this path to params
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        import json
+
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+
+    
+        main.step("Collecting topology information from ONOS")
+        devices1 = main.ONOScli1.devices()
+        devices2 = main.ONOScli2.devices()
+        switch1 = main.ONOScli1.get_device("0000000000000001")
+        hosts1 = main.ONOScli1.hosts()
+        hosts2 = main.ONOScli2.hosts()
+        host1 = main.ONOScli1.get_host("00:00:00:00:00:01")
+        #print json.dumps(json.loads(hosts1), sort_keys=True,indent=4,separators=(',', ': '))
+        #print json.dumps(json.loads(hosts2), sort_keys=True,indent=4,separators=(',', ': '))
+        #print json.dumps(host1, sort_keys=True,indent=4,separators=(',', ': '))
+        ports1 = main.ONOScli1.ports()
+        ports2 = main.ONOScli2.ports()
+        links1 = main.ONOScli1.links()
+        links2 = main.ONOScli2.links()
+
+
+        main.step("Comparing ONOS topology to MN")
+        #results =  main.Mininet1.compare_topo(MNTopo, json.loads(devices))
+        switches_results1 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices1))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results1,
+                onpass="ONOS1 Switches view is correct",
+                onfail="ONOS1 Switches view is incorrect")
+
+        switches_results2 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices2))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results2,
+                onpass="ONOS2 Switches view is correct",
+                onfail="ONOS2 Switches view is incorrect")
+
+
+        ports_results1 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports1))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results1,
+                onpass="ONOS1 Ports view is correct",
+                onfail="ONOS1 Ports view is incorrect")
+
+        ports_results2 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports2))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results2,
+                onpass="ONOS2 Ports view is correct",
+                onfail="ONOS2 Ports view is incorrect")
+
+        links_results1 =  main.Mininet1.compare_links(MNTopo, json.loads(links1))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results1,
+                onpass="ONOS1 Links view is correct",
+                onfail="ONOS1 Links view is incorrect")
+
+        links_results2 =  main.Mininet1.compare_links(MNTopo, json.loads(links2))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results2,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+
+        topo_result = switches_results1 and switches_results2 \
+                and ports_results1 and ports_results2\
+                and links_results1 and links_results2
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+    def CASE8(self, main):
+        '''
+        try doing some role assignments
+        '''
+        import time
+        print main.ONOScli1.devices()
+        print main.ONOScli1.device_role("of:0000000000000001", "    ", "none")
+        time.sleep(1)
+        roles = main.ONOScli1.roles()
+        roles2 = main.ONOScli2.roles()
+        print roles
+        print roles2
+        print main.ONOScli1.get_role("00001")
+
+        print main.ONOScli1.devices()
+        print main.ONOScli1.device_role("of:0000000000000001", "10.128.30.11", "master")
+        time.sleep(1)
+        roles = main.ONOScli1.roles()
+        roles2 = main.ONOScli2.roles()
+        print roles
+        print roles2
+        print main.ONOScli1.get_role("00001")
+
+        print main.ONOScli1.devices()
+        print main.ONOScli1.device_role("of:0000000000000001", "10.128.30.11", "standby")
+        time.sleep(1)
+        roles = main.ONOScli1.roles()
+        roles2 = main.ONOScli2.roles()
+        print roles
+        print roles2
+        print main.ONOScli1.get_role("00001")
+
+        print main.ONOScli1.devices()
+        print main.ONOScli1.device_role("of:0000000000000001", "10.128.30.11", "MASTER")
+        time.sleep(1)
+        roles = main.ONOScli1.roles()
+        roles2 = main.ONOScli2.roles()
+        print roles
+        print roles2
+        print main.ONOScli1.get_role("00001")
+        print main.ONOScli1.devices()
+
+    def CASE9(self, main):
+        '''
+        Bring Links down
+        '''
+        main.Mininet1.link(END1="s1", END2="s2", OPTION="down")
+        main.Mininet1.link(END1="s1", END2="s3", OPTION="down")
+        main.Mininet1.link(END1="s1", END2="s4", OPTION="down")
+
+
+
+
+######
+#jhall@onlab.us
+#andrew@onlab.us
+######
diff --git a/TestON/tests/JonTest/JonTest.topo b/TestON/tests/JonTest/JonTest.topo
new file mode 100755
index 0000000..bf8cb18
--- /dev/null
+++ b/TestON/tests/JonTest/JonTest.topo
@@ -0,0 +1,65 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+        <ONOS1>
+            <host>10.128.30.11</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.30.12</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <Mininet1>
+            <host>10.128.11.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --topo tree,2,3</arg1>
+                <arg2> </arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/FvtTest/__init__.py b/TestON/tests/JonTest/__init__.py
similarity index 100%
rename from TestON/tests/FvtTest/__init__.py
rename to TestON/tests/JonTest/__init__.py
diff --git a/TestON/tests/LincOETest/LincOETest.params b/TestON/tests/LincOETest/LincOETest.params
new file mode 100755
index 0000000..46e4f19
--- /dev/null
+++ b/TestON/tests/LincOETest/LincOETest.params
@@ -0,0 +1,20 @@
+<PARAMS>
+    
+    <testcases>1,2</testcases>
+
+    #Environment variables
+    <ENV>
+        <cellName>linc_oe_test</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.174.1</ip1>
+        <port1>6633</port1>
+    </CTRL>
+
+    <GIT>
+        <autoPull>off</autoPull>
+        <checkout>master</checkout>
+    </GIT>
+
+</PARAMS>
diff --git a/TestON/tests/LincOETest/LincOETest.py b/TestON/tests/LincOETest/LincOETest.py
new file mode 100755
index 0000000..bb52ca8
--- /dev/null
+++ b/TestON/tests/LincOETest/LincOETest.py
@@ -0,0 +1,114 @@
+#LincOETest
+#
+#Packet-Optical Intent Testing
+#
+#andrew@onlab.us
+
+
+import time
+import sys
+import os
+import re
+
+class LincOETest:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        onos-install -f
+        onos-wait-for-start
+        '''
+        import time
+
+        cell_name = main.params['ENV']['cellName']
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        
+        git_pull_trigger = main.params['GIT']['autoPull']
+        git_checkout_branch = main.params['GIT']['checkout']
+
+        main.case("Setting up test environment")
+        
+        main.step("Creating cell file")
+        #params: (bench ip, cell name, mininet ip, *onos ips)
+        cell_file_result = main.ONOSbench.create_cell_file(
+                "10.128.20.10", cell_name, "10.128.10.90",
+                "onos-core-trivial,onos-app-fwd",
+                "10.128.174.1")
+
+        main.step("Applying cell variable to environment")
+        #cell_result = main.ONOSbench.set_cell(cell_name)
+        cell_result = main.ONOSbench.set_cell("temp_cell_2")
+        verify_result = main.ONOSbench.verify_cell()
+       
+        if git_pull_trigger == 'on':
+            main.step("Git checkout and pull master")
+            main.ONOSbench.git_checkout(git_checkout_branch)
+            git_pull_result = main.ONOSbench.git_pull()
+        else:
+            main.log.info("Git checkout and pull skipped by config")
+            git_pull_result = main.TRUE
+
+        main.step("Using mvn clean & install")
+        #clean_install_result = main.ONOSbench.clean_install()
+        clean_install_result = main.TRUE
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        onos_install_result = main.ONOSbench.onos_install()
+        onos1_isup = main.ONOSbench.isup()
+   
+        main.step("Starting ONOS service")
+        start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+        main.step("Setting cell for ONOScli")
+        main.ONOScli.set_cell(cell_name)
+
+        main.step("Starting ONOScli")
+        main.ONOScli.start_onos_cli(ONOS1_ip)
+
+        case1_result = (clean_install_result and package_result and\
+                cell_result and verify_result and onos_install_result and\
+                onos1_isup and start_result )
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+        time.sleep(10)
+
+    def CASE2(self, main):
+        '''
+        Configure topology
+        '''
+        import time
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        default_sw_port = main.params['CTRL']['port1'] 
+
+        #Assign packet level switches to controller 
+        main.Mininet1.assign_sw_controller(sw="1",
+                ip1=ONOS1_ip, port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(sw="2",
+                ip1=ONOS1_ip, port1=default_sw_port)
+
+        #Check devices in controller
+        #This should include Linc-OE devices as well
+        devices = main.ONOScli.devices()
+        main.log.info(devices)
+
+    def CASE3(self, main):
+        '''
+        Install multi-layer intents
+        '''
+
+
diff --git a/TestON/tests/LincOETest/LincOETest.topo b/TestON/tests/LincOETest/LincOETest.topo
new file mode 100755
index 0000000..221256e
--- /dev/null
+++ b/TestON/tests/LincOETest/LincOETest.topo
@@ -0,0 +1,55 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.20.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli>
+            <host>10.128.20.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli>
+
+        <ONOS1>
+            <host>10.128.174.1</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <LincOE>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </LincOE>
+
+        <Mininet1>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> 
+                <arg1> --custom optical.py </arg1>
+                <arg2> --arp --mac</arg2>
+                <arg3> --topo optical</arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/MininetSlicing/MininetSlicing.py b/TestON/tests/MininetSlicing/MininetSlicing.py
index ac723fb..86b3ddc 100644
--- a/TestON/tests/MininetSlicing/MininetSlicing.py
+++ b/TestON/tests/MininetSlicing/MininetSlicing.py
@@ -1,17 +1,4 @@
-'''
-	
- *   TestON is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 2 of the License, or
- *   (at your option) any later version.
 
- *   TestON is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
-
-
-'''
 class MininetSlicing :
 
     def __init__(self) :
@@ -81,5 +68,4 @@
     
     
     
-    
-    
+    
\ No newline at end of file
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.params b/TestON/tests/ONOSNextTest/ONOSNextTest.params
new file mode 100755
index 0000000..d600eae
--- /dev/null
+++ b/TestON/tests/ONOSNextTest/ONOSNextTest.params
@@ -0,0 +1,20 @@
+<PARAMS>
+    
+    <testcases>1,5</testcases>
+
+    #Environment variables
+    <ENV>
+        <cellName>driver_test</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.174.1</ip1>
+        <port1>6633</port1>
+    </CTRL>
+
+    <GIT>
+        <autoPull>off</autoPull>
+        <checkout>master</checkout>
+    </GIT>
+
+</PARAMS>
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.py b/TestON/tests/ONOSNextTest/ONOSNextTest.py
new file mode 100755
index 0000000..3496771
--- /dev/null
+++ b/TestON/tests/ONOSNextTest/ONOSNextTest.py
@@ -0,0 +1,335 @@
+
+#Testing the basic functionality of ONOS Next
+#For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+
+class ONOSNextTest:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        onos-install -f
+        onos-wait-for-start
+        '''
+        import time
+
+        cell_name = main.params['ENV']['cellName']
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        
+        git_pull_trigger = main.params['GIT']['autoPull']
+        git_checkout_branch = main.params['GIT']['checkout']
+
+        main.case("Setting up test environment")
+        
+        main.step("Creating cell file")
+        #params: (bench ip, cell name, mininet ip, *onos ips)
+        cell_file_result = main.ONOSbench.create_cell_file(
+                "10.128.20.10", "temp_cell_2", "10.128.10.90",
+                "onos-core-trivial,onos-app-fwd",
+                "10.128.174.1")
+
+        main.step("Applying cell variable to environment")
+        #cell_result = main.ONOSbench.set_cell(cell_name)
+        cell_result = main.ONOSbench.set_cell("temp_cell_2")
+        verify_result = main.ONOSbench.verify_cell()
+       
+        if git_pull_trigger == 'on':
+            main.step("Git checkout and pull master")
+            main.ONOSbench.git_checkout(git_checkout_branch)
+            git_pull_result = main.ONOSbench.git_pull()
+        else:
+            main.log.info("Git checkout and pull skipped by config")
+            git_pull_result = main.TRUE
+
+        main.step("Using mvn clean & install")
+        #clean_install_result = main.ONOSbench.clean_install()
+        clean_install_result = main.TRUE
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        onos_install_result = main.ONOSbench.onos_install()
+        onos1_isup = main.ONOSbench.isup()
+   
+        main.step("Starting ONOS service")
+        start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+        case1_result = (clean_install_result and package_result and\
+                cell_result and verify_result and onos_install_result and\
+                onos1_isup and start_result )
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+        time.sleep(10)
+
+    def CASE11(self, main):
+        '''
+        Cleanup sequence:
+        onos-service <node_ip> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+        
+        '''
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Cleaning up test environment")
+
+        main.step("Testing ONOS kill function")
+        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
+
+        main.step("Stopping ONOS service")
+        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
+
+        main.step("Uninstalling ONOS service") 
+        uninstall_result = main.ONOSbench.onos_uninstall()
+
+    def CASE3(self, main):
+        '''
+        Test 'onos' command and its functionality in driver
+        '''
+        
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Testing 'onos' command")
+
+        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        cmdstr1 = "system:name"
+        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
+        main.log.info("onos command returned: "+cmd_result1)
+
+        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        cmdstr2 = "onos:topology"
+        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result2)
+        
+        main.step("Testing check_status")
+        check_status_results =  main.ONOSbench.check_status(ONOS1_ip, 4, 6)
+        main.log.info("Results of check_status " + str(check_status_results))
+
+        main.step("Sending command 'onos -w <onos-ip> bundle:list'")
+        cmdstr3 = "bundle:list"
+        cmd_result3 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr3)
+        main.log.info("onos command returned: "+cmd_result3)
+        case3_result = (cmd_result1 and cmd_result2 and\
+                check_status_results and cmd_result3 )
+        utilities.assert_equals(expect=main.TRUE, actual=case3_result,
+                onpass="Test case 3 successful",
+                onfail="Test case 3 NOT successful")
+
+    def CASE4(self, main):
+        import re
+        import time
+        main.case("Pingall Test(No intents are added)")
+        main.step("Assigning switches to controllers")
+        for i in range(1,5): #1 to (num of switches +1)
+            main.Mininet1.assign_sw_controller(sw=str(i), 
+                    ip1=ONOS1_ip, port1=ONOS1_port)
+        switch_mastership = main.TRUE
+        for i in range (1,5):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            print("Response is " + str(response))
+            if re.search("tcp:"+ONOS1_ip,response):
+                switch_mastership = switch_mastership and main.TRUE
+            else:
+                switch_mastership = main.FALSE
+
+        #REACTIVE FWD test
+        main.step("Pingall")
+        ping_result = main.FALSE
+        while ping_result == main.FALSE:
+            time1 = time.time()
+            ping_result = main.Mininet1.pingall()
+            time2 = time.time()
+            print "Time for pingall: %2f seconds" % (time2 - time1)
+      
+        case4_result = switch_mastership and ping_result
+        utilities.assert_equals(expect=main.TRUE, actual=case4_result,
+                onpass="Pingall Test successful",
+                onfail="Pingall Test NOT successful")
+
+    def CASE5(self, main):
+        '''
+        Test the ONOS-cli functionality
+        
+        Below are demonstrations of what the 
+        ONOS cli driver functions can be used for.
+        '''
+        import time
+        import json
+
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        
+        main.case("Testing the ONOS-cli")
+        
+        main.step("Set cell for ONOS-cli environment")
+        #main.ONOScli.set_cell(cell_name)
+        main.ONOScli.set_cell("temp_cell_2")
+
+        main.step("Start ONOS-cli")
+        main.ONOScli.start_onos_cli(ONOS1_ip)
+
+        main.step("issue command: onos:topology")
+        topology_obj = main.ONOScli.topology()
+
+        main.step("issue various feature:install <str> commands")
+        #main.ONOScli.feature_install("onos-app-fwd")
+        #main.ONOScli.feature_install("onos-rest")
+
+        main.step("Add a bad node")
+        node_result = main.ONOScli.add_node("111", "10.128.20.")
+        if node_result == main.TRUE:
+            main.log.info("Node successfully added")
+
+        main.step("Add a correct node")
+        node_result = main.ONOScli.add_node("111", "10.128.174.2")
+
+        main.step("Assign switches and list devices")
+        for i in range(1,8):
+            main.Mininet2.handle.sendline("sh ovs-vsctl set-controller s"+str(i)+
+                    " tcp:10.128.174.1")
+            main.Mininet2.handle.expect("mininet>")
+        #Need to sleep to allow switch add processing
+        time.sleep(5)
+        list_result = main.ONOScli.devices(json_format=False)
+        main.log.info(list_result)
+
+        main.step("Get all devices id")
+        devices_id_list = main.ONOScli.get_all_devices_id()
+        main.log.info(devices_id_list)
+
+        main.step("Get path and cost between device 1 and 7")
+        (path, cost) = main.ONOScli.paths(devices_id_list[0], devices_id_list[6])
+        main.log.info("Path: "+str(path))
+        main.log.info("Cost: "+str(cost))
+
+        main.step("Get nodes currently visible")
+        nodes_str = main.ONOScli.nodes()
+        main.log.info(nodes_str)
+
+        main.step("Get all nodes id's")
+        node_id_list = main.ONOScli.get_all_nodes_id()
+        main.log.info(node_id_list)
+
+        main.step("Set device "+str(devices_id_list[0])+" to role: standby")
+        device_role_result = main.ONOScli.device_role(
+                devices_id_list[0], node_id_list[0], "standby")
+        if device_role_result == main.TRUE:
+            main.log.report("Device role successfully set")
+
+        main.step("Revert device role to master")
+        device_role = main.ONOScli.device_role(
+                devices_id_list[0], node_id_list[0], "master")
+
+        main.step("Check devices / role again")
+        dev_result = main.ONOScli.devices(json_format=False)
+        main.log.info(dev_result)
+       
+        #Sample steps to push intents ***********
+        # * Obtain host id in ONOS format 
+        # * Push intents
+        main.step("Get list of hosts from Mininet")
+        host_list = main.Mininet2.get_hosts()
+        main.log.info(host_list)
+
+        main.step("Get host list in ONOS format")
+        host_onos_list = main.ONOScli.get_hosts_id(host_list)
+        main.log.info(host_onos_list)
+
+        time.sleep(5)
+
+        #We must use ping from hosts we want to add intents from 
+        #to make the hosts talk
+        #main.Mininet2.handle.sendline("\r")
+        #main.Mininet2.handle.sendline("h4 ping 10.1.1.1 -c 1 -W 1")
+        #time.sleep(3)
+        #main.Mininet2.handle.sendline("h5 ping 10.1.1.1 -c 1 -W 1")
+        #time.sleep(5)
+
+        main.ONOScli.feature_install("onos-app-fwd")
+        
+        main.Mininet2.pingall()
+
+        time.sleep(5)
+
+        main.step("Get hosts")
+        main.ONOScli.handle.sendline("hosts")
+        main.ONOScli.handle.expect("onos>")
+        hosts = main.ONOScli.handle.before
+        main.log.info(hosts)
+
+        main.step("Install host-to-host-intents")
+        intent_install1 = main.ONOScli.add_host_intent(
+                host_onos_list[0], host_onos_list[1])
+        intent_install2 = main.ONOScli.add_host_intent(
+                host_onos_list[2], host_onos_list[3])
+        intent_install3 = main.ONOScli.add_host_intent(
+                host_onos_list[4], host_onos_list[5])
+
+        main.log.info(intent_install1)
+        main.log.info(intent_install2)
+        main.log.info(intent_install3)
+
+        main.step("Get intents installed on ONOS")
+        get_intent_result = main.ONOScli.intents()
+        main.log.info(get_intent_result)
+        #****************************************
+
+        #Sample steps to delete intents ********
+        main.step("Get all intent id's")
+        intent_id = main.ONOScli.get_all_intents_id()
+        main.log.info(intent_id)
+
+        main.step("Remove specified intent id: "+str(intent_id[0]))
+        intent_result = main.ONOScli.remove_intent(intent_id[0])
+        main.log.info(intent_result)
+
+        main.step("Check installed intents again")
+        get_intent_result = main.ONOScli.intents()
+        main.log.info(get_intent_result)
+        #***************************************
+
+        #Sample steps to add point-to-point intents*
+        main.step("Add point-to-point intents")
+        ptp_intent_result = main.ONOScli.add_point_intent(
+                devices_id_list[0], 1, devices_id_list[1], 2)
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli.intents()
+            main.log.info("Point to point intent install successful")
+            main.log.info(get_intent_result)
+        #*******************************************
+
+        main.step("Print intents in json format")
+        intents = main.ONOScli.intents(json_format = True)
+        main.log.info(intents)
+
+        main.step("Add eth options in point-to-point intent")
+        ptp_eth = main.ONOScli.add_point_intent(
+                devices_id_list[2], 1, devices_id_list[3], 2,
+                ethSrc = "00:02", ethDst = "00:03")
+        main.log.info(ptp_eth)
+
+        main.step("Print intents with eth options")
+        intents = main.ONOScli.intents()
+        main.log.info(intents)
+######
+#jhall@onlab.us
+#andrew@onlab.us
+######
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.topo b/TestON/tests/ONOSNextTest/ONOSNextTest.topo
new file mode 100755
index 0000000..0c84cc7
--- /dev/null
+++ b/TestON/tests/ONOSNextTest/ONOSNextTest.topo
@@ -0,0 +1,61 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.20.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli>
+            <host>10.128.20.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli>
+
+        <ONOS1>
+            <host>10.128.174.1</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <Mininet1>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --topo tree,2,3</arg1>
+                <arg2> </arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.91</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> 
+                <arg1> --custom topo-intentTPtest.py </arg1>
+                <arg2> --arp --mac</arg2>
+                <arg3> --topo mytopo</arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/ONOSSanity4/ONOSSanity4.params b/TestON/tests/ONOSSanity4/ONOSSanity4.params
deleted file mode 100644
index 027d361..0000000
--- a/TestON/tests/ONOSSanity4/ONOSSanity4.params
+++ /dev/null
@@ -1,49 +0,0 @@
-<PARAMS>
-    <testcases>1</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h7</source1>
-        <target1>h32</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <RestIP>10.128.4.151</RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.4.151</restIP1>
-	<restIP2>10.128.4.152</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/onos/topology/switches</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/ONOSSanity4/ONOSSanity4.py b/TestON/tests/ONOSSanity4/ONOSSanity4.py
deleted file mode 100644
index 209a664..0000000
--- a/TestON/tests/ONOSSanity4/ONOSSanity4.py
+++ /dev/null
@@ -1,181 +0,0 @@
-class ONOSSanity4 :
-    def __init__(self) :
-        self.default = ''
-
-#************************************************************************************************************************************
-    '''
-    CASE1: Initial Startup
-    This case will follow the following steps
-    1. Stop all instances of Zookeeper, RAMCloud, and ONOS
-    2. Pull and build (if necessary) the latest ONOS code from Gerrit
-    3. Start Up Zookeeper, RAMCloud, and ONOS. (We will be using the start_all function aka ./onos.sh start)
-    4. Start up Mininet (Omitted for now as the Mininet is started up when the handle is connected)
-    5. Start up Rest Server
-    6. Test startup of Zookeeper
-    7. Test startup of RAMCloud
-    8. Test startup of ONOS
-    9. Test startup of Rest Server
-    10. Test startup of Mininet
-    '''
-    def CASE1(self,main) :
-        main.case("Initial Startup")
-        main.step("\n*************************\nStop all instances of ZK, RC, and ONOS\n*******************\n")
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.RC1.stop_serv()
-        main.RC2.stop_serv()
-        main.RC3.stop_serv()
-        main.RC4.stop_serv()
-        main.RC1.stop_coor()
-        main.Zookeeper1.stop()
-        main.Zookeeper2.stop()
-        main.Zookeeper3.stop()
-        main.Zookeeper4.stop()
-        main.step("**************\nPull and build (if necessary) the latest ONOS code from Gerrit \n****************\n")
-        uptodate = main.ONOS1.git_pull()
-        main.ONOS2.git_pull()
-        main.ONOS3.git_pull()
-        main.ONOS4.git_pull()
-        ver1 = main.ONOS1.get_version()
-        ver2 = main.ONOS4.get_version()
-        if ver1!=ver2:
-            main.ONOS2.git_pull("ONOS1 master")
-            main.ONOS3.git_pull("ONOS1 master")
-            main.ONOS4.git_pull("ONOS1 master")
-        if uptodate==0:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-            main.ONOS4.git_compile()
-        main.ONOS1.print_version()
-        main.step("Start up ZK, RC, and ONOS")
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        time.sleep(3)
-        main.RC1.del_db()
-        main.RC2.del_db()
-        main.RC3.del_db()
-        main.RC4.del_db()
-        time.sleep(5)
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        #main.step("Start Up Mininet")
-        main.step("Start up Rest Server")
-        main.ONOS1.start_rest()
-        main.step("Test startup of Zookeeper")
-        for i in range(2):
-            zk1up = main.Zookeeper1.isup()
-            zk2up = main.Zookeeper2.isup()
-            zk3up = main.Zookeeper3.isup()
-            zk4up = main.Zookeeper4.isup()
-            zkup = zk1up and zk2up and zk3up and zk4up
-            if zkup==main.TRUE:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=zkup,onpass="Zookeeper is up!",onfail="Zookeeper is down! Exiting!")
-        if zkup==main.FALSE:
-            main.cleanup()
-            main.exit()
-        main.step("Test startup of RamCloud")
-        for i in range(2):
-            rccup = main.RC1.status_coor()
-            rcs1up = main.RC1.status_serv()
-            rcs2up = main.RC2.status_serv()
-            rcs3up = main.RC3.status_serv()
-            rcs4up = main.RC4.status_serv()
-            rcup = rccup and rcs1up and rcs2up and rcs3up and rcs4up
-            if rcup==main.TRUE:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=rcup,onpass="RAMCloud is up!",onfail="RAMCloud is down! Exiting!")
-        if rcup == main.FALSE:
-            main.cleanup()
-            main.exit()
-
-        main.step("Test startup of ONOS")
-        for i in range(2):
-            ONOS1up = main.ONOS1.isup()
-            ONOS2up = main.ONOS2.isup()
-            ONOS3up = main.ONOS3.isup()
-            ONOS4up = main.ONOS4.isup()
-            ONOSup = ONOS1up and ONOS2up and ONOS3up and ONOS4up
-            if ONOSup==main.TRUE:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=ONOSup,onpass="ONOS is up!",onfail="ONOS is down! Exiting!")
-        if ONOSup==main.FALSE:
-            main.cleanup()
-            main.exit()
-
-        main.step("Test startup of Rest Server")
-        for i in range(2):
-            restStatus = main.ONOS1.rest_status()
-            if restStatus==main.TRUE:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=restStatus,onpass="Rest Server is up!",onfail="Rest Server is Down! Exiting!")
-        if restStatus==main.FALSE:
-            main.cleanup()
-            main.exit()
-
-        main.step("Test startup of Mininet")
-        main.log.report("Host IP Checking using checkIP")
-        result1 = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        result2 = main.Mininet1.checkIP(main.params['CASE1']['target'])
-        result = result1 and result2
-        utilities.assert_equals(expect=main.TRUE,actual=result, onpass="Host IP addresses configured",onfail="Host IP addresses not configured")
-        if result==main.FALSE:
-            main.cleanup()
-            main.exit()
-
-
-
-
-#************************************************************************************************************************************
-
-
-#************************************************************************************************************************************
-        '''
-        CASE2: Assign Controllers
-        This case will follow the following steps
-        1. Assign a Master Controller to each switch
-        2. Verify Master Controller
-        3. Assign all controllers to all switches
-        4. Verify all controllers
-        '''
-        main.case("Assign Controllers")
-        main.step("Assign a master controller to each switch")
-        for i in range(25):
-            if i<3:
-                main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-            elif i<16:
-                main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-        main.step("Verify Master controllers of each switch")
-        for i in range(25):
-            if i<3:
-                
-#************************************************************************************************************************************
-
-
-#************************************************************************************************************************************
-        '''
-        CASE3: Device Discovery Test
-        This case will follow the following steps
-        1. Ping to generate arp packets to switch
-        2. Find number of hosts with target IP (Try twice if not 1. Then will fail)
-        3. Yank the switch
-        4. Ping to generate arp packets to switch
-        5. Find number of hosts with target IP (Try twice if not 0. Then will fail)
-        6. Plug the switch
-        7. Ping to generate arp packets to switch
-        8. Find number of hosts with target IP (Try twice if not 1. Then will fail)
-
-        
-        '''
-#************************************************************************************************************************************
diff --git a/TestON/tests/ONOSSanity4/ONOSSanity4.topo b/TestON/tests/ONOSSanity4/ONOSSanity4.topo
deleted file mode 100644
index f4e1745..0000000
--- a/TestON/tests/ONOSSanity4/ONOSSanity4.topo
+++ /dev/null
@@ -1,139 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <RC1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-
-        <ONOS1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4nodeNEW.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/ONOSSanity4/__init__.py b/TestON/tests/ONOSSanity4/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/ONOSSanity4/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.params b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.params
deleted file mode 100644
index 9740c48..0000000
--- a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.params
+++ /dev/null
@@ -1,32 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <pingSleep>1</pingSleep>
-    <pingAttempts>15</pingAttempts>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <CTRL>
-        <ip1>10.128.100.21</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.100.22</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.100.23</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.100.24</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <RestIP> 10.128.100.21 </RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-</PARAMS>      
diff --git a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.py b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.py
deleted file mode 100644
index 8f30b10..0000000
--- a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.py
+++ /dev/null
@@ -1,514 +0,0 @@
-
-class OnosCHO4nodes :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.ONOS1.git_pull()
-        main.ONOS2.git_pull()
-        main.ONOS3.git_pull()
-        main.ONOS4.git_pull()
-        main.Cassandra1.start()
-        main.Cassandra2.start()
-        main.Cassandra3.start()
-        main.Cassandra4.start()
-        time.sleep(20)
-        main.ONOS1.drop_keyspace()
-        main.ONOS1.start()
-        time.sleep(30)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        time.sleep(20)
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")   
-        data =  main.Cassandra1.isup() 
-        if data == main.FALSE:
-            main.Cassandra1.stop()
-            main.Cassandra2.stop()
-            main.Cassandra3.stop()
-            main.Cassandra4.stop()
-
-            time.sleep(5)
- 
-            main.Cassandra1.start()
-            main.Cassandra2.start()
-            main.Cassandra3.start()
-            main.Cassandra4.start()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup() 
-        data = data and main.ONOS2.isup() 
-        data = data and main.ONOS3.isup() 
-        data = data and main.ONOS4.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            main.ONOS2.stop()
-            main.ONOS3.stop()
-            main.ONOS4.stop()
-            time.sleep(5)
-            main.ONOS1.start()
-            time.sleep(30)
-            main.ONOS2.start()
-            main.ONOS3.start()
-            main.ONOS4.start()
-            data = main.ONOS1.isup()
-        #main.ONOS1.tcpdump()
-        #main.ONOS2.tcpdump()
-        #main.ONOS3.tcpdump()
-        #main.ONOS4.tcpdump()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
-
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break 
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        time.sleep(5)
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+"  seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-             main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove all but one ONOS then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        import random
-
-        random.seed(None)
-
-        num = random.randint(1,4)
-        if num == 1:
-            ip = main.params['CTRL']['ip1']
-            port = main.params['CTRL']['port1']
-        elif num == 2:
-            ip = main.params['CTRL']['ip2']
-            port = main.params['CTRL']['port2']
-        elif num == 3:
-            ip = main.params['CTRL']['ip3']
-            port = main.params['CTRL']['port3']
-        else:
-            ip = main.params['CTRL']['ip4']
-            port = main.params['CTRL']['port4']
-
-        main.log.report("ONOS"+str(num)+" will be the sole controller")
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
-        main.log.report("Check initially hostMAC exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestIP2 = main.params['RESTCALL']['restIP2']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus =main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-
-        if Reststatus == 1:
-            main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result = main.FALSE
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
-            result = main.TRUE
-        else:
-            main.log.report("Attempt to yank out s1-eht1 from s1 failed.")
-            result = main.FALSE
-        
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus =main.ONOS1.find_host(RestIP2,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
-            result = main.FALSE
-        elif attachedSW == "00:00:00:00:00:00:00:06":
-            main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
-            result = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
-            result = main.FALSE
-        elif attachedSW == "00:00:00:00:00:00:00:01":
-            main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
-            result = main.FALSE
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-
-
-
diff --git a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.topo b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.topo
deleted file mode 100644
index daa8d44..0000000
--- a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.topo
+++ /dev/null
@@ -1,139 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.100.21</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.100.22</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.100.23</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.100.24</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <Cassandra1>
-            <host>10.128.100.21</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Cassandra2>
-            <host>10.128.100.22</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra2>
-       
-        <Cassandra3>
-            <host>10.128.100.23</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra3>
-       
-        <Cassandra4>
-            <host>10.128.100.24</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra4>
-
-        <ONOS1>
-            <host>10.128.100.21</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.100.22</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.100.23</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.100.24</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.100.25</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.topo.back b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.topo.back
deleted file mode 100644
index 9561597..0000000
--- a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.topo.back
+++ /dev/null
@@ -1,42 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <COMPONENTS>
-             </COMPONENTS>   
-        </Zookeeper1>     
-        <Cassandra1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>CassandraCliDriver</type>
-            <COMPONENTS>
-             </COMPONENTS>   
-        </Cassandra1>   
-        <ONOS1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <COMPONENTS>
-            
-             </COMPONENTS>   
-        </ONOS1> 
-        
-        
-         <ONOSRESTAPI1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosRestApiDriver</type>
-            <COMPONENTS>
-            <topology_url>http://10.128.4.26:9000/topology</topology_url>
-             </COMPONENTS>   
-        </ONOSRESTAPI1> 
-        
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosCHO4nodes/__init__.py b/TestON/tests/OnosCHO4nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosCHO4nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosCHO8nodes/.OnosSanity.topo.swp b/TestON/tests/OnosCHO8nodes/.OnosSanity.topo.swp
deleted file mode 100644
index c2a0aff..0000000
--- a/TestON/tests/OnosCHO8nodes/.OnosSanity.topo.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.params.swp b/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.params.swp
deleted file mode 100644
index 127ce94..0000000
--- a/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.params.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.py.swn b/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.py.swn
deleted file mode 100644
index cb578ac..0000000
--- a/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.py.swn
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.py.swo b/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.py.swo
deleted file mode 100644
index 5389b47..0000000
--- a/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.py.swo
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.topo.swp b/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.topo.swp
deleted file mode 100644
index 1500dc4..0000000
--- a/TestON/tests/OnosCHO8nodes/.OnosSanity4nodes.topo.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.params b/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.params
deleted file mode 100644
index 003af0d..0000000
--- a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.params
+++ /dev/null
@@ -1,35 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <CTRL>
-        <ip1>10.128.4.11</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.12</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.13</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.14</ip4>
-        <port4>6633</port4>
-        <ip5>10.128.4.15</ip5>
-        <port5>6633</port5>
-        <ip6>10.128.4.16</ip6>
-        <port6>6633</port6>
-        <ip7>10.128.4.17</ip7>
-        <port7>6633</port7>
-        <ip8>10.128.4.18</ip8>
-        <port8>6633</port8>
-    </CTRL>
-</PARAMS>      
diff --git a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.py b/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.py
deleted file mode 100644
index 52089f7..0000000
--- a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.py
+++ /dev/null
@@ -1,276 +0,0 @@
-
-class OnosCHO8nodes :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        import time
-        main.case("Checking if the startup was clean...") 
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.Zookeeper5.start()
-        main.Zookeeper6.start()
-        main.Zookeeper7.start()
-        main.Zookeeper8.start()
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")   
-        data =  main.Cassandra1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5) 
-            data = main.ONOS1.isup()
-        main.log.report("\n\n\t\t\t\t ONOS VERSION")
-        main.ONOS1.get_version()
-        main.log.info("\n\n")
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(3)
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(3)
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(3)
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(3)
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(3)
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(3)
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(3)
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(3)
-        main.Mininet1.get_sw_controller("s1")       
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        time.sleep(5)
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        tmp = main.FALSE
-        count = 1
-        main.log.info("Wait for flows to settle, then check")
-        while tmp == main.FALSE:
-            main.step("Waiting")
-            time.sleep(10)
-            main.step("Checking")
-            tmp = main.ONOS1.check_flow()
-            if tmp == main.FALSE and count < 6:
-                count = count + 1
-                main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
-            elif tmp == main.FALSE and count == 6:
-                result = main.FALSE
-                break
-            else:
-                result = main.TRUE
-                break
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 10 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-                time.sleep(3)
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(3)
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 15 seconds")
-                time.sleep(15)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(3)
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(3)
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 15 seconds")
-                time.sleep(15)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 15 seconds")
-                i = 6
-                time.sleep(15)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between S1 and S2 up, then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        main.case("Bringing Link back up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 15 seconds")
-                i = 6
-                time.sleep(15)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
diff --git a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.topo b/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.topo
deleted file mode 100644
index d74a523..0000000
--- a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.topo
+++ /dev/null
@@ -1,259 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <Zookeeper5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper5>
-
-        <Zookeeper6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper6>
-
-        <Zookeeper7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper7>
-
-        <Zookeeper8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper8>
-
-        <Cassandra1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Cassandra2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra2>
-       
-        <Cassandra3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra3>
-       
-        <Cassandra4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra4>
-
-        <Cassandra5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra5>
-
-        <Cassandra6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra6>
-
-        <Cassandra7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra7>
-
-        <Cassandra8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>16</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra8>
-
-        <ONOS1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>17</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>18</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>19</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>20</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>21</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <ONOS6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>22</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS6>
-
-        <ONOS7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>23</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS7>
-
-        <ONOS8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>24</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS8>
-
-        <Mininet1>
-            <host>10.128.6.2</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>25</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-2sw-2host.py </arg1>
-                <arg2> --topo mytopo</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.topo.back b/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.topo.back
deleted file mode 100644
index 9561597..0000000
--- a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.topo.back
+++ /dev/null
@@ -1,42 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <COMPONENTS>
-             </COMPONENTS>   
-        </Zookeeper1>     
-        <Cassandra1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>CassandraCliDriver</type>
-            <COMPONENTS>
-             </COMPONENTS>   
-        </Cassandra1>   
-        <ONOS1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <COMPONENTS>
-            
-             </COMPONENTS>   
-        </ONOS1> 
-        
-        
-         <ONOSRESTAPI1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosRestApiDriver</type>
-            <COMPONENTS>
-            <topology_url>http://10.128.4.26:9000/topology</topology_url>
-             </COMPONENTS>   
-        </ONOSRESTAPI1> 
-        
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosCHO8nodes/__init__.py b/TestON/tests/OnosCHO8nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosCHO8nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosPerf/.OnosSanity.py.swp b/TestON/tests/OnosPerf/.OnosSanity.py.swp
deleted file mode 100644
index ac9cdc3..0000000
--- a/TestON/tests/OnosPerf/.OnosSanity.py.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosPerf/OnosPerf.params b/TestON/tests/OnosPerf/OnosPerf.params
deleted file mode 100644
index 0616eec..0000000
--- a/TestON/tests/OnosPerf/OnosPerf.params
+++ /dev/null
@@ -1,42 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7</testcases>
-    <Iterations>1</Iterations>
-    <WaitTime>30</WaitTime>
-    <RestIP>10.128.4.11</RestIP>
-    <NR_Switches>4</NR_Switches>
-    <NR_Links>6</NR_Links>
-    <MN_size>57</MN_size>
-    <TargetTime>20</TargetTime>
-    <FLOWDEF>~/flowdef_files/8N_DEMO/flowdef_test_30.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h1</destination>
-    </CASE1>       
-    <LINK1>
-        <dpid1>00:00:00:00:ba:5e:ba:13</dpid1>
-        <port1>22</port1>
-        <dpid2>00:00:20:4e:7f:51:8a:35</dpid2>
-        <port2>22</port2>
-    </LINK1>
-    <PING>
-        <source1>g4h02</source1>
-        <source2>g4h03</source2>
-        <source3>g4h04</source3>
-        <source4>g4h05</source4>
-        <source5>g4h06</source5>
-        <source6>g4h07</source6>
-        <source7>g4h08</source7>
-        <source8>g4h09</source8>
-        <source9>g4h10</source9>
-        <source10>g4h11</source10>
-        <target1>192.168.8.2</target1>
-        <target2>192.168.8.3</target2>
-        <target3>192.168.8.4</target3>
-        <target4>192.168.8.5</target4>
-        <target5>192.168.8.6</target5>
-        <target6>192.168.8.7</target6>
-        <target7>192.168.8.8</target7>
-        <target8>192.168.8.9</target8>
-        <target9>192.168.8.10</target9>
-        <target10>192.168.8.11</target10>
-    </PING>
-</PARAMS>      
diff --git a/TestON/tests/OnosPerf/OnosPerf.py b/TestON/tests/OnosPerf/OnosPerf.py
deleted file mode 100644
index 3225de1..0000000
--- a/TestON/tests/OnosPerf/OnosPerf.py
+++ /dev/null
@@ -1,183 +0,0 @@
-
-class OnosPerf:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")
-        data =  main.Cassandra1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        #main.step("Pulling and Compiling ONOS Repo")
-        #main.ONOS1.git_pull()
-        main.ONOS1.drop_keyspace()
-        time.sleep(5) 
-        main.ONOS1.start()
-        time.sleep(5)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS5.start()
-        main.ONOS6.start()
-        main.ONOS7.start()
-        main.ONOS8.start()
-        main.step("Testing startup ONOS")
-        data = main.ONOS1.isup()
-        if data == main.FALSE:
-            main.log.info("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5)
-            data = main.ONOS1.isup()
-        #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running ",onfail="ONOS didn't start ...")
-
-    def CASE2(self,main) :
-        '''
-        Makes sure that the HW links are all up
-        Verifies that at least one mininet host exists.
-        Proves that there is actually a mininet that we are working with
-        '''
-        import time
-        main.case("Bringing Link up... ")
-        main.ONOS1.link_up(SDPID=main.params['LINK1']['dpid1'],SPORT=main.params['LINK1']['port1'],DDPID=main.params['LINK1']['dpid2'],DPORT=main.params['LINK1']['port2'])
-        main.log.info( "Waiting 10 seconds.... " )
-        time.sleep(10)
-        main.step("Checking if MN switches exist")
-        result = main.TRUE
-        result = result & main.Mininet2.checknum(main.params['MN_size'])
-        result = result & main.Mininet3.checknum(main.params['MN_size'])
-        result = result & main.Mininet4.checknum(main.params['MN_size'])
-        result = result & main.Mininet5.checknum(main.params['MN_size'])
-        result = result & main.Mininet6.checknum(main.params['MN_size'])
-        result = result & main.Mininet7.checknum(main.params['MN_size'])
-        result = result & main.Mininet8.checknum(main.params['MN_size'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="MN switches exist",onfail="MN is missing switches")
-
-
-    def CASE3(self,main) :
-        '''
-        This Test case: 
-            - Clears out any leftover flows
-            - Adds new flows into ONOS
-            - Checks flows up to 10 times waiting for each flow to be caluculated and no "NOT" statements inte get_flow
-        '''
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.log.info("deleting...")
-        main.ONOS1.delete_flow("all")
-        main.log.info("adding...")
-        t1 = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])   
-        main.log.info("Checking...")
-        for i in range(15):
-            result = main.ONOS1.check_flow()
-            if result == main.TRUE: 
-                t2 = time.time()
-                main.log.info( 'Adding flows took %0.3f ms' % ((t2-t1)*1000.0))
-                break
-            time.sleep(2)
-            main.log.info("Checking Flows again...")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="flows are good",onfail="FLOWS not correct") 
-
-
-    def CASE4(self,main) :
-        '''
-        Tests a single ping 
-        '''
-        main.case("Testing ping...")
-        ping_result = main.Mininet4.pingHost(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") 
-
-
-    def CASE5(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        import time
-        main.case("Starting long ping... ") 
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
-        time.sleep(5) 
-        result = main.Mininet4.pingstatus()
-        utilities.assert_equals(expect=main.TRUE,actual=result) 
-
-
-    def CASE6(self,main) : 
-        '''
-        Brings the defined link down and up a certain number of iterations
-        Stops the continuous pings that are running on the mininet machines from CASE 5
-        '''
-        import time
-        import os
-        main.log.case( "Link down number of iterations: " +  main.params['Iterations'] )
-        os.popen("echo "" > ~/tools/downtimes.log")
-        for i in range(int(main.params['Iterations'])):
-            main.log.info("Bringing Link down... ")
-            main.ONOS1.link_down(SDPID=main.params['LINK1']['dpid1'],SPORT=main.params['LINK1']['port1'],DDPID=main.params['LINK1']['dpid2'],DPORT=main.params['LINK1']['port2'])
-            os.popen("echo `date +%s` >> ~/tools/downtimes.log")
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-            #main.log.info("Checking...")
-            #t1 = time.time()
-            #for i in range(15):
-            #    result = main.ONOS1.check_flow()
-            #    if result == main.TRUE:
-            #        t2 = time.time()
-            #        main.log.info( 'Adding flows took %0.3f ms' % ((t2-t1)*1000.0))
-            #        break
-            #time.sleep(2)
-            #main.log.info("Checking Flows again...")
-            main.log.info("Bringing Link up... ")
-            main.ONOS1.link_up(SDPID=main.params['LINK1']['dpid1'],SPORT=main.params['LINK1']['port1'],DDPID=main.params['LINK1']['dpid2'],DPORT=main.params['LINK1']['port2'])
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-        main.case("Killing remote ping processes ") 
-        result = main.Mininet4.pingKill() 
-        utilities.assert_equals(expect=main.TRUE,actual=result) 
-       
-
-    def CASE7(self,main) :
-        '''
-        Processes all of the ping data and outputs raw data and an overall average
-        '''
-        import os
-        import time
-        main.case("Processing Ping data") 
-        time.sleep(3) 
-        result=os.popen("~/tools/shell.sh " + main.params['Iterations']).read()
-        average=result.split(":")[1] 
-        main.log.info( "Reroute times are... " ) 
-        main.log.report( result ) 
-        try:
-            if float(average) < float(main.params['TargetTime']) :
-                test=main.TRUE
-            else:
-                test=main.FALSE
-        except ValueError: 
-            main.log.error("Data is corrupted")
-            test=main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ")
diff --git a/TestON/tests/OnosPerf/OnosPerf.topo b/TestON/tests/OnosPerf/OnosPerf.topo
deleted file mode 100644
index f62e07a..0000000
--- a/TestON/tests/OnosPerf/OnosPerf.topo
+++ /dev/null
@@ -1,132 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Cassandra1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
- 
-        <ONOS1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-        </ONOS4>
-        <ONOS5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-        </ONOS5>
-        <ONOS6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS6>
-        <ONOS7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-        </ONOS7>
-        <ONOS8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-        </ONOS8>
-
-
-        <Mininet2>
-            <host>10.128.6.2</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet2>
-        <Mininet3>
-            <host>10.128.6.3</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>5</connect_order>
-        </Mininet3>
-        <Mininet4>
-            <host>10.128.6.4</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>6</connect_order>
-        </Mininet4>
-        <Mininet5>
-            <host>10.128.6.5</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>7</connect_order>
-        </Mininet5>
-        <Mininet6>
-            <host>10.128.6.6</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>8</connect_order>
-        </Mininet6>
-        <Mininet7>
-            <host>10.128.6.7</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>9</connect_order>
-        </Mininet7>
-        <Mininet8>
-            <host>10.128.6.8</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>10</connect_order>
-        </Mininet8>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosPerf/__init__.py b/TestON/tests/OnosPerf/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosPerf/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosPerf4nodes/.OnosSanity.py.swp b/TestON/tests/OnosPerf4nodes/.OnosSanity.py.swp
deleted file mode 100644
index ac9cdc3..0000000
--- a/TestON/tests/OnosPerf4nodes/.OnosSanity.py.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params
deleted file mode 100644
index f2c0b42..0000000
--- a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params
+++ /dev/null
@@ -1,43 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,4,8,7,4,9,7</testcases>
-    <Iterations>3</Iterations>
-    <WaitTime>60</WaitTime>
-    <RestIP>10.128.100.4</RestIP>
-    <MN_size>57</MN_size>
-    <TargetTime>30</TargetTime>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CTRL>
-        <ip1>10.128.100.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.100.4</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.100.5</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.100.6</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <PING>
-        <source1>h6</source1>
-        <source2>h7</source2>
-        <source3>h8</source3>
-        <source4>h9</source4>
-        <source5>h10</source5>
-        <source6>h11</source6>
-        <source7>h12</source7>
-        <source8>h13</source8>
-        <source9>h14</source9>
-        <source10>h15</source10>
-        <target1>10.0.0.16</target1>
-        <target2>10.0.0.17</target2>
-        <target3>10.0.0.18</target3>
-        <target4>10.0.0.19</target4>
-        <target5>10.0.0.20</target5>
-        <target6>10.0.0.21</target6>
-        <target7>10.0.0.22</target7>
-        <target8>10.0.0.23</target8>
-        <target9>10.0.0.24</target9>
-        <target10>10.0.0.25</target10>
-    </PING>
-</PARAMS>      
diff --git a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params_nightly b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params_nightly
deleted file mode 100644
index 5bd4c49..0000000
--- a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params_nightly
+++ /dev/null
@@ -1,43 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,4,5,6,7,4,5,6,7,4,8,7,4,9,7</testcases>
-    <Iterations>3</Iterations>
-    <WaitTime>60</WaitTime>
-    <RestIP>10.128.100.4</RestIP>
-    <MN_size>57</MN_size>
-    <TargetTime>30</TargetTime>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CTRL>
-        <ip1>10.128.100.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.100.4</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.100.5</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.100.6</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <PING>
-        <source1>h6</source1>
-        <source2>h7</source2>
-        <source3>h8</source3>
-        <source4>h9</source4>
-        <source5>h10</source5>
-        <source6>h11</source6>
-        <source7>h12</source7>
-        <source8>h13</source8>
-        <source9>h14</source9>
-        <source10>h15</source10>
-        <target1>10.0.0.16</target1>
-        <target2>10.0.0.17</target2>
-        <target3>10.0.0.18</target3>
-        <target4>10.0.0.19</target4>
-        <target5>10.0.0.20</target5>
-        <target6>10.0.0.21</target6>
-        <target7>10.0.0.22</target7>
-        <target8>10.0.0.23</target8>
-        <target9>10.0.0.24</target9>
-        <target10>10.0.0.25</target10>
-    </PING>
-</PARAMS>      
diff --git a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.py b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.py
deleted file mode 100644
index 0557929..0000000
--- a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.py
+++ /dev/null
@@ -1,413 +0,0 @@
-
-class OnosPerf4nodes:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.Cassandra1.start()
-        main.Cassandra2.start()
-        main.Cassandra3.start()
-        main.Cassandra4.start()
-        time.sleep(20)
-        main.ONOS1.drop_keyspace()
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")
-        data =  main.Cassandra1.isup()
-        if data == main.FALSE:
-            main.Cassandra1.stop()
-            main.Cassandra2.stop()
-            main.Cassandra3.stop()
-            main.Cassandra4.stop()
-
-            time.sleep(5)
-
-            main.Cassandra1.start()
-            main.Cassandra2.start()
-            main.Cassandra3.start()
-            main.Cassandra4.start()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")
-        data = main.ONOS1.isup()
-        data = data and main.ONOS2.isup()
-        data = data and main.ONOS3.isup()
-        data = data and main.ONOS4.isup()
-        if data == main.FALSE:
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            main.ONOS2.stop()
-            main.ONOS3.stop()
-            main.ONOS4.stop()
-            time.sleep(5)
-            main.ONOS1.start()
-            time.sleep(10)
-            main.ONOS2.start()
-            main.ONOS3.start()
-            main.ONOS4.start()
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-
-    def CASE2(self,main) :
-        '''
-        Makes sure that the HW links are all up
-        Verifies that at least one mininet host exists.
-        Proves that there is actually a mininet that we are working with
-        '''
-        import time
-        main.step("Checking if MN switches exist")
-        main.log.report("Check if MN switches exist")
-        #result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        #for i in range(2):
-        #    if result == main.FALSE: 
-        #        time.sleep(5)
-        #        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        #    else: 
-        #        break
-        #main.step("Verifying the result")
-        #utilities.assert_equals(expect=main.TRUE,actual=result,onpass="MN switches exist",onfail="MN is missing switches and or links...")
-
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25):
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")
-        time.sleep(5)        
-
-    def CASE3(self,main) :
-        '''
-        Verifies that ONOS sees the right topology... 
-        '''
-        import time
-        main.log.report("checking if ONOS sees the right topo...") 
-        main.case("TOPO check")
-        main.step("calling rest calls") 
-        for i in range(4):
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            time.sleep(5)
-            if result == 1:
-                break
-        if result == 0:
-            main.ONOS1.start()
-            main.ONOS2.start()
-            main.ONOS3.start()
-            main.ONOS4.start()
-            time.sleep(45)
-            for i in range(4):
-                result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                time.sleep(5)
-                if result == 1:
-                    break
-        utilities.assert_equals(expect=1,actual=result)
-       
-    def CASE4(self,main) :
-        '''
-        This Test case: 
-            - Clears out any leftover flows
-            - Adds new flows into ONOS
-            - Checks flows up to 10 times waiting for each flow to be caluculated and no "NOT" statements inte get_flow
-        '''
-        import time
-        main.log.report("Deleting and adding flows")
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.log.info("deleting...")
-        main.ONOS1.delete_flow("all")
-        main.log.info("adding...")
-        t1 = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])   
-        main.log.info("Checking...")
-        for i in range(15):
-            result = main.ONOS1.check_flow()
-            if result == main.TRUE: 
-                t2 = time.time()
-                main.log.info( 'Adding flows took %0.3f s' % (t2-t1))
-                break
-            time.sleep(5)
-            main.log.info("Checking Flows again...")
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 3:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
-                time.sleep(10)
-            elif ping == main.FALSE and count ==3:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.info("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.info("\tPING TEST FAIL")
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="flows are good",onfail="FLOWS not correct") 
-
-        main.log.report("checking if ONOS sees the right topo...")
-        main.case("TOPO check")
-        main.step("calling rest calls")
-        for i in range(3):
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            time.sleep(5)
-            if result == 1:
-                break
-
-    def CASE5(self,main) :
-        '''
-        Tests a single ping 
-        '''
-        main.log.report("Testing a single ping")
-        main.case("Testing ping...")
-        ping_result = main.Mininet4.pingHost(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") 
-
-
-    def CASE6(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        main.log.report("Starting continuous ping, then toggle a single link in the center triangle")
-        import time
-        import os
-        main.case("Starting long ping... ") 
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
-        main.step("Check that the pings are going") 
-        result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
-        main.step( "Link down number of iterations: " +  main.params['Iterations'] )
-        for i in range(int(main.params['Iterations'])):
-            main.log.info("Bringing Link down... ") 
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-            main.log.info("Bringing Link up... ")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-        main.case("Killing remote ping processes ") 
-        result =  result & main.Mininet4.pingKill() 
-        utilities.assert_equals(expect=main.TRUE,actual=result) 
-       
-
-    def CASE7(self,main) :
-        '''
-        Processes all of the ping data and outputs raw data and an overall average
-        '''
-        import os
-        import time
-        main.log.report("Process ping data (Fail is time is >20 seconds)")
-        main.case("Processing Ping data") 
-        time.sleep(3) 
-        #result=os.popen("/home/admin/tools/shell.sh " + main.params['Iterations']).read()
-        try:
-            result=os.popen("/home/admin/ONLabTest/TestON/scripts/get_reroute_times.py").read() 
-            average=result.split(":")[1] 
-            main.log.info( "Reroute times are... " ) 
-            main.log.report( result + " seconds" ) 
-            try:
-                if float(average) < float(main.params['TargetTime']) :
-                    test=main.TRUE
-                else:
-                    test=main.FALSE
-            except ValueError: 
-                main.log.error("Data is corrupted")
-                test=main.FALSE
-        except:
-            main.log.report("No data")
-            test=main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ")
-
-    def CASE8(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        main.log.report("Start continuous pings, then toggle multiple links in center triangle")
-        import time
-        import os
-        time.sleep(20)
-        main.case("Starting long ping... ")
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
-        main.step("Check that the pings are going")
-        result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
-        main.step( "Making topo change while flows are rerouting")
-        main.step( "Link down number of iterations: " +  main.params['Iterations'] )
-        for i in range(int(main.params['Iterations'])):
-            main.log.info("s1-s2 link down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
-            main.Mininet1.link(END1="s1",END2="s3",OPTION="up")
-            main.Mininet1.link(END1="s2",END2="s3",OPTION="up")
-
-            time.sleep(5)
-
-            main.log.info("s1-s2 link up | s1-s3 link down | s2-s3 link down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-            main.Mininet1.link(END1="s1",END2="s3",OPTION="down")
-            main.Mininet1.link(END1="s2",END2="s3",OPTION="down")
-
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) + 60 )
-
-        main.case("Killing remote ping processes ")
-        result =  result & main.Mininet4.pingKill()
-        utilities.assert_equals(expect=main.TRUE,actual=result)
-        main.log.info("Make sure all links in triangle are up")
-        main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-        main.Mininet1.link(END1="s1",END2="s3",OPTION="up")
-        main.Mininet1.link(END1="s2",END2="s3",OPTION="up")
-
-    def CASE9(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        main.log.report("Start continuous pings, then toggle one link in center triangle and start/stop 1 ONOS node")
-        import time
-        import os
-
-        time.sleep(20)
-        main.case("Starting long ping... ")
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
-        main.step("Check that the pings are going")
-        result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
-        main.step( "Making topo change while flows are rerouting")
-        main.step( "Link down number of iterations: " +  main.params['Iterations'] )
-        for i in range(int(main.params['Iterations'])):
-            main.log.info("s1-s2 link down | Onos 1 down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
-            if i % 4 == 0:
-                main.ONOS1.stop()
-            elif i % 4 == 1:
-                main.ONOS2.stop()
-            elif i % 4 == 2:
-                main.ONOS3.stop()
-            else:
-                main.ONOS4.stop()
-
-            time.sleep(5)
-
-            main.log.info("s1-s2 link up | Onos 1 back up")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-            if i % 4 == 0:
-                main.ONOS1.start()
-                main.ONOS1.isup()
-            elif i % 4 == 1:
-                main.ONOS2.start()
-                main.ONOS2.isup()
-            elif i % 4 == 2:
-                main.ONOS3.start()
-                main.ONOS3.isup()
-            else:
-                main.ONOS4.start()
-                main.ONOS4.isup()
-
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-
-        main.case("Killing remote ping processes ")
-        result =  result & main.Mininet4.pingKill()
-        utilities.assert_equals(expect=main.TRUE,actual=result)
-
diff --git a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.topo b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.topo
deleted file mode 100644
index be580b1..0000000
--- a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.topo
+++ /dev/null
@@ -1,91 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-        </Zookeeper1>
-
-        <Cassandra1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>2</connect_order>
-        </Cassandra1>
-        <Cassandra2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>3</connect_order>
-        </Cassandra2>
-        <Cassandra3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>4</connect_order>
-        </Cassandra3>
-        <Cassandra4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>5</connect_order>
-        </Cassandra4>
- 
-        <ONOS1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet4>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>11</connect_order>
-        </Mininet4>
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosPerf4nodes/__init__.py b/TestON/tests/OnosPerf4nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosPerf4nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosPerfTest/OnosPerfTest.params b/TestON/tests/OnosPerfTest/OnosPerfTest.params
deleted file mode 100644
index 05c11da..0000000
--- a/TestON/tests/OnosPerfTest/OnosPerfTest.params
+++ /dev/null
@@ -1,43 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,8,9</testcases>
-    <Iterations>3</Iterations>
-    <WaitTime>120</WaitTime>
-    <RestIP>10.128.100.4</RestIP>
-    <MN_size>57</MN_size>
-    <TargetTime>20</TargetTime>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CTRL>
-        <ip1>10.128.100.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.100.4</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.100.5</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.100.6</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <PING>
-        <source1>h6</source1>
-        <source2>h7</source2>
-        <source3>h8</source3>
-        <source4>h9</source4>
-        <source5>h10</source5>
-        <source6>h11</source6>
-        <source7>h12</source7>
-        <source8>h13</source8>
-        <source9>h14</source9>
-        <source10>h15</source10>
-        <target1>10.0.0.16</target1>
-        <target2>10.0.0.17</target2>
-        <target3>10.0.0.18</target3>
-        <target4>10.0.0.19</target4>
-        <target5>10.0.0.20</target5>
-        <target6>10.0.0.21</target6>
-        <target7>10.0.0.22</target7>
-        <target8>10.0.0.23</target8>
-        <target9>10.0.0.24</target9>
-        <target10>10.0.0.25</target10>
-    </PING>
-</PARAMS>      
diff --git a/TestON/tests/OnosPerfTest/OnosPerfTest.py b/TestON/tests/OnosPerfTest/OnosPerfTest.py
deleted file mode 100644
index a5e95bd..0000000
--- a/TestON/tests/OnosPerfTest/OnosPerfTest.py
+++ /dev/null
@@ -1,337 +0,0 @@
-
-class OnosPerfTest:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.log.report("Checking if the startup was clean") 
-        main.case("Checking if the startup was clean...")
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.step("Testing startup Zookeeper")
-        main.ONOS1.get_version()
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")
-        main.Cassandra1.start()
-        main.Cassandra2.start()
-        main.Cassandra3.start()
-        main.Cassandra4.start()
-        data =  main.Cassandra1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.ONOS1.drop_keyspace()
-        time.sleep(5) 
-        main.ONOS1.start()
-        time.sleep(5)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.step("Testing startup ONOS")
-        data = main.ONOS1.isup()
-        if data == main.FALSE:
-            main.log.info("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5)
-            data = main.ONOS1.isup()
-        data = data & main.ONOS2.isup()
-        data = data & main.ONOS3.isup()
-        data = data & main.ONOS4.isup()
-        main.ONOS1.start_rest()
-        #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running ",onfail="ONOS didn't start ...")
-
-    def CASE2(self,main) :
-        '''
-        Makes sure that the HW links are all up
-        Verifies that at least one mininet host exists.
-        Proves that there is actually a mininet that we are working with
-        '''
-        import time
-        main.step("Checking if MN switches exist")
-        main.log.report("Check if MN switches exist")
-        #result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        #for i in range(2):
-        #    if result == main.FALSE: 
-        #        time.sleep(5)
-        #        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        #    else: 
-        #        break
-        #main.step("Verifying the result")
-        #utilities.assert_equals(expect=main.TRUE,actual=result,onpass="MN switches exist",onfail="MN is missing switches and or links...")
-
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25):
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")
-
-    def CASE3(self,main) :
-        '''
-        Verifies that ONOS sees the right topology... 
-        '''
-        import time
-        main.log.report("checking if ONOS sees the right topo...") 
-        main.case("TOPO check")
-        main.step("calling rest calls") 
-        for i in range(9):
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            time.sleep(5)
-            if result == 1:
-                break
-        if result == 0:
-            main.ONOS1.start()
-            main.ONOS2.start()
-            main.ONOS3.start()
-            main.ONOS4.start()
-            for i in range(9):
-                result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                time.sleep(5)
-                if result == 1:
-                    break
-        utilities.assert_equals(expect=1,actual=result)
-       
-    def CASE4(self,main) :
-        '''
-        This Test case: 
-            - Clears out any leftover flows
-            - Adds new flows into ONOS
-            - Checks flows up to 10 times waiting for each flow to be caluculated and no "NOT" statements inte get_flow
-        '''
-        import time
-        main.log.report("Deleting and adding flows")
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.log.info("deleting...")
-        main.ONOS1.delete_flow("all")
-        main.log.info("adding...")
-        t1 = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])   
-        main.log.info("Checking...")
-        for i in range(15):
-            result = main.ONOS1.check_flow()
-            if result == main.TRUE: 
-                t2 = time.time()
-                main.log.info( 'Adding flows took %0.3f s' % (t2-t1))
-                break
-            time.sleep(5)
-            main.log.info("Checking Flows again...")
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 3:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
-                time.sleep(10)
-            elif ping == main.FALSE and count ==3:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.info("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.info("\tPING TEST FAIL")
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="flows are good",onfail="FLOWS not correct") 
-
-
-    def CASE5(self,main) :
-        '''
-        Tests a single ping 
-        '''
-        main.log.report("Testing a single ping")
-        main.case("Testing ping...")
-        ping_result = main.Mininet4.pingHost(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") 
-
-
-    def CASE6(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        main.log.report("Start continuous pings, then toggle links in center triangle")
-        import time
-        import os
-
-        main.case("Starting long ping... ") 
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
-        main.step("Check that the pings are going")
-        result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
-        main.step( "Making topo change while flows are rerouting")
-            
-        for i in range(int(main.params['Iterations'])): 
-            main.log.info("s1-s2 link down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
-
-            time.sleep(3)
-
-            main.log.info("s1-s2 link up | s1-s3 link down | s2-s3 link down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-            main.Mininet1.link(END1="s1",END2="s3",OPTION="down")
-            main.Mininet1.link(END1="s2",END2="s3",OPTION="down")
-
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-
-        main.case("Killing remote ping processes ") 
-        result =  result & main.Mininet4.pingKill() 
-        utilities.assert_equals(expect=main.TRUE,actual=result) 
-       
-
-    def CASE7(self,main) :
-        '''
-        Processes all of the ping data and outputs raw data and an overall average
-        '''
-        import os
-        import time
-        main.log.report("Process ping data")
-        main.case("Processing Ping data") 
-        time.sleep(3) 
-        #result=os.popen("/home/admin/tools/shell.sh " + main.params['Iterations']).read()
-        result=os.popen("/home/admin/get_reroute_times.py").read() 
-        average=result.split(":")[1] 
-        main.log.info( "Reroute times are... " ) 
-        main.log.report( result ) 
-        try:
-            if float(average) < float(main.params['TargetTime']) :
-                test=main.TRUE
-            else:
-                test=main.FALSE
-        except ValueError: 
-            main.log.error("Data is corrupted")
-            test=main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ")
-
-    def CASE8(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        main.log.report("Start continuous pings, then toggle links in center triangle")
-        import time
-        import os
-
-        main.case("Starting long ping... ")
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
-        main.step("Check that the pings are going")
-        result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
-        main.step( "Making topo change while flows are rerouting")
-
-        for i in range(int(main.params['Iterations'])):
-            main.log.info("s1-s2 link down | Onos 1 down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
-            main.ONOS1.stop() 
-
-            time.sleep(3)
-
-            main.log.info("s1-s2 link up | Onos 1 back up")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-            main.ONOS1.start()
-            main.ONOS1.isup()
-
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-
-        main.case("Killing remote ping processes ")
-        result =  result & main.Mininet4.pingKill()
-        utilities.assert_equals(expect=main.TRUE,actual=result)
-
-
-    def CASE9(self,main) :
-        '''
-        Processes all of the ping data and outputs raw data and an overall average
-        '''
-        import os
-        import time
-        main.log.report("Process ping data")
-        main.case("Processing Ping data")
-        time.sleep(3)
-        #result=os.popen("/home/admin/tools/shell.sh " + main.params['Iterations']).read()
-        result=os.popen("/home/admin/get_reroute_times.py").read()
-        average=result.split(":")[1]
-        main.log.info( "Reroute times are... " )
-        main.log.report( result )
-        try:
-            if float(average) < float(main.params['TargetTime']) :
-                test=main.TRUE
-            else:
-                test=main.FALSE
-        except ValueError:
-            main.log.error("Data is corrupted")
-            test=main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ")
-
diff --git a/TestON/tests/OnosPerfTest/OnosPerfTest.topo b/TestON/tests/OnosPerfTest/OnosPerfTest.topo
deleted file mode 100644
index d7bf736..0000000
--- a/TestON/tests/OnosPerfTest/OnosPerfTest.topo
+++ /dev/null
@@ -1,99 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-        </Zookeeper1>
-
-        <Cassandra1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>2</connect_order>
-        </Cassandra1>
-        <Cassandra2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>3</connect_order>
-        </Cassandra2>
-        <Cassandra3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>4</connect_order>
-        </Cassandra3>
-        <Cassandra4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>5</connect_order>
-        </Cassandra4>
- 
-        <ONOS1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo</arg2>
-                <controller> remote,ip=10.128.100.1,port=6633 </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet4>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>11</connect_order>
-        </Mininet4>
-        <Mininet8>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>12</connect_order>
-        </Mininet8>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosPerfTest/__init__.py b/TestON/tests/OnosPerfTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosPerfTest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosSanity4ARP/.OnosSanity4nodes.py.swn b/TestON/tests/OnosSanity4ARP/.OnosSanity4nodes.py.swn
deleted file mode 100644
index cb578ac..0000000
--- a/TestON/tests/OnosSanity4ARP/.OnosSanity4nodes.py.swn
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosSanity4ARP/.OnosSanity4nodes.py.swo b/TestON/tests/OnosSanity4ARP/.OnosSanity4nodes.py.swo
deleted file mode 100644
index 5389b47..0000000
--- a/TestON/tests/OnosSanity4ARP/.OnosSanity4nodes.py.swo
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.params b/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.params
deleted file mode 100644
index 4d9be1d..0000000
--- a/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.params
+++ /dev/null
@@ -1,48 +0,0 @@
-<PARAMS>
-    <testcases>1,2,4,5,6,7,3,4,5,6,7</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.100.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.100.4</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.100.5</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.100.6</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <RestIP>10.128.100.1</RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.100.1</restIP1>
-	<restIP2>10.128.100.5</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/device/</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.py b/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.py
deleted file mode 100644
index 2163878..0000000
--- a/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.py
+++ /dev/null
@@ -1,447 +0,0 @@
-
-class OnosSanity4ARP :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.log.report("Pulling latest code from github to all nodes")
-        main.ONOS1.git_pull()
-        main.ONOS2.git_pull()
-        main.ONOS3.git_pull()
-        main.ONOS4.git_pull()
-        main.Cassandra1.start()
-        main.Cassandra2.start()
-        main.Cassandra3.start()
-        main.Cassandra4.start()
-        time.sleep(20)
-        main.ONOS1.drop_keyspace()
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")   
-        data =  main.Cassandra1.isup() 
-        if data == main.FALSE:
-            main.Cassandra1.stop()
-            main.Cassandra2.stop()
-            main.Cassandra3.stop()
-            main.Cassandra4.stop()
-
-            time.sleep(5)
- 
-            main.Cassandra1.start()
-            main.Cassandra2.start()
-            main.Cassandra3.start()
-            main.Cassandra4.start()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5) 
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 9:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==9:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-
-        result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        hostip = main.params['YANK']['hostip']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-       
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, RestSwitch, RestPort = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
-        try:
-            attachedSW = RestSwitch[0]['dpid']
-            host_ip = RestSwitch[0]['devices'][0]['ipv4addresses']
-        except:
-            Reststatus = 0
-        if Reststatus == 1 and host_ip == '10.0.0.1':
-            main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
-            result = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " has " + Reststatus + " duplicated IP addresses. FAILED")
-        else:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result = main.FALSE
-
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, RestSwitch, RestPort = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
-        try:
-            attachedSW = RestSwitch[0]['dpid']
-            host_ip = RestSwitch[0]['devices'][0]['ipv4addresses']
-        except:
-            Reststatus = 0
-        if Reststatus == 1 and host_ip == '10.0.0.1':
-            main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
-            result = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " has " + Reststatus + " duplicated IP addresses. FAILED")
-        else:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result = main.FALSE
-
-         
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, RestSwitch, RestPort = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
-        try:
-            attachedSW = RestSwitch[0]['dpid']
-            host_ip = RestSwitch[0]['devices'][0]['ipv4addresses']
-        except:
-            Reststatus = 0
-        if Reststatus == 1 and host_ip == '10.0.0.1':
-            main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
-            result = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " has " + Reststatus + " duplicated IP addresses. FAILED")
-        else:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result = main.FALSE
-
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, RestSwitch, RestPort = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
-        try:
-            attachedSW = RestSwitch[0]['dpid']
-            host_ip = RestSwitch[0]['devices'][0]['ipv4addresses']
-        except:
-            Reststatus = 0
-        if Reststatus == 1 and host_ip == '10.0.0.1':
-            main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
-            result = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " has " + Reststatus + " duplicated IP addresses. FAILED")
-        else:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result = main.FALSE
-
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-
diff --git a/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.topo b/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.topo
deleted file mode 100644
index 0c77a3b..0000000
--- a/TestON/tests/OnosSanity4ARP/OnosSanity4ARP.topo
+++ /dev/null
@@ -1,139 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <Cassandra1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Cassandra2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra2>
-       
-        <Cassandra3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra3>
-       
-        <Cassandra4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra4>
-
-        <ONOS1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosSanity4ARP/OnosSanity4node_testDD.py b/TestON/tests/OnosSanity4ARP/OnosSanity4node_testDD.py
deleted file mode 100644
index d6192fb..0000000
--- a/TestON/tests/OnosSanity4ARP/OnosSanity4node_testDD.py
+++ /dev/null
@@ -1,460 +0,0 @@
-
-class OnosSanity4nodes :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.log.report("Pulling latest code from github to all nodes")
-        main.ONOS1.git_pull()
-        main.ONOS2.git_pull()
-        main.ONOS3.git_pull()
-        main.ONOS4.git_pull()
-        main.Cassandra1.start()
-        main.Cassandra2.start()
-        main.Cassandra3.start()
-        main.Cassandra4.start()
-        time.sleep(20)
-        main.ONOS1.drop_keyspace()
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")   
-        data =  main.Cassandra1.isup() 
-        if data == main.FALSE:
-            main.Cassandra1.stop()
-            main.Cassandra2.stop()
-            main.Cassandra3.stop()
-            main.Cassandra4.stop()
-
-            time.sleep(5)
- 
-            main.Cassandra1.start()
-            main.Cassandra2.start()
-            main.Cassandra3.start()
-            main.Cassandra4.start()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5) 
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        time.sleep(5)
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        tmp = main.FALSE
-        count = 1
-        main.log.info("Wait for flows to be pushed to the switches, then check")
-        while tmp == main.FALSE:
-            main.step("Waiting")
-            time.sleep(10)
-            main.step("Checking")
-            tmp = main.ONOS1.check_flow()
-            if tmp == main.FALSE and count < 6:
-                count = count + 1
-                main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
-            elif tmp == main.FALSE and count == 6:
-                result1 = main.FALSE
-                break
-            else:
-                result1 = main.TRUE
-                break
-        endTime = time.time()
-        if result1 == main.TRUE:
-            main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-        
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 3:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
-                time.sleep(10)
-            elif ping == main.FALSE and count ==3:
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        if result2 == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-
-        result3 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result1 and result2 and result3,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                time.sleep(5)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                time.sleep(5)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                i = 6
-                time.sleep(5)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                i = 6
-                time.sleep(5)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        from drivers.common.api.onosrestapidriver import *
-        main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
-        main.log.report("Check initially hostMAC exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestIP2 = main.params['RESTCALL']['restIP2']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        restcall = OnosRestApiDriver()
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            host_ip = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 1 and host_ip == '10.0.0.1':
-            main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
-            result = main.TRUE
-        else:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result = main.FALSE
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-        except IndexError:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
-            result = main.TRUE
-        else:
-            main.log.report("Attempt to yank out s1-eht1 from s1 failed.")
-            result = main.FALSE
-        
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            host_ip = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
-            result = main.FALSE
-        elif attachedSW == "00:00:00:00:00:00:00:06"and host_ip == '10.0.0.1':
-            main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
-            result = main.TRUE
-        else:
-            main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
-            result = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            host_ip = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
-            result = main.FALSE
-        elif attachedSW == "00:00:00:00:00:00:00:01" and host_ip == '10.0.0.1':
-            main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
-            result = main.TRUE
-        else:
-            main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
-            result = main.FALSE
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-
diff --git a/TestON/tests/OnosSanity4ARP/OnosSanity4nodes.params_old b/TestON/tests/OnosSanity4ARP/OnosSanity4nodes.params_old
deleted file mode 100644
index 2eea988..0000000
--- a/TestON/tests/OnosSanity4ARP/OnosSanity4nodes.params_old
+++ /dev/null
@@ -1,30 +0,0 @@
-<PARAMS>
-    <testcases>1,2,21,21,3,4,5,6,7</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <CTRL>
-        <ip1>10.128.100.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.100.4</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.100.5</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.100.6</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <RestIP> 10.128.100.1 </RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-</PARAMS>      
diff --git a/TestON/tests/OnosSanity4ARP/OnosSanity4nodes.topo.back b/TestON/tests/OnosSanity4ARP/OnosSanity4nodes.topo.back
deleted file mode 100644
index 9561597..0000000
--- a/TestON/tests/OnosSanity4ARP/OnosSanity4nodes.topo.back
+++ /dev/null
@@ -1,42 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <COMPONENTS>
-             </COMPONENTS>   
-        </Zookeeper1>     
-        <Cassandra1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>CassandraCliDriver</type>
-            <COMPONENTS>
-             </COMPONENTS>   
-        </Cassandra1>   
-        <ONOS1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <COMPONENTS>
-            
-             </COMPONENTS>   
-        </ONOS1> 
-        
-        
-         <ONOSRESTAPI1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosRestApiDriver</type>
-            <COMPONENTS>
-            <topology_url>http://10.128.4.26:9000/topology</topology_url>
-             </COMPONENTS>   
-        </ONOSRESTAPI1> 
-        
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosSanity4ARP/__init__.py b/TestON/tests/OnosSanity4ARP/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosSanity4ARP/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params
deleted file mode 100644
index b4da842..0000000
--- a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params
+++ /dev/null
@@ -1,49 +0,0 @@
-<PARAMS>
-    <testcases>1,2,21,31,4,5,6,7,3,4,5,6,7</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.100.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.100.4</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.100.5</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.100.6</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <RestIP>10.128.100.1</RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.100.1</restIP1>
-	<restIP2>10.128.100.5</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/onos/ng/switches/json</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py
deleted file mode 100644
index 0a757a6..0000000
--- a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py
+++ /dev/null
@@ -1,489 +0,0 @@
-
-class OnosSanity4nodes :
-
-    def __init__(self) :
-        self.default = ''
-
-#*****************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.log.report("Pulling latest code from github to all nodes")
-        main.ONOS1.git_pull()
-        main.ONOS2.git_pull()
-        main.ONOS3.git_pull()
-        main.ONOS4.git_pull()
-        main.Cassandra1.stop()
-        main.Cassandra2.stop()
-        main.Cassandra3.stop()
-        main.Cassandra4.stop()
-        main.Cassandra1.start()
-        main.Cassandra2.start()
-        main.Cassandra3.start()
-        main.Cassandra4.start()
-        time.sleep(20)
-        main.ONOS1.drop_keyspace()
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")   
-        data =  main.Cassandra1.isup() 
-        if data == main.FALSE:
-            main.Cassandra1.stop()
-            main.Cassandra2.stop()
-            main.Cassandra3.stop()
-            main.Cassandra4.stop()
-
-            time.sleep(5)
- 
-            main.Cassandra1.start()
-            main.Cassandra2.start()
-            main.Cassandra3.start()
-            main.Cassandra4.start()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5) 
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 9:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==9:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        hostip = main.params['YANK']['hostip']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 0
-        t_restwait = 10
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port, MAC = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result1 = main.FALSE
-        else:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.step("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port, MAC = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        else:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-         
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.step("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port, MAC = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result3 = main.FALSE
-        else:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.step("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port, MAC = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result4 = main.FALSE
-        else:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-# Run a pure ping test. 
-
-    def CASE31(self, main):
-        main.log.report("Performing Ping Test")        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            strtTime = time.time() 
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.topo b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.topo
deleted file mode 100644
index 56ba3cf..0000000
--- a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.topo
+++ /dev/null
@@ -1,139 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <Cassandra1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Cassandra2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra2>
-       
-        <Cassandra3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra3>
-       
-        <Cassandra4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra4>
-
-        <ONOS1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosSanity4nodes/__init__.py b/TestON/tests/OnosSanity4nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosSanity4nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosSanity8nodes/.OnosSanity.topo.swp b/TestON/tests/OnosSanity8nodes/.OnosSanity.topo.swp
deleted file mode 100644
index c2a0aff..0000000
--- a/TestON/tests/OnosSanity8nodes/.OnosSanity.topo.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.params.swp b/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.params.swp
deleted file mode 100644
index 127ce94..0000000
--- a/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.params.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.py.swn b/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.py.swn
deleted file mode 100644
index cb578ac..0000000
--- a/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.py.swn
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.py.swo b/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.py.swo
deleted file mode 100644
index 5389b47..0000000
--- a/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.py.swo
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.topo.swp b/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.topo.swp
deleted file mode 100644
index 1500dc4..0000000
--- a/TestON/tests/OnosSanity8nodes/.OnosSanity4nodes.topo.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.params b/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.params
deleted file mode 100644
index 2e98b7d..0000000
--- a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.params
+++ /dev/null
@@ -1,35 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <CTRL>
-        <ip1>10.128.4.11</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.12</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.13</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.14</ip4>
-        <port4>6633</port4>
-        <ip5>10.128.4.15</ip5>
-        <port5>6633</port5>
-        <ip6>10.128.4.16</ip6>
-        <port6>6633</port6>
-        <ip7>10.128.4.17</ip7>
-        <port7>6633</port7>
-        <ip8>10.128.4.18</ip8>
-        <port8>6633</port8>
-    </CTRL>
-</PARAMS>      
diff --git a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.py b/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.py
deleted file mode 100644
index b5afc02..0000000
--- a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.py
+++ /dev/null
@@ -1,276 +0,0 @@
-
-class OnosSanity8nodes :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        import time
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.Zookeeper5.start()
-        main.Zookeeper6.start()
-        main.Zookeeper7.start()
-        main.Zookeeper8.start()
-        main.case("Checking if the startup was clean...") 
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")   
-        data =  main.Cassandra1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5) 
-            data = main.ONOS1.isup()
-        main.log.report("\n\n\t\t\t\t ONOS VERSION")
-        main.ONOS1.get_version()
-        main.log.info("\n\n")
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(1)
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(1)
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(1)
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(1)
-        main.Mininet1.get_sw_controller("s1")       
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        time.sleep(5)
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        tmp = main.FALSE
-        count = 1
-        main.log.info("Wait for flows to settle, then check")
-        while tmp == main.FALSE:
-            main.step("Waiting")
-            time.sleep(10)
-            main.step("Checking")
-            tmp = main.ONOS1.check_flow()
-            if tmp == main.FALSE and count < 6:
-                count = count + 1
-                main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
-            elif tmp == main.FALSE and count == 6:
-                result = main.FALSE
-                break
-            else:
-                result = main.TRUE
-                break
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 10 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-                time.sleep(1)
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 15 seconds")
-                time.sleep(15)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(1)
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw="s"+str(j),count=8,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'],ip5=main.params['CTRL']['ip5'],port5=main.params['CTRL']['port5'],ip6=main.params['CTRL']['ip6'],port6=main.params['CTRL']['port6'],ip7=main.params['CTRL']['ip7'],port7=main.params['CTRL']['port7'],ip8=main.params['CTRL']['ip8'],port8=main.params['CTRL']['port8'])
-                time.sleep(1)
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 15 seconds")
-                time.sleep(15)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 15 seconds")
-                i = 6
-                time.sleep(15)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between S1 and S2 up, then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        main.case("Bringing Link back up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 15 seconds")
-                i = 6
-                time.sleep(15)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
diff --git a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.topo b/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.topo
deleted file mode 100644
index 912464b..0000000
--- a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.topo
+++ /dev/null
@@ -1,259 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <Zookeeper5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper5>
-
-        <Zookeeper6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper6>
-
-        <Zookeeper7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper7>
-
-        <Zookeeper8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper8>
-
-        <Cassandra1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Cassandra2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra2>
-       
-        <Cassandra3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra3>
-       
-        <Cassandra4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra4>
-
-        <Cassandra5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra5>
-
-        <Cassandra6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra6>
-
-        <Cassandra7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra7>
-
-        <Cassandra8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>16</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra8>
-
-        <ONOS1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>17</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>18</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>19</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>20</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>21</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <ONOS6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>22</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS6>
-
-        <ONOS7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>23</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS7>
-
-        <ONOS8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>24</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS8>
-
-        <Mininet1>
-            <host>10.128.7.7</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>25</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-2sw-2host.py </arg1>
-                <arg2> --topo mytopo</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.topo.back b/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.topo.back
deleted file mode 100644
index 9561597..0000000
--- a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.topo.back
+++ /dev/null
@@ -1,42 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <COMPONENTS>
-             </COMPONENTS>   
-        </Zookeeper1>     
-        <Cassandra1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>CassandraCliDriver</type>
-            <COMPONENTS>
-             </COMPONENTS>   
-        </Cassandra1>   
-        <ONOS1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <COMPONENTS>
-            
-             </COMPONENTS>   
-        </ONOS1> 
-        
-        
-         <ONOSRESTAPI1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosRestApiDriver</type>
-            <COMPONENTS>
-            <topology_url>http://10.128.4.26:9000/topology</topology_url>
-             </COMPONENTS>   
-        </ONOSRESTAPI1> 
-        
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosSanity8nodes/__init__.py b/TestON/tests/OnosSanity8nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosSanity8nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosScale/.OnosSanity.py.swp b/TestON/tests/OnosScale/.OnosSanity.py.swp
deleted file mode 100644
index ac9cdc3..0000000
--- a/TestON/tests/OnosScale/.OnosSanity.py.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosScale/OnosScale.params b/TestON/tests/OnosScale/OnosScale.params
deleted file mode 100644
index 68dabe7..0000000
--- a/TestON/tests/OnosScale/OnosScale.params
+++ /dev/null
@@ -1,9 +0,0 @@
-<PARAMS>
-    <testcases>1,2</testcases>
-    <Iterations>2</Iterations>
-    <WaitTime>20</WaitTime>
-    <TargetTime>20</TargetTime>
-    <RestIP>10.128.4.11</RestIP>
-    <NR_Switches>405</NR_Switches>
-    <NR_Links>802</NR_Links>
-</PARAMS>      
diff --git a/TestON/tests/OnosScale/OnosScale.py b/TestON/tests/OnosScale/OnosScale.py
deleted file mode 100644
index 2655089..0000000
--- a/TestON/tests/OnosScale/OnosScale.py
+++ /dev/null
@@ -1,133 +0,0 @@
-
-class OnosScale:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")
-        data =  main.Cassandra1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")
-        main.ONOS1.start()
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS5.start()
-        main.ONOS6.start()
-        main.ONOS7.start()
-        main.ONOS8.start()
-        data = main.ONOS1.isup()
-        if data == main.FALSE:
-            main.log.info("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5)
-            data = main.ONOS1.isup()
-        #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        topoview = main.TRUE
-        if topoview == main.TRUE & data == main.TRUE :
-            data = main.TRUE
-        else:
-            data = main.FALSE
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running and has full view of topology",onfail="ONOS didn't start or has fragmented view of topology...")
-
-    def CASE2(self,main) :
-        '''
-        Second case is to time the convergence time of a topology for ONOS. 
-        It shuts down the ONOS, drops keyspace, starts ONOS...
-        Then it points all the mininet switches at the ONOS node and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
-        '''
-        import time
-        main.case("Timing Onos Convergence for switch -> ONOS1")
-        main.step("Bringing ONOS down...") 
-        main.log.info("all switch no controllers") 
-        main.Mininet2.ctrl_none()
-        main.Mininet3.ctrl_none()
-        main.Mininet4.ctrl_none()
-        main.Mininet5.ctrl_none()
-        main.Mininet6.ctrl_none()
-        main.Mininet7.ctrl_none()
-        main.Mininet8.ctrl_none()
-        main.log.info("bringing ONOS down") 
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.ONOS5.stop()
-        main.ONOS6.stop()
-        main.ONOS7.stop()
-        main.ONOS8.stop()
-        main.log.info("Dropping keyspace...")
-        main.ONOS1.drop_keyspace()
-        time.sleep(5)
-        main.log.info("Bringing ONOS up")
-        main.ONOS1.start()
-        time.sleep(5) 
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS5.start()
-        main.ONOS6.start()
-        main.ONOS7.start()
-        main.ONOS8.start()
-        main.ONOS1.isup()
-        main.ONOS2.isup()
-        main.ONOS3.isup()
-        main.ONOS4.isup()
-        main.ONOS5.isup()
-        main.ONOS6.isup()
-        main.ONOS7.isup()
-        main.ONOS8.isup()
-        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.log.info("Pointing the Switches at controller... then BEGIN time") 
-        main.Mininet2.ctrl_local()
-        main.Mininet3.ctrl_local()
-        main.Mininet4.ctrl_local()
-        main.Mininet5.ctrl_local()
-        main.Mininet6.ctrl_local()
-        main.Mininet7.ctrl_local()
-        main.Mininet8.ctrl_local()
-        #main.Mininet2.ctrl_one(main.params['RestIP'])
-        #main.Mininet3.ctrl_one(main.params['RestIP'])
-        #main.Mininet4.ctrl_one(main.params['RestIP'])
-        #main.Mininet5.ctrl_one(main.params['RestIP'])
-        #main.Mininet6.ctrl_one(main.params['RestIP'])
-        #main.Mininet7.ctrl_one(main.params['RestIP'])
-        #main.Mininet8.ctrl_one(main.params['RestIP'])
-        t1 = time.time()
-        for i in range(4) : 
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            if result == 1 : 
-                break
-            else : 
-                time.sleep(1)
-        t2 = time.time()
-        conv_time = t2 - t1
-        if result == 1 : 
-            main.log.info( "Convergence time of : %f seconds" % conv_time ) 
-            if float(conv_time) < float(main.params['TargetTime']) :
-                test=main.TRUE
-                main.log.info("Time is less then supplied target time")
-            else:
-                test=main.FALSE
-                main.log.info("Time is greater then supplied target time")
-        else : 
-            main.log.info( "ONOS did NOT converge over : %f seconds" % conv_time ) 
-            test=main.FALSE
- 
-        utilities.assert_equals(expect=main.TRUE,actual=test)
-
diff --git a/TestON/tests/OnosScale/OnosScale.topo b/TestON/tests/OnosScale/OnosScale.topo
deleted file mode 100644
index db65096..0000000
--- a/TestON/tests/OnosScale/OnosScale.topo
+++ /dev/null
@@ -1,133 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOS1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>4</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.4.12</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.4.13</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.4.14</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-        </ONOS4>
-        <ONOS5>
-            <host>10.128.4.15</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-        </ONOS5>
-        <ONOS6>
-            <host>10.128.4.16</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS6>
-        <ONOS7>
-            <host>10.128.4.17</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-        </ONOS7>
-        <ONOS8>
-            <host>10.128.4.18</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-        </ONOS8>
-
-
-        <Zookeeper1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Cassandra1>
-            <host>10.128.4.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Mininet2>
-            <host>10.128.6.2</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet2>
-        <Mininet3>
-            <host>10.128.6.3</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet3>
-        <Mininet4>
-            <host>10.128.6.4</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet4>
-        <Mininet5>
-            <host>10.128.6.5</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet5>
-        <Mininet6>
-            <host>10.128.6.6</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet6>
-        <Mininet7>
-            <host>10.128.6.7</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet7>
-        <Mininet8>
-            <host>10.128.6.8</host>
-            <user>miniuser</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>4</connect_order>
-        </Mininet8>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosScale/OnosScale.topo.back b/TestON/tests/OnosScale/OnosScale.topo.back
deleted file mode 100644
index a17ae48..0000000
--- a/TestON/tests/OnosScale/OnosScale.topo.back
+++ /dev/null
@@ -1,52 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOS1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-
-             </COMPONENTS>
-        </ONOS1>
-
-        <!--
-        <Zookeeper1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Cassandra1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>CassandraCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Mininet1>
-            <host>10.128.4.26</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-2sw-2host.py </arg1>
-                <arg2> --topo mytopo</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-        -->
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosScale/__init__.py b/TestON/tests/OnosScale/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosScale/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosScale/check_status.py b/TestON/tests/OnosScale/check_status.py
deleted file mode 100755
index 8e870bc..0000000
--- a/TestON/tests/OnosScale/check_status.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#! /usr/bin/env python
-import json
-import os
-import sys
-
-# http://localhost:8080/wm/onos/ng/switches/json
-# http://localhost:8080/wm/onos/ng/links/json
-# http://localhost:8080/wm/onos/registry/controllers/json
-# http://localhost:8080/wm/onos/registry/switches/json"
-
-def get_json(url):
-  try:
-    command = "curl -s %s" % (url)
-    result = os.popen(command).read()
-    parsedResult = json.loads(result)
-  except:
-    print "REST IF %s has issue" % command
-    parsedResult = ""
-
-  if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
-    print "REST %s returned code %s" % (command, parsedResult['code'])
-    parsedResult = ""
-
-  return parsedResult 
-
-def check_switch(RestIP,correct_nr_switch ):
-  buf = ""
-  retcode = 0
-  RestPort="8080"
-
-  url="http://%s:%s/wm/onos/ng/switches/json" % (RestIP, RestPort)
-  parsedResult = get_json(url)
-
-  if parsedResult == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-  url = "http://%s:%s/wm/onos/registry/switches/json" % (RestIP, RestPort)
-  registry = get_json(url)
-
-  if registry == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-
-  buf += "switch: total %d switches\n" % len(parsedResult)
-  cnt = 0
-  active = 0
-
-  for s in parsedResult:
-    cnt += 1
-
-    if s['state']  == "ACTIVE":
-      active += 1
-
-    if not s['dpid'] in registry:
-      buf += "switch:  dpid %s lost controller\n" % (s['dpid'])
-
-  buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
-  if correct_nr_switch != cnt:
-    buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
-    retcode = 1
-
-  if correct_nr_switch != active:
-    buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
-    retcode = 1
-
-  return (retcode, buf)
-
-def check_link(RestIP, nr_links):
-  RestPort = "8080"
-  buf = ""
-  retcode = 0
-
-  url = "http://%s:%s/wm/onos/ng/links/json" % (RestIP, RestPort)
-  parsedResult = get_json(url)
-
-  if parsedResult == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-  buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
-  intra = 0
-  interlink=0
-
-  for s in parsedResult:
-    intra = intra + 1 
-
-  if intra != nr_links:
-    buf += "link fail: network %d should have %d intra links but has %d\n" % (1, nr_links, intra)
-    retcode = 1
-
-  return (retcode, buf)
-
-#if __name__ == "__main__":
-def check_status(ip, numoswitch, numolink):
-
-  switch = check_switch(ip, numoswitch)
-  link = check_link(ip, numolink)
-  value = switch[0]
-  value += link[0]
-  if value != 0:
-    print "FAIL"
-    return 0
-  else: 
-    print "PASS"
-    return 1
-  print "%s" % switch[1]
-  print "%s" % link[1]
- # print "%s" % check_switch_local()[1]
- # print "%s" % check_controllers(8)[1]
diff --git a/TestON/tests/OnosScale4nodes/.OnosSanity.py.swp b/TestON/tests/OnosScale4nodes/.OnosSanity.py.swp
deleted file mode 100644
index ac9cdc3..0000000
--- a/TestON/tests/OnosScale4nodes/.OnosSanity.py.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/OnosScale4nodes/OnosScale4nodes.params b/TestON/tests/OnosScale4nodes/OnosScale4nodes.params
deleted file mode 100644
index dff7284..0000000
--- a/TestON/tests/OnosScale4nodes/OnosScale4nodes.params
+++ /dev/null
@@ -1,9 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4</testcases>
-    <Iterations>2</Iterations>
-    <WaitTime>50</WaitTime>
-    <TargetTime>50</TargetTime>
-    <RestIP>10.128.100.4</RestIP>
-    <NR_Switches>100</NR_Switches>
-    <NR_Links>198</NR_Links>
-</PARAMS>      
diff --git a/TestON/tests/OnosScale4nodes/OnosScale4nodes.py b/TestON/tests/OnosScale4nodes/OnosScale4nodes.py
deleted file mode 100644
index bae4b5c..0000000
--- a/TestON/tests/OnosScale4nodes/OnosScale4nodes.py
+++ /dev/null
@@ -1,252 +0,0 @@
-
-class OnosScale4nodes:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.Cassandra1.start()
-        main.Cassandra2.start()
-        main.Cassandra3.start()
-        main.Cassandra4.start()
-        time.sleep(20)
-        main.ONOS1.drop_keyspace()
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")
-        data =  main.Cassandra1.isup()
-        if data == main.FALSE:
-            main.Cassandra1.stop()
-            main.Cassandra2.stop()
-            main.Cassandra3.stop()
-            main.Cassandra4.stop()
-
-            time.sleep(5)
-
-            main.Cassandra1.start()
-            main.Cassandra2.start()
-            main.Cassandra3.start()
-            main.Cassandra4.start()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")
-        data = main.ONOS1.isup()
-        data = data and main.ONOS2.isup()
-        data = data and main.ONOS3.isup()
-        data = data and main.ONOS4.isup()
-        if data == main.FALSE:
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            main.ONOS2.stop()
-            main.ONOS3.stop()
-            main.ONOS4.stop()
-            time.sleep(5)
-            main.ONOS1.start()
-            time.sleep(10)
-            main.ONOS2.start()
-            main.ONOS3.start()
-            main.ONOS4.start()
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-
-    def CASE2(self,main) :
-        '''
-        Second case is to time the convergence time of a topology for ONOS. 
-        It shuts down the ONOS, drops keyspace, starts ONOS...
-        Then it points all the mininet switches at the ONOS node and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
-        '''
-        import time
-        main.log.report("Time convergence for switches -> single ONOS node in cluster")
-        main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
-        main.step("Bringing ONOS down...") 
-        main.log.info("all switch no controllers") 
-        main.Mininet1.ctrl_none()
-        main.log.info("bringing ONOS down") 
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.log.info("Dropping keyspace...")
-        main.ONOS1.drop_keyspace()
-        time.sleep(5)
-        main.log.info("Bringing ONOS up")
-        main.ONOS1.start()
-        time.sleep(5) 
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.isup()
-        main.ONOS2.isup()
-        main.ONOS3.isup()
-        main.ONOS4.isup()
-        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.log.info("Pointing the Switches at ONE controller... then BEGIN time") 
-        main.Mininet1.ctrl_local()
-        t1 = time.time()
-        for i in range(15) : 
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            if result == 1 : 
-                break
-            else : 
-                time.sleep(1)
-        t2 = time.time()
-        conv_time = t2 - t1
-        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
-            if float(conv_time) < float(main.params['TargetTime']) :
-                test=main.TRUE
-                main.log.info("Time is less then supplied target time")
-            else:
-                test=main.FALSE
-                main.log.info("Time is greater then supplied target time")
-        else : 
-            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
-            test=main.FALSE
- 
-        utilities.assert_equals(expect=main.TRUE,actual=test)
-
-    def CASE3(self,main) :
-        '''
-        Second case is to time the convergence time of a topology for ONOS. 
-        It shuts down the ONOS, drops keyspace, starts ONOS...
-        Then it points all the mininet switches at all ONOS nodes and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
-        '''
-        import time
-        main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
-        main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
-        main.step("Bringing ONOS down...") 
-        main.log.info("all switch no controllers") 
-        main.Mininet1.ctrl_none()
-        main.log.info("bringing ONOS down") 
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        #main.log.info("Dropping keyspace...")
-        #main.ONOS1.drop_keyspace()
-        time.sleep(5)
-        main.log.info("Bringing ONOS up")
-        main.ONOS1.start()
-        time.sleep(5) 
-        main.ONOS2.start()
-        main.ONOS2.start_rest()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.isup()
-        main.ONOS2.isup()
-        main.ONOS3.isup()
-        main.ONOS4.isup()
-        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.log.info("Pointing the Switches at ALL controllers... then BEGIN time") 
-        main.Mininet1.ctrl_all()
-        t1 = time.time()
-        for i in range(15) : 
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            if result == 1 : 
-                break
-            else : 
-                time.sleep(1)
-        t2 = time.time()
-        conv_time = t2 - t1
-        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
-            if float(conv_time) < float(main.params['TargetTime']) :
-                test=main.TRUE
-                main.log.info("Time is less then supplied target time")
-            else:
-                test=main.FALSE
-                main.log.info("Time is greater then supplied target time")
-        else : 
-            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
-            test=main.FALSE
- 
-        utilities.assert_equals(expect=main.TRUE,actual=test)
-
-    def CASE4(self,main) :
-        '''
-        Second case is to time the convergence time of a topology for ONOS. 
-        It shuts down the ONOS, drops keyspace, starts ONOS...
-        Then it evenly points all mininet switches to all ONOS nodes, but only one node, and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
-        '''
-        import time
-        main.log.report("Time convergence for switches -> Divide switches equall among all  nodes in cluster")
-        main.case("Timing Onos Convergence for even single controller distribution")
-        main.step("Bringing ONOS down...") 
-        main.log.info("all switch no controllers") 
-        main.Mininet1.ctrl_none()
-        main.log.info("bringing ONOS down") 
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        #main.log.info("Dropping keyspace...")
-        #main.ONOS1.drop_keyspace()
-        time.sleep(5)
-        main.log.info("Bringing ONOS up")
-        main.ONOS1.start()
-        time.sleep(5) 
-        main.ONOS2.start()
-        main.ONOS2.start_rest()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.isup()
-        main.ONOS2.isup()
-        main.ONOS3.isup()
-        main.ONOS4.isup()
-        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.log.info("Pointing the Switches to alternating controllers... then BEGIN time") 
-        main.Mininet1.ctrl_divide()
-        t1 = time.time()
-        for i in range(15) : 
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            if result == 1 : 
-                break
-            else : 
-                time.sleep(1)
-        t2 = time.time()
-        conv_time = t2 - t1
-        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
-            if float(conv_time) < float(main.params['TargetTime']) :
-                test=main.TRUE
-                main.log.info("Time is less then supplied target time")
-            else:
-                test=main.FALSE
-                main.log.info("Time is greater then supplied target time")
-        else : 
-            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
-            test=main.FALSE
- 
-        utilities.assert_equals(expect=main.TRUE,actual=test)
-
diff --git a/TestON/tests/OnosScale4nodes/OnosScale4nodes.topo b/TestON/tests/OnosScale4nodes/OnosScale4nodes.topo
deleted file mode 100644
index 44b11c2..0000000
--- a/TestON/tests/OnosScale4nodes/OnosScale4nodes.topo
+++ /dev/null
@@ -1,87 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOS1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-        </ONOS4>
-
-        <Zookeeper1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Cassandra1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>3</connect_order>
-        </Cassandra1>
-        <Cassandra2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>4</connect_order>
-        </Cassandra2>
-        <Cassandra3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>5</connect_order>
-        </Cassandra3>
-        <Cassandra4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>6</connect_order>
-        </Cassandra4>
-
-        <Mininet1>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>25</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> </arg1>
-                <arg2> --topo linear,100 --arp</arg2>
-                <controller> remote,ip=10.128.100.1,port=6633 </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosScale4nodes/__init__.py b/TestON/tests/OnosScale4nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OnosScale4nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/OnosScale4nodes/check_status.py b/TestON/tests/OnosScale4nodes/check_status.py
deleted file mode 100755
index 8e870bc..0000000
--- a/TestON/tests/OnosScale4nodes/check_status.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#! /usr/bin/env python
-import json
-import os
-import sys
-
-# http://localhost:8080/wm/onos/ng/switches/json
-# http://localhost:8080/wm/onos/ng/links/json
-# http://localhost:8080/wm/onos/registry/controllers/json
-# http://localhost:8080/wm/onos/registry/switches/json"
-
-def get_json(url):
-  try:
-    command = "curl -s %s" % (url)
-    result = os.popen(command).read()
-    parsedResult = json.loads(result)
-  except:
-    print "REST IF %s has issue" % command
-    parsedResult = ""
-
-  if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
-    print "REST %s returned code %s" % (command, parsedResult['code'])
-    parsedResult = ""
-
-  return parsedResult 
-
-def check_switch(RestIP,correct_nr_switch ):
-  buf = ""
-  retcode = 0
-  RestPort="8080"
-
-  url="http://%s:%s/wm/onos/ng/switches/json" % (RestIP, RestPort)
-  parsedResult = get_json(url)
-
-  if parsedResult == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-  url = "http://%s:%s/wm/onos/registry/switches/json" % (RestIP, RestPort)
-  registry = get_json(url)
-
-  if registry == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-
-  buf += "switch: total %d switches\n" % len(parsedResult)
-  cnt = 0
-  active = 0
-
-  for s in parsedResult:
-    cnt += 1
-
-    if s['state']  == "ACTIVE":
-      active += 1
-
-    if not s['dpid'] in registry:
-      buf += "switch:  dpid %s lost controller\n" % (s['dpid'])
-
-  buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
-  if correct_nr_switch != cnt:
-    buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
-    retcode = 1
-
-  if correct_nr_switch != active:
-    buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
-    retcode = 1
-
-  return (retcode, buf)
-
-def check_link(RestIP, nr_links):
-  RestPort = "8080"
-  buf = ""
-  retcode = 0
-
-  url = "http://%s:%s/wm/onos/ng/links/json" % (RestIP, RestPort)
-  parsedResult = get_json(url)
-
-  if parsedResult == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-  buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
-  intra = 0
-  interlink=0
-
-  for s in parsedResult:
-    intra = intra + 1 
-
-  if intra != nr_links:
-    buf += "link fail: network %d should have %d intra links but has %d\n" % (1, nr_links, intra)
-    retcode = 1
-
-  return (retcode, buf)
-
-#if __name__ == "__main__":
-def check_status(ip, numoswitch, numolink):
-
-  switch = check_switch(ip, numoswitch)
-  link = check_link(ip, numolink)
-  value = switch[0]
-  value += link[0]
-  if value != 0:
-    print "FAIL"
-    return 0
-  else: 
-    print "PASS"
-    return 1
-  print "%s" % switch[1]
-  print "%s" % link[1]
- # print "%s" % check_switch_local()[1]
- # print "%s" % check_controllers(8)[1]
diff --git a/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.params b/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.params
deleted file mode 100644
index a6a596d..0000000
--- a/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.params
+++ /dev/null
@@ -1,59 +0,0 @@
-<PARAMS>
-    <testcases>1,2,9,[3,9,4,9,5,9,6,9,7,9]*3000</testcases>
-    <pingSleep>1</pingSleep>
-    <pingAttempts>60</pingAttempts>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <CTRL>
-        <ip1>10.128.5.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.5.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.5.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.5.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-    </CTRL>
-    <RestIP> 10.128.5.1 </RestIP>
-    <INTENTS>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent</intentURL>
-    </INTENTS>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-        <sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-        <sw6>s6</sw6>
-        <sw1>s1</sw1>
-    </PLUG>
-    <RESTCALL>
-        <restIP1>10.128.5.1</restIP1>
-        <restIP2>10.128.5.2</restIP2>
-        <restPort>8080</restPort>
-        <restURL>/wm/onos/topology/hosts</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.py b/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.py
deleted file mode 100644
index af41618..0000000
--- a/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.py
+++ /dev/null
@@ -1,1096 +0,0 @@
-
-class RCOnosCHO4nodes :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.ONOS1.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS2.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS3.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS4.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.RamCloud1.stop_coor()
-        main.RamCloud1.stop_serv()
-        main.RamCloud2.stop_serv()
-        main.RamCloud3.stop_serv()
-        main.RamCloud4.stop_serv()
-        time.sleep(10)
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        time.sleep(10)
-        main.log.report("Pulling latest code from github to all nodes")
-        for i in range(2):
-            uptodate = main.ONOS1.git_pull()
-            main.ONOS2.git_pull()
-            main.ONOS3.git_pull()
-            main.ONOS4.git_pull()
-            ver1 = main.ONOS1.get_version()
-            ver2 = main.ONOS4.get_version()
-            if ver1==ver2:
-                break
-            elif i==1:
-                main.ONOS2.git_pull("ONOS1 master")
-                main.ONOS3.git_pull("ONOS1 master")
-                main.ONOS4.git_pull("ONOS1 master")
-       #if uptodate==0
-        if 1:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-            main.ONOS4.git_compile()
-        main.ONOS1.print_version()
-       # main.RamCloud1.git_pull()
-       # main.RamCloud2.git_pull()
-       # main.RamCloud3.git_pull()
-       # main.RamCloud4.git_pull()
-       # main.ONOS1.get_version()
-       # main.ONOS2.get_version()
-       # main.ONOS3.get_version()
-       # main.ONOS4.get_version()
-        main.RamCloud1.start_coor()
-        time.sleep(1)
-        main.RamCloud1.start_serv()
-        main.RamCloud2.start_serv()
-        main.RamCloud3.start_serv()
-        main.RamCloud4.start_serv()
-        main.ONOS1.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        time.sleep(5)
-        main.ONOS2.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS3.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS4.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS1.start_rest()
-        time.sleep(10)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")
-        data =  main.RamCloud1.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")
-        data = main.ONOS1.isup()
-        for i in range(3):
-            if data == main.FALSE:
-                #main.log.report("Something is funny... restarting ONOS")
-                #main.ONOS1.stop()
-                time.sleep(3)
-                #main.ONOS1.start()
-                #time.sleep(5)
-                data = main.ONOS1.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-        time.sleep(10)
-
-          
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        result =  main.Mininet1.get_sw_controller("s1")
-        if result:
-            result = main.TRUE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="S1 assigned to controller",onfail="S1 not assigned to controller")
-
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break 
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows using intents and wait for switch flow tables to update")
-        import time
-
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-
-        ####New Topo Check
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result) 
-        ###End New Topo Check
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-       
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        intentIP = main.params['CTRL']['ip1']
-        intentPort=main.params['INTENTS']['intentPort']
-        intentURL=main.params['INTENTS']['intentURL']
-        #main.ONOS1.delete_flow("all")
-        main.ONOS1.del_intent(intentIP=intentIP)
-        time.sleep(5)
-        strtTime = time.time()
-        main.step("Adding Intents")
-        count=1
-        for i in range(6,16):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            srcDPID = '00:00:00:00:00:00:10:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:20:' +str(i+25)
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,
-                    src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,
-                    intentURL=intentURL)
-            count=count +1
-            dstDPID = '00:00:00:00:00:00:10:'+str(i).zfill(2)
-            srcDPID= '00:00:00:00:00:00:20:' +str(i+25)
-            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
-            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,
-                    src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,
-                    intentURL=intentURL)
-            count=count +1
-        main.step("Checking flows with pings")
-        
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+"  seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-             main.log.report("\n\t\t\t\tTime from pushing intents to successful ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Assign all switches to just one ONOS instance then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        import random
-
-        random.seed(None)
-
-        num = random.randint(1,4)
-        if num == 1:
-            ip = main.params['CTRL']['ip1']
-            port = main.params['CTRL']['port1']
-        elif num == 2:
-            ip = main.params['CTRL']['ip2']
-            port = main.params['CTRL']['port2']
-        elif num == 3:
-            ip = main.params['CTRL']['ip3']
-            port = main.params['CTRL']['port3']
-        else:
-            ip = main.params['CTRL']['ip4']
-            port = main.params['CTRL']['port4']
-
-        main.log.report("ONOS"+str(num)+" will be the sole controller")
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        ####New Topo Check
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result) 
-        ###End New Topo Check
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time() 
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore switch assignments to all 4 ONOS instances then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        ####New Topo Check
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result) 
-        ###End New Topo Check
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                break
-        ####New Topo Check
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result) 
-        ###End New Topo Check
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        ####New Topo Check
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result) 
-        ###End New Topo Check
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-# **********************************************************************************************************************************************************************************************
-# Runs reactive ping test
-    def CASE8(self,main) :
-        main.log.report("Reactive flow ping test:ping until the routes are active or fail after 10 attempts")
-        import time
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        ####New Topo Check
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result) 
-        ###End New Topo Check
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-# This is the same as case 6, but specifically for the reactive tests
-
-    def CASE61(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                break
-        ####New Topo Check
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result) 
-        ###End New Topo Check
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-# Specifically for the Reactive tests
-
-    def CASE71(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        ####New Topo Check
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(MNTopo, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result) 
-        ###End New Topo Check
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-
-
-# ******************************************************************************************************************************************************************
-# Check for ONOS Components health
-
-    def CASE9(self,main) :
-        main.case("Checking component status")
-        result = main.TRUE
-
-        main.step("Checking Zookeeper status")
-        result1 = main.Zookeeper1.status()
-        if not result1:
-            main.log.report("Zookeeper1 encountered a tragic death!")
-        result2 = main.Zookeeper2.status()
-        if not result2:
-            main.log.report("Zookeeper2 encountered a tragic death!")
-        result3 = main.Zookeeper3.status()
-        if not result3:
-            main.log.report("Zookeeper3 encountered a tragic death!")
-        result4 = main.Zookeeper4.status()
-        if not result4:
-            main.log.report("Zookeeper4 encountered a tragic death!")
-        result = result and result1 and result2 and result3 and result4
-
-        main.step("Checking RamCloud status")
-        result5 = main.RamCloud1.status_coor()
-        if not result5:
-            main.log.report("RamCloud Coordinator1 encountered a tragic death!")
-        result6 = main.RamCloud1.status_serv()
-        if not result6:
-            main.log.report("RamCloud Server1 encountered a tragic death!")
-        result7 = main.RamCloud2.status_serv()
-        if not result7:
-            main.log.report("RamCloud Server2 encountered a tragic death!")
-        result8 = main.RamCloud3.status_serv()
-        if not result8:
-            main.log.report("RamCloud Server3 encountered a tragic death!")
-        result9 = main.RamCloud4.status_serv()
-        if not result9:
-            main.log.report("RamCloud Server4 encountered a tragic death!")
-        result = result and result5 and result6 and result7 and result8 and result9
-
-
-        main.step("Checking ONOS status")
-        result10 = main.ONOS1.status()
-        if not result10:
-            main.log.report("ONOS1 core encountered a tragic death!")
-        result11 = main.ONOS2.status()
-        if not result11:
-            main.log.report("ONOS2 core encountered a tragic death!")
-        result12 = main.ONOS3.status()
-        if not result12:
-            main.log.report("ONOS3 core encountered a tragic death!")
-        result13 = main.ONOS4.status()
-        if not result13:
-            main.log.report("ONOS4 core encountered a tragic death!")
-        result = result and result10 and result11 and result12 and result13
-
-
-
-        rest_result =  main.ONOS1.rest_status()
-        if not rest_result:
-            main.log.report("Simple Rest GUI server is not running on ONOS1")
-
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="All Components are running",onfail="One or more components failed")
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, and move host h1 from s1->s6->s1. Per mininet naming, the name of the switch port the host attaches to will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 5
-        t_restwait = 5
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-        main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host mac = " + mac + ";  attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0]))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac  addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            result1 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result1 = main.FALSE
-
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result2 = main.FALSE
-
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result3 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result4 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result4 = main.FALSE
-        time.sleep(20)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus ==1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout")
-        elif Reststatus>1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout(multiple found)")
-        elif Reststatus==0:
-            main.log.report("\t PASSED - Device cleared after timeout")
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
diff --git a/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.topo b/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.topo
deleted file mode 100644
index d97e541..0000000
--- a/TestON/tests/RCOnosCHO4nodes/RCOnosCHO4nodes.topo
+++ /dev/null
@@ -1,139 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.5.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.5.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.5.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.5.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <RamCloud1>
-            <host>10.128.5.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud1>
-
-        <RamCloud2>
-            <host>10.128.5.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud2>
-       
-        <RamCloud3>
-            <host>10.128.5.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud3>
-       
-        <RamCloud4>
-            <host>10.128.5.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud4>
-
-        <ONOS1>
-            <host>10.128.5.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.5.2</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.5.3</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.5.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.5.9</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/RCOnosCHO4nodes/__init__.py b/TestON/tests/RCOnosCHO4nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/RCOnosCHO4nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params
deleted file mode 100644
index f932b70..0000000
--- a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params
+++ /dev/null
@@ -1,48 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,4,8,7,4,9,7,66</testcases>
-    <tcpdump>
-        <intf>eth0</intf>
-        <port>port 6633</port>
-        <filename>~/packet_captures/Perf.pcap</filename>
-    </tcpdump>
-    <Iterations>3</Iterations>
-    <WaitTime>60</WaitTime>
-    <RestIP>10.128.4.151</RestIP>
-    <MN_size>57</MN_size>
-    <TargetTime>30</TargetTime>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <PING>
-        <source1>h6</source1>
-        <source2>h7</source2>
-        <source3>h8</source3>
-        <source4>h9</source4>
-        <source5>h10</source5>
-        <source6>h11</source6>
-        <source7>h12</source7>
-        <source8>h13</source8>
-        <source9>h14</source9>
-        <source10>h15</source10>
-        <target1>10.0.0.16</target1>
-        <target2>10.0.0.17</target2>
-        <target3>10.0.0.18</target3>
-        <target4>10.0.0.19</target4>
-        <target5>10.0.0.20</target5>
-        <target6>10.0.0.21</target6>
-        <target7>10.0.0.22</target7>
-        <target8>10.0.0.23</target8>
-        <target9>10.0.0.24</target9>
-        <target10>10.0.0.25</target10>
-    </PING>
-</PARAMS>      
diff --git a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params_nightly b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params_nightly
deleted file mode 100644
index d99f6de..0000000
--- a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params_nightly
+++ /dev/null
@@ -1,43 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,4,5,6,7,4,5,6,7,4,8,7,4,9,7</testcases>
-    <Iterations>3</Iterations>
-    <WaitTime>60</WaitTime>
-    <RestIP>10.128.4.151</RestIP>
-    <MN_size>57</MN_size>
-    <TargetTime>30</TargetTime>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <PING>
-        <source1>h6</source1>
-        <source2>h7</source2>
-        <source3>h8</source3>
-        <source4>h9</source4>
-        <source5>h10</source5>
-        <source6>h11</source6>
-        <source7>h12</source7>
-        <source8>h13</source8>
-        <source9>h14</source9>
-        <source10>h15</source10>
-        <target1>10.0.0.16</target1>
-        <target2>10.0.0.17</target2>
-        <target3>10.0.0.18</target3>
-        <target4>10.0.0.19</target4>
-        <target5>10.0.0.20</target5>
-        <target6>10.0.0.21</target6>
-        <target7>10.0.0.22</target7>
-        <target8>10.0.0.23</target8>
-        <target9>10.0.0.24</target9>
-        <target10>10.0.0.25</target10>
-    </PING>
-</PARAMS>      
diff --git a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.py b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.py
deleted file mode 100644
index 32a6601..0000000
--- a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.py
+++ /dev/null
@@ -1,476 +0,0 @@
-
-class RCOnosPerf4nodes:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and RamCloud are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.case("Initial Setup")
-        main.step("Stopping ONOS")
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        main.step("Start tcpdump on mn")
-        main.Mininet2.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
-#        main.step("Start tcpdump on mn")
-#        main.Mininet1.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
-        main.step("Starting ONOS")
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")
-        data =  main.RamCloud1.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-            data = main.RamCloud1.status_serv()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")
-        data = main.ONOS1.isup()
-        data = data and main.ONOS2.isup()
-        data = data and main.ONOS3.isup()
-        data = data and main.ONOS4.isup()
-        for i in range(3):
-            if data == main.FALSE:
-                main.log.report("Something is funny... rechecking ONOS")
-                time.sleep(5)
-                data = main.ONOS1.isup()
-                data = data and main.ONOS2.isup()
-                data = data and main.ONOS3.isup()
-                data = data and main.ONOS4.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-
-    def CASE2(self,main) :
-        '''
-        Makes sure that the HW links are all up
-        Verifies that at least one mininet host exists.
-        Proves that there is actually a mininet that we are working with
-        '''
-        import time
-        import re
-        main.step("Checking if MN switches exist")
-        main.log.report("Check if MN switches exist")
-        #result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        #for i in range(2):
-        #    if result == main.FALSE: 
-        #        time.sleep(5)
-        #        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        #    else: 
-        #        break
-        #main.step("Verifying the result")
-        #utilities.assert_equals(expect=main.TRUE,actual=result,onpass="MN switches exist",onfail="MN is missing switches and or links...")
-
-        main.step("assigning ONOS controllers to switches")
-        data = main.TRUE
-        for i in range(25):
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                controllers = main.Mininet1.get_sw_controller("s"+str(j))
-
-                if re.search("tcp:"+main.params['CTRL']['ip1'],controllers):
-                    main.log.report("SW" + str(j) + " Master Controller Set Correctly")
-                    data = data and main.TRUE
-                else:
-                    main.log.report("SW" + str(j) + " MASTER CONTROLLER SET INCORRECTLY!!")
-                    data = main.FALSE
-                time.sleep(1)
-
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                controllers = main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+ main.params['CTRL']['ip2'],controllers):
-                    main.log.report("SW" + str(j) + " Master Controller Set Correctly")
-                    data = data and main.TRUE
-                else:
-                    main.log.report("SW" + str(j) + " MASTER CONTROLLER SET INCORRECTLY!!")
-                    data = main.FALSE
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                controllers = main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+ main.params['CTRL']['ip3'],controllers):
-                    main.log.report("SW" + str(j) + " Master Controller Set Correctly")
-                    data = data and main.TRUE
-                else:
-                    main.log.report("SW" + str(j) + " MASTER CONTROLLER SET INCORRECTLY!!")
-                    data = main.FALSE
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-
-                controllers = main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+ main.params['CTRL']['ip4'],controllers):
-                    main.log.report("SW" + str(j) + " Master Controller Set Correctly")
-                    data = data and main.TRUE
-                else:
-                    main.log.report("SW" + str(j) + " MASTER CONTROLLER SET INCORRECTLY!!")
-                    data = main.FALSE
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Mininet Controllers Set!",onfail="Mininet Controllers not correct!!!!!!!!!!!!!!!!!!!!")
-        time.sleep(5)        
-
-    def CASE3(self,main) :
-        '''
-        Verifies that ONOS sees the right topology... 
-        '''
-        import time
-        main.log.report("checking if ONOS sees the right topo...") 
-        main.case("TOPO check")
-        main.step("calling rest calls") 
-        for i in range(4):
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            time.sleep(5)
-            if result == 1:
-                break
-        if result == 0:
-            main.ONOS1.start()
-            main.ONOS2.start()
-            main.ONOS3.start()
-            main.ONOS4.start()
-            time.sleep(45)
-            for i in range(4):
-                result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                time.sleep(5)
-                if result == 1:
-                    break
-        utilities.assert_equals(expect=1,actual=result)
-       
-    def CASE4(self,main) :
-        '''
-        This Test case: 
-            - Clears out any leftover flows
-            - Adds new flows into ONOS
-            - Checks flows up to 10 times waiting for each flow to be caluculated and no "NOT" statements inte get_flow
-        '''
-        import time
-        main.log.report("Deleting and adding flows")
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.log.info("deleting...")
-        main.ONOS1.rm_intents()
-       # main.ONOS1.delete_flow("all")
-        main.log.info("adding...")
-        t1 = time.time()
-        main.ONOS1.add_intents()
-       # main.ONOS1.add_flow(main.params['FLOWDEF'])   
-        main.log.info("Checking...")
-        for i in range(15):
-            #result = main.ONOS1.check_flow()
-            result = main.TRUE
-            if result == main.TRUE: 
-                t2 = time.time()
-                main.log.info( 'Adding flows took %0.3f s' % (t2-t1))
-                break
-            time.sleep(5)
-            main.log.info("Checking Flows again...")
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 3:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
-                time.sleep(10)
-            elif ping == main.FALSE and count ==3:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.info("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.info("\tPING TEST FAIL")
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="flows are good",onfail="FLOWS not correct") 
-
-        main.log.report("checking if ONOS sees the right topo...")
-        main.case("TOPO check")
-        main.step("calling rest calls")
-        for i in range(3):
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            time.sleep(5)
-            if result == 1:
-                break
-
-    def CASE5(self,main) :
-        '''
-        Tests a single ping 
-        '''
-        main.log.report("Testing a single ping")
-        main.case("Testing ping...")
-        ping_result = main.Mininet4.pingHost(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
-        utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") 
-
-
-    def CASE6(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        main.log.report("Starting continuous ping, then toggle a single link in the center triangle")
-        import time
-        import os
-        main.case("Starting long ping... ") 
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'], pingTime = 100)
-        main.step("Check that the pings are going") 
-        result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
-        main.step( "Link down number of iterations: " +  main.params['Iterations'] )
-        for i in range(int(main.params['Iterations'])):
-            main.log.info("Bringing Link down... ") 
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-            main.log.info("Bringing Link up... ")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-        main.case("Killing remote ping processes ") 
-        result =  result & main.Mininet4.pingKill() 
-        utilities.assert_equals(expect=main.TRUE,actual=result) 
-       
-
-    def CASE7(self,main) :
-        '''
-        Processes all of the ping data and outputs raw data and an overall average
-        '''
-        import os
-        import time
-        main.log.report("Process ping data (Fail is time is >20 seconds)")
-        main.case("Processing Ping data") 
-        time.sleep(3) 
-        #result=os.popen("/home/admin/tools/shell.sh " + main.params['Iterations']).read()
-        try:
-            result=os.popen("/home/admin/ONLabTest/TestON/scripts/get_reroute_times.py").read() 
-            average=result.split(":")[1] 
-            main.log.info( "Reroute times are... " ) 
-            main.log.report( result + " seconds" ) 
-            try:
-                if float(average) < float(main.params['TargetTime']) :
-                    test=main.TRUE
-                else:
-                    test=main.FALSE
-            except ValueError: 
-                main.log.error("Data is corrupted")
-                test=main.FALSE
-        except:
-            main.log.report("No data")
-            test=main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ")
-
-    def CASE8(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        main.log.report("Start continuous pings, then toggle multiple links in center triangle")
-        import time
-        import os
-        time.sleep(20)
-        main.case("Starting long ping... ")
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'], pingTime = 100)
-        main.step("Check that the pings are going")
-        result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
-        main.step( "Making topo change while flows are rerouting")
-        main.step( "Link down number of iterations: " +  main.params['Iterations'] )
-        for i in range(int(main.params['Iterations'])):
-            main.log.info("s1-s2 link down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
-            main.Mininet1.link(END1="s1",END2="s3",OPTION="up")
-            main.Mininet1.link(END1="s2",END2="s3",OPTION="up")
-
-            time.sleep(5)
-
-            main.log.info("s1-s2 link up | s1-s3 link down | s2-s3 link down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-            main.Mininet1.link(END1="s1",END2="s3",OPTION="down")
-            main.Mininet1.link(END1="s2",END2="s3",OPTION="down")
-
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) + 60 )
-
-        main.case("Killing remote ping processes ")
-        result =  result & main.Mininet4.pingKill()
-        utilities.assert_equals(expect=main.TRUE,actual=result)
-        main.log.info("Make sure all links in triangle are up")
-        main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-        main.Mininet1.link(END1="s1",END2="s3",OPTION="up")
-        main.Mininet1.link(END1="s2",END2="s3",OPTION="up")
-
-    def CASE9(self,main) :
-        '''
-        Starts continuous pings on the Mininet nodes
-        '''
-        main.log.report("Start continuous pings, then toggle one link in center triangle and start/stop 1 ONOS node")
-        import time
-        import os
-
-        time.sleep(20)
-        main.case("Starting long ping... ")
-        main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'], pingTime = 100)
-        main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'], pingTime = 100)
-        main.step("Check that the pings are going")
-        result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
-        result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
-        main.step( "Making topo change while flows are rerouting")
-        main.step( "Link down number of iterations: " +  main.params['Iterations'] )
-        for i in range(int(main.params['Iterations'])):
-            main.log.info("s1-s2 link down | Onos 1 down")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
-            if i % 4 == 0:
-                main.ONOS1.stop()
-            elif i % 4 == 1:
-                main.ONOS2.stop()
-            elif i % 4 == 2:
-                main.ONOS3.stop()
-            else:
-                main.ONOS4.stop()
-
-            time.sleep(5)
-
-            main.log.info("s1-s2 link up | Onos 1 back up")
-            main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
-            if i % 4 == 0:
-                main.ONOS1.start()
-                main.ONOS1.isup()
-            elif i % 4 == 1:
-                main.ONOS2.start()
-                main.ONOS2.isup()
-            elif i % 4 == 2:
-                main.ONOS3.start()
-                main.ONOS3.isup()
-            else:
-                main.ONOS4.start()
-                main.ONOS4.isup()
-
-            main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
-            time.sleep( int(main.params['WaitTime']) )
-
-        main.case("Killing remote ping processes ")
-        result =  result & main.Mininet4.pingKill()
-        utilities.assert_equals(expect=main.TRUE,actual=result)
-
-    def CASE66(self, main):
-        main.log.report("Checking ONOS logs for exceptions")
-        count = 0
-        check1 = main.ONOS1.check_exceptions()
-        main.log.report("Exceptions in ONOS1 logs: \n" + check1)
-        check2 = main.ONOS2.check_exceptions()
-        main.log.report("Exceptions in ONOS2 logs: \n" + check2)
-        check3 = main.ONOS3.check_exceptions()
-        main.log.report("Exceptions in ONOS3 logs: \n" + check3)
-        check4 = main.ONOS4.check_exceptions()
-        main.log.report("Exceptions in ONOS4 logs: \n" + check4)
-        result = main.TRUE
-        if (check1 or check2 or check3 or check4):
-            result = main.FALSE
-            count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs")
-        main.Mininet2.stop_tcpdump()
-
-
diff --git a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.topo b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.topo
deleted file mode 100644
index 6402f13..0000000
--- a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.topo
+++ /dev/null
@@ -1,129 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-        </Zookeeper1>
-
-       <Zookeeper2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-
-        <Zookeeper4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-
-        <RamCloud1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>5</connect_order>
-        </RamCloud1>
-        <RamCloud2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-        </RamCloud2>
-        <RamCloud3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-        </RamCloud3>
-        <RamCloud4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-        </RamCloud4>
- 
-        <ONOS1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4nodeNEW.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-        <Mininet2>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-        </Mininet2>
-
-        <Mininet4>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>15</connect_order>
-        </Mininet4>
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/RCOnosPerf4nodes/__init__.py b/TestON/tests/RCOnosPerf4nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/RCOnosPerf4nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/RCOnosSanity/RCOnosSanity.params b/TestON/tests/RCOnosSanity/RCOnosSanity.params
deleted file mode 100644
index 3e236b4..0000000
--- a/TestON/tests/RCOnosSanity/RCOnosSanity.params
+++ /dev/null
@@ -1,60 +0,0 @@
-<PARAMS>
-    <testcases>1,2,200,3,4,5,6,7</testcases>
-    <FLOWDEF>/home/onos/ONLabTest/TestON/tests/RCOnosSanity</FLOWDEF>
-    <INTENTS>
-    	<add>pyintents.py</add>
-	<rem>rem_intent_sanity.py</rem>
-    </INTENTS>
-    <RESTTEST>
-        <url>http://127.0.0.1:8080/wm/onos/datagrid/add/intents/json</url>
-        <head>{'Content-type': 'application/json', 'Accept': 'application/json'}</head>
-        <srcMac>00:00:00:00:00:06</srcMac>
-        <dstMac>00:00:00:00:00:10</dstMac>
-        <srcSwitch>00:00:00:00:00:00:10:06</srcSwitch>
-        <dstSwitch>00:00:00:00:00:00:20:31</dstSwitch>
-        <srcPort>1</srcPort>
-        <dstPort>1</dstPort>
-        <intID>6</intID>
-    </RESTTEST>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h7</source1>
-        <target1>h32</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>192.168.56.10</ip1>
-        <port1>6633</port1>
-    </CTRL>
-    <RestIP>192.168.56.10</RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>192.168.56.10</restIP1>
-	<restPort>8080</restPort>
-	<restURL>/wm/onos/topology/switches</restURL>
-        <restURL2>/wm/onos/intent/high</restURL2>
-        <restURL3>/wm/onos/topology/hosts</restURL3>
-        <restURL4>/wm/onos/topology/links</restURL4>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/RCOnosSanity/RCOnosSanity.py b/TestON/tests/RCOnosSanity/RCOnosSanity.py
deleted file mode 100644
index 5a21d48..0000000
--- a/TestON/tests/RCOnosSanity/RCOnosSanity.py
+++ /dev/null
@@ -1,515 +0,0 @@
-
-class RCOnosSanity :
-
-    def __init__(self) :
-        self.default = ''
-
-#*****************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.ONOS.start()
-        time.sleep(20)
-        main.ONOS.rest_stop()
-        main.ONOS.start_rest()
-        test= main.ONOS.rest_status()
-        if test == main.FALSE:
-            main.ONOS.start_rest()
-        main.ONOS.get_version()
-        main.log.report("Started Zookeeper, RamCloud, and ONOS")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing Zookeeper Status")   
-        data =  main.ONOS.zk_status()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing Ramcloud Coord Status")   
-        data =  main.ONOS.rcc_status()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Ramcloud Coord is up!",onfail="Ramcloud Coord is down...")
-        main.step("Testing Ramcloud Server Status")   
-        data =  main.ONOS.rcs_status()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Ramcloud Server is up!",onfail="Ramcloud Server is down...")
-        main.step("Testing ONOS Status")   
-        data =  main.ONOS.status()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up!",onfail="ONOS is down...")
-        main.step("Testing Rest Status")
-        data =  main.ONOS.rest_status()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="REST is up!",onfail="REST is down...")
-	
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined #inParams as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then #assigns all controllers.    
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign the switches to ONOS")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controller to switches")
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            else:
-                j=i+16
-                main.Mininet.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        #time.sleep(1)
-        main.Mininet.get_sw_controller("s1")
-
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the #check flow test
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS.delete_flow(main.params['INTENTS']['rem'], main.params['FLOWDEF'])
-        strtTime = time.time()
-        main.ONOS.add_flow(main.params['INTENTS']['add'], main.params['FLOWDEF'])
-        main.case("Checking flows")
-        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet.pingHost(SRC="h"+str(i),TARGET="h"+str(i+25))
-            if ping == main.FALSE and count < 9:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==9:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        result2 = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-##########*****************************************************
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            else:
-                j=i+16
-                main.Mininet.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        strtTime = time.time()
-        result = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            else:
-                j=i+16
-                main.Mininet.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-        strtTime = time.time()
-        result = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") 
-# #**********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-# #**********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")      
-        strtTime = time.time()
-        result = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-# #******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        hostip = main.params['YANK']['hostip']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 0
-        t_restwait = 10
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet.pingHost(SRC = str(host),TARGET = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port, MAC = main.ONOS.find_host(RestIP1,RestPort,url, hostip)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result1 = main.FALSE
-        else:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-        main.log.report("Yank out s1-eth1")
-        main.step("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet.pingHost(SRC = str(host),TARGET = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port, MAC = main.ONOS.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        else:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-         
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.step("Plug s1-eth1 to s6")
-        result = main.Mininet.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port, MAC = main.ONOS.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result3 = main.FALSE
-        else:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.step("Move s1-eth1 back to s1")
-        result = main.Mininet.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port, MAC = main.ONOS.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result4 = main.FALSE
-        else:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-# Run a pure ping test. 
-
-    def CASE31(self, main):
-        main.log.report("Performing Ping Test")        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            strtTime = time.time() 
-            ping = main.Mininet.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-    def CASE200(self, main): 
-        '''
-        POSTS 2 pre-set intents to the REST server and compares the REST server output to expected flows. 
-        '''
-        import time
-        import requests
-        import json
-        import re
-        main.case("Testing Rest Status") 
-
-        #----------------------
-
-        main.log.report("Starting Rest API Only Test")
-        main.log.report("Rest IP used: " + main.params['RestIP'])
-        restcall1 = "http://"+ main.params['RESTCALL']['restIP1'] + ":" + main.params['RESTCALL']['restPort'] + main.params['RESTCALL']['restURL'] 
-        restcall2 = "http://"+ main.params['RESTCALL']['restIP1'] + ":" + main.params['RESTCALL']['restPort'] + main.params['RESTCALL']['restURL2']
-        restcall3 = "http://"+ main.params['RESTCALL']['restIP1'] + ":" + main.params['RESTCALL']['restPort'] + main.params['RESTCALL']['restURL3']
-        restcall4 = "http://"+ main.params['RESTCALL']['restIP1'] + ":" + main.params['RESTCALL']['restPort'] + main.params['RESTCALL']['restURL4']
-
-        main.log.report("Rest Calls used: " + restcall1)
-        main.log.report("Rest Calls used: " + restcall2)
-        main.log.report("Rest Calls used: " + restcall3)
-        main.log.report("Rest Calls used: " + restcall4)
-
-        url = main.params['RESTTEST']['url']
-        #headers = main.params['RESTTEST']['head']
-        headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
-        expSrcMac = main.params['RESTTEST']['srcMac']
-        expDstMac = main.params['RESTTEST']['dstMac']
-        expSrcSwitch = main.params['RESTTEST']['srcSwitch']
-        expDstSwitch = main.params['RESTTEST']['dstSwitch']
-        srcPort = main.params['RESTTEST']['srcPort']
-        dstPort = main.params['RESTTEST']['dstPort']
-        intID = int(main.params['RESTTEST']['intID'])
-
-        intent = [{'intent_id': '%d' %(intID),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':expSrcSwitch,'srcPort':int(srcPort),'srcMac':expSrcMac,'dstSwitch':expDstSwitch,'dstPort':int(dstPort),'dstMac':expDstMac}]
-        r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
-
-        intent = [{'intent_id': '%d' %(intID+10),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':expDstSwitch,'srcPort':int(dstPort),'srcMac':expDstMac,'dstSwitch':expSrcSwitch,'dstPort':int(srcPort),'dstMac':expSrcMac}]
-        r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
-
-        count = 0
-        main.step("Getting JSON...")
-        #r1 = main.ONOS.get_json_string(restcall1, expSrcSwitch, expDstSwitch, expSrcMac, expDstMac, srcPort, dstPort, intID)
-        r1 = main.ONOS.get_json(restcall1)
-        if re.search(expSrcSwitch, str(r1)) and re.search(expDstSwitch, str(r1)):
-            main.log.report("Restcall: "+restcall1)
-            main.log.report("Expected SrcSwitch "+expSrcSwitch+" found")
-            main.log.report("Expected DstSwitch "+expDstSwitch+" found")
-            count = count+1
-        #r2 = main.ONOS.get_json_string(restcall2, expSrcSwitch, expDstSwitch, expSrcMac, expDstMac, srcPort, dstPort, intID) 
-        r2 = main.ONOS.get_json(restcall2)
-        if re.search("u\'srcMac\': u\'"+expSrcMac+"\'", str(r2)) and re.search("u\'dstMac\': u\'"+expDstMac+"\'", str(r2)):
-            main.log.report("Restcall: "+restcall2)
-            main.log.report("Expected SrcMac "+expSrcMac+" found")
-            main.log.report("Expected DstMac "+expDstMac+" found")
-            if re.search("u\'srcSwitchDpid\': u\'"+expSrcSwitch+"\'", str(r2)) and re.search("u\'dstSwitchDpid\': u\'"+expDstSwitch+"\'", str(r2)):
-                main.log.report("Expected SrcSwitch "+expSrcSwitch+" found")
-                main.log.report("Expected DstSwitch "+expDstSwitch+" found")
-                if re.search("u\'srcPortNumber\': u\'"+srcPort+"\'", str(r2)) and re.search("u\'dstPortNumber\': u\'"+dstPort+"\'", str(r2)):
-                    main.log.report("Expected SrcPort "+srcPort+" found")
-                    main.log.report("Expected DstPort "+dstPort+" found")
-                    count = count+1
-                else:
-                    main.log.report("Expected SrcPort "+srcPort+" NOT found")
-                    main.log.report("Expected DstPort "+dstPort+" NOT found")
-            else:
-                main.log.report("Expected SrcSwitch "+expSrcSwitch+" NOT found")
-                main.log.report("Expected DstSwitch "+expDstSwitch+" NOT found")
-        else:
-            main.log.report("Expected SrcMac "+expSrcMac+" NOT found")
-            main.log.report("Expected DstMac "+expDstMac+" NOT found")
-        if count != 2:
-            main.log.report("Actual data: "+str(r2)) 
- 
-        #r3 = main.ONOS.get_json_string(restcall3, expSrcSwitch, expDstSwitch, expSrcMac, expDstMac, srcPort, dstPort, intID)
-        r3 = main.ONOS.get_json(restcall3)
-        if re.search("", str(r3)):
-            main.log.report("Restcall: "+restcall3)
-            count = count+1
-  
-        #r4 = main.ONOS.get_json_string(restcall4, expSrcSwitch, expDstSwitch, expSrcMac, expDstMac, srcPort, dstPort, intID)
-        r4 = main.ONOS.get_json(restcall4)
-        if re.search(expSrcSwitch, str(r4)) and re.search(expDstSwitch, str(r4)):
-            main.log.report("Restcall: "+restcall4)
-            main.log.report("Expected SrcSwitch: "+expSrcSwitch+" found")
-            main.log.report("Expected DstSwitch: "+expDstSwitch+" found")
-            count = count+1
-        else:
-            main.log.report("Expected SrcSwitch: "+expSrcSwitch+" NOT found")
-            main.log.report("Expected DstSwitch: "+expDstSwitch+" NOT found")
-
-        utilities.assert_equals(expect=4,actual=count,onpass="REST API test passed!",onfail="REST API test failed...")
- 
diff --git a/TestON/tests/RCOnosSanity/RCOnosSanity.topo b/TestON/tests/RCOnosSanity/RCOnosSanity.topo
deleted file mode 100644
index 1e1bf8b..0000000
--- a/TestON/tests/RCOnosSanity/RCOnosSanity.topo
+++ /dev/null
@@ -1,29 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-
-        <ONOS>
-            <host>192.168.56.10</host>
-            <user>onos</user>
-            <password>onos</password>
-            <type>onossanityclidriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS>
-
-        <Mininet>
-            <host>192.168.56.10</host>
-            <user>onos</user>
-            <password>onos</password>
-            <type>MininetCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-                <arg1> --custom ~/mininet/custom/topo-onos1node.py </arg1>
-                <arg2> --topo mytopo --arp --mac</arg2>
-                <controller>remote</controller>
-             </COMPONENTS>
-        </Mininet>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/RCOnosSanity/README.txt b/TestON/tests/RCOnosSanity/README.txt
deleted file mode 100644
index fe51a93..0000000
--- a/TestON/tests/RCOnosSanity/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Please read before proceeding to run test
-- Keep the intent files in the RCOnosSanity directory!
-  Code has been revised to point to FLOWDEF in the params for
-  the intent files. 
-- To use a different intent, modify the .params file.
diff --git a/TestON/tests/RCOnosSanity/__init__.py b/TestON/tests/RCOnosSanity/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/RCOnosSanity/__init__.py
+++ /dev/null
diff --git a/TestON/tests/RCOnosSanity/add_intent_sanity.py b/TestON/tests/RCOnosSanity/add_intent_sanity.py
deleted file mode 100755
index 9e8ec99..0000000
--- a/TestON/tests/RCOnosSanity/add_intent_sanity.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /usr/bin/python
-
-import json
-import requests
-
-
-url = 'http://127.0.0.1:8080/wm/onos/datagrid/add/intents/json'
-headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
-
-
-for i in range(6,16):
-	srcMac = '00:00:00:00:00:'+ str(hex(i)[2:]).zfill(2)
-	dstMac = '00:00:00:00:00:'+ str(hex(i+10)[2:])
-	srcSwitch = '00:00:00:00:00:00:10:'+ str(i).zfill(2)
-	dstSwitch = '00:00:00:00:00:00:20:'+ str(i+25)
-	srcPort = 1
-	dstPort = 1
-	
-	intent = [{'intent_id': '%d' %(i),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':srcSwitch,'srcPort':srcPort,'srcMac':srcMac,'dstSwitch':dstSwitch,'dstPort':dstPort,'dstMac':dstMac}]
-	r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
-	#print json.dumps(intent, sort_keys = True)
-	
-	intent = [{'intent_id': '%d' %(i+10),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':dstSwitch,'srcPort':dstPort,'srcMac':dstMac,'dstSwitch':srcSwitch,'dstPort':srcPort,'dstMac':srcMac}]
-	#print json.dumps(intent, sort_keys = True)
-	r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
-
diff --git a/TestON/tests/RCOnosSanity/rem_intent_sanity.py b/TestON/tests/RCOnosSanity/rem_intent_sanity.py
deleted file mode 100755
index f841270..0000000
--- a/TestON/tests/RCOnosSanity/rem_intent_sanity.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /usr/bin/python
-
-import json
-import requests
-
-
-url = 'http://127.0.0.1:8080/wm/onos/datagrid/remove/intents/json'
-headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
-
-for i in range(6,16):
-	srcMac = '00:00:00:00:00:'+ str(hex(i)[2:]).zfill(2)
-	dstMac = '00:00:00:00:00:'+ str(hex(i+10)[2:])
-	srcSwitch = '00:00:00:00:00:00:10:'+ str(i).zfill(2)
-	dstSwitch = '00:00:00:00:00:00:20:'+ str(i+25)
-	srcPort = 1
-	dstPort = 1
-	
-	intent = [{'intent_id': '%d' %(i),'intent_type':'shortest_intent_type','intent_op':'remove','srcSwitch':srcSwitch,'srcPort':srcPort,'srcMac':srcMac,'dstSwitch':dstSwitch,'dstPort':dstPort,'dstMac':dstMac}]
-	r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
-	#print json.dumps(intent, sort_keys = True)
-	
-	intent = [{'intent_id': '%d' %(i+10),'intent_type':'shortest_intent_type','intent_op':'remove','srcSwitch':dstSwitch,'srcPort':dstPort,'srcMac':dstMac,'dstSwitch':srcSwitch,'dstPort':srcPort,'dstMac':srcMac}]
-	#print json.dumps(intent, sort_keys = True)
-	
-#r = requests.post(url, data=json.dumps(add_intent1, sort_keys=True), headers = headers)
-	r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
-
diff --git a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.params b/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.params
deleted file mode 100644
index f644d9f..0000000
--- a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.params
+++ /dev/null
@@ -1,62 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,31,6,7,6,7,4,6,7,6,7,5,6,7,6,7,41,6,7,6,7,5,6,7,6,7,66</testcases>
-    <tcpdump> 
-        <intf>eth0</intf>
-        <port>port 6633</port>
-        <filename>~/packet_captures/Sanity.pcap</filename>
-    </tcpdump>
-    <CASE1>       
-        <destination>h6</destination>
-        <target>h40</target>
-    </CASE1>       
-    <PING>
-        <source1>h7</source1>
-        <target1>h32</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <INTENTREST>
-        <intentIP>10.128.4.151</intentIP>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent/high</intentURL>
-    </INTENTREST>
-    <RestIP>10.128.4.151</RestIP>
-    <RestIP2>10.128.4.152</RestIP2>
-    <RestIP3>10.128.4.153</RestIP3>
-    <RestIP4>10.128.4.154</RestIP4>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.4.151</restIP1>
-	<restIP2>10.128.4.152</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/onos/topology/hosts</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py b/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py
deleted file mode 100644
index 10f142d..0000000
--- a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py
+++ /dev/null
@@ -1,887 +0,0 @@
-
-class RCOnosSanity4nodesJ :
-
-
-
-    def __init__(self) :
-        self.default = ''
-
-#        def print_hello_world(self,main):
-#            print("hello world")
-#*****************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        main.case("Initial setup")
-        main.step("Stop ONOS")
-        import time
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-#        main.print_hello_world()
-        main.ONOS4.stop_all()
-        main.ONOS2.stop_rest()
-        main.ONOS1.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS2.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS3.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        main.ONOS4.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")        
-        main.step("Start tcpdump on mn")
-        main.Mininet2.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
-        main.step("Start ONOS")
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        time.sleep(1)
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        main.log.report("Pulling latest code from github to all nodes")
-        for i in range(2):
-            uptodate = main.ONOS1.git_pull()
-            main.ONOS2.git_pull()
-            main.ONOS3.git_pull()
-            main.ONOS4.git_pull()
-            ver1 = main.ONOS1.get_version()
-            ver2 = main.ONOS4.get_version()
-            if ver1==ver2:
-                break
-            elif i==1:
-                main.ONOS2.git_pull("ONOS1 master")
-                main.ONOS3.git_pull("ONOS1 master")
-                main.ONOS4.git_pull("ONOS1 master")
-        if uptodate==0:
-       # if 1:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-            main.ONOS4.git_compile()
-        main.ONOS1.print_version()    
-       # main.RamCloud1.git_pull()
-       # main.RamCloud2.git_pull()
-       # main.RamCloud3.git_pull()
-       # main.RamCloud4.git_pull()
-       # main.ONOS1.get_version()
-       # main.ONOS2.get_version()
-       # main.ONOS3.get_version()
-       # main.ONOS4.get_version()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS2.start_rest()
-        test= main.ONOS2.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")   
-        data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() and main.RamCloud4.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-            time.sleep(5)
-            data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() and main.RamCloud4.status_serv()
-            
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                #main.log.report("Something is funny... restarting ONOS")
-                #main.ONOS1.stop()
-                time.sleep(3)
-                #main.ONOS1.start()
-                #time.sleep(5) 
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-        time.sleep(20)
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(2)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
-        time.sleep(30)
-
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        #main.ONOS1.delete_flow("all")
-        strtTime = time.time()
-        main.ONOS1.rm_intents()
-        print("world")
-        time.sleep(5)
-        main.ONOS1.add_intents()
-        print("hello")
-       # main.ONOS1.add_flow(main.params['FLOWDEF']['testONip'],main.params['FLOWDEF']['user'],main.params['FLOWDEF']['password'],main.params['FLOWDEF']['flowDef'])
-        main.case("Checking flows")
-       
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 9:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==9:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-    def CASE41(self,main) :
-        main.log.report("Testing Removal")
-        time.sleep(20)
-        main.ONOS2.stop()
-        time.sleep(30)
-        main.ONOS3.stop()
-        time.sleep(30)
-        main.ONOS4.stop()
-        time.sleep(45)
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-        main.ONOS2.start() 
-        main.ONOS3.start()
-        main.ONOS4.start() 
-        time.sleep(20)
-
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-                time.sleep(1)
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-        time.sleep(30)
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1='s1',END2='s3',OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-        time.sleep(30) 
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        data = main.Mininet1.link(END1='s1',END2='s3',OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 5
-        t_restwait = 5
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-        main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host mac = " + mac + ";  attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0]))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac  addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            result1 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result1 = main.FALSE
-
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result2 = main.FALSE
-         
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result3 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result4 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result4 = main.FALSE
-        time.sleep(20)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus ==1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout")
-        elif Reststatus>1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout(multiple found)")
-        elif Reststatus==0:
-            main.log.report("\t PASSED - Device cleared after timeout")
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-# Run a pure ping test. 
-
-    def CASE31(self, main):
-        main.log.report("Performing Ping Test")        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            strtTime = time.time()
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-    def CASE66(self, main):
-        main.log.report("Checking ONOS logs for exceptions")
-        count = 0
-        check1 = main.ONOS1.check_exceptions()
-        main.log.report("Exceptions in ONOS1 logs: \n" + check1)
-        check2 = main.ONOS2.check_exceptions()
-        main.log.report("Exceptions in ONOS2 logs: \n" + check2)
-        check3 = main.ONOS3.check_exceptions()
-        main.log.report("Exceptions in ONOS3 logs: \n" + check3)
-        check4 = main.ONOS4.check_exceptions()
-        main.log.report("Exceptions in ONOS4 logs: \n" + check4)
-        result = main.TRUE
-        if (check1 or check2 or check3 or check4):
-            result = main.FALSE
-            count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs")
-        main.Mininet1.stop_tcpdump()
-
-
-    def CASE8(self,main) :
-        main.log.report("Testing Removal of Zookeeper")
-        main.Zookeeper2.stop()
-        main.Zookeeper3.stop()
-        main.Zookeeper4.stop()
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-        main.Zookeeper2.start() 
-        main.Zookeeper3.start()
-        main.Zookeeper4.start() 
-        time.sleep(10)
-
-
-    def CASE67(self, main) :
-        main.case("Flapping link s1-s2")
-        main.log.report("Toggling of link s1-s2 multiple times")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])))
-            else:
-                break
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-           
-
-
-    def CASE101(self,main) :
-        import time
-        import json
-        import re
-        main.case("Testing the Intent Framework of ONOS")
-        
-        main.step("Assigning Master Controllers to the Switches and check")
-        for i in range(25):
-            if i<3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-            elif i>=3 and i<5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port1'])
-            elif i>=5 and i<15:
-                j=j+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port1'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port1'])
-        result = main.TRUE
-        for i in range(25):
-            if i<3:
-                j=i+1
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                print(response)
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response) :
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=3 and i<5:
-                j=i+1
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip2'],response) :
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            elif i>=5 and i<15:
-                j=j+1
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip3'],response) :
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                j=i+16
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip4'],response) :
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            print(result)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Master Controllers assigned Properly",onfail="FAILED TO ASSIGN MASTER CONTROLLERS!")
-
-        main.step("Assigning all Controllers as Backups to Switches and Check")
-        for i in range(25):
-            if i<15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        result = main.TRUE
-        for i in range(25):
-            if i<15:
-                j=i+1
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response) and re.search("tcp:"+main.params['CTRL']['ip2'],response) and re.search("tcp:"+main.params['CTRL']['ip3'],response) and re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-            else:
-                j=i+16
-                response=main.Mininet1.get_sw_controller("s"+str(j))
-                if re.search("tcp:"+main.params['CTRL']['ip1'],response) and re.search("tcp:"+main.params['CTRL']['ip2'],response) and re.search("tcp:"+main.params['CTRL']['ip3'],response) and re.search("tcp:"+main.params['CTRL']['ip4'],response):
-                    result = result and main.TRUE
-                else:
-                    result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Controllers assigned properly to all switches",onfail="FAILED TO ASSIGN CONTROLLERS PROPERLY!")
-        
-        main.step("Install intents and Check for Installation of Flows")
-        intentIP = main.params['INTENTREST']['intentIP']
-        intentPort=main.params['INTENTREST']['intentPort']
-        intentURL=main.params['INTENTREST']['intentURL']
-        for i in range(6,16):
-            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
-            dstMac = '00:00:00:00:00:'+str(hex(i+25)[2:])
-        #    srcDPID=str(i)
-        #    dstDPID=str(i+10)
-            srcDPID = '00:00:00:00:00:00:10:'+str(i).zfill(2)
-            dstDPID= '00:00:00:00:00:00:20:' +str(i+25)
-            main.ONOS1.add_intent(intent_id=str(i),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-        result = main.TRUE
-        response = main.Mininet1.check_flows(sw="s1")
-        for i in range(6,16):
-            if re.search("dl_src=00:00:00:00:00:"+''.join('%02x'%i),response) and re.search("dl_src=00:00:00:00:00:"+''.join('%02x'%(i+10)),response) and re.search("dl_dst=00:00:00:00:00:"+''.join('%02x'%i),response) and re.search("dl_dst=00:00:00:00:00:"+''.join('%02x'%(i+10)),response):   
-                result = result and main.TRUE
-            else:
-                result = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flows added Properly",onfail="Flows were not added properly")
- 
-
-
-    def CASE10(self, main) :
-        import time
-        time.sleep(600)
diff --git a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py_backup b/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py_backup
deleted file mode 100644
index d599f86..0000000
--- a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py_backup
+++ /dev/null
@@ -1,492 +0,0 @@
-
-class RCOnosSanity4nodesJ :
-
-    def __init__(self) :
-        self.default = ''
-
-#*****************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.log.report("Pulling latest code from github to all nodes")
-        main.ONOS1.git_pull()
-        main.ONOS2.git_pull()
-        main.ONOS3.git_pull()
-        main.ONOS4.git_pull()
-        main.RamCloud1.git_pull()
-        main.RamCloud2.git_pull()
-        main.RamCloud3.git_pull()
-        main.RamCloud4.git_pull()
-        main.RamCloud1.start_coor()
-        main.RamCloud1.start_serv()
-        main.RamCloud2.start_serv()
-        main.RamCloud3.start_serv()
-        main.RamCloud4.start_serv()
-        time.sleep(20)
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")   
-        data =  main.RamCloud1.isup() 
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5) 
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 9:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==9:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        from drivers.common.api.onosrestapidriver import *
-        main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        hostip = main.params['YANK']['hostip']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 0
-        t_restwait = 10
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        restcall = OnosRestApiDriver()
-        Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result1 = main.FALSE
-        else:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        restcall = OnosRestApiDriver()
-        Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        else:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-         
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        restcall = OnosRestApiDriver()
-        Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result3 = main.FALSE
-        else:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        restcall = OnosRestApiDriver()
-        Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result4 = main.FALSE
-        else:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-# Run a pure ping test. 
-
-    def CASE31(self, main):
-        main.log.report("Performing Ping Test")        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            strtTime = time.time()
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
diff --git a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.topo b/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.topo
deleted file mode 100644
index 3bfaa2f..0000000
--- a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.topo
+++ /dev/null
@@ -1,153 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <RamCloud1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud1>
-
-        <RamCloud2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud2>
-       
-        <RamCloud3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud3>
-       
-        <RamCloud4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud4>
-
-        <ONOS1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/RCOnosSanity4nodesJ/__init__.py b/TestON/tests/RCOnosSanity4nodesJ/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/RCOnosSanity4nodesJ/__init__.py
+++ /dev/null
diff --git a/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.params b/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.params
deleted file mode 100644
index a7ad8df..0000000
--- a/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.params
+++ /dev/null
@@ -1,48 +0,0 @@
-<PARAMS>
-    <testcases>1,2,21,3,4,5,6,7</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.100.35</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.100.40</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.100.41</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.100.14</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <RestIP>10.128.100.35</RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.100.35</restIP1>
-	<restIP2>10.128.100.40</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/device/</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.py b/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.py
deleted file mode 100644
index 600d813..0000000
--- a/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.py
+++ /dev/null
@@ -1,484 +0,0 @@
-
-class RCOnosSanity4nodes_cass :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.log.report("Pulling latest code from github to all nodes")
-        main.ONOS1.git_pull()
-        main.ONOS2.git_pull()
-        main.ONOS3.git_pull()
-        main.ONOS4.git_pull()
-        main.Cassandra1.start()
-        main.Cassandra2.start()
-        main.Cassandra3.start()
-        main.Cassandra4.start()
-        time.sleep(20)
-        main.ONOS1.drop_keyspace()
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")   
-        data =  main.Cassandra1.isup() 
-        if data == main.FALSE:
-            main.Cassandra1.stop()
-            main.Cassandra2.stop()
-            main.Cassandra3.stop()
-            main.Cassandra4.stop()
-
-            time.sleep(5)
- 
-            main.Cassandra1.start()
-            main.Cassandra2.start()
-            main.Cassandra3.start()
-            main.Cassandra4.start()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5) 
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
-
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break 
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        time.sleep(5)
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        tmp = main.FALSE
-        count = 1
-        main.log.info("Wait for flows to be pushed to the switches, then check")
-        while tmp == main.FALSE:
-            main.step("Waiting")
-            time.sleep(5)
-            main.step("Checking")
-            tmp = main.ONOS1.check_flow()
-            if tmp == main.FALSE and count < 6:
-                count = count + 1
-                main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
-            elif tmp == main.FALSE and count == 6:
-                result1 = main.FALSE
-                break
-            else:
-                result1 = main.TRUE
-                break
-        endTime = time.time()
-        if result1 == main.TRUE:
-            main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 3:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
-                time.sleep(10)
-            elif ping == main.FALSE and count ==3:
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        if result2 == main.TRUE:
-            main.log.info("Flows successfully added")
-        else:
-            main.log.report("\tPING TEST FAIL")
-
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result1 and result2,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                time.sleep(5)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                time.sleep(5)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                i = 6
-                time.sleep(5)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                i = 6
-                time.sleep(5)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        from drivers.common.api.onosrestapidriver import *
-        main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
-        main.log.report("Check initially hostMAC exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestIP2 = main.params['RESTCALL']['restIP2']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        restcall = OnosRestApiDriver()
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-
-        if Reststatus == 1:
-            main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result = main.FALSE
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
-            result = main.TRUE
-        else:
-            main.log.report("Attempt to yank out s1-eht1 from s1 failed.")
-            result = main.FALSE
-        
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
-            result = main.FALSE
-        elif attachedSW == "00:00:00:00:00:00:00:06":
-            main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
-            result = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
-            result = main.FALSE
-        elif attachedSW == "00:00:00:00:00:00:00:01":
-            main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
-            result = main.FALSE
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-
-
-
diff --git a/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.topo b/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.topo
deleted file mode 100644
index 5d4a91b..0000000
--- a/TestON/tests/RCOnosSanity4nodes_cass/RCOnosSanity4nodes_cass.topo
+++ /dev/null
@@ -1,139 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.100.35</host>
-            <user>onos</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.100.40</host>
-            <user>onos</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.100.41</host>
-            <user>onos</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-
-        <Zookeeper4>
-            <host>10.128.100.14</host>
-            <user>onos</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-       
-        <Cassandra1>
-            <host>10.128.100.35</host>
-            <user>onos</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra1>
-
-        <Cassandra2>
-            <host>10.128.100.40</host>
-            <user>onos</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra2>
-       
-        <Cassandra3>
-            <host>10.128.100.41</host>
-            <user>onos</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra3>
-       
-        <Cassandra4>
-            <host>10.128.100.14</host>
-            <user>onos</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Cassandra4>
-
-        <ONOS1>
-            <host>10.128.100.35</host>
-            <user>onos</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.100.40</host>
-            <user>onos</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.100.41</host>
-            <user>onos</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.100.14</host>
-            <user>onos</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.100.37</host>
-            <user>onos</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/RCOnosSanity4nodes_cass/__init__.py b/TestON/tests/RCOnosSanity4nodes_cass/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/RCOnosSanity4nodes_cass/__init__.py
+++ /dev/null
diff --git a/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.params b/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.params
deleted file mode 100644
index 26af96b..0000000
--- a/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.params
+++ /dev/null
@@ -1,48 +0,0 @@
-<PARAMS>
-    <testcases>2,3,4,5,6,7</testcases>
-    <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <RestIP>10.128.4.151</RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.4.151</restIP1>
-	<restIP2>10.128.4.152</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/device/</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.py b/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.py
deleted file mode 100644
index b5313d2..0000000
--- a/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.py
+++ /dev/null
@@ -1,484 +0,0 @@
-
-class RCOnosSanity4nodes_rc:
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RC1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.log.report("Pulling latest code from github to all nodes")
-        main.ONOS1.git_pull()
-        main.ONOS2.git_pull()
-        main.ONOS3.git_pull()
-        main.ONOS4.git_pull()
-        main.RC1.start()
-        main.RC2.start()
-        main.RC3.start()
-        main.RC4.start()
-        time.sleep(20)
-        main.ONOS1.drop_keyspace()
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RC1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RC")   
-        data =  main.RC1.isup() 
-        if data == main.FALSE:
-            main.RC1.stop()
-            main.RC2.stop()
-            main.RC3.stop()
-            main.RC4.stop()
-
-            time.sleep(5)
- 
-            main.RC1.start()
-            main.RC2.start()
-            main.RC3.start()
-            main.RC4.start()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RC is up!",onfail="RC is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5) 
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
-
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break 
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        main.ONOS1.delete_flow("all")
-        time.sleep(5)
-        strtTime = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.case("Checking flows")
-        tmp = main.FALSE
-        count = 1
-        main.log.info("Wait for flows to be pushed to the switches, then check")
-        while tmp == main.FALSE:
-            main.step("Waiting")
-            time.sleep(5)
-            main.step("Checking")
-            tmp = main.ONOS1.check_flow()
-            if tmp == main.FALSE and count < 6:
-                count = count + 1
-                main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
-            elif tmp == main.FALSE and count == 6:
-                result1 = main.FALSE
-                break
-            else:
-                result1 = main.TRUE
-                break
-        endTime = time.time()
-        if result1 == main.TRUE:
-            main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 3:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
-                time.sleep(10)
-            elif ping == main.FALSE and count ==3:
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        if result2 == main.TRUE:
-            main.log.info("Flows successfully added")
-        else:
-            main.log.report("\tPING TEST FAIL")
-
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result1 and result2,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                time.sleep(5)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                time.sleep(5)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                i = 6
-                time.sleep(5)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
-                i = 6
-                time.sleep(5)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        from drivers.common.api.onosrestapidriver import *
-        main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
-        main.log.report("Check initially hostMAC exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestIP2 = main.params['RESTCALL']['restIP2']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        
-        main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        restcall = OnosRestApiDriver()
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-
-        if Reststatus == 1:
-            main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result = main.FALSE
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
-            result = main.TRUE
-        else:
-            main.log.report("Attempt to yank out s1-eht1 from s1 failed.")
-            result = main.FALSE
-        
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(3)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
-            result = main.FALSE
-        elif attachedSW == "00:00:00:00:00:00:00:06":
-            main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
-            result = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(3)
-        retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
-        try:
-            attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
-            ip_found = Hoststatus[0]['ipv4'][0]
-        except:
-            Reststatus = 0
-        if Reststatus == 0:
-            main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
-            result = main.FALSE
-        elif attachedSW == "00:00:00:00:00:00:00:01":
-            main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
-            if ip_found != None:
-                main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
-                result = main.TRUE
-            else:
-                main.log.report("\t Found host attached to switch, but no IP address discovered.")
-                result = main.FALSE
-        else:
-            main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
-            result = main.FALSE
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-
-
-
diff --git a/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.topo b/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.topo
deleted file mode 100644
index f67fea8..0000000
--- a/TestON/tests/RCOnosSanity4nodes_rc/RCOnosSanity4nodes_rc.topo
+++ /dev/null
@@ -1,153 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-
-        <Zookeeper4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-	<!--       
-        <RC1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type></type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC1>
-
-        <RC2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type></type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC2>
-       
-        <RC3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type></type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC3>
-       
-        <RC4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type></type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RC4>
-	-->
-
-        <ONOS1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-	<!--
-        <COORD>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type></type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </COORD>
-	-->
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/RCOnosSanity4nodes_rc/__init__.py b/TestON/tests/RCOnosSanity4nodes_rc/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/RCOnosSanity4nodes_rc/__init__.py
+++ /dev/null
diff --git a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.params b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.params
deleted file mode 100644
index 725ac3d..0000000
--- a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.params
+++ /dev/null
@@ -1,24 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,66</testcases>
-    <tcpdump>
-        <intf>eth0</intf>
-        <port>port 6633</port>
-        <filename>~/packet_captures/Scale.pcap</filename>
-    </tcpdump>
-    <Iterations>2</Iterations>
-    <WaitTime>50</WaitTime>
-    <TargetTime>50</TargetTime>
-    <RestIP>10.128.4.151</RestIP>
-    <NR_Switches>100</NR_Switches>
-    <NR_Links>198</NR_Links>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-</PARAMS>      
diff --git a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.py b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.py
deleted file mode 100644
index 243eeac..0000000
--- a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.py
+++ /dev/null
@@ -1,340 +0,0 @@
-
-class RCOnosScale4nodes:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and RamCloud are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.case("Initial setup")
-        main.step("stopping ONOS")
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.RamCloud1.stop_coor()
-        main.RamCloud1.stop_serv()
-        main.RamCloud2.stop_serv()
-        main.RamCloud3.stop_serv()
-        main.RamCloud4.stop_serv()
-        main.step("Start tcpdump on mn")
-        main.Mininet1.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
-#        main.step("Start tcpdump on mn")
-#        main.Mininet1.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
-        main.step("Starting ONOS")
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        time.sleep(10)
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        
-        main.RamCloud1.start_coor()
-        time.sleep(10)
-        main.RamCloud1.start_serv()
-        main.RamCloud2.start_serv()
-        main.RamCloud3.start_serv()
-        main.RamCloud4.start_serv()
-        time.sleep(20)
-        main.ONOS1.start()
-        time.sleep(10)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        time.sleep(5)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")
-        data =  main.RamCloud1.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-            main.RamCloud1.del_db()
-            main.RamCloud2.del_db()
-            main.RamCloud3.del_db()
-            main.RamCloud4.del_db()
-
-            time.sleep(5)
-
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-        data =  main.RamCloud1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")
-        time.sleep(10)
-        data = main.ONOS1.isup()
-        data = data and main.ONOS2.isup()
-        data = data and main.ONOS3.isup()
-        data = data and main.ONOS4.isup()
-        if data == main.FALSE:
-            main.log.report("Something is funny... restarting ONOS")
-            time.sleep(10)
-            data = main.ONOS1.isup()
-            data = data and main.ONOS2.isup()
-            data = data and main.ONOS3.isup()
-            data = data and main.ONOS4.isup()
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-
-    def CASE2(self,main) :
-        '''
-        Second case is to time the convergence time of a topology for ONOS. 
-        It shuts down the ONOS, drops keyspace, starts ONOS...
-        Then it points all the mininet switches at the ONOS node and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
-        '''
-        import time
-        main.log.report("Time convergence for switches -> single ONOS node in cluster")
-        main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
-        main.step("Bringing ONOS down...") 
-        main.log.info("all switch no controllers") 
-        for i in range(1,int(main.params['NR_Switches'])+1):
-            main.Mininet1.delete_sw_controller("s"+str(i))
-        main.log.info("bringing ONOS down") 
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.RamCloud1.stop_coor()
-        main.RamCloud1.stop_serv()
-        main.RamCloud2.stop_serv()
-        main.RamCloud3.stop_serv()
-        main.RamCloud4.stop_serv()
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        time.sleep(4)
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-
-        time.sleep(5)
-
-        main.RamCloud1.start_coor()
-        main.RamCloud1.start_serv()
-        main.RamCloud2.start_serv()
-        main.RamCloud3.start_serv()
-        main.RamCloud4.start_serv()
-        
-        main.log.info("Bringing ONOS up")
-        main.ONOS1.start()
-        time.sleep(5) 
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        time.sleep(10)
-        data = main.ONOS1.isup()
-        data = data and main.ONOS2.isup()
-        data = data and main.ONOS3.isup()
-        data = data and main.ONOS4.isup()
-        if data == main.FALSE:
-            main.log.report("Something is funny... restarting ONOS")
-            time.sleep(10)
-            data = main.ONOS1.isup()
-            data = data and main.ONOS2.isup()
-            data = data and main.ONOS3.isup()
-            data = data and main.ONOS4.isup()
-        if data == main.FALSE:
-            main.log.report("Something is funny... restarting ONOS")
-        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-
-        main.log.info("Pointing the Switches at ONE controller... then BEGIN time") 
-        for i in range(1,int(main.params['NR_Switches'])+1):
-            main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-
-
-
-        t1 = time.time()
-        for i in range(15) : 
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            if result == 1 : 
-                break
-            else : 
-                time.sleep(1)
-        t2 = time.time()
-        conv_time = t2 - t1
-        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
-            if float(conv_time) < float(main.params['TargetTime']) :
-                test=main.TRUE
-                main.log.info("Time is less then supplied target time")
-            else:
-                test=main.FALSE
-                main.log.info("Time is greater then supplied target time")
-        else : 
-            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
-            test=main.FALSE
- 
-        utilities.assert_equals(expect=main.TRUE,actual=test)
-
-    def CASE3(self,main) :
-        '''
-        Second case is to time the convergence time of a topology for ONOS. 
-        It shuts down the ONOS, drops keyspace, starts ONOS...
-        Then it points all the mininet switches at all ONOS nodes and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
-        '''
-        import time
-        main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
-        main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
-        main.step("Bringing ONOS down...") 
-        main.log.info("all switch no controllers") 
-        for i in range(1,int(main.params['NR_Switches'])+1):
-            main.Mininet1.delete_sw_controller("s"+str(i))
-        main.log.info("bringing ONOS down") 
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        #main.log.info("Dropping keyspace...")
-        #main.ONOS1.drop_keyspace()
-        time.sleep(5)
-        main.log.info("Bringing ONOS up")
-        main.ONOS1.start()
-        time.sleep(5) 
-        main.ONOS2.start()
-        main.ONOS2.start_rest()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.isup()
-        main.ONOS2.isup()
-        main.ONOS3.isup()
-        main.ONOS4.isup()
-        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.log.info("Pointing the Switches at ALL controllers... then BEGIN time") 
-        for i in range(1,int(main.params['NR_Switches'])+1):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        t1 = time.time()
-        for i in range(15) : 
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            if result == 1 : 
-                break
-            else : 
-                time.sleep(1)
-        t2 = time.time()
-        conv_time = t2 - t1
-        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
-            if float(conv_time) < float(main.params['TargetTime']) :
-                test=main.TRUE
-                main.log.info("Time is less then supplied target time")
-            else:
-                test=main.FALSE
-                main.log.info("Time is greater then supplied target time")
-        else : 
-            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
-            test=main.FALSE
- 
-        utilities.assert_equals(expect=main.TRUE,actual=test)
-
-    def CASE4(self,main) :
-        '''
-        Second case is to time the convergence time of a topology for ONOS. 
-        It shuts down the ONOS, drops keyspace, starts ONOS...
-        Then it evenly points all mininet switches to all ONOS nodes, but only one node, and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
-        '''
-        import time
-        main.log.report("Time convergence for switches -> Divide switches equall among all  nodes in cluster")
-        main.case("Timing Onos Convergence for even single controller distribution")
-        main.step("Bringing ONOS down...") 
-        main.log.info("all switch no controllers") 
-        for i in range(1,int(main.params['NR_Switches'])+1):
-            main.Mininet1.delete_sw_controller("s"+str(i))
-        main.log.info("bringing ONOS down") 
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        #main.log.info("Dropping keyspace...")
-        #main.ONOS1.drop_keyspace()
-        time.sleep(5)
-        main.log.info("Bringing ONOS up")
-        main.ONOS1.start()
-        time.sleep(5) 
-        main.ONOS2.start()
-        main.ONOS2.start_rest()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.isup()
-        main.ONOS2.isup()
-        main.ONOS3.isup()
-        main.ONOS4.isup()
-        main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-
-
-        main.log.info("Pointing the Switches to alternating controllers... then BEGIN time") 
-        count = 0
-        for i in range(1,int(main.params['NR_Switches'])+1):
-            num = (count % 4)+1
-            #num = count % len(controllers) #TODO: check number of controllers in cluster
-            main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip'+str(num)],port1=main.params['CTRL']['port'+str(num)])
-            count = count + 1
-
-
-        t1 = time.time()
-        for i in range(15) : 
-            result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            if result == 1 : 
-                break
-            else : 
-                time.sleep(1)
-        t2 = time.time()
-        conv_time = t2 - t1
-        main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            main.log.report( "Convergence time of : %f seconds" % conv_time ) 
-            if float(conv_time) < float(main.params['TargetTime']) :
-                test=main.TRUE
-                main.log.info("Time is less then supplied target time")
-            else:
-                test=main.FALSE
-                main.log.info("Time is greater then supplied target time")
-        else : 
-            main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) 
-            test=main.FALSE
- 
-        utilities.assert_equals(expect=main.TRUE,actual=test)
-
-    def CASE66(self, main):
-        main.log.report("Checking ONOS logs for exceptions")
-        count = 0
-        check1 = main.ONOS1.check_exceptions()
-        main.log.report("Exceptions in ONOS1 logs: \n" + check1)
-        check2 = main.ONOS2.check_exceptions()
-        main.log.report("Exceptions in ONOS2 logs: \n" + check2)
-        check3 = main.ONOS3.check_exceptions()
-        main.log.report("Exceptions in ONOS3 logs: \n" + check3)
-        check4 = main.ONOS4.check_exceptions()
-        main.log.report("Exceptions in ONOS4 logs: \n" + check4)
-        result = main.TRUE
-        if (check1 or check2 or check3 or check4):
-            result = main.FALSE
-            count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs")
-        main.Mininet1.stop_tcpdump()
-
-
diff --git a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.topo b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.topo
deleted file mode 100644
index 5c97a42..0000000
--- a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.topo
+++ /dev/null
@@ -1,120 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOS1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-        </ONOS4>
-
-        <Zookeeper1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
- 
-        <Zookeeper3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-
- 
-        <Zookeeper4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
- 
-        <RamCloud1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>5</connect_order>
-        </RamCloud1>
-        <RamCloud2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-        </RamCloud2>
-        <RamCloud3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-        </RamCloud3>
-        <RamCloud4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-        </RamCloud4>
-
-        <Mininet1>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> </arg1>
-                <arg2> --topo linear,100 --arp</arg2>
-                <controller> remote,ip=10.128.4.151,port=6633 </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/RCOnosScale4nodes/__init__.py b/TestON/tests/RCOnosScale4nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/RCOnosScale4nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/RCOnosScale4nodes/check_status.py b/TestON/tests/RCOnosScale4nodes/check_status.py
deleted file mode 100755
index 8e870bc..0000000
--- a/TestON/tests/RCOnosScale4nodes/check_status.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#! /usr/bin/env python
-import json
-import os
-import sys
-
-# http://localhost:8080/wm/onos/ng/switches/json
-# http://localhost:8080/wm/onos/ng/links/json
-# http://localhost:8080/wm/onos/registry/controllers/json
-# http://localhost:8080/wm/onos/registry/switches/json"
-
-def get_json(url):
-  try:
-    command = "curl -s %s" % (url)
-    result = os.popen(command).read()
-    parsedResult = json.loads(result)
-  except:
-    print "REST IF %s has issue" % command
-    parsedResult = ""
-
-  if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
-    print "REST %s returned code %s" % (command, parsedResult['code'])
-    parsedResult = ""
-
-  return parsedResult 
-
-def check_switch(RestIP,correct_nr_switch ):
-  buf = ""
-  retcode = 0
-  RestPort="8080"
-
-  url="http://%s:%s/wm/onos/ng/switches/json" % (RestIP, RestPort)
-  parsedResult = get_json(url)
-
-  if parsedResult == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-  url = "http://%s:%s/wm/onos/registry/switches/json" % (RestIP, RestPort)
-  registry = get_json(url)
-
-  if registry == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-
-  buf += "switch: total %d switches\n" % len(parsedResult)
-  cnt = 0
-  active = 0
-
-  for s in parsedResult:
-    cnt += 1
-
-    if s['state']  == "ACTIVE":
-      active += 1
-
-    if not s['dpid'] in registry:
-      buf += "switch:  dpid %s lost controller\n" % (s['dpid'])
-
-  buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
-  if correct_nr_switch != cnt:
-    buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
-    retcode = 1
-
-  if correct_nr_switch != active:
-    buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
-    retcode = 1
-
-  return (retcode, buf)
-
-def check_link(RestIP, nr_links):
-  RestPort = "8080"
-  buf = ""
-  retcode = 0
-
-  url = "http://%s:%s/wm/onos/ng/links/json" % (RestIP, RestPort)
-  parsedResult = get_json(url)
-
-  if parsedResult == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-  buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
-  intra = 0
-  interlink=0
-
-  for s in parsedResult:
-    intra = intra + 1 
-
-  if intra != nr_links:
-    buf += "link fail: network %d should have %d intra links but has %d\n" % (1, nr_links, intra)
-    retcode = 1
-
-  return (retcode, buf)
-
-#if __name__ == "__main__":
-def check_status(ip, numoswitch, numolink):
-
-  switch = check_switch(ip, numoswitch)
-  link = check_link(ip, numolink)
-  value = switch[0]
-  value += link[0]
-  if value != 0:
-    print "FAIL"
-    return 0
-  else: 
-    print "PASS"
-    return 1
-  print "%s" % switch[1]
-  print "%s" % link[1]
- # print "%s" % check_switch_local()[1]
- # print "%s" % check_controllers(8)[1]
diff --git a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.params b/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.params
deleted file mode 100644
index 250da70..0000000
--- a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.params
+++ /dev/null
@@ -1,57 +0,0 @@
-<PARAMS>
-    <testcases>1,2,21,31,6,7,4,6,7,5,6,7,41,6,7,5,6,7,6,7,66</testcases>
-    <tcpdump>
-        <intf>eth0</intf>
-        <port>port 6633</port>
-        <filename>~/packet_captures/RSanity.pcap</filename>
-    </tcpdump>
-    <CASE1>       
-        <destination>h6</destination>
-        <target>h40</target>
-    </CASE1>       
-    <PING>
-        <source1>h7</source1>
-        <target1>h32</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.4.151</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.4.152</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.4.153</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.4.154</ip4>
-        <port4>6633</port4>
-    </CTRL>
-    <RestIP>10.128.4.151</RestIP>
-    <RestIP2>10.128.4.152</RestIP2>
-    <RestIP3>10.128.4.153</RestIP3>
-    <RestIP4>10.128.4.154</RestIP4>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.4.151</restIP1>
-	<restIP2>10.128.4.152</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/onos/topology/hosts</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.py b/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.py
deleted file mode 100644
index bebdf4b..0000000
--- a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.py
+++ /dev/null
@@ -1,621 +0,0 @@
-
-class RRCOnosSanity4nodesJ :
-
-    def __init__(self) :
-        self.default = ''
-
-#*****************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.case("Initial Setup")
-        main.step("stop onos")
-        main.ONOS1.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS2.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS3.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS4.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS1.stop_all()        
-        main.ONOS2.stop_all()        
-        main.ONOS3.stop_all()        
-        main.ONOS4.stop_all() 
-        main.step("Start tcpdump on mn")
-        main.Mininet2.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port']) 
-#        main.step("Start tcpdump on mn")
-#        main.Mininet1.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port']) 
-        main.step("start ONOS")
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        main.log.report("Pulling latest code from github to all nodes")
-        for i in range(2):
-            uptodate = main.ONOS1.git_pull()
-            main.ONOS2.git_pull()
-            main.ONOS3.git_pull()
-            main.ONOS4.git_pull()
-            ver1 = main.ONOS1.get_version()
-            ver2 = main.ONOS4.get_version()
-            if ver1==ver2:
-                break
-            elif i==1:
-                main.ONOS2.git_pull("ONOS1 master")
-                main.ONOS3.git_pull("ONOS1 master")
-                main.ONOS4.git_pull("ONOS1 master")
-       #if uptodate==0
-        if 1:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-            main.ONOS4.git_compile()
-        main.ONOS1.print_version()    
-       # main.RamCloud1.git_pull()
-       # main.RamCloud2.git_pull()
-       # main.RamCloud3.git_pull()
-       # main.RamCloud4.git_pull()
-       # main.ONOS1.get_version()
-       # main.ONOS2.get_version()
-       # main.ONOS3.get_version()
-       # main.ONOS4.get_version()
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        main.ONOS2.start_rest()
-        time.sleep(10)
-        test= main.ONOS2.rest_status()
-        if test == main.FALSE:
-            main.ONOS2.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")   
-        data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() and main.RamCloud4.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-            time.sleep(5)
-            data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() and main.RamCloud4.status_serv()
-            
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                #main.log.report("Something is funny... restarting ONOS")
-                #main.ONOS1.stop()
-                time.sleep(3)
-                #main.ONOS1.start()
-                #time.sleep(5) 
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-        time.sleep(20)
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        main.Mininet1.get_sw_controller("s1")       
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        #main.ONOS1.delete_flow("all")
-        strtTime = time.time()
-        main.ONOS1.rm_intents()
-        print("world")
-        main.ONOS1.add_intents()
-        time.sleep(2)
-        main.ONOS1.add_intents()
-        print("hello")
-       # main.ONOS1.add_flow(main.params['FLOWDEF']['testONip'],main.params['FLOWDEF']['user'],main.params['FLOWDEF']['password'],main.params['FLOWDEF']['flowDef'])
-        main.case("Checking flows")
-       
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 9:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==9:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-    def CASE41(self,main) :
-        main.log.report("Testing Removal")
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-        main.ONOS2.start() 
-        main.ONOS3.start()
-        main.ONOS4.start() 
-        time.sleep(10)
-
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-        time.sleep(5) 
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(15)
-                main.ONOS2.check_status_report(main.params['RestIP2'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP3'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP4'],main.params['NR_Switches'],main.params['NR_Links'])
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 5
-        t_restwait = 5
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-        main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host mac = " + mac + ";  attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0]))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac  addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            result1 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result1 = main.FALSE
-
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result2 = main.FALSE
-         
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result3 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))            
-            result4 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result4 = main.FALSE
-        time.sleep(20)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus ==1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout")
-        elif Reststatus>1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout(multiple found)")
-        elif Reststatus==0:
-            main.log.report("\t PASSED - Device cleared after timeout")
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-# Run a pure ping test. 
-
-    def CASE31(self, main):
-        main.log.report("Performing Ping Test")        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            strtTime = time.time()
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-    def CASE66(self, main):
-        main.log.report("Checking ONOS logs for exceptions")
-        count = 0
-        check1 = main.ONOS1.check_exceptions()
-        main.log.report("Exceptions in ONOS1 logs: \n" + check1)
-        check2 = main.ONOS2.check_exceptions()
-        main.log.report("Exceptions in ONOS2 logs: \n" + check2)
-        check3 = main.ONOS3.check_exceptions()
-        main.log.report("Exceptions in ONOS3 logs: \n" + check3)
-        check4 = main.ONOS4.check_exceptions()
-        main.log.report("Exceptions in ONOS4 logs: \n" + check4)
-        result = main.TRUE
-        if (check1 or check2 or check3 or check4):
-            result = main.FALSE
-            count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs")
-        main.Mininet2.stop_tcpdump()
-
-
diff --git a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.py.backup b/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.py.backup
deleted file mode 100644
index 1027e35..0000000
--- a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.py.backup
+++ /dev/null
@@ -1,622 +0,0 @@
-
-class RRCOnosSanity4nodesJ :
-
-    def __init__(self) :
-        self.default = ''
-
-#*****************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.Zookeeper1.stop()
-        main.Zookeeper2.stop()
-        main.Zookeeper3.stop()
-        main.Zookeeper4.stop()
-        main.RamCloud1.stop_coor()
-        main.RamCloud1.stop_serv()
-        main.RamCloud2.stop_serv()
-        main.RamCloud3.stop_serv()
-        main.RamCloud4.stop_serv()
-                
-        main.ONOS1.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS2.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS3.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS4.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        time.sleep(3)
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        for i in range(2):
-            uptodate = main.ONOS1.git_pull()
-            main.ONOS2.git_pull()
-            main.ONOS3.git_pull()
-            main.ONOS4.git_pull()
-            ver1 = main.ONOS1.get_version()
-            ver2 = main.ONOS4.get_version()
-            if ver1==ver2:
-                break
-            elif i==1:
-                main.ONOS2.git_pull("ONOS1 master")
-                main.ONOS3.git_pull("ONOS1 master")
-                main.ONOS4.git_pull("ONOS1 master")
-        #if uptodate==0:
-        if 1:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-            main.ONOS4.git_compile()
-        main.ONOS1.print_version()    
-       # main.RamCloud1.git_pull()
-       # main.RamCloud2.git_pull()
-       # main.RamCloud3.git_pull()
-       # main.RamCloud4.git_pull()
-       # main.ONOS1.get_version()
-       # main.ONOS2.get_version()
-       # main.ONOS3.get_version()
-       # main.ONOS4.get_version()
-        '''
-        main.RamCloud1.start_coor()
-        time.sleep(1)
-        main.RamCloud1.start_serv()
-        main.RamCloud2.start_serv()
-        main.RamCloud3.start_serv()
-        main.RamCloud4.start_serv()
-        main.ONOS1.start()
-        time.sleep(5)
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS2.start_rest()
-        time.sleep(5)
-        '''
-        main.ONOS1.start_all()
-        main.ONOS2.start_all()
-        main.ONOS3.start_all()
-        main.ONOS4.start_all()
-        test= main.ONOS2.rest_status()
-        if test == main.FALSE:
-            main.ONOS2.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")   
-        data =  main.RamCloud1.status_serv() 
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup()
-        if data == main.FALSE: 
-            main.log.report("Something is funny... restarting ONOS")
-        #    main.ONOS1.stop()
-            time.sleep(3)
-        #    main.ONOS1.start()
-        #    time.sleep(5) 
-            data = main.ONOS1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-           
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.get_sw_controller("s"+str(j))       
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-                main.Mininet1.get_sw_controller("s"+str(j))       
-
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.get_sw_controller("s"+str(j))       
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-                main.Mininet1.get_sw_controller("s"+str(j))       
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                main.Mininet1.get_sw_controller("s"+str(j))       
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-                main.Mininet1.get_sw_controller("s"+str(j))       
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                main.Mininet1.get_sw_controller("s"+str(j))       
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-                main.Mininet1.get_sw_controller("s"+str(j))       
-        main.Mininet1.get_sw_controller("s1")       
-        time.sleep(10)
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
-        import time
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        #main.ONOS1.delete_flow("all")
-        strtTime = time.time()
-        print("hello")
-        main.ONOS1.rm_intents()
-        print("world")
-        main.ONOS1.add_intents()
-       # main.ONOS1.add_flow(main.params['FLOWDEF']['testONip'],main.params['FLOWDEF']['user'],main.params['FLOWDEF']['password'],main.params['FLOWDEF']['flowDef'])
-        main.case("Checking flows")
-       
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 9:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==9:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-    def CASE41(self,main) :
-        main.log.report("Testing Removal")
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-        main.ONOS2.start() 
-        main.ONOS3.start()
-        main.ONOS4.start() 
-        time.sleep(10)
-
-
-    def CASE4(self,main) :
-        main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(10):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time() 
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        time.sleep(10)
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                break
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count == 10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-        time.sleep(5) 
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for i in range(2):
-            if result == main.FALSE:
-                time.sleep(5)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                break
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 10:
-                count = count + 1
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                i = 6
-                time.sleep(2)
-            elif ping == main.FALSE and count ==10:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-    
-        t_topowait = 0 
-        t_restwait = 10
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-        main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus))        
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host mac = " + mac + ";  attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0]))
-            result1 = main.TRUE 
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac  addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            result1 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result1 = main.FALSE
-
-
-                ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port))
-            result2 = main.FALSE 
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result2 = main.FALSE
-
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result3 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result3 = main.FALSE
-       
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result4 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result4 = main.FALSE
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-
-# Run a pure ping test. 
-
-    def CASE31(self, main):
-        main.log.report("Performing Ping Test")        
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            strtTime = time.time()
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < 6:
-                count = count + 1
-                i = 6
-                main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
-                time.sleep(2)
-            elif ping == main.FALSE and count ==6:
-                main.log.error("Ping test failed")
-                i = 17
-                result = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result = main.TRUE
-        endTime = time.time()
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-
-    def CASE66(self, main):
-        main.log.report("Checking ONOS logs for exceptions")
-        count = 0
-        check1 = main.ONOS1.check_exceptions()
-        main.log.report("Exceptions in ONOS1 logs: \n" + check1)
-        check2 = main.ONOS2.check_exceptions()
-        main.log.report("Exceptions in ONOS2 logs: \n" + check2)
-        check3 = main.ONOS3.check_exceptions()
-        main.log.report("Exceptions in ONOS3 logs: \n" + check3)
-        check4 = main.ONOS4.check_exceptions()
-        main.log.report("Exceptions in ONOS4 logs: \n" + check4)
-        result = main.TRUE
-        if (check1 or check2 or check3 or check4):
-            result = main.FALSE
-            count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs")
-
-
diff --git a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.topo b/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.topo
deleted file mode 100644
index bf88550..0000000
--- a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.topo
+++ /dev/null
@@ -1,147 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <RamCloud1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud1>
-
-        <RamCloud2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud2>
-       
-        <RamCloud3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud3>
-       
-        <RamCloud4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud4>
-
-        <ONOS1>
-            <host>10.128.4.151</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.4.152</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.4.153</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.4.154</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp --mac</arg2>
-                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-        <Mininet2>
-            <host>10.128.4.159</host>
-            <user>admin</user>
-            <password></password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>14</connect_order>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/RRCOnosSanity4nodesJ/__init__.py b/TestON/tests/RRCOnosSanity4nodesJ/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/RRCOnosSanity4nodesJ/__init__.py
+++ /dev/null
diff --git a/TestON/tests/SDNIPRouteTest/Check_Flowtable.py b/TestON/tests/SDNIPRouteTest/Check_Flowtable.py
deleted file mode 100755
index efbcd0e..0000000
--- a/TestON/tests/SDNIPRouteTest/Check_Flowtable.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import pexpect
-import re
-import time
-import sys
-
-def pronto(ip, user, passwd):
-    print "Connecting to Pronto switch"
-    child = pexpect.spawn("telnet " + ip)
-    i = child.expect(["login:", "CLI#",pexpect.TIMEOUT])
-    if i == 0:
-        print "Username and password required. Passing login info."    
-        child.sendline(user)
-        child.expect("Password:")
-        child.sendline(passwd)
-        child.expect("CLI#")
-    print "Logged in, getting flowtable."
-    child.sendline("flowtable brief")
-    for t in range (9): 
-        t2 = 9 - t 
-        print "\r" + str(t2)
-        sys.stdout.write("\033[F")
-        time.sleep(1)
-    print "Scanning flowtable"
-    child.expect("Flow table show")
-    count = 0
-    while 1:
-        i = child.expect(['17\d\.\d{1,3}\.\d{1,3}\.\d{1,3}','CLI#',pexpect.TIMEOUT])
-        if i == 0:
-            count = count + 1
-        elif i == 1:
-            print "Pronto flows: " + str(count) + "\nDone\n"
-            break
-        else:
-            break
-
-def cisco(ip,user,passwd):
-    print "Establishing Cisco switch connection"
-    child = pexpect.spawn("ssh " +  user + "@" + ip)
-    i = child.expect(["Password:", "CLI#",pexpect.TIMEOUT])
-    if i == 0:
-        print "Password required. Passing now."
-        child.sendline(passwd)
-        child.expect("#")
-    print "Logged in. Retrieving flow table then counting flows."
-    child.sendline("show openflow switch all flows all")
-    child.expect("Logical Openflow Switch")
-    print "Flow table retrieved. Counting flows"
-    count = 0
-    while 1:
-        i = child.expect(["nw_src=17","#",pexpect.TIMEOUT])
-        if i == 0:
-            count = count + 1
-        elif i == 1:
-            print "Cisco flows: " + str(count) + "\nDone\n"
-            break
-        else: 
-            break
-
-if __name__ == "__main__":
-    usage_msg = "<Switch brand> <IP> <Username> <Password>\n"
-    usage_msg = usage_msg + "\nCurrently supported switches:\n"
-    usage_msg = usage_msg + "Pronto | Cisco\n"
-    usage_msg = usage_msg + "\nShorthand commands: \n"
-    usage_msg = usage_msg + "SDNIP : Runs \"Pronto 10.128.0.63 admin admin\" and \"Cisco 10.128.0.30 admin onos_test\" \n"
-
-    if len(sys.argv) == 2:
-        if sys.argv[1].lower() == "sdnip":
-            switch = sys.argv[1]
-    elif len(sys.argv) < 5 or (sys.argv[1] == "-h" or sys.argv[1] == "--help"):
-        print(usage_msg)
-        exit(0)
-    else:
-        switch = sys.argv[1]
-        ip = sys.argv[2]
-        user = sys.argv[3]
-        passwd = sys.argv[4]
-
-    if switch.lower() == "sdnip":
-        pronto("10.128.0.63","admin","admin")
-        cisco("10.128.0.30","admin","onos_test")
-    elif switch.lower() == "pronto":
-        pronto(ip,user,passwd)
-    elif switch.lower() == "cisco":
-        cisco(ip,user,passwd)
diff --git a/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.params b/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.params
deleted file mode 100644
index 804bc08..0000000
--- a/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.params
+++ /dev/null
@@ -1,21 +0,0 @@
-<PARAMS>
-   <testcases>1</testcases>
-   <numRoutes>600</numRoutes>
-   <Q1>
-      <net>172</net>
-      <routeRate>20</routeRate>
-      <startNet>1</startNet>
-   </Q1>
-   <Q2>
-      <net>173</net>
-      <routeRate>20</routeRate>
-      <startNet>1</startNet>
-   </Q2>
-   <DP1>
-      <pingIntf>eth0:1</pingIntf>
-   </DP1>
-   <DP2>
-      <pingIntf>eth0:1</pingIntf>
-   </DP2>
-</PARAMS>   
-
diff --git a/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.py b/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.py
deleted file mode 100644
index 414e15a..0000000
--- a/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.py
+++ /dev/null
@@ -1,65 +0,0 @@
-class SDNIPRouteTest :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self):
-        
-        result = main.Quagga1.enter_config(1)
-        result = result and main.Quagga2.enter_config(2)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Entered config mode successfully",onfail="Failed to enter config mode")
-    
-        result = main.Dataplane1.create_interfaces(main.params['Q1']['net'],main.params['numRoutes'],main.params['Q1']['startNet'])
-        result = result and main.Dataplane2.create_interfaces(main.params['Q2']['net'],main.params['numRoutes'],main.params['Q2']['startNet'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Interfaces created successfully",onfail="Failed to create interfaces")
-    def CASE2(self):
-        import time
-
-        main.log.info('Adding routes into Quagga1 and Quagga2')
-        result = main.Quagga1.add_route(str(main.params['Q1']['net']),int(main.params['numRoutes']),int(main.params['Q1']['routeRate']))
-        result = result and main.Quagga2.add_route(str(main.params['Q2']['net']),int(main.params['numRoutes']),int(main.params['Q2']['routeRate']))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Added routes successfully",onfail="Failed to add routes")
-
-        main.log.info('Routes added, now waiting 30 seconds')
-        time.sleep(30)
-
-        main.log.info('Dataplane1 pinging all interfaces on Dataplane1')
-        result = main.Dataplane1.pingall_interfaces(main.params['DP1']['pingIntf'],main.params['Q2']['net'],main.params['Q2']['startNet'],main.params['numRoutes'])
-        main.log.info('Dataplane2 pinging all interfaces on Dataplane2')
-        result = result and main.Dataplane2.pingall_interfaces(main.params['DP2']['pingIntf'],main.params['Q1']['net'],main.params['Q1']['startNet'],main.params['numRoutes'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switches properly direct traffic",onfail="Network unable to ping")
-        
-    def CASE3(self):
-        import time
-
-        main.log.info('Removing routes on Quagga1 and Quagga2')
-        result = main.Quagga1.del_route(str(main.params['Q1']['net']),int(main.params['numRoutes']),int(main.params['Q1']['routeRate']))
-        result = result and main.Quagga2.del_route(str(main.params['Q2']['net']),int(main.params['numRoutes']),int(main.params['Q2']['routeRate']))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Removed routes successfully",onfail="Failed to remove routes")
-
-        main.log.info('Routes removed, now waiting 30 seconds')
-        time.sleep(30)
-
-        main.log.info('Dataplane1 pinging all interfaces on Dataplane1')
-        result = main.Dataplane1.pingall_interfaces(main.params['DP1']['pingIntf'],main.params['Q2']['net'],main.params['Q2']['startNet'],main.params['numRoutes'])
-        main.log.info('Dataplane2 pinging all interfaces on Dataplane2')
-        result = result and main.Dataplane2.pingall_interfaces(main.params['DP2']['pingIntf'],main.params['Q1']['net'],main.params['Q1']['startNet'],main.params['numRoutes'])
-        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="Flows removed properly",onfail="Flows still present")
-
-        '''
-        num_routes = int(main.params['Q1']['numRoutes'])
-        a = str(Q2check)
-        main.log.info("The number of routes checked are" + a)
-        #print Q2check
-        #if Q1check == num_routes:
-        #    main.log.info("all routes added from Quagga1 successfully")
-        #else:
-        #    main.log.info("failed to add routes from Quagga1 fully")
-        if Q2check == num_routes:
-            print "all routes added from Quagga2 successfully"
-        else:
-            print "failed to add routes from Quagga2 fully"
-        #delresult = main.Quagga1.del_route(str(main.params['Q1']['net']),int(main.params['Q1']['numRoutes']),int(main.params['Q1']['routeRate']))
-        delresult = main.Quagga2.del_route(str(main.params['Q2']['net']),int(main.params['Q2']['numRoutes']),int(main.params['Q2']['routeRate'])) 
-        utilities.assert_equals(expect=main.TRUE,actual=delresult,onpass="Deleted routes successfully",onfaile="Failed to delete routes")
-        '''
diff --git a/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.topo b/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.topo
deleted file mode 100644
index f58989f..0000000
--- a/TestON/tests/SDNIPRouteTest/SDNIPRouteTest.topo
+++ /dev/null
@@ -1,50 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Quagga1>
-            <host>10.128.100.19</host>
-            <user>sdnip</user>
-            <password>sdnipRocks</password>
-            <type>QuaggaCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENT>
-            </COMPONENT>
-        </Quagga1>
-        <Quagga2>
-            <host>10.128.100.20</host>
-            <user>sdnip</user>
-            <password>sdnipRocks</password>
-            <type>QuaggaCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENT>
-            </COMPONENT>
-        </Quagga2>
-        <SDNIP>
-            <host>10.128.100.3</host>
-            <user>sdnip</user>
-            <password>sdnipRocks</password>
-            <type>SDNIPCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENT>
-            </COMPONENT>
-        </SDNIP>
-        <Dataplane1>
-            <host>10.128.100.19</host>
-            <user>sdnip</user>
-            <password>sdnipRocks</password>
-            <type>DPCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENT>
-            </COMPONENT>
-        </Dataplane1>
-        <Dataplane2>
-            <host>10.128.100.20</host>
-            <user>sdnip</user>
-            <password>sdnipRocks</password>
-            <type>DPCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENT>
-            </COMPONENT>
-        </Dataplane2>
-     </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/SDNIPRouteTest/__init__.py b/TestON/tests/SDNIPRouteTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/SDNIPRouteTest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/TimsDeathTest/.OnosSanity.py.swp b/TestON/tests/TimsDeathTest/.OnosSanity.py.swp
deleted file mode 100644
index ac9cdc3..0000000
--- a/TestON/tests/TimsDeathTest/.OnosSanity.py.swp
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/TimsDeathTest/TimsDeathTest.params b/TestON/tests/TimsDeathTest/TimsDeathTest.params
deleted file mode 100644
index 749cc51..0000000
--- a/TestON/tests/TimsDeathTest/TimsDeathTest.params
+++ /dev/null
@@ -1,34 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17</testcases>
-    <Iterations>2</Iterations>
-    <WaitTime>50</WaitTime>
-    <TargetTime>50</TargetTime>
-    <RestIP>10.128.100.4</RestIP>
-    <NR_Switches>104</NR_Switches>
-    <NR_Links>212</NR_Links>
-    <FLOWDEF>~/flowdef_files/TimsDeathTest/flowdef_96.txt</FLOWDEF>
-    <SET1>
-        <begin>
-            <one>s1</one>
-            <two>s1</two>
-            <three>s3</three>
-        </begin>
-        <end>
-            <one>s2</one>
-            <two>s3</two>
-            <three>s4</three>
-        </end>
-    </SET1>
-    <SET2>
-        <begin>
-            <one>s1</one>
-            <two>s2</two>
-            <three>s1</three>
-        </begin>
-        <end>
-            <one>s4</one>
-            <two>s3</two>
-            <three>s2</three>
-        </end>
-    </SET2>
-</PARAMS>      
diff --git a/TestON/tests/TimsDeathTest/TimsDeathTest.py b/TestON/tests/TimsDeathTest/TimsDeathTest.py
deleted file mode 100644
index 4aa278b..0000000
--- a/TestON/tests/TimsDeathTest/TimsDeathTest.py
+++ /dev/null
@@ -1,418 +0,0 @@
-
-class TimsDeathTest:
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-        '''
-        First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
-        If ONOS if not running properly, it will restart ONOS once before continuing. 
-        It will then check if the ONOS has a view of all the switches and links as defined in the params file.
-        The test will only pass if ONOS is running properly, and has a full view of all topology elements.
-        '''
-        import time
-        main.log.report("Checking is startup was clean")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        main.ONOS1.get_version()
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup Cassandra")
-        data =  main.Cassandra1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
-        main.step("Testing startup ONOS")
-        main.ONOS1.start()
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        main.ONOS1.start_rest()
-        main.ONOS2.start_rest()
-        main.ONOS3.start_rest()
-        main.ONOS4.start_rest()
-        data = main.ONOS1.isup()
-        if data == main.FALSE:
-            main.log.info("Something is funny... restarting ONOS")
-            main.ONOS1.stop()
-            time.sleep(3)
-            main.ONOS1.start()
-            time.sleep(5)
-            data = main.ONOS1.isup()
-        topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if topoview == main.TRUE & data == main.TRUE :
-            data = main.TRUE
-        else:
-            data = main.FALSE
-
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running and has full view of topology",onfail="ONOS didn't start or has fragmented view of topology...")
-
-    def CASE2(self,main) :
-        '''
-        Second case is to time the convergence time of a topology for ONOS. 
-        It shuts down the ONOS, drops keyspace, starts ONOS...
-        Then it points all the mininet switches at the ONOS node and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
-        '''
-        import time
-        main.log.report("Time convergence for switches -> single ONOS node in cluster")
-        main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
-        main.step("Bringing ONOS down...") 
-        main.log.info("all switch no controllers") 
-        main.Mininet1.ctrl_none()
-        main.log.info("bringing ONOS down") 
-        main.ONOS1.stop()
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        main.log.info("Dropping keyspace...")
-        main.ONOS1.drop_keyspace()
-        time.sleep(5)
-        main.log.info("Bringing ONOS up")
-        main.ONOS1.start()
-        time.sleep(5) 
-        main.ONOS2.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        onosup = main.ONOS1.isup()
-        onosup = onosup & main.ONOS2.isup()
-        onosup = onosup & main.ONOS3.isup()
-        onosup = onosup & main.ONOS4.isup()
-        onosup = onosup & main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        utilities.assert_equals(expect=main.TRUE,actual=onosup,onpass="ONOS is up and running and has full view of topology",onfail="ONOS could not even start properly...")
-
-    def CASE3(self, main) :
-        import time
-        main.log.report("Pointing the Switches at ONE controller...") 
-        main.case("Point the switches to ONOS, ONOS must discover ") 
-        main.Mininet1.ctrl_divide()
-        time.sleep( 10 )
-        result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            test = main.TRUE
-        else : 
-            test = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="ONOS converged",onfail="ONOS did not converge")
-
-    def CASE4(self,main) :
-        import time
-        main.log.report("Test Convergence again") 
-        main.case("Test Convergence again") 
-        time.sleep( 5 ) 
-        result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            test = main.TRUE
-        else : 
-            test = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="ONOS converged",onfail="ONOS did not converge")
-
-    def CASE5(self,main) :
-        import time
-        main.log.report("Test Convergence again") 
-        main.case("Test Convergence again") 
-        time.sleep( 5 ) 
-        result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        if result == 1 : 
-            test = main.TRUE
-        else : 
-            test = main.FALSE
-        utilities.assert_equals(expect=main.TRUE,actual=test,onpass="ONOS converged",onfail="ONOS did not converge, moving on with the test")
-
-    def CASE6(self,main) :
-        '''
-        This Test case:
-            - Clears out any leftover flows
-            - Adds new flows into ONOS
-            - Checks flows up to 10 times waiting for each flow to be caluculated and no "NOT" statements inte get_flow
-        '''
-        import time
-        main.log.report("Deleting and adding flows")
-        main.case("Taking care of these flows!")
-        main.step("Cleaning out any leftover flows...")
-        main.log.info("deleting...")
-        main.ONOS1.delete_flow("all")
-        main.log.info("adding...")
-        t1 = time.time()
-        main.ONOS1.add_flow(main.params['FLOWDEF'])
-        main.log.info("Checking...")
-        for i in range(8):
-            result = main.ONOS1.check_flow()
-            if result == main.TRUE:
-                t2 = time.time()
-                main.log.info( 'Adding flows took %0.3f ms' % ((t2-t1)*1000.0))
-                break
-            time.sleep(2)
-            main.log.info("Checking Flows again...")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="flows are good",onfail="FLOWS not correct")
-
-    def CASE7(self,main) : 
-        '''
-        First major stir of the network... 
-        '''
-        main.log.report("bring down links and test pings") 
-        main.case("bring down links and test pings")
-        main.step("Links down") 
-        for link in main.params['SET1']['begin']:
-            main.log.info(str(main.params['SET1']['begin'][link]))
-            main.Mininet1.link(END1=main.params['SET1']['begin'][link],END2=main.params['SET1']['end'][link],OPTION="down")
- 
-        main.step("Testing ping")
-        success = 0
-        main.log.info("starting loops") 
-        result = main.Mininet1.fpingHost(src="h9",target="h33")
-        for j in range(23) :
-            result = result & main.Mininet1.fpingHost(src="h"+str((10+j)),target="h"+str((34+j)))
-            main.log.info("result updated") 
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h"+str((33+j)),target="h"+str((57+j)))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h"+str((57+j)),target="h"+str((81+j)))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h"+str((81+j)),target="h"+str((9+j)))
-            if result == main.TRUE:
-                success = success + 1
-        main.log.info("%d/98 Pings Good" % success) 
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Pings are good, flow re-route: SUCCESS",onfail="Pings are bad. flow re-route: FAILED")
-
-    def CASE8(self,main) :
-        '''
-        Continued ping checking
-        '''
-        main.log.report("Testing flow re-route with ping")
-        main.case("Testing ping")
-        result = main.TRUE
-        success = 0
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(9+j),target="h%d"%(33+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(33+j),target="h%d"%(57+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(57+j),target="h%d"%(81+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(81+j),target="h%d"%(9+j))
-            if result == main.TRUE:
-                success = success + 1
-        main.log.info("%d/98 Pings Good" % success)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Pings are good, flow re-route: SUCCESS",onfail="Pings are bad. flow re-route: FAILED")
-
-    def CASE9(self,main) :
-        '''
-        Continued ping checking
-        '''
-        main.log.report("Testing flow re-route with ping")
-        main.case("Testing ping")
-        result = main.TRUE
-        success = 0
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(9+j),target="h%d"%(33+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(33+j),target="h%d"%(57+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(57+j),target="h%d"%(81+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(81+j),target="h%d"%(9+j))
-            if result == main.TRUE:
-                success = success + 1
-        main.log.info("%d/98 Pings Good" % success)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Pings are good, flow re-route: SUCCESS",onfail="Pings are bad. flow re-route: FAILED, moving on... ")
-
-    def CASE10(self,main) :
-        '''
-        Links back, up check pings. 
-        '''
-        main.log.report("bring up links and test pings")
-        main.case("bring up links and test pings")
-        main.step("Links up")
-        for link in main.params['SET1']['begin']:
-            main.log.info(str(main.params['SET1']['begin'][link]))
-            main.Mininet1.link(END1=main.params['SET1']['begin'][link],END2=main.params['SET1']['end'][link],OPTION="up")
-
-        main.step("Testing ping")
-        result = main.TRUE
-        success = 0 
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(9+j),target="h%d"%(33+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(33+j),target="h%d"%(57+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(57+j),target="h%d"%(81+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(81+j),target="h%d"%(9+j))
-            if result == main.TRUE:
-                success = success + 1
-        main.log.info("%d/98 Pings Good" % success) 
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Pings are good ",onfail="Pings are bad")
-
-    def CASE11(self,main) : 
-        '''
-        Assign all switches to all Controllers, then kill 3 / 4 of the controllers
-        '''
-        import time
-        main.log.report("Assign all switches to all Controllers, then kill 3 / 4 of the controllers") 
-        main.case("Assign all switches to all Controllers, then kill 3 / 4 of the controllers") 
-        main.step("Assign all switches to all Controllers...") 
-        main.Mininet1.ctrl_all()
-        time.sleep( 5 ) 		# Sleep for 5 sec because of my immense generosity
-        main.step("Kill ONOS 1, 3, 4") 
-        main.ONOS1.stop() 
-        main.ONOS3.stop() 
-        main.ONOS4.stop() 
-        
-        time.sleep( 10 ) 		# Sleep again... failover failover failover failover... 
-        topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        utilities.assert_equals(expect=main.TRUE,actual=topoview,onpass="ONOS has full view of topology",onfail="ONOS has fragmented view of topology...")
-
-    def CASE12(self,main) : 
-        '''
-        Check Convergance
-        '''
-        import time
-        main.log.report("Still checking convergance") 
-        main.case("Call the rest call, check all switches") 
-        time.sleep( 10 ) 		# Sleep again... failover failover failover failover... 
-        topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        utilities.assert_equals(expect=main.TRUE,actual=topoview,onpass="ONOS has full view of topology",onfail="ONOS has fragmented view of topology...")
- 
-    def CASE13(self,main) : 
-        '''
-        Check Convergance
-        '''
-        import time
-        main.log.report("Still checking convergance") 
-        main.case("Call the rest call, check all switches") 
-        time.sleep( 10 ) 		# Sleep again... failover failover failover failover... 
-        topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        utilities.assert_equals(expect=main.TRUE,actual=topoview,onpass="ONOS has full view of topology",onfail="ONOS has fragmented view of topology...")
- 
-    def CASE14(self,main) : 
-        '''
-        Bring ONOS nodes back to a good state and check health 
-        '''
-        main.log.report("Bringing ONOS nodes back up and checking if they're healthy") 
-        main.case("Bring up ONOS nodes") 
-        import time
-        main.ONOS1.start()
-        main.ONOS3.start()
-        main.ONOS4.start()
-        onosup = main.ONOS1.isup()
-        onosup = onosup & main.ONOS2.isup()
-        onosup = onosup & main.ONOS3.isup()
-        onosup = onosup & main.ONOS4.isup()
-        onosup = onosup & main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        utilities.assert_equals(expect=main.TRUE,actual=onosup,onpass="ONOS is up and running and has full view of topology",onfail="ONOS could not even start properly...")
-
-    def CASE15(self,main):
-        '''
-        Make a major churn in the network again... 
-        '''
-        import time
-        main.log.report("Maked a major churn in the network") 
-        main.case("Churning the network") 
-        main.step("Links down")
-        for link in main.params['SET2']['begin']:
-            main.log.info(str(main.params['SET2']['begin'][link]))
-            main.Mininet1.link(END1=main.params['SET2']['begin'][link],END2=main.params['SET2']['end'][link],OPTION="down")
-        main.step("ONOS nodes down") 
-        main.ONOS2.stop()
-        main.ONOS3.stop()
-        main.ONOS4.stop()
-        time.sleep( 10 ) 
-        main.step("First ping check") 
-        result = main.TRUE
-        success = 0
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(9+j),target="h%d"%(33+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(33+j),target="h%d"%(57+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(57+j),target="h%d"%(81+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(81+j),target="h%d"%(9+j))
-            if result == main.TRUE:
-                success = success + 1
-        main.log.info("%d/98 Pings Good" % success)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Pings are good, flow re-route: SUCCESS",onfail="Pings are bad. flow re-route: FAILED ")
-
-    def CASE16(self,main) :
-        '''
-        Continued ping checking
-        '''
-        main.log.report("Testing flow re-route with ping")
-        main.case("Testing ping")
-        main.step("Second ping check") 
-        result = main.TRUE
-        success = 0
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(9+j),target="h%d"%(33+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(33+j),target="h%d"%(57+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(57+j),target="h%d"%(81+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(81+j),target="h%d"%(9+j))
-            if result == main.TRUE:
-                success = success + 1
-        main.log.info("%d/98 Pings Good" % success)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Pings are good, flow re-route: SUCCESS",onfail="Pings are bad. flow re-route: FAILED")
-
-    def CASE17(self,main) :
-        '''
-        Continued ping checking
-        '''
-        main.log.report("Testing flow re-route with ping")
-        main.case("Testing ping")
-        main.step("Third ping check")
-        result = main.TRUE
-        success = 0
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(9+j),target="h%d"%(33+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(33+j),target="h%d"%(57+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(57+j),target="h%d"%(81+j))
-            if result == main.TRUE:
-                success = success + 1
-        for j in range(24) :
-            result = result & main.Mininet1.fpingHost(src="h%d"%(81+j),target="h%d"%(9+j))
-            if result == main.TRUE:
-                success = success + 1
-        main.log.info("%d/98 Pings Good" % success)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Pings are good, flow re-route: SUCCESS",onfail="Pings are bad. flow re-route: FAILED")
diff --git a/TestON/tests/TimsDeathTest/TimsDeathTest.topo b/TestON/tests/TimsDeathTest/TimsDeathTest.topo
deleted file mode 100644
index 351e98e..0000000
--- a/TestON/tests/TimsDeathTest/TimsDeathTest.topo
+++ /dev/null
@@ -1,17 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        <Mininet1>
-            <host>10.128.100.15</host>
-            <user>user_one</user>
-            <password>user_one</password>
-            <type>MininetCliDriver</type>
-            <connect_order>25</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/TimsDeathTopo.py </arg1>
-                <arg2> --topo timtopo </arg2>
-                <controller> none </controller>
-             </COMPONENTS>
-        </Mininet1>
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/TimsDeathTest/__init__.py b/TestON/tests/TimsDeathTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/TimsDeathTest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/TopoONOS2/TopoONOS2.back b/TestON/tests/TopoONOS2/TopoONOS2.back
deleted file mode 100644
index 97698e1..0000000
--- a/TestON/tests/TopoONOS2/TopoONOS2.back
+++ /dev/null
@@ -1,971 +0,0 @@
-
-class TopoONOS2 :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.ONOS1.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS2.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS3.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS4.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.RamCloud1.stop_coor()
-        main.RamCloud1.stop_serv()
-        main.RamCloud2.stop_serv()
-        main.RamCloud3.stop_serv()
-        main.RamCloud4.stop_serv()
-        time.sleep(10)
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        time.sleep(10)
-        main.log.report("Pulling latest code from github to all nodes")
-        for i in range(2):
-            uptodate = main.ONOS1.git_pull()
-            main.ONOS2.git_pull()
-            main.ONOS3.git_pull()
-            main.ONOS4.git_pull()
-            ver1 = main.ONOS1.get_version()
-            ver2 = main.ONOS4.get_version()
-            if ver1==ver2:
-                break
-            elif i==1:
-                main.ONOS2.git_pull("ONOS1 master")
-                main.ONOS3.git_pull("ONOS1 master")
-                main.ONOS4.git_pull("ONOS1 master")
-        if uptodate==0:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-            main.ONOS4.git_compile()
-        main.ONOS1.print_version()
-       # main.RamCloud1.git_pull()
-       # main.RamCloud2.git_pull()
-       # main.RamCloud3.git_pull()
-       # main.RamCloud4.git_pull()
-       # main.ONOS1.get_version()
-       # main.ONOS2.get_version()
-       # main.ONOS3.get_version()
-       # main.ONOS4.get_version()
-        main.RamCloud1.start_coor()
-        time.sleep(1)
-        main.RamCloud1.start_serv()
-        main.RamCloud2.start_serv()
-        main.RamCloud3.start_serv()
-        main.RamCloud4.start_serv()
-        main.ONOS1.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        time.sleep(5)
-        main.ONOS2.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS3.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS4.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS1.start_rest()
-        time.sleep(10)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")
-        data =  main.RamCloud1.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")
-        data = main.ONOS1.isup()
-        for i in range(3):
-            if data == main.FALSE:
-                #main.log.report("Something is funny... restarting ONOS")
-                #main.ONOS1.stop()
-                time.sleep(3)
-                #main.ONOS1.start()
-                #time.sleep(5)
-                data = main.ONOS1.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-        time.sleep(10)
-
-          
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        result =  main.Mininet1.get_sw_controller("s1")
-        if result:
-            result = main.TRUE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="S1 assigned to controller",onfail="S1 not assigned to controller")
-
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break 
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows using intents and wait for switch flow tables to update")
-        import time
-
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        #main.ONOS1.delete_flow("all")
-        main.ONOS1.rm_intents()
-        time.sleep(5)
-        main.ONOS1.purge_intents()
-        strtTime = time.time()
-        main.ONOS1.add_intents()
-        main.case("Checking flows with pings")
-        
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+"  seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-             main.log.report("\n\t\t\t\tTime from pushing intents to successful ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Assign all switches to just one ONOS instance then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        import random
-
-        random.seed(None)
-
-        num = random.randint(1,4)
-        if num == 1:
-            ip = main.params['CTRL']['ip1']
-            port = main.params['CTRL']['port1']
-        elif num == 2:
-            ip = main.params['CTRL']['ip2']
-            port = main.params['CTRL']['port2']
-        elif num == 3:
-            ip = main.params['CTRL']['ip3']
-            port = main.params['CTRL']['port3']
-        else:
-            ip = main.params['CTRL']['ip4']
-            port = main.params['CTRL']['port4']
-
-        main.log.report("ONOS"+str(num)+" will be the sole controller")
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time() 
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore switch assignments to all 4 ONOS instances then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-# **********************************************************************************************************************************************************************************************
-# Runs reactive ping test
-    def CASE8(self,main) :
-        main.log.report("Reactive flow ping test:ping until the routes are active or fail after 10 attempts")
-        import time
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-# This is the same as case 6, but specifically for the reactive tests
-
-    def CASE61(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-# Specifically for the Reactive tests
-
-    def CASE71(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-
-
-# ******************************************************************************************************************************************************************
-# Check for ONOS Components health
-
-    def CASE9(self,main) :
-        main.case("Checking component status")
-        result = main.TRUE
-
-        main.step("Checking Zookeeper status")
-        result1 = main.Zookeeper1.status()
-        if not result1:
-            main.log.report("Zookeeper1 encountered a tragic death!")
-        result2 = main.Zookeeper2.status()
-        if not result2:
-            main.log.report("Zookeeper2 encountered a tragic death!")
-        result3 = main.Zookeeper3.status()
-        if not result3:
-            main.log.report("Zookeeper3 encountered a tragic death!")
-        result4 = main.Zookeeper4.status()
-        if not result4:
-            main.log.report("Zookeeper4 encountered a tragic death!")
-        result = result and result1 and result2 and result3 and result4
-
-        main.step("Checking RamCloud status")
-        result5 = main.RamCloud1.status_coor()
-        if not result5:
-            main.log.report("RamCloud Coordinator1 encountered a tragic death!")
-        result6 = main.RamCloud1.status_serv()
-        if not result6:
-            main.log.report("RamCloud Server1 encountered a tragic death!")
-        result7 = main.RamCloud2.status_serv()
-        if not result7:
-            main.log.report("RamCloud Server2 encountered a tragic death!")
-        result8 = main.RamCloud3.status_serv()
-        if not result8:
-            main.log.report("RamCloud Server3 encountered a tragic death!")
-        result9 = main.RamCloud4.status_serv()
-        if not result9:
-            main.log.report("RamCloud Server4 encountered a tragic death!")
-        result = result and result5 and result6 and result7 and result8 and result9
-
-
-        main.step("Checking ONOS status")
-        result10 = main.ONOS1.status()
-        if not result10:
-            main.log.report("ONOS1 core encountered a tragic death!")
-        result11 = main.ONOS2.status()
-        if not result11:
-            main.log.report("ONOS2 core encountered a tragic death!")
-        result12 = main.ONOS3.status()
-        if not result12:
-            main.log.report("ONOS3 core encountered a tragic death!")
-        result13 = main.ONOS4.status()
-        if not result13:
-            main.log.report("ONOS4 core encountered a tragic death!")
-        result = result and result10 and result11 and result12 and result13
-
-
-
-        rest_result =  main.ONOS1.rest_status()
-        if not rest_result:
-            main.log.report("Simple Rest GUI server is not running on ONOS1")
-
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="All Components are running",onfail="One or more components failed")
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, and move host h1 from s1->s6->s1. Per mininet naming, the name of the switch port the host attaches to will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 5
-        t_restwait = 0
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-        main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host mac = " + mac + ";  attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0]))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac  addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            result1 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result1 = main.FALSE
-
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result2 = main.FALSE
-
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result3 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result4 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result4 = main.FALSE
-        time.sleep(20)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus ==1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout")
-        elif Reststatus>1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout(multiple found)")
-        elif Reststatus==0:
-            main.log.report("\t PASSED - Device cleared after timeout")
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-
-    def CASE100(self,main):
-        
-        from sts.topology.teston_topology import TestONTopology # assumes that sts already in you PYTHONPATH
-
-        topo = TestONTopology(main.Mininet1, onos_controllers=
-        [(main.ONOS1, 'ONOS1', main.params['CTRL']['ip1'], main.params['CTRL']['port1']),
-        (main.ONOS2, 'ONOS2', main.params['CTRL']['ip2'], main.params['CTRL']['port2']),
-        (main.ONOS3, 'ONOS3', main.params['CTRL']['ip3'], main.params['CTRL']['port3']),
-        (main.ONOS4, 'ONOS4', main.params['CTRL']['ip4'], main.params['CTRL']['port4'])])
-
-
-
-        #for switch in topo.graph.switches: print "Switch name: %s, dpid: %s, ports: %s" % (switch.name, switch.dpid, [p.hw_addr for p in switch.ports.values()])
-        print()
-        print()
-        print()
-        import json
-        '''
-        output = '{"Switches":['
-        for switch in topo.graph.switches: 
-            ports = '%s' % [p.hw_addr for p in switch.ports.values()]
-            ports = ports.replace('\'','"')
-            output += '{"name": "%s", "dpid": "%s", "ports": %s},' % (switch.name, switch.dpid, ports)
-        output = output[:-1]
-        output += ']}'
-        '''
-        output = {"Switches":[]}
-        for switch in topo.graph.switches: 
-            print [p.hw_addr for p in switch.ports.values()]
-            ports = '%s' % [p.hw_addr for p in switch.ports.values()]
-            ports = ports.replace('\'','')
-            output['Switches'].append({"name": switch.name, "dpid": switch.dpid, "ports": ports})
-        print output
-        #mn_json = json.loads(output)
-        print json.dumps(output, sort_keys=True,indent=4,separators=(',', ': '))
-        print type(output)
-        print output.items()
-        mnDPIDs=[]
-        for switch in output['Switches']:
-            mnDPIDs.append(switch['dpid'])
-        mnDPIDs.append('mn1')
-        mnDPIDs.sort()
-        print mnDPIDs
-        print
-        print "Dumping ONOS view of Switches"
-        onos=main.ONOS1.get_json("10.128.11.1:8080/wm/onos/topology/switches")
-        onosDPIDs=[]
-        for switch in onos:
-            print switch
-            onosDPIDs.append(switch['dpid'].replace(":",''))
-        onosDPIDs.append(00121)
-        onosDPIDs.sort()
-        print onosDPIDs
-        if mnDPIDs!=onosDPIDs:
-            print "Switches in MN but not in ONOS:"
-            print [switch for switch in mnDPIDs if switch not in onosDPIDs]
-            print "Switches in ONOS but not in MN:"
-            print [switch for switch in onosDPIDs if switch not in mnDPIDs]
-        print()
-        print()
-        print()
-        '''
-        for host in topo.graph.hosts: print "Host: %s, interfaces: %s" % (host.name, [iface.hw_addr for iface in host.interfaces])
-        print()
-        print()
-        print()
-        for link in topo.graph.links: print "Link: %s" % link
-        print()
-        print()
-        print()
-        # To print just internal network links (connecting switches to each other)
-        print "Just printing network links"
-        for link in topo.patch_panel.network_links: print "Link: %s" % link
-        '''
-        '''
-        # Bring links up and down
-        for link in topo.patch_panel.network_links:
-          topo.patch_panel.sever_network_link(link)
-        for link in topo.patch_panel.access_links:
-          topo.patch_panel.sever_access_link(link)
-        for link in topo.patch_panel.network_links:
-          topo.patch_panel.repair_network_link(link)
-        for link in topo.patch_panel.access_links:
-          topo.patch_panel.repair_access_link(link)
-        '''
-        
-
-        time.sleep(40)
-
diff --git a/TestON/tests/TopoONOS2/TopoONOS2.params b/TestON/tests/TopoONOS2/TopoONOS2.params
deleted file mode 100644
index ce2b4fb..0000000
--- a/TestON/tests/TopoONOS2/TopoONOS2.params
+++ /dev/null
@@ -1,55 +0,0 @@
-<PARAMS>
-    <testcases>2,100 </testcases>
-    <pingSleep>1</pingSleep>
-    <pingAttempts>60</pingAttempts>
-    <CASE1>       
-        <destination>h6</destination>
-    </CASE1>       
-    <PING>
-        <source1>h6</source1>
-        <target1>h31</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <CTRL>
-        <ip1>10.128.11.1</ip1>
-        <port1>6633</port1>
-        <restPort1>8080</restPort1>
-        <ip2>10.128.11.2</ip2>
-        <port2>6633</port2>
-        <restPort2>8080</restPort2>
-        <ip3>10.128.11.3</ip3>
-        <port3>6633</port3>
-        <restPort3>8080</restPort3>
-        <ip4>10.128.11.4</ip4>
-        <port4>6633</port4>
-        <restPort4>8080</restPort4>
-    </CTRL>
-    <TopoRest>/wm/onos/topology</TopoRest>
-    <RestIP> 10.128.11.1 </RestIP>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-        <sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-        <sw6>s6</sw6>
-        <sw1>s1</sw1>
-    </PLUG>
-    <RESTCALL>
-        <restIP1>10.128.11.1</restIP1>
-        <restIP2>10.128.11.2</restIP2>
-        <restPort>8080</restPort>
-        <restURL>/wm/onos/topology/hosts</restURL>
-    </RESTCALL>
-</PARAMS>      
diff --git a/TestON/tests/TopoONOS2/TopoONOS2.py b/TestON/tests/TopoONOS2/TopoONOS2.py
deleted file mode 100644
index 032e2b0..0000000
--- a/TestON/tests/TopoONOS2/TopoONOS2.py
+++ /dev/null
@@ -1,914 +0,0 @@
-
-class TopoONOS2 :
-
-    def __init__(self) :
-        self.default = ''
-
-#**********************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        import time
-        main.ONOS1.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS2.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS3.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-        main.ONOS4.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
-
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-        main.ONOS4.stop_all()
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.RamCloud1.stop_coor()
-        main.RamCloud1.stop_serv()
-        main.RamCloud2.stop_serv()
-        main.RamCloud3.stop_serv()
-        main.RamCloud4.stop_serv()
-        time.sleep(10)
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-        main.RamCloud4.del_db()
-        time.sleep(10)
-        main.log.report("Pulling latest code from github to all nodes")
-        for i in range(2):
-            uptodate = main.ONOS1.git_pull()
-            main.ONOS2.git_pull()
-            main.ONOS3.git_pull()
-            main.ONOS4.git_pull()
-            ver1 = main.ONOS1.get_version()
-            ver2 = main.ONOS4.get_version()
-            if ver1==ver2:
-                break
-            elif i==1:
-                main.ONOS2.git_pull("ONOS1 master")
-                main.ONOS3.git_pull("ONOS1 master")
-                main.ONOS4.git_pull("ONOS1 master")
-        if uptodate==0:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-            main.ONOS4.git_compile()
-        main.ONOS1.print_version()
-       # main.RamCloud1.git_pull()
-       # main.RamCloud2.git_pull()
-       # main.RamCloud3.git_pull()
-       # main.RamCloud4.git_pull()
-       # main.ONOS1.get_version()
-       # main.ONOS2.get_version()
-       # main.ONOS3.get_version()
-       # main.ONOS4.get_version()
-        main.RamCloud1.start_coor()
-        time.sleep(1)
-        main.RamCloud1.start_serv()
-        main.RamCloud2.start_serv()
-        main.RamCloud3.start_serv()
-        main.RamCloud4.start_serv()
-        main.ONOS1.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        time.sleep(5)
-        main.ONOS2.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS3.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS4.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
-        main.ONOS1.start_rest()
-        time.sleep(10)
-        test= main.ONOS1.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
-        main.case("Checking if the startup was clean...")
-        main.step("Testing startup Zookeeper")
-        data =  main.Zookeeper1.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        main.step("Testing startup RamCloud")
-        data =  main.RamCloud1.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-            main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-            main.RamCloud4.start_serv()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        main.step("Testing startup ONOS")
-        data = main.ONOS1.isup()
-        for i in range(3):
-            if data == main.FALSE:
-                #main.log.report("Something is funny... restarting ONOS")
-                #main.ONOS1.stop()
-                time.sleep(3)
-                #main.ONOS1.start()
-                #time.sleep(5)
-                data = main.ONOS1.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-        time.sleep(10)
-
-          
-#**********************************************************************************************************************************************************************************************
-#Assign Controllers
-#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
-#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
-#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
-#      the controllers already assigned to the switch are not specified.
-
-    def CASE2(self,main) :    #Make sure mininet exists, then assign controllers to switches
-        import time
-        main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
-        main.case("Checking if one MN host exists")
-        main.step("Host IP Checking using checkIP")
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
-        main.step("assigning ONOS controllers to switches")
-        for i in range(25): 
-            if i < 3:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 3 and i < 5:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            elif i >= 5 and i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
-                time.sleep(1)
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-        result =  main.Mininet1.get_sw_controller("s1")
-        if result:
-            result = main.TRUE
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="S1 assigned to controller",onfail="S1 not assigned to controller")
-
-        for i in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break 
- 
-# **********************************************************************************************************************************************************************************************
-#Add Flows
-#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
-#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
-
-    def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
-        main.log.report("Delete any flows from previous tests, then add flows using intents and wait for switch flow tables to update")
-        import time
-
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        main.case("Taking care of these flows!") 
-        main.step("Cleaning out any leftover flows...")
-        #main.ONOS1.delete_flow("all")
-        main.ONOS1.rm_intents()
-        time.sleep(5)
-        main.ONOS1.purge_intents()
-        strtTime = time.time()
-        main.ONOS1.add_intents()
-        main.case("Checking flows with pings")
-        
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+"  seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-             main.log.report("\n\t\t\t\tTime from pushing intents to successful ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tFlows failed check")
-
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-#**********************************************************************************************************************************************************************************************
-#This test case removes Controllers 2,3, and 4 then performs a ping test.
-#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
-#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
-#If the ping test fails 6 times, then the test case will return false
-
-    def CASE4(self,main) :
-        main.log.report("Assign all switches to just one ONOS instance then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-        import random
-
-        random.seed(None)
-
-        num = random.randint(1,4)
-        if num == 1:
-            ip = main.params['CTRL']['ip1']
-            port = main.params['CTRL']['port1']
-        elif num == 2:
-            ip = main.params['CTRL']['ip2']
-            port = main.params['CTRL']['port2']
-        elif num == 3:
-            ip = main.params['CTRL']['ip3']
-            port = main.params['CTRL']['port3']
-        else:
-            ip = main.params['CTRL']['ip4']
-            port = main.params['CTRL']['port4']
-
-        main.log.report("ONOS"+str(num)+" will be the sole controller")
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)  #Assigning a single controller removes all other controllers
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time() 
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAIL")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#This test case restores the controllers removed by Case 4 then performs a ping test.
-
-    def CASE5(self,main) :
-        main.log.report("Restore switch assignments to all 4 ONOS instances then ping until all hosts are reachable or fail after 6 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        for i in range(25):
-            if i < 15:
-                j=i+1
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-            else:
-                j=i+16
-                main.Mininet1.assign_sw_controller(sw=str(j),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-               # i = 6
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-
-    def CASE6(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-
-    def CASE7(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-# **********************************************************************************************************************************************************************************************
-# Runs reactive ping test
-    def CASE8(self,main) :
-        main.log.report("Reactive flow ping test:ping until the routes are active or fail after 10 attempts")
-        import time
-      
-        strtTime = time.time() 
-        result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result == main.FALSE:
-                time.sleep(3)
-                result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-# **********************************************************************************************************************************************************************************************
-#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
-# This is the same as case 6, but specifically for the reactive tests
-
-    def CASE61(self,main) :
-        main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        main.case("Bringing Link down... ")
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
-       
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TEST FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-# **********************************************************************************************************************************************************************************************
-#Brings the link that Case 6 took down  back up, then runs a ping test to view reroute time
-# Specifically for the Reactive tests
-
-    def CASE71(self,main) :
-        main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
-        import time
-        main.case("Bringing Link up... ")
-
-        #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
-        time.sleep(10)
-
-        result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-      
-        strtTime = time.time() 
-        result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-        for counter in range(9):
-            if result1 == main.FALSE:
-                time.sleep(3)
-                result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-            else:
-                main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
-
-        pingAttempts = main.params['pingAttempts']
-        pingSleep = main.params['pingSleep']
-
-        strtTime = time.time()
-        count = 1
-        i = 6
-        while i < 16 :
-            main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
-            if ping == main.FALSE and count < int(pingAttempts):
-                count = count + 1
-                main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
-                #i = 6
-                time.sleep(int(pingSleep))
-            elif ping == main.FALSE and count == int(pingAttempts):
-                main.log.error("Ping test failed")
-                i = 17
-                result2 = main.FALSE
-            elif ping == main.TRUE:
-                i = i + 1
-                result2 = main.TRUE
-        endTime = time.time()
-        result = result and result2 and result1
-        if result == main.TRUE:
-            main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
-        else:
-            main.log.report("\tPING TESTS FAILED")
-            main.ONOS1.show_intent(main.params['RestIP'])
-        
-        print main.ONOS1.check_exceptions()
-        print main.ONOS2.check_exceptions()
-        print main.ONOS3.check_exceptions()
-        print main.ONOS4.check_exceptions()
-
-        utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
-
-
-
-
-# ******************************************************************************************************************************************************************
-# Check for ONOS Components health
-
-    def CASE9(self,main) :
-        main.case("Checking component status")
-        result = main.TRUE
-
-        main.step("Checking Zookeeper status")
-        result1 = main.Zookeeper1.status()
-        if not result1:
-            main.log.report("Zookeeper1 encountered a tragic death!")
-        result2 = main.Zookeeper2.status()
-        if not result2:
-            main.log.report("Zookeeper2 encountered a tragic death!")
-        result3 = main.Zookeeper3.status()
-        if not result3:
-            main.log.report("Zookeeper3 encountered a tragic death!")
-        result4 = main.Zookeeper4.status()
-        if not result4:
-            main.log.report("Zookeeper4 encountered a tragic death!")
-        result = result and result1 and result2 and result3 and result4
-
-        main.step("Checking RamCloud status")
-        result5 = main.RamCloud1.status_coor()
-        if not result5:
-            main.log.report("RamCloud Coordinator1 encountered a tragic death!")
-        result6 = main.RamCloud1.status_serv()
-        if not result6:
-            main.log.report("RamCloud Server1 encountered a tragic death!")
-        result7 = main.RamCloud2.status_serv()
-        if not result7:
-            main.log.report("RamCloud Server2 encountered a tragic death!")
-        result8 = main.RamCloud3.status_serv()
-        if not result8:
-            main.log.report("RamCloud Server3 encountered a tragic death!")
-        result9 = main.RamCloud4.status_serv()
-        if not result9:
-            main.log.report("RamCloud Server4 encountered a tragic death!")
-        result = result and result5 and result6 and result7 and result8 and result9
-
-
-        main.step("Checking ONOS status")
-        result10 = main.ONOS1.status()
-        if not result10:
-            main.log.report("ONOS1 core encountered a tragic death!")
-        result11 = main.ONOS2.status()
-        if not result11:
-            main.log.report("ONOS2 core encountered a tragic death!")
-        result12 = main.ONOS3.status()
-        if not result12:
-            main.log.report("ONOS3 core encountered a tragic death!")
-        result13 = main.ONOS4.status()
-        if not result13:
-            main.log.report("ONOS4 core encountered a tragic death!")
-        result = result and result10 and result11 and result12 and result13
-
-
-
-        rest_result =  main.ONOS1.rest_status()
-        if not rest_result:
-            main.log.report("Simple Rest GUI server is not running on ONOS1")
-
-
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="All Components are running",onfail="One or more components failed")
-
-# ******************************************************************************************************************************************************************
-# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
-
-    def CASE21(self,main) :
-        import json
-        main.log.report("Test device discovery function, by attach, detach, and move host h1 from s1->s6->s1. Per mininet naming, the name of the switch port the host attaches to will remain as 's1-eth1' throughout the test.")
-        main.log.report("Check initially hostMAC/IP exist on the mininet...")
-        host = main.params['YANK']['hostname']
-        mac = main.params['YANK']['hostmac']
-        RestIP1 = main.params['RESTCALL']['restIP1']
-        RestPort = main.params['RESTCALL']['restPort']
-        url = main.params['RESTCALL']['restURL']
-       
-        t_topowait = 5
-        t_restwait = 0
-        main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
-        main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
-        #print "host=" + host + ";  RestIP=" + RestIP1 + ";  RestPort=" + str(RestPort)
-        time.sleep(t_topowait) 
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-        main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\t PASSED - Found host mac = " + mac + ";  attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0]))
-            result1 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac  addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            result1 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
-            result1 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result1 = main.FALSE
-
-
-        ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
-
-        main.log.report("Yank out s1-eth1")
-        main.case("Yankout s6-eth1 (link to h1) from s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
-
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port))
-            result2 = main.FALSE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result2 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
-            result2 = main.TRUE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result2 = main.FALSE
-
-        ##### Step to plug "s1-eth1" to s6, which is on autoONOS3  ######
-        main.log.report("Plug s1-eth1 into s6")
-        main.case("Plug s1-eth1 to s6")
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
-        time.sleep(t_topowait)
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result3 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result3 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result3 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result3 = main.FALSE
-
-        ###### Step to put interface "s1-eth1" back to s1"#####
-        main.log.report("Move s1-eth1 back on to s1")
-        main.case("Move s1-eth1 back to s1")
-        result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
-        time.sleep(t_topowait)
-        result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
-        main.log.info("\n\t\t\t\t ping issue one ping from " + str(host) + " to generate arp to switch. Ping result is not important" )
-
-        ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
-        time.sleep(t_restwait)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
-
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus == 1:
-            main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
-            result4 = main.TRUE
-        elif Reststatus > 1:
-            main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
-            main.log.report("switches are: " + "; ".join(Switch))
-            main.log.report("Ports are: " + "; ".join(Port))
-            main.log.report("MACs are: " + "; ".join(MAC))
-            result4 = main.FALSE
-        elif Reststatus == 0 and Switch == []:
-            main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
-            result4 = main.FALSE
-        else:# check if rest server is working
-            main.log.error("Issue with find host")
-            result4 = main.FALSE
-        time.sleep(20)
-        Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
-        main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
-        if Reststatus ==1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout")
-        elif Reststatus>1:
-            main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout(multiple found)")
-        elif Reststatus==0:
-            main.log.report("\t PASSED - Device cleared after timeout")
-
-        result = result1 and result2 and result3 and result4
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
-
-
-    def CASE100(self,main):
-
-        time.sleep(40)
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-
-
-        topo_result = main.TRUE
-        for n in range(1,5):
-            temp_result = main.Mininet1.compare_topo(ctrls, main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest'])) 
-            '''
-            temp_result = main.Mininet1.compare_topo(
-                        [(main.ONOS1, 'ONOS1', main.params['CTRL']['ip1'], main.params['CTRL']['port1']),
-                            (main.ONOS2, 'ONOS2', main.params['CTRL']['ip2'], main.params['CTRL']['port2']),
-                            (main.ONOS3, 'ONOS3', main.params['CTRL']['ip3'], main.params['CTRL']['port3']),
-                            (main.ONOS4, 'ONOS4', main.params['CTRL']['ip4'], main.params['CTRL']['port4'])],
-                        main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            '''
-            topo_result = topo_result and temp_result
-        print "Topoology check results: " + str(topo_result)
-
diff --git a/TestON/tests/TopoONOS2/TopoONOS2.topo b/TestON/tests/TopoONOS2/TopoONOS2.topo
deleted file mode 100644
index c3f1b4b..0000000
--- a/TestON/tests/TopoONOS2/TopoONOS2.topo
+++ /dev/null
@@ -1,139 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.11.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.11.2</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.11.3</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.11.4</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <RamCloud1>
-            <host>10.128.11.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud1>
-
-        <RamCloud2>
-            <host>10.128.11.2</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud2>
-       
-        <RamCloud3>
-            <host>10.128.11.3</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud3>
-       
-        <RamCloud4>
-            <host>10.128.11.4</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud4>
-
-        <ONOS1>
-            <host>10.128.11.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.11.2</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.11.3</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.11.4</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <Mininet1>
-            <host>10.128.11.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/TopoONOS2/__init__.py b/TestON/tests/TopoONOS2/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/TopoONOS2/__init__.py
+++ /dev/null
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.params b/TestON/tests/TopoPerfNext/TopoPerfNext.params
new file mode 100644
index 0000000..01334c9
--- /dev/null
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.params
@@ -0,0 +1,58 @@
+<PARAMS>
+    <testcases>1,2,3,4,5</testcases>
+
+    <ENV>
+        <cellName>topo_perf_test</cellName>
+    </ENV>
+
+    <GIT>
+        #autoPull 'on' or 'off'
+        <autoPull>off</autoPull>
+        <checkout>master</checkout>
+    </GIT>
+
+    <CTRL>
+        <user>admin</user>
+        <ip1>10.128.174.1</ip1>
+        <port1>6633</port1>
+        <ip2>10.128.174.2</ip2>
+        <port2>6633</port2>
+        <ip3>10.128.174.3</ip3>
+        <port3>6633</port3>
+    </CTRL>
+
+    <MN>
+        <ip1>10.128.10.90</ip1>
+        <ip2>10.128.10.91</ip2>
+    </MN>
+
+    <BENCH>
+        <ip>10.128.174.10</ip>
+    </BENCH>
+
+    <TEST>
+        #'on' or 'off' debug mode.
+        #If on, logging will be more verbose and
+        #tshark pcap will be enabled
+        #pcap file located at /tmp/'capture_name'
+        <debugMode>on</debugMode>
+
+        #Number of times to iterate each case
+        <numIter>5</numIter>
+        <numSwitch>100</numSwitch>         
+    
+        <singleSwThreshold>0,1000</singleSwThreshold>
+        <portUpThreshold>0,1000</portUpThreshold>
+        <portDownThreshold>0,1000</portDownThreshold>
+        <linkUpThreshold>0,10000</linkUpThreshold>
+        <linkDownThreshold>0,10000</linkDownThreshold>
+        <swDisc100Threshold>0,10000</swDisc100Threshold>
+    </TEST>
+
+    <JSON>
+        <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
+        <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
+        <linkTimestamp>topologyLinkEventTimestamp</linkTimestamp>
+        <graphTimestamp>topologyGraphEventTimestamp</graphTimestamp>
+    </JSON>
+</PARAMS>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
new file mode 100644
index 0000000..9dd828e
--- /dev/null
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -0,0 +1,1497 @@
+#TopoPerfNext
+#
+#Topology Performance test for ONOS-next
+#
+#andrew@onlab.us
+
+import time
+import sys
+import os
+import re
+
+class TopoPerfNext:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        ONOS startup sequence
+        '''
+        import time
+    
+        cell_name = main.params['ENV']['cellName']
+
+        git_pull = main.params['GIT']['autoPull']
+        checkout_branch = main.params['GIT']['checkout']
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        MN1_ip = main.params['MN']['ip1']
+        BENCH_ip = main.params['BENCH']['ip']
+
+        main.case("Setting up test environment")
+
+        main.step("Creating cell file")
+        cell_file_result = main.ONOSbench.create_cell_file(
+                BENCH_ip, cell_name, MN1_ip, "onos-core",
+                ONOS1_ip, ONOS2_ip, ONOS3_ip)
+
+        main.step("Applying cell file to environment")
+        cell_apply_result = main.ONOSbench.set_cell(cell_name)
+        verify_cell_result = main.ONOSbench.verify_cell()
+        
+        main.step("Git checkout and pull "+checkout_branch)
+        if git_pull == 'on':
+            checkout_result = \
+                    main.ONOSbench.git_checkout(checkout_branch)
+            pull_result = main.ONOSbench.git_pull()
+        else:
+            checkout_result = main.TRUE
+            pull_result = main.TRUE
+            main.log.info("Skipped git checkout and pull")
+
+        main.step("Using mvn clean & install")
+        #mvn_result = main.ONOSbench.clean_install()
+        mvn_result = main.TRUE
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
+        install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
+        install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
+
+        #NOTE: This step may be unnecessary
+        #main.step("Starting ONOS service")
+        #start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+        main.step("Set cell for ONOS cli env")
+        main.ONOS1cli.set_cell(cell_name)
+        main.ONOS2cli.set_cell(cell_name)
+        main.ONOS3cli.set_cell(cell_name)
+
+        time.sleep(10)
+
+        main.step("Start onos cli")
+        cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
+        cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
+        cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
+
+        main.step("Enable metrics feature")
+        main.ONOS1cli.feature_install("onos-app-metrics-topology")
+        main.ONOS2cli.feature_install("onos-app-metrics-topology")
+        main.ONOS3cli.feature_install("onos-app-metrics-topology")
+
+        utilities.assert_equals(expect=main.TRUE,
+                actual= cell_file_result and cell_apply_result and\
+                        verify_cell_result and checkout_result and\
+                        pull_result and mvn_result and\
+                        install1_result and install2_result and\
+                        install3_result,
+                onpass="ONOS started successfully",
+                onfail="Failed to start ONOS")
+
+    def CASE2(self, main):
+        '''
+        Assign s1 to ONOS1 and measure latency
+        
+        There are 4 levels of latency measurements to this test:
+        1) End-to-end measurement: Complete end-to-end measurement
+           from TCP (SYN/ACK) handshake to Graph change
+        2) OFP-to-graph measurement: 'ONOS processing' snippet of
+           measurement from OFP Vendor message to Graph change
+        3) OFP-to-device measurement: 'ONOS processing without 
+           graph change' snippet of measurement from OFP vendor
+           message to Device change timestamp
+        4) T0-to-device measurement: Measurement that includes
+           the switch handshake to devices timestamp without 
+           the graph view change. (TCP handshake -> Device 
+           change)
+        '''
+        import time
+        import subprocess
+        import json
+        import requests
+        import os
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+       
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+       
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+
+        debug_mode = main.params['TEST']['debugMode']
+
+        #Threshold for the test
+        threshold_str = main.params['TEST']['singleSwThreshold']
+        threshold_obj = threshold_str.split(",")
+        threshold_min = int(threshold_obj[0])
+        threshold_max = int(threshold_obj[1])
+
+        #List of switch add latency collected from
+        #all iterations
+        latency_end_to_end_list = []
+        latency_ofp_to_graph_list = []
+        latency_ofp_to_device_list = []
+        latency_t0_to_device_list = []
+
+        #Directory/file to store tshark results
+        tshark_of_output = "/tmp/tshark_of_topo.txt"
+        tshark_tcp_output = "/tmp/tshark_tcp_topo.txt"
+
+        #String to grep in tshark output
+        tshark_tcp_string = "TCP 74 "+default_sw_port
+        tshark_of_string = "OFP 86 Vendor"
+     
+        #Initialize assertion to TRUE
+        assertion = main.TRUE
+      
+        local_time = time.strftime('%x %X')
+        if debug_mode == 'on':
+            main.ONOS1.tshark_pcap("eth0",
+                    "/tmp/single_sw_lat_pcap"+local_time) 
+
+        main.log.report("Latency of adding one switch")
+
+        for i in range(0, int(num_iter)):
+            main.log.info("Starting tshark capture")
+
+            #* TCP [ACK, SYN] is used as t0_a, the
+            #  very first "exchange" between ONOS and 
+            #  the switch for end-to-end measurement
+            #* OFP [Stats Reply] is used for t0_b
+            #  the very last OFP message between ONOS
+            #  and the switch for ONOS measurement
+            main.ONOS1.tshark_grep(tshark_tcp_string,
+                    tshark_tcp_output)
+            main.ONOS1.tshark_grep(tshark_of_string,
+                    tshark_of_output)
+
+            #Wait and ensure tshark is started and 
+            #capturing
+            time.sleep(10)
+
+            main.log.info("Assigning s1 to controller")
+
+            main.Mininet1.assign_sw_controller(sw="1",
+                    ip1=ONOS1_ip, port1=default_sw_port)
+
+            #Wait and ensure switch is assigned
+            #before stopping tshark
+            time.sleep(30)
+   
+            main.log.info("Stopping all Tshark processes")
+            main.ONOS1.stop_tshark()
+
+            #tshark output is saved in ONOS. Use subprocess
+            #to copy over files to TestON for parsing
+            main.log.info("Copying over tshark files")
+            
+            #TCP CAPTURE ****
+            #Copy the tshark output from ONOS machine to
+            #TestON machine in tshark_tcp_output directory>file
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_tcp_output+" /tmp/") 
+            tcp_file = open(tshark_tcp_output, 'r')
+            temp_text = tcp_file.readline()
+            temp_text = temp_text.split(" ")
+
+            main.log.info("Object read in from TCP capture: "+
+                    str(temp_text))
+            if len(temp_text) > 1:
+                t0_tcp = float(temp_text[1])*1000.0
+            else:
+                main.log.error("Tshark output file for TCP"+
+                        " returned unexpected results")
+                t0_tcp = 0
+                assertion = main.FALSE
+            
+            tcp_file.close()
+            #****************
+
+            #OF CAPTURE ****
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_of_output+" /tmp/")
+            of_file = open(tshark_of_output, 'r')
+           
+            line_ofp = ""
+            #Read until last line of file
+            while True:
+                temp_text = of_file.readline()
+                if temp_text !='':
+                    line_ofp = temp_text
+                else:
+                    break 
+            obj = line_ofp.split(" ")
+            
+            main.log.info("Object read in from OFP capture: "+
+                    str(line_ofp))
+    
+            if len(line_ofp) > 1:
+                t0_ofp = float(obj[1])*1000.0
+            else:
+                main.log.error("Tshark output file for OFP"+
+                        " returned unexpected results")
+                t0_ofp = 0
+                assertion = main.FALSE
+            
+            of_file.close()
+            #****************
+           
+            json_str_1 = main.ONOS1cli.topology_events_metrics()
+            json_str_2 = main.ONOS2cli.topology_events_metrics()
+            json_str_3 = main.ONOS3cli.topology_events_metrics()
+
+            json_obj_1 = json.loads(json_str_1)
+            json_obj_2 = json.loads(json_str_2)
+            json_obj_3 = json.loads(json_str_3)
+
+            #Obtain graph timestamp. This timestsamp captures
+            #the epoch time at which the topology graph was updated.
+            graph_timestamp_1 = \
+                    json_obj_1[graphTimestamp]['value']
+            graph_timestamp_2 = \
+                    json_obj_2[graphTimestamp]['value']
+            graph_timestamp_3 = \
+                    json_obj_3[graphTimestamp]['value']
+
+            #Obtain device timestamp. This timestamp captures
+            #the epoch time at which the device event happened
+            device_timestamp_1 = \
+                    json_obj_1[deviceTimestamp]['value'] 
+            device_timestamp_2 = \
+                    json_obj_2[deviceTimestamp]['value'] 
+            device_timestamp_3 = \
+                    json_obj_3[deviceTimestamp]['value'] 
+
+            #t0 to device processing latency 
+            delta_device_1 = int(device_timestamp_1) - int(t0_tcp)
+            delta_device_2 = int(device_timestamp_2) - int(t0_tcp)
+            delta_device_3 = int(device_timestamp_3) - int(t0_tcp)
+        
+            #Get average of delta from all instances
+            avg_delta_device = \
+                    (int(delta_device_1)+\
+                     int(delta_device_2)+\
+                     int(delta_device_3)) / 3
+
+            #Ensure avg delta meets the threshold before appending
+            if avg_delta_device > 0.0 and avg_delta_device < 10000:
+                latency_t0_to_device_list.append(avg_delta_device)
+            else:
+                main.log.info("Results for t0-to-device ignored"+\
+                        "due to excess in threshold")
+
+            #t0 to graph processing latency (end-to-end)
+            delta_graph_1 = int(graph_timestamp_1) - int(t0_tcp)
+            delta_graph_2 = int(graph_timestamp_2) - int(t0_tcp)
+            delta_graph_3 = int(graph_timestamp_3) - int(t0_tcp)
+        
+            #Get average of delta from all instances
+            avg_delta_graph = \
+                    (int(delta_graph_1)+\
+                     int(delta_graph_2)+\
+                     int(delta_graph_3)) / 3
+
+            #Ensure avg delta meets the threshold before appending
+            if avg_delta_graph > 0.0 and avg_delta_graph < 10000:
+                latency_end_to_end_list.append(avg_delta_graph)
+            else:
+                main.log.info("Results for end-to-end ignored"+\
+                        "due to excess in threshold")
+
+            #ofp to graph processing latency (ONOS processing)
+            delta_ofp_graph_1 = int(graph_timestamp_1) - int(t0_ofp)
+            delta_ofp_graph_2 = int(graph_timestamp_2) - int(t0_ofp)
+            delta_ofp_graph_3 = int(graph_timestamp_3) - int(t0_ofp)
+            
+            avg_delta_ofp_graph = \
+                    (int(delta_ofp_graph_1)+\
+                     int(delta_ofp_graph_2)+\
+                     int(delta_ofp_graph_3)) / 3
+            
+            if avg_delta_ofp_graph > threshold_min \
+                    and avg_delta_ofp_graph < threshold_max:
+                latency_ofp_to_graph_list.append(avg_delta_ofp_graph)
+            else:
+                main.log.info("Results for ofp-to-graph "+\
+                        "ignored due to excess in threshold")
+
+            #ofp to device processing latency (ONOS processing)
+            delta_ofp_device_1 = float(device_timestamp_1) - float(t0_ofp)
+            delta_ofp_device_2 = float(device_timestamp_2) - float(t0_ofp)
+            delta_ofp_device_3 = float(device_timestamp_3) - float(t0_ofp)
+            
+            avg_delta_ofp_device = \
+                    (float(delta_ofp_device_1)+\
+                     float(delta_ofp_device_2)+\
+                     float(delta_ofp_device_3)) / 3.0
+            
+            #NOTE: ofp - delta measurements are occasionally negative
+            #      due to system time misalignment.
+            latency_ofp_to_device_list.append(avg_delta_ofp_device)
+
+            #TODO:
+            #Fetch logs upon threshold excess
+
+            main.log.info("ONOS1 delta end-to-end: "+
+                    str(delta_graph_1) + " ms")
+            main.log.info("ONOS2 delta end-to-end: "+
+                    str(delta_graph_2) + " ms")
+            main.log.info("ONOS3 delta end-to-end: "+
+                    str(delta_graph_3) + " ms")
+
+            main.log.info("ONOS1 delta OFP - graph: "+
+                    str(delta_ofp_graph_1) + " ms")
+            main.log.info("ONOS2 delta OFP - graph: "+
+                    str(delta_ofp_graph_2) + " ms")
+            main.log.info("ONOS3 delta OFP - graph: "+
+                    str(delta_ofp_graph_3) + " ms")
+            
+            main.log.info("ONOS1 delta device - t0: "+
+                    str(delta_device_1) + " ms")
+            main.log.info("ONOS2 delta device - t0: "+
+                    str(delta_device_2) + " ms")
+            main.log.info("ONOS3 delta device - t0: "+
+                    str(delta_device_3) + " ms")
+          
+            #main.log.info("ONOS1 delta OFP - device: "+
+            #        str(delta_ofp_device_1) + " ms")
+            #main.log.info("ONOS2 delta OFP - device: "+
+            #        str(delta_ofp_device_2) + " ms")
+            #main.log.info("ONOS3 delta OFP - device: "+
+            #        str(delta_ofp_device_3) + " ms")
+
+            main.step("Remove switch from controller")
+            main.Mininet1.delete_sw_controller("s1")
+
+            time.sleep(5)
+
+        #END of for loop iteration
+
+        #If there is at least 1 element in each list,
+        #pass the test case
+        if len(latency_end_to_end_list) > 0 and\
+           len(latency_ofp_to_graph_list) > 0 and\
+           len(latency_ofp_to_device_list) > 0 and\
+           len(latency_t0_to_device_list) > 0:
+            assertion = main.TRUE
+        elif len(latency_end_to_end_list) == 0:
+            #The appending of 0 here is to prevent 
+            #the min,max,sum functions from failing 
+            #below
+            latency_end_to_end_list.append(0)
+            assertion = main.FALSE
+        elif len(latency_ofp_to_graph_list) == 0:
+            latency_ofp_to_graph_list.append(0)
+            assertion = main.FALSE
+        elif len(latency_ofp_to_device_list) == 0:
+            latency_ofp_to_device_list.append(0)
+            assertion = main.FALSE
+        elif len(latency_t0_to_device_list) == 0:
+            latency_t0_to_device_list.append(0)
+            assertion = main.FALSE
+
+        #Calculate min, max, avg of latency lists
+        latency_end_to_end_max = \
+                int(max(latency_end_to_end_list))
+        latency_end_to_end_min = \
+                int(min(latency_end_to_end_list))
+        latency_end_to_end_avg = \
+                (int(sum(latency_end_to_end_list)) / \
+                 len(latency_end_to_end_list))
+   
+        latency_ofp_to_graph_max = \
+                int(max(latency_ofp_to_graph_list))
+        latency_ofp_to_graph_min = \
+                int(min(latency_ofp_to_graph_list))
+        latency_ofp_to_graph_avg = \
+                (int(sum(latency_ofp_to_graph_list)) / \
+                 len(latency_ofp_to_graph_list))
+
+        latency_ofp_to_device_max = \
+                int(max(latency_ofp_to_device_list))
+        latency_ofp_to_device_min = \
+                int(min(latency_ofp_to_device_list))
+        latency_ofp_to_device_avg = \
+                (int(sum(latency_ofp_to_device_list)) / \
+                 len(latency_ofp_to_device_list))
+
+        latency_t0_to_device_max = \
+                float(max(latency_t0_to_device_list))
+        latency_t0_to_device_min = \
+                float(min(latency_t0_to_device_list))
+        latency_t0_to_device_avg = \
+                (float(sum(latency_t0_to_device_list)) / \
+                 len(latency_ofp_to_device_list))
+
+        main.log.report("Switch add - End-to-end latency: \n"+\
+                "Min: "+str(latency_end_to_end_min)+" mx\n"+\
+                "Max: "+str(latency_end_to_end_max)+" ms\n"+\
+                "Avg: "+str(latency_end_to_end_avg)+" ms")
+        main.log.report("Switch add - OFP-to-Graph latency: \n"+\
+                "Min: "+str(latency_ofp_to_graph_min)+" ms \n"+\
+                "Max: "+str(latency_ofp_to_graph_max)+" ms\n"+\
+                "Avg: "+str(latency_ofp_to_graph_avg)+" ms")
+        main.log.report("Switch add - t0-to-Device latency: \n"+\
+                "Min: "+str(latency_t0_to_device_min)+" ms\n"+\
+                "Max: "+str(latency_t0_to_device_max)+" ms\n"+\
+                "Avg: "+str(latency_t0_to_device_avg)+" ms")
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass="Switch latency test successful",
+                onfail="Switch latency test failed")
+
+    def CASE3(self, main):
+        '''
+        Bring port up / down and measure latency.
+        Port enable / disable is simulated by ifconfig up / down
+        
+        In ONOS-next, we must ensure that the port we are 
+        manipulating is connected to another switch with a valid
+        connection. Otherwise, graph view will not be updated.
+        '''
+        import time
+        import subprocess
+        import os
+        import requests
+        import json
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+      
+        assertion = main.TRUE
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+       
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+        
+        debug_mode = main.params['TEST']['debugMode']
+
+        local_time = time.strftime('%x %X')
+        if debug_mode == 'on':
+            main.ONOS1.tshark_pcap("eth0",
+                    "/tmp/port_lat_pcap"+local_time) 
+
+        #Threshold for this test case
+        up_threshold_str = main.params['TEST']['portUpThreshold']
+        down_threshold_str = main.params['TEST']['portDownThreshold']
+        up_threshold_obj = up_threshold_str.split(",")
+        down_threshold_obj = down_threshold_str.split(",")
+
+        up_threshold_min = int(up_threshold_obj[0])
+        up_threshold_max = int(up_threshold_obj[1])
+
+        down_threshold_min = int(down_threshold_obj[0])
+        down_threshold_max = int(down_threshold_obj[1])
+
+        #NOTE: Some hardcoded variables you may need to configure
+        #      besides the params
+            
+        tshark_port_status = "OFP 130 Port Status"
+
+        tshark_port_up = "/tmp/tshark_port_up.txt"
+        tshark_port_down = "/tmp/tshark_port_down.txt"
+        interface_config = "s1-eth1"
+
+        main.log.report("Port enable / disable latency")
+
+        main.step("Assign switches s1 and s2 to controller 1")
+        main.Mininet1.assign_sw_controller(sw="1",ip1=ONOS1_ip,
+                port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(sw="2",ip1=ONOS1_ip,
+                port1=default_sw_port)
+
+        #Give enough time for metrics to propagate the 
+        #assign controller event. Otherwise, these events may
+        #carry over to our measurements
+        time.sleep(10)
+
+        main.step("Verify switch is assigned correctly")
+        result_s1 = main.Mininet1.get_sw_controller(sw="s1")
+        result_s2 = main.Mininet1.get_sw_controller(sw="s2")
+        if result_s1 == main.FALSE or result_s2 == main.FALSE:
+            main.log.info("Switch s1 was not assigned correctly")
+            assertion = main.FALSE
+        else:
+            main.log.info("Switch s1 was assigned correctly")
+
+        port_up_device_to_ofp_list = []
+        port_up_graph_to_ofp_list = []
+        port_down_device_to_ofp_list = []
+        port_down_graph_to_ofp_list = []
+
+        for i in range(0, int(num_iter)):
+            main.step("Starting wireshark capture for port status down")
+            main.ONOS1.tshark_grep(tshark_port_status,
+                    tshark_port_down)
+            
+            time.sleep(10)
+
+            #Disable interface that is connected to switch 2
+            main.step("Disable port: "+interface_config)
+            main.Mininet2.handle.sendline("sudo ifconfig "+
+                    interface_config+" down")
+            main.Mininet2.handle.expect("\$")
+            time.sleep(10)
+
+            main.ONOS1.tshark_stop()
+            time.sleep(5)
+            
+            #Copy tshark output file from ONOS to TestON instance
+            #/tmp directory
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_port_down+" /tmp/")
+
+            f_port_down = open(tshark_port_down, 'r')
+            #Get first line of port down event from tshark
+            f_line = f_port_down.readline()
+            obj_down = f_line.split(" ")
+            if len(f_line) > 0:
+                timestamp_begin_pt_down = int(float(obj_down[1]))*1000
+                main.log.info("Port down begin timestamp: "+
+                        str(timestamp_begin_pt_down))
+            else:
+                main.log.info("Tshark output file returned unexpected"+
+                        " results: "+str(obj_down))
+                timestamp_begin_pt_down = 0
+            
+            f_port_down.close()
+
+            main.log.info("TEST tshark obj: "+str(obj_down))
+
+            main.step("Obtain t1 by REST call")
+            json_str_1 = main.ONOS1cli.topology_events_metrics()
+            json_str_2 = main.ONOS2cli.topology_events_metrics()
+            json_str_3 = main.ONOS3cli.topology_events_metrics()
+
+            main.log.info("TEST json_str 1: "+str(json_str_1))
+
+            json_obj_1 = json.loads(json_str_1)
+            json_obj_2 = json.loads(json_str_2)
+            json_obj_3 = json.loads(json_str_3)
+           
+            time.sleep(5)
+
+            #Obtain graph timestamp. This timestsamp captures
+            #the epoch time at which the topology graph was updated.
+            graph_timestamp_1 = \
+                    json_obj_1[graphTimestamp]['value']
+            graph_timestamp_2 = \
+                    json_obj_2[graphTimestamp]['value']
+            graph_timestamp_3 = \
+                    json_obj_3[graphTimestamp]['value']
+
+            #Obtain device timestamp. This timestamp captures
+            #the epoch time at which the device event happened
+            device_timestamp_1 = \
+                    json_obj_1[deviceTimestamp]['value'] 
+            device_timestamp_2 = \
+                    json_obj_2[deviceTimestamp]['value'] 
+            device_timestamp_3 = \
+                    json_obj_3[deviceTimestamp]['value'] 
+
+            #Get delta between graph event and OFP 
+            pt_down_graph_to_ofp_1 = int(graph_timestamp_1) -\
+                    int(timestamp_begin_pt_down)
+            pt_down_graph_to_ofp_2 = int(graph_timestamp_2) -\
+                    int(timestamp_begin_pt_down)
+            pt_down_graph_to_ofp_3 = int(graph_timestamp_3) -\
+                    int(timestamp_begin_pt_down)
+
+            #Get delta between device event and OFP
+            pt_down_device_to_ofp_1 = int(device_timestamp_1) -\
+                    int(timestamp_begin_pt_down)
+            pt_down_device_to_ofp_2 = int(device_timestamp_2) -\
+                    int(timestamp_begin_pt_down)
+            pt_down_device_to_ofp_3 = int(device_timestamp_3) -\
+                    int(timestamp_begin_pt_down)
+       
+            #Caluclate average across clusters
+            pt_down_graph_to_ofp_avg =\
+                    (int(pt_down_graph_to_ofp_1) +
+                     int(pt_down_graph_to_ofp_2) + 
+                     int(pt_down_graph_to_ofp_3)) / 3.0
+            pt_down_device_to_ofp_avg = \
+                    (int(pt_down_device_to_ofp_1) + 
+                     int(pt_down_device_to_ofp_2) +
+                     int(pt_down_device_to_ofp_3)) / 3.0
+
+            if pt_down_graph_to_ofp_avg > 0.0 and \
+                    pt_down_graph_to_ofp_avg < 1000:
+                port_down_graph_to_ofp_list.append(
+                    pt_down_graph_to_ofp_avg)
+                main.log.info("Port down: graph to ofp avg: "+
+                    str(pt_down_graph_to_ofp_avg) + " ms")
+            else:
+                main.log.info("Average port down graph-to-ofp result" +
+                        " exceeded the threshold: "+
+                        str(pt_down_graph_to_ofp_avg))
+
+            if pt_down_device_to_ofp_avg > 0 and \
+                    pt_down_device_to_ofp_avg < 1000:
+                port_down_device_to_ofp_list.append(
+                    pt_down_device_to_ofp_avg)
+                main.log.info("Port down: device to ofp avg: "+
+                    str(pt_down_device_to_ofp_avg) + " ms")
+            else:
+                main.log.info("Average port down device-to-ofp result" +
+                        " exceeded the threshold: "+
+                        str(pt_down_device_to_ofp_avg))
+
+            #Port up events 
+            main.step("Enable port and obtain timestamp")
+            main.step("Starting wireshark capture for port status up")
+            main.ONOS1.tshark_grep("OFP 130 Port Status", tshark_port_up)
+            time.sleep(5)
+
+            main.Mininet2.handle.sendline("sudo ifconfig "+
+                    interface_config+" up")
+            main.Mininet2.handle.expect("\$")
+            time.sleep(10)
+            
+            main.ONOS1.tshark_stop()
+
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_port_up+" /tmp/")
+
+            f_port_up = open(tshark_port_up, 'r')
+            f_line = f_port_up.readline()
+            obj_up = f_line.split(" ")
+            if len(f_line) > 0:
+                timestamp_begin_pt_up = int(float(obj_up[1]))*1000
+                main.log.info("Port up begin timestamp: "+
+                        str(timestamp_begin_pt_up))
+            else:
+                main.log.info("Tshark output file returned unexpected"+
+                        " results.")
+                timestamp_begin_pt_up = 0
+            
+            f_port_up.close()
+
+            main.step("Obtain t1 by REST call")
+            json_str_1 = main.ONOS1cli.topology_events_metrics()
+            json_str_2 = main.ONOS2cli.topology_events_metrics()
+            json_str_3 = main.ONOS3cli.topology_events_metrics()
+
+            json_obj_1 = json.loads(json_str_1)
+            json_obj_2 = json.loads(json_str_2)
+            json_obj_3 = json.loads(json_str_3)
+
+            #Obtain graph timestamp. This timestsamp captures
+            #the epoch time at which the topology graph was updated.
+            graph_timestamp_1 = \
+                    json_obj_1[graphTimestamp]['value']
+            graph_timestamp_2 = \
+                    json_obj_2[graphTimestamp]['value']
+            graph_timestamp_3 = \
+                    json_obj_3[graphTimestamp]['value']
+
+            #Obtain device timestamp. This timestamp captures
+            #the epoch time at which the device event happened
+            device_timestamp_1 = \
+                    json_obj_1[deviceTimestamp]['value'] 
+            device_timestamp_2 = \
+                    json_obj_2[deviceTimestamp]['value'] 
+            device_timestamp_3 = \
+                    json_obj_3[deviceTimestamp]['value'] 
+
+            #Get delta between graph event and OFP 
+            pt_up_graph_to_ofp_1 = int(graph_timestamp_1) -\
+                    int(timestamp_begin_pt_up)
+            pt_up_graph_to_ofp_2 = int(graph_timestamp_2) -\
+                    int(timestamp_begin_pt_up)
+            pt_up_graph_to_ofp_3 = int(graph_timestamp_3) -\
+                    int(timestamp_begin_pt_up)
+
+            #Get delta between device event and OFP
+            pt_up_device_to_ofp_1 = int(device_timestamp_1) -\
+                    int(timestamp_begin_pt_up)
+            pt_up_device_to_ofp_2 = int(device_timestamp_2) -\
+                    int(timestamp_begin_pt_up)
+            pt_up_device_to_ofp_3 = int(device_timestamp_3) -\
+                    int(timestamp_begin_pt_up)
+
+            pt_up_graph_to_ofp_avg = \
+                    (float(pt_up_graph_to_ofp_1) + 
+                     float(pt_up_graph_to_ofp_2) +
+                     float(pt_up_graph_to_ofp_3)) / 3
+
+            pt_up_device_to_ofp_avg = \
+                    (float(pt_up_device_to_ofp_1) + 
+                     float(pt_up_device_to_ofp_2) +
+                     float(pt_up_device_to_ofp_3)) / 3
+
+            if pt_up_graph_to_ofp_avg > up_threshold_min and \
+                    pt_up_graph_to_ofp_avg < up_threshold_max: 
+                port_up_graph_to_ofp_list.append(
+                        pt_up_graph_to_ofp_avg)
+                main.log.info("Port down: graph to ofp avg: "+
+                    str(pt_up_graph_to_ofp_avg) + " ms")
+            else:
+                main.log.info("Average port up graph-to-ofp result"+
+                        " exceeded the threshold: "+
+                        str(pt_up_graph_to_ofp_avg))
+            
+            if pt_up_device_to_ofp_avg > up_threshold_min and \
+                    pt_up_device_to_ofp_avg < up_threshold_max:
+                port_up_device_to_ofp_list.append(
+                        pt_up_device_to_ofp_avg)
+                main.log.info("Port up: device to ofp avg: "+
+                    str(pt_up_device_to_ofp_avg) + " ms")
+            else:
+                main.log.info("Average port up device-to-ofp result"+
+                        " exceeded the threshold: "+
+                        str(pt_up_device_to_ofp_avg))
+            
+            #END ITERATION FOR LOOP
+        
+        #Check all list for latency existence and set assertion
+        if (port_down_graph_to_ofp_list and port_down_device_to_ofp_list\
+           and port_up_graph_to_ofp_list and port_up_device_to_ofp_list):
+            assertion = main.TRUE
+
+        #Calculate and report latency measurements
+        port_down_graph_to_ofp_min = min(port_down_graph_to_ofp_list)
+        port_down_graph_to_ofp_max = max(port_down_graph_to_ofp_list)
+        port_down_graph_to_ofp_avg = \
+                (sum(port_down_graph_to_ofp_list) / 
+                 len(port_down_graph_to_ofp_list))
+        
+        main.log.report("Port down graph-to-ofp \nMin: "+
+                str(port_down_graph_to_ofp_min)+" ms  \nMax: "+
+                str(port_down_graph_to_ofp_max)+" ms  \nAvg: "+
+                str(port_down_graph_to_ofp_avg)+" ms")
+        
+        port_down_device_to_ofp_min = min(port_down_device_to_ofp_list)
+        port_down_device_to_ofp_max = max(port_down_device_to_ofp_list)
+        port_down_device_to_ofp_avg = \
+                (sum(port_down_device_to_ofp_list) /\
+                 len(port_down_device_to_ofp_list))
+        
+        main.log.report("Port down device-to-ofp \nMin: "+
+                str(port_down_device_to_ofp_min)+" ms  \nMax: "+
+                str(port_down_device_to_ofp_max)+" ms  \nAvg: "+
+                str(port_down_device_to_ofp_avg)+" ms")
+        
+        port_up_graph_to_ofp_min = min(port_up_graph_to_ofp_list)
+        port_up_graph_to_ofp_max = max(port_up_graph_to_ofp_list)
+        port_up_graph_to_ofp_avg = \
+                (sum(port_up_graph_to_ofp_list) /\
+                 len(port_up_graph_to_ofp_list))
+        
+        main.log.report("Port up graph-to-ofp \nMin: "+
+                str(port_up_graph_to_ofp_min)+" ms  \nMax: "+
+                str(port_up_graph_to_ofp_max)+" ms  \nAvg: "+
+                str(port_up_graph_to_ofp_avg)+" ms")
+          
+        port_up_device_to_ofp_min = min(port_up_device_to_ofp_list)
+        port_up_device_to_ofp_max = max(port_up_device_to_ofp_list)
+        port_up_device_to_ofp_avg = \
+                (sum(port_up_device_to_ofp_list) /\
+                 len(port_up_device_to_ofp_list))
+        
+        main.log.report("Port up device-to-ofp \nMin: "+
+                str(port_up_device_to_ofp_min)+" ms  \nMax: "+
+                str(port_up_device_to_ofp_max)+" ms  \nAvg: "+
+                str(port_up_device_to_ofp_avg)+" ms")
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass="Port discovery latency calculation successful",
+                onfail="Port discovery test failed")
+
+    def CASE4(self, main):
+        '''
+        Link down event using loss rate 100%
+        
+        Important:
+            Use a simple 2 switch topology with 1 link between
+            the two switches. Ensure that mac addresses of the 
+            switches are 1 / 2 respectively
+        '''
+        import time
+        import subprocess
+        import os
+        import requests
+        import json
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+       
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+       
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        linkTimestamp = main.params['JSON']['linkTimestamp'] 
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+        
+        debug_mode = main.params['TEST']['debugMode']
+
+        local_time = time.strftime('%x %X')
+        if debug_mode == 'on':
+            main.ONOS1.tshark_pcap("eth0",
+                    "/tmp/link_lat_pcap"+local_time) 
+
+        #Threshold for this test case
+        up_threshold_str = main.params['TEST']['linkUpThreshold']
+        down_threshold_str = main.params['TEST']['linkDownThreshold']
+
+        up_threshold_obj = up_threshold_str.split(",")
+        down_threshold_obj = down_threshold_str.split(",")
+
+        up_threshold_min = int(up_threshold_obj[0])
+        up_threshold_max = int(up_threshold_obj[1])
+
+        down_threshold_min = int(down_threshold_obj[0])
+        down_threshold_max = int(down_threshold_obj[1])
+
+        assertion = main.TRUE
+        #Link event timestamp to system time list
+        link_down_link_to_system_list = []
+        link_up_link_to_system_list = []
+        #Graph event timestamp to system time list
+        link_down_graph_to_system_list = []
+        link_up_graph_to_system_list = [] 
+
+        main.log.report("Add / remove link latency between "+
+                "two switches")
+
+        main.step("Assign all switches")
+        main.Mininet1.assign_sw_controller(sw="1",
+                ip1=ONOS1_ip, port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(sw="2",
+                ip1=ONOS1_ip, port1=default_sw_port)
+
+        main.step("Verifying switch assignment")
+        result_s1 = main.Mininet1.get_sw_controller(sw="s1")
+        result_s2 = main.Mininet1.get_sw_controller(sw="s2")
+          
+        #Allow time for events to finish before taking measurements
+        time.sleep(10)
+
+        link_down1 = False
+        link_down2 = False
+        link_down3 = False
+        #Start iteration of link event test
+        for i in range(0, int(num_iter)):
+            main.step("Getting initial system time as t0")
+            
+            timestamp_link_down_t0 = time.time() * 1000
+            #Link down is simulated by 100% loss rate using traffic 
+            #control command
+            main.Mininet1.handle.sendline(
+                    "sh tc qdisc add dev s1-eth1 root netem loss 100%")
+
+            #TODO: Iterate through 'links' command to verify that
+            #      link s1 -> s2 went down (loop timeout 30 seconds) 
+            #      on all 3 ONOS instances
+            main.log.info("Checking ONOS for link update")
+            loop_count = 0
+            while( not (link_down1 and link_down2 and link_down3)\
+                    and loop_count < 30 ):
+                json_str1 = main.ONOS1cli.links()
+                json_str2 = main.ONOS2cli.links()
+                json_str3 = main.ONOS3cli.links()
+                
+                if not (json_str1 and json_str2 and json_str3):
+                    main.log.error("CLI command returned error ")
+                    break
+                else:
+                    json_obj1 = json.loads(json_str1)
+                    json_obj2 = json.loads(json_str2)
+                    json_obj3 = json.loads(json_str3)
+                for obj1 in json_obj1:
+                    if '01' not in obj1['src']['device']:
+                        link_down1 = True
+                        main.log.report("Link down from "+
+                                "s1 -> s2 on ONOS1 detected")
+                for obj2 in json_obj2:
+                    if '01' not in obj2['src']['device']:
+                        link_down2 = True
+                        main.log.report("Link down from "+
+                                "s1 -> s2 on ONOS2 detected")
+                for obj3 in json_obj3:
+                    if '01' not in obj3['src']['device']:
+                        link_down3 = True
+                        main.log.report("Link down from "+
+                                "s1 -> s2 on ONOS3 detected")
+                
+                loop_count += 1
+                #If CLI doesn't like the continuous requests
+                #and exits in this loop, increase the sleep here.
+                #Consequently, while loop timeout will increase
+                time.sleep(1)
+    
+            #Give time for metrics measurement to catch up
+            #NOTE: May need to be configured more accurately
+            time.sleep(10)
+            #If we exited the while loop and link down 1,2,3 are still 
+            #false, then ONOS has failed to discover link down event
+            if not (link_down1 and link_down2 and link_down3):
+                main.log.info("Link down discovery failed")
+                
+                link_down_lat_graph1 = 0
+                link_down_lat_graph2 = 0
+                link_down_lat_graph3 = 0
+                link_down_lat_device1 = 0
+                link_down_lat_device2 = 0
+                link_down_lat_device3 = 0
+                
+                assertion = main.FALSE
+            else:
+                json_topo_metrics_1 =\
+                        main.ONOS1cli.topology_events_metrics()
+                json_topo_metrics_2 =\
+                        main.ONOS2cli.topology_events_metrics()
+                json_topo_metrics_3 =\
+                        main.ONOS3cli.topology_events_metrics()
+                json_topo_metrics_1 = json.loads(json_topo_metrics_1)
+                json_topo_metrics_2 = json.loads(json_topo_metrics_2)
+                json_topo_metrics_3 = json.loads(json_topo_metrics_3)
+
+                main.log.info("Obtaining graph and device timestamp")
+                graph_timestamp_1 = \
+                    json_topo_metrics_1[graphTimestamp]['value']
+                graph_timestamp_2 = \
+                    json_topo_metrics_2[graphTimestamp]['value']
+                graph_timestamp_3 = \
+                    json_topo_metrics_3[graphTimestamp]['value']
+
+                link_timestamp_1 = \
+                    json_topo_metrics_1[linkTimestamp]['value']
+                link_timestamp_2 = \
+                    json_topo_metrics_2[linkTimestamp]['value']
+                link_timestamp_3 = \
+                    json_topo_metrics_3[linkTimestamp]['value']
+
+                if graph_timestamp_1 and graph_timestamp_2 and\
+                        graph_timestamp_3 and link_timestamp_1 and\
+                        link_timestamp_2 and link_timestamp_3:
+                    link_down_lat_graph1 = int(graph_timestamp_1) -\
+                            timestamp_link_down_t0
+                    link_down_lat_graph2 = int(graph_timestamp_2) -\
+                            timestamp_link_down_t0
+                    link_down_lat_graph3 = int(graph_timestamp_3) -\
+                            timestamp_link_down_t0
+                
+                    link_down_lat_link1 = int(link_timestamp_1) -\
+                            timestamp_link_down_t0
+                    link_down_lat_link2 = int(link_timestamp_2) -\
+                            timestamp_link_down_t0
+                    link_down_lat_link3 = int(link_timestamp_3) -\
+                            timestamp_link_down_t0
+                else:
+                    main.log.error("There was an error calculating"+
+                        " the delta for link down event")
+                    link_down_lat_graph1 = 0
+                    link_down_lat_graph2 = 0
+                    link_down_lat_graph3 = 0
+                    
+                    link_down_lat_device1 = 0
+                    link_down_lat_device2 = 0
+                    link_down_lat_device3 = 0
+        
+            main.log.report("Link down latency ONOS1 iteration "+
+                    str(i)+" (end-to-end): "+
+                    str(link_down_lat_graph1)+" ms")
+            main.log.report("Link down latency ONOS2 iteration "+
+                    str(i)+" (end-to-end): "+
+                    str(link_down_lat_graph2)+" ms")
+            main.log.report("Link down latency ONOS3 iteration "+
+                    str(i)+" (end-to-end): "+
+                    str(link_down_lat_graph3)+" ms")
+            
+            main.log.report("Link down latency ONOS1 iteration "+
+                    str(i)+" (link-event-to-system-timestamp): "+
+                    str(link_down_lat_link1)+" ms")
+            main.log.report("Link down latency ONOS2 iteration "+
+                    str(i)+" (link-event-to-system-timestamp): "+
+                    str(link_down_lat_link2)+" ms")
+            main.log.report("Link down latency ONOS3 iteration "+
+                    str(i)+" (link-event-to-system-timestamp): "+
+                    str(link_down_lat_link3))
+      
+            #Calculate avg of node calculations
+            link_down_lat_graph_avg =\
+                    (link_down_lat_graph1 +
+                     link_down_lat_graph2 +
+                     link_down_lat_graph3) / 3.0
+            link_down_lat_link_avg =\
+                    (link_down_lat_link1 +
+                     link_down_lat_link2 +
+                     link_down_lat_link3) / 3.0
+
+            #Set threshold and append latency to list
+            if link_down_lat_graph_avg > down_threshold_min and\
+               link_down_lat_graph_avg < down_threshold_max:
+                link_down_graph_to_system_list.append(
+                        link_down_lat_graph_avg)
+            else:
+                main.log.info("Link down latency exceeded threshold")
+                main.log.info("Results for iteration "+str(i)+
+                        "have been omitted")
+            if link_down_lat_link_avg > down_threshold_min and\
+               link_down_lat_link_avg < down_threshold_max:
+                link_down_link_to_system_list.append(
+                        link_down_lat_link_avg)
+            else:
+                main.log.info("Link down latency exceeded threshold")
+                main.log.info("Results for iteration "+str(i)+
+                        "have been omitted")
+
+            #NOTE: To remove loss rate and measure latency:
+            #       'sh tc qdisc del dev s1-eth1 root'
+            timestamp_link_up_t0 = time.time() * 1000
+            main.Mininet1.handle.sendline("sh tc qdisc del dev "+
+                    "s1-eth1 root")
+            main.Mininet1.handle.expect("mininet>")
+            
+            main.log.info("Checking ONOS for link update")
+            
+            link_down1 = True
+            link_down2 = True
+            link_down3 = True
+            loop_count = 0
+            while( (link_down1 and link_down2 and link_down3)\
+                    and loop_count < 30 ):
+                json_str1 = main.ONOS1cli.links()
+                json_str2 = main.ONOS2cli.links()
+                json_str3 = main.ONOS3cli.links()
+                if not (json_str1 and json_str2 and json_str3):
+                    main.log.error("CLI command returned error ")
+                    break
+                else:
+                    json_obj1 = json.loads(json_str1)
+                    json_obj2 = json.loads(json_str2)
+                    json_obj3 = json.loads(json_str3)
+                
+                for obj1 in json_obj1:
+                    if '01' in obj1['src']['device']:
+                        link_down1 = False 
+                        main.log.report("Link up from "+
+                            "s1 -> s2 on ONOS1 detected")
+                for obj2 in json_obj2:
+                    if '01' in obj2['src']['device']:
+                        link_down2 = False 
+                        main.log.report("Link up from "+
+                            "s1 -> s2 on ONOS2 detected")
+                for obj3 in json_obj3:
+                    if '01' in obj3['src']['device']:
+                        link_down3 = False 
+                        main.log.report("Link up from "+
+                            "s1 -> s2 on ONOS3 detected")
+                
+                loop_count += 1
+                time.sleep(1)
+            
+            if (link_down1 and link_down2 and link_down3):
+                main.log.info("Link up discovery failed")
+                
+                link_up_lat_graph1 = 0
+                link_up_lat_graph2 = 0
+                link_up_lat_graph3 = 0
+                link_up_lat_device1 = 0
+                link_up_lat_device2 = 0
+                link_up_lat_device3 = 0
+                
+                assertion = main.FALSE
+            else:
+                json_topo_metrics_1 =\
+                        main.ONOS1cli.topology_events_metrics()
+                json_topo_metrics_2 =\
+                        main.ONOS2cli.topology_events_metrics()
+                json_topo_metrics_3 =\
+                        main.ONOS3cli.topology_events_metrics()
+                json_topo_metrics_1 = json.loads(json_topo_metrics_1)
+                json_topo_metrics_2 = json.loads(json_topo_metrics_2)
+                json_topo_metrics_3 = json.loads(json_topo_metrics_3)
+
+                main.log.info("Obtaining graph and device timestamp")
+                graph_timestamp_1 = \
+                    json_topo_metrics_1[graphTimestamp]['value']
+                graph_timestamp_2 = \
+                    json_topo_metrics_2[graphTimestamp]['value']
+                graph_timestamp_3 = \
+                    json_topo_metrics_3[graphTimestamp]['value']
+
+                link_timestamp_1 = \
+                    json_topo_metrics_1[linkTimestamp]['value']
+                link_timestamp_2 = \
+                    json_topo_metrics_2[linkTimestamp]['value']
+                link_timestamp_3 = \
+                    json_topo_metrics_3[linkTimestamp]['value']
+
+                if graph_timestamp_1 and graph_timestamp_2 and\
+                        graph_timestamp_3 and link_timestamp_1 and\
+                        link_timestamp_2 and link_timestamp_3:
+                    link_up_lat_graph1 = int(graph_timestamp_1) -\
+                            timestamp_link_up_t0
+                    link_up_lat_graph2 = int(graph_timestamp_2) -\
+                            timestamp_link_up_t0
+                    link_up_lat_graph3 = int(graph_timestamp_3) -\
+                            timestamp_link_up_t0
+                
+                    link_up_lat_link1 = int(link_timestamp_1) -\
+                            timestamp_link_up_t0
+                    link_up_lat_link2 = int(link_timestamp_2) -\
+                            timestamp_link_up_t0
+                    link_up_lat_link3 = int(link_timestamp_3) -\
+                            timestamp_link_up_t0
+                else:
+                    main.log.error("There was an error calculating"+
+                        " the delta for link down event")
+                    link_up_lat_graph1 = 0
+                    link_up_lat_graph2 = 0
+                    link_up_lat_graph3 = 0
+                    
+                    link_up_lat_device1 = 0
+                    link_up_lat_device2 = 0
+                    link_up_lat_device3 = 0
+       
+            if debug_mode == 'on':
+                main.log.info("Link up latency ONOS1 iteration "+
+                    str(i)+" (end-to-end): "+
+                    str(link_up_lat_graph1)+" ms")
+                main.log.info("Link up latency ONOS2 iteration "+
+                    str(i)+" (end-to-end): "+
+                    str(link_up_lat_graph2)+" ms")
+                main.log.info("Link up latency ONOS3 iteration "+
+                    str(i)+" (end-to-end): "+
+                    str(link_up_lat_graph3)+" ms")
+            
+                main.log.info("Link up latency ONOS1 iteration "+
+                    str(i)+" (link-event-to-system-timestamp): "+
+                    str(link_up_lat_link1)+" ms")
+                main.log.info("Link up latency ONOS2 iteration "+
+                    str(i)+" (link-event-to-system-timestamp): "+
+                    str(link_up_lat_link2)+" ms")
+                main.log.info("Link up latency ONOS3 iteration "+
+                    str(i)+" (link-event-to-system-timestamp): "+
+                    str(link_up_lat_link3))
+      
+            #Calculate avg of node calculations
+            link_up_lat_graph_avg =\
+                    (link_up_lat_graph1 +
+                     link_up_lat_graph2 +
+                     link_up_lat_graph3) / 3.0
+            link_up_lat_link_avg =\
+                    (link_up_lat_link1 +
+                     link_up_lat_link2 +
+                     link_up_lat_link3) / 3.0
+
+            #Set threshold and append latency to list
+            if link_up_lat_graph_avg > up_threshold_min and\
+               link_up_lat_graph_avg < up_threshold_max:
+                link_up_graph_to_system_list.append(
+                        link_up_lat_graph_avg)
+            else:
+                main.log.info("Link up latency exceeded threshold")
+                main.log.info("Results for iteration "+str(i)+
+                        "have been omitted")
+            if link_up_lat_link_avg > up_threshold_min and\
+               link_up_lat_link_avg < up_threshold_max:
+                link_up_link_to_system_list.append(
+                        link_up_lat_link_avg)
+            else:
+                main.log.info("Link up latency exceeded threshold")
+                main.log.info("Results for iteration "+str(i)+
+                        "have been omitted")
+
+        #Calculate min, max, avg of list and report
+        link_down_min = min(link_down_graph_to_system_list)
+        link_down_max = max(link_down_graph_to_system_list)
+        link_down_avg = sum(link_down_graph_to_system_list) / \
+                        len(link_down_graph_to_system_list)
+        link_up_min = min(link_up_graph_to_system_list)
+        link_up_max = max(link_up_graph_to_system_list)
+        link_up_avg = sum(link_up_graph_to_system_list) / \
+                        len(link_up_graph_to_system_list)
+
+        main.log.report("Link down latency - \nMin: "+
+                str(link_down_min)+" ms  \nMax: "+
+                str(link_down_max)+" ms  \nAvg: "+
+                str(link_down_avg)+" ms")
+        main.log.report("Link up latency - \nMin: "+
+                str(link_up_min)+" ms  \nMax: "+
+                str(link_up_max)+" ms  \nAvg: "+
+                str(link_up_avg)+" ms")
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass="Link discovery latency calculation successful",
+                onfail="Link discovery latency case failed")
+
+    def CASE5(self, main):
+        '''
+        100 Switch discovery latency
+
+        Important:
+            This test case can be potentially dangerous if 
+            your machine has previously set iptables rules.
+            One of the steps of the test case will flush
+            all existing iptables rules.
+        Note:
+            You can specify the number of switches in the 
+            params file to adjust the switch discovery size
+            (and specify the corresponding topology in Mininet1 
+            .topo file)
+        '''
+        import time
+        import subprocess
+        import os
+        import requests
+        import json
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        MN1_ip = main.params['MN']['ip1']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+       
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+        num_sw = main.params['TEST']['numSwitch']
+
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+        
+        debug_mode = main.params['TEST']['debugMode']
+
+        local_time = time.strftime('%x %X')
+        if debug_mode == 'on':
+            main.ONOS1.tshark_pcap("eth0",
+                    "/tmp/100_sw_lat_pcap"+local_time) 
+ 
+        #Threshold for this test case
+        sw_disc_threshold_str = main.params['TEST']['swDisc100Threshold']
+        sw_disc_threshold_obj = sw_disc_threshold_str.split(",")
+        sw_disc_threshold_min = int(sw_disc_threshold_obj[0])
+        sw_disc_threshold_max = int(sw_disc_threshold_obj[1])
+
+        tshark_ofp_output = "/tmp/tshark_ofp_"+num_sw+"sw.txt"
+        tshark_tcp_output = "/tmp/tshark_tcp_"+num_sw+"sw.txt"
+
+        tshark_ofp_result_list = []
+        tshark_tcp_result_list = []
+
+        sw_discovery_lat_list = []
+
+        main.case(num_sw+" Switch discovery latency")
+        main.step("Assigning all switches to ONOS1")
+        for i in range(1, int(num_sw)+1):
+            main.Mininet1.assign_sw_controller(
+                    sw=str(i),
+                    ip1=ONOS1_ip,
+                    port1=default_sw_port)
+        
+        #Ensure that nodes are configured with ptpd
+        #Just a warning message
+        main.log.info("Please check ptpd configuration to ensure"+\
+                " All nodes' system times are in sync")
+        time.sleep(5)
+
+        for i in range(0, int(num_iter)):
+            
+            main.step("Set iptables rule to block incoming sw connections")
+            #Set iptables rule to block incoming switch connections
+            #The rule description is as follows:
+            #   Append to INPUT rule,
+            #   behavior DROP that matches following:
+            #       * packet type: tcp
+            #       * source IP: MN1_ip
+            #       * destination PORT: 6633
+            main.ONOS1.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+MN1_ip+
+                    " --dport "+default_sw_port+" -j DROP")
+            main.ONOS1.handle.expect("\$") 
+            #   Append to OUTPUT rule, 
+            #   behavior DROP that matches following:
+            #       * packet type: tcp
+            #       * source IP: MN1_ip
+            #       * destination PORT: 6633
+            main.ONOS1.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+MN1_ip+
+                    " --dport "+default_sw_port+" -j DROP")
+            main.ONOS1.handle.expect("\$")
+            #Give time to allow rule to take effect
+            #NOTE: Sleep period may need to be configured 
+            #      based on the number of switches in the topology
+            main.log.info("Please wait for switch connection to "+
+                    "time out")
+            time.sleep(60)
+            
+            #Gather vendor OFP with tshark
+            main.ONOS1.tshark_grep("OFP 86 Vendor", 
+                    tshark_ofp_output)
+            main.ONOS1.tshark_grep("TCP 74 ",
+                    tshark_tcp_output)
+
+            #NOTE: Remove all iptables rule quickly (flush)
+            #      Before removal, obtain TestON timestamp at which 
+            #      removal took place
+            #      (ensuring nodes are configured via ptp)
+            #      sudo iptables -F
+            
+            t0_system = time.time() * 1000
+            main.ONOS1.handle.sendline(
+                    "sudo iptables -F")
+
+            #Counter to track loop count
+            counter_loop = 0
+            counter_avail1 = 0
+            counter_avail2 = 0
+            counter_avail3 = 0
+            onos1_dev = False
+            onos2_dev = False
+            onos3_dev = False
+            while counter_loop < 60:
+                #Continue to check devices for all device 
+                #availability. When all devices in all 3
+                #ONOS instances indicate that devices are available
+                #obtain graph event timestamp for t1.
+                device_str_obj1 = main.ONOS1cli.devices()
+                device_str_obj2 = main.ONOS2cli.devices()
+                device_str_obj3 = main.ONOS3cli.devices()
+
+                device_json1 = json.loads(device_str_obj1)                
+                device_json2 = json.loads(device_str_obj2)                
+                device_json3 = json.loads(device_str_obj3)           
+                
+                for device1 in device_json1:
+                    if device1['available'] == True:
+                        counter_avail1 += 1
+                        if counter_avail1 == int(num_sw):
+                            onos1_dev = True
+                            main.log.info("All devices have been "+
+                                    "discovered on ONOS1")
+                    else:
+                        counter_avail1 = 0
+                for device2 in device_json2:
+                    if device2['available'] == True:
+                        counter_avail2 += 1
+                        if counter_avail2 == int(num_sw):
+                            onos2_dev = True
+                            main.log.info("All devices have been "+
+                                    "discovered on ONOS2")
+                    else:
+                        counter_avail2 = 0
+                for device3 in device_json3:
+                    if device3['available'] == True:
+                        counter_avail3 += 1
+                        if counter_avail3 == int(num_sw):
+                            onos3_dev = True
+                            main.log.info("All devices have been "+
+                                    "discovered on ONOS3")
+                    else:
+                        counter_avail3 = 0
+
+                if onos1_dev and onos2_dev and onos3_dev:
+                    main.log.info("All devices have been discovered "+
+                            "on all ONOS instances")
+                    json_str_topology_metrics_1 =\
+                        main.ONOS1cli.topology_events_metrics()
+                    json_str_topology_metrics_2 =\
+                        main.ONOS2cli.topology_events_metrics()
+                    json_str_topology_metrics_3 =\
+                        main.ONOS3cli.topology_events_metrics()
+                   
+                    #Exit while loop if all devices discovered
+                    break 
+                
+                counter_loop += 1
+                #Give some time in between CLI calls
+                #(will not affect measurement)
+                time.sleep(3)
+
+            main.ONOS1.tshark_stop()
+            
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_ofp_output+" /tmp/") 
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_tcp_output+" /tmp/")
+
+            #TODO: Automate OFP output analysis
+            #Debug mode - print out packets captured at runtime     
+            if debug_mode == 'on': 
+                ofp_file = open(tshark_ofp_output, 'r')
+                main.log.info("Tshark OFP Vendor output: ")
+                for line in ofp_file:
+                    tshark_ofp_result_list.append(line)
+                    main.log.info(line)
+                ofp_file.close()
+
+                tcp_file = open(tshark_tcp_output, 'r')
+                main.log.info("Tshark TCP 74 output: ")
+                for line in tcp_file:
+                    tshark_tcp_result_list.append(line)
+                    main.log.info(line)
+                tcp_file.close()
+
+            json_obj_1 = json.loads(json_str_topology_metrics_1)
+            json_obj_2 = json.loads(json_str_topology_metrics_2)
+            json_obj_3 = json.loads(json_str_topology_metrics_3)
+
+            graph_timestamp_1 = \
+                    json_obj_1[graphTimestamp]['value']
+            graph_timestamp_2 = \
+                    json_obj_2[graphTimestamp]['value']
+            graph_timestamp_3 = \
+                    json_obj_3[graphTimestamp]['value']
+
+            graph_lat_1 = int(graph_timestamp_1) - int(t0_system)
+            graph_lat_2 = int(graph_timestamp_2) - int(t0_system)
+            graph_lat_3 = int(graph_timestamp_3) - int(t0_system)
+
+            avg_graph_lat = \
+                    (int(graph_lat_1) +\
+                     int(graph_lat_2) +\
+                     int(graph_lat_3)) / 3
+    
+            if avg_graph_lat > sw_disc_threshold_min \
+                    and avg_graph_lat < sw_disc_threshold_max:
+                sw_discovery_lat_list.append(
+                        avg_graph_lat)
+            else:
+                main.log.info("100 Switch discovery latency "+
+                        "exceeded the threshold.")
+            
+            #END ITERATION FOR LOOP
+
+        sw_lat_min = min(sw_discovery_lat_list)
+        sw_lat_max = max(sw_discovery_lat_list)
+        sw_lat_avg = sum(sw_discovery_lat_list) /\
+                     len(sw_discovery_lat_list)
+
+        main.log.report("100 Switch discovery lat - \n"+\
+                "Min: "+str(sw_lat_min)+" ms\n"+\
+                "Max: "+str(sw_lat_max)+" ms\n"+\
+                "Avg: "+str(sw_lat_avg)+" ms\n")
+
+
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.topo b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
new file mode 100644
index 0000000..5010fcc
--- /dev/null
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
@@ -0,0 +1,91 @@
+<TOPOLOGY>
+    <COMPONENT>
+        
+        <ONOSbench>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1cli>
+
+        <ONOS2cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2cli>
+        
+        <ONOS3cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3cli>
+
+        <ONOS1>
+            <host>10.128.174.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.174.2</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>10.128.174.3</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+        <Mininet1>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+                <arg1> --custom topo-100sw.py </arg1>
+                <arg2> --arp --mac --topo mytopo</arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
new file mode 100644
index 0000000..f797706
--- /dev/null
+++ b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
@@ -0,0 +1,45 @@
+<PARAMS>
+    <testcases>1,2,3,4,5</testcases>
+
+    <ENV>
+        <cellName>topo_perf_test</cellName>
+    </ENV>
+
+    <GIT>
+        #autoPull 'on' or 'off'
+        <autoPull>off</autoPull>
+        <checkout>master</checkout>
+    </GIT>
+
+    <CTRL>
+        <user>admin</user>
+        <ip1>10.128.174.1</ip1>
+        <port1>6633</port1>
+        <ip2>10.128.174.2</ip2>
+        <port2>6633</port2>
+        <ip3>10.128.174.3</ip3>
+        <port3>6633</port3>
+    </CTRL>
+
+    <MN>
+        <ip1>10.128.10.90</ip1>
+        <ip2>10.128.10.91</ip2>
+    </MN>
+
+    <BENCH>
+        <ip>10.128.174.10</ip>
+    </BENCH>
+
+    <TEST>
+        #Number of times to iterate each case
+        <numIter>5</numIter>
+        <numSwitch>100</numSwitch>         
+    </TEST>
+
+    <JSON>
+        <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
+        <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
+        <linkTimestamp>topologyLinkEventTimestamp</linkTimestamp>
+        <graphTimestamp>topologyGraphEventTimestamp</graphTimestamp>
+    </JSON>
+</PARAMS>
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
new file mode 100644
index 0000000..d10c0ee
--- /dev/null
+++ b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
@@ -0,0 +1,1108 @@
+#TopoPerfNext
+#
+#Topology Performance test for ONOS-next
+#*** Revised for single node operation ***
+#
+#andrew@onlab.us
+
+import time
+import sys
+import os
+import re
+
+class TopoPerfNextSingleNode:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        ONOS startup sequence
+        '''
+        import time
+    
+        cell_name = main.params['ENV']['cellName']
+
+        git_pull = main.params['GIT']['autoPull']
+        checkout_branch = main.params['GIT']['checkout']
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        MN1_ip = main.params['MN']['ip1']
+        BENCH_ip = main.params['BENCH']['ip']
+
+        main.case("Setting up test environment")
+
+        main.step("Creating cell file")
+        cell_file_result = main.ONOSbench.create_cell_file(
+                BENCH_ip, cell_name, MN1_ip, "onos-core",
+                ONOS1_ip)
+
+        main.step("Applying cell file to environment")
+        cell_apply_result = main.ONOSbench.set_cell(cell_name)
+        verify_cell_result = main.ONOSbench.verify_cell()
+        
+        main.step("Git checkout and pull "+checkout_branch)
+        if git_pull == 'on':
+            checkout_result = \
+                    main.ONOSbench.git_checkout(checkout_branch)
+            pull_result = main.ONOSbench.git_pull()
+        else:
+            checkout_result = main.TRUE
+            pull_result = main.TRUE
+            main.log.info("Skipped git checkout and pull")
+
+        main.step("Using mvn clean & install")
+        #mvn_result = main.ONOSbench.clean_install()
+        mvn_result = main.TRUE
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
+
+        #NOTE: This step may be unnecessary
+        #main.step("Starting ONOS service")
+        #start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+        main.step("Set cell for ONOS cli env")
+        main.ONOS1cli.set_cell(cell_name)
+
+        time.sleep(10)
+
+        main.step("Start onos cli")
+        cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
+
+        main.step("Enable metrics feature")
+        main.ONOS1cli.feature_install("onos-app-metrics")
+
+        utilities.assert_equals(expect=main.TRUE,
+                actual= cell_file_result and cell_apply_result and\
+                        verify_cell_result and checkout_result and\
+                        pull_result and mvn_result and\
+                        install1_result, 
+                onpass="ONOS started successfully",
+                onfail="Failed to start ONOS")
+
+    def CASE2(self, main):
+        '''
+        Assign s1 to ONOS1 and measure latency
+        
+        There are 4 levels of latency measurements to this test:
+        1) End-to-end measurement: Complete end-to-end measurement
+           from TCP (SYN/ACK) handshake to Graph change
+        2) OFP-to-graph measurement: 'ONOS processing' snippet of
+           measurement from OFP Vendor message to Graph change
+        3) OFP-to-device measurement: 'ONOS processing without 
+           graph change' snippet of measurement from OFP vendor
+           message to Device change timestamp
+        4) T0-to-device measurement: Measurement that includes
+           the switch handshake to devices timestamp without 
+           the graph view change. (TCP handshake -> Device 
+           change)
+        '''
+        import time
+        import subprocess
+        import json
+        import requests
+        import os
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+       
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+       
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+
+        #List of switch add latency collected from
+        #all iterations
+        latency_end_to_end_list = []
+        latency_ofp_to_graph_list = []
+        latency_ofp_to_device_list = []
+        latency_t0_to_device_list = []
+
+        #Directory/file to store tshark results
+        tshark_of_output = "/tmp/tshark_of_topo.txt"
+        tshark_tcp_output = "/tmp/tshark_tcp_topo.txt"
+
+        #String to grep in tshark output
+        tshark_tcp_string = "TCP 74 "+default_sw_port
+        tshark_of_string = "OFP 86 Vendor"
+     
+        #Initialize assertion to TRUE
+        assertion = main.TRUE
+        
+        main.log.report("Latency of adding one switch")
+
+        for i in range(0, int(num_iter)):
+            main.log.info("Starting tshark capture")
+
+            #* TCP [ACK, SYN] is used as t0_a, the
+            #  very first "exchange" between ONOS and 
+            #  the switch for end-to-end measurement
+            #* OFP [Stats Reply] is used for t0_b
+            #  the very last OFP message between ONOS
+            #  and the switch for ONOS measurement
+            main.ONOS1.tshark_grep(tshark_tcp_string,
+                    tshark_tcp_output)
+            main.ONOS1.tshark_grep(tshark_of_string,
+                    tshark_of_output)
+
+            #Wait and ensure tshark is started and 
+            #capturing
+            time.sleep(10)
+
+            main.log.info("Assigning s1 to controller")
+
+            main.Mininet1.assign_sw_controller(sw="1",
+                    ip1=ONOS1_ip, port1=default_sw_port)
+
+            #Wait and ensure switch is assigned
+            #before stopping tshark
+            time.sleep(30)
+   
+            main.log.info("Stopping all Tshark processes")
+            main.ONOS1.stop_tshark()
+
+            #tshark output is saved in ONOS. Use subprocess
+            #to copy over files to TestON for parsing
+            main.log.info("Copying over tshark files")
+            
+            #TCP CAPTURE ****
+            #Copy the tshark output from ONOS machine to
+            #TestON machine in tshark_tcp_output directory>file
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_tcp_output+" /tmp/") 
+            tcp_file = open(tshark_tcp_output, 'r')
+            temp_text = tcp_file.readline()
+            temp_text = temp_text.split(" ")
+
+            main.log.info("Object read in from TCP capture: "+
+                    str(temp_text))
+            if len(temp_text) > 1:
+                t0_tcp = float(temp_text[1])*1000.0
+            else:
+                main.log.error("Tshark output file for TCP"+
+                        " returned unexpected results")
+                t0_tcp = 0
+                assertion = main.FALSE
+            
+            tcp_file.close()
+            #****************
+
+            #OF CAPTURE ****
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_of_output+" /tmp/")
+            of_file = open(tshark_of_output, 'r')
+           
+            line_ofp = ""
+            #Read until last line of file
+            while True:
+                temp_text = of_file.readline()
+                if temp_text !='':
+                    line_ofp = temp_text
+                else:
+                    break 
+            obj = line_ofp.split(" ")
+            
+            main.log.info("Object read in from OFP capture: "+
+                    str(line_ofp))
+    
+            if len(line_ofp) > 1:
+                t0_ofp = float(obj[1])*1000.0
+            else:
+                main.log.error("Tshark output file for OFP"+
+                        " returned unexpected results")
+                t0_ofp = 0
+                assertion = main.FALSE
+            
+            of_file.close()
+            #****************
+           
+            json_str_1 = main.ONOS1cli.topology_events_metrics()
+
+            json_obj_1 = json.loads(json_str_1)
+
+            #Obtain graph timestamp. This timestsamp captures
+            #the epoch time at which the topology graph was updated.
+            graph_timestamp_1 = \
+                    json_obj_1[graphTimestamp]['value']
+
+            #Obtain device timestamp. This timestamp captures
+            #the epoch time at which the device event happened
+            device_timestamp_1 = \
+                    json_obj_1[deviceTimestamp]['value'] 
+            
+            #t0 to device processing latency 
+            delta_device_1 = int(device_timestamp_1) - int(t0_tcp)
+        
+            #Get average of delta from all instances
+            avg_delta_device = (int(delta_device_1))
+
+            #Ensure avg delta meets the threshold before appending
+            if avg_delta_device > 0.0 and avg_delta_device < 10000:
+                latency_t0_to_device_list.append(avg_delta_device)
+            else:
+                main.log.info("Results for t0-to-device ignored"+\
+                        "due to excess in threshold")
+
+            #t0 to graph processing latency (end-to-end)
+            delta_graph_1 = int(graph_timestamp_1) - int(t0_tcp)
+        
+            #Get average of delta from all instances
+            avg_delta_graph = int(delta_graph_1)
+
+            #Ensure avg delta meets the threshold before appending
+            if avg_delta_graph > 0.0 and avg_delta_graph < 10000:
+                latency_end_to_end_list.append(avg_delta_graph)
+            else:
+                main.log.info("Results for end-to-end ignored"+\
+                        "due to excess in threshold")
+
+            #ofp to graph processing latency (ONOS processing)
+            delta_ofp_graph_1 = int(graph_timestamp_1) - int(t0_ofp)
+            
+            avg_delta_ofp_graph = int(delta_ofp_graph_1)
+            
+            if avg_delta_ofp_graph > 0.0 and avg_delta_ofp_graph < 10000:
+                latency_ofp_to_graph_list.append(avg_delta_ofp_graph)
+            else:
+                main.log.info("Results for ofp-to-graph "+\
+                        "ignored due to excess in threshold")
+
+            #ofp to device processing latency (ONOS processing)
+            delta_ofp_device_1 = float(device_timestamp_1) - float(t0_ofp)
+            
+            avg_delta_ofp_device = float(delta_ofp_device_1)
+            
+            #NOTE: ofp - delta measurements are occasionally negative
+            #      due to system time misalignment.
+            latency_ofp_to_device_list.append(avg_delta_ofp_device)
+
+            #TODO:
+            #Fetch logs upon threshold excess
+
+            main.log.info("ONOS1 delta end-to-end: "+
+                    str(delta_graph_1) + " ms")
+
+            main.log.info("ONOS1 delta OFP - graph: "+
+                    str(delta_ofp_graph_1) + " ms")
+            
+            main.log.info("ONOS1 delta device - t0: "+
+                    str(delta_device_1) + " ms")
+          
+            main.step("Remove switch from controller")
+            main.Mininet1.delete_sw_controller("s1")
+
+            time.sleep(5)
+
+        #END of for loop iteration
+
+        #If there is at least 1 element in each list,
+        #pass the test case
+        if len(latency_end_to_end_list) > 0 and\
+           len(latency_ofp_to_graph_list) > 0 and\
+           len(latency_ofp_to_device_list) > 0 and\
+           len(latency_t0_to_device_list) > 0:
+            assertion = main.TRUE
+        elif len(latency_end_to_end_list) == 0:
+            #The appending of 0 here is to prevent 
+            #the min,max,sum functions from failing 
+            #below
+            latency_end_to_end_list.append(0)
+            assertion = main.FALSE
+        elif len(latency_ofp_to_graph_list) == 0:
+            latency_ofp_to_graph_list.append(0)
+            assertion = main.FALSE
+        elif len(latency_ofp_to_device_list) == 0:
+            latency_ofp_to_device_list.append(0)
+            assertion = main.FALSE
+        elif len(latency_t0_to_device_list) == 0:
+            latency_t0_to_device_list.append(0)
+            assertion = main.FALSE
+
+        #Calculate min, max, avg of latency lists
+        latency_end_to_end_max = \
+                int(max(latency_end_to_end_list))
+        latency_end_to_end_min = \
+                int(min(latency_end_to_end_list))
+        latency_end_to_end_avg = \
+                (int(sum(latency_end_to_end_list)) / \
+                 len(latency_end_to_end_list))
+   
+        latency_ofp_to_graph_max = \
+                int(max(latency_ofp_to_graph_list))
+        latency_ofp_to_graph_min = \
+                int(min(latency_ofp_to_graph_list))
+        latency_ofp_to_graph_avg = \
+                (int(sum(latency_ofp_to_graph_list)) / \
+                 len(latency_ofp_to_graph_list))
+
+        latency_ofp_to_device_max = \
+                int(max(latency_ofp_to_device_list))
+        latency_ofp_to_device_min = \
+                int(min(latency_ofp_to_device_list))
+        latency_ofp_to_device_avg = \
+                (int(sum(latency_ofp_to_device_list)) / \
+                 len(latency_ofp_to_device_list))
+
+        latency_t0_to_device_max = \
+                float(max(latency_t0_to_device_list))
+        latency_t0_to_device_min = \
+                float(min(latency_t0_to_device_list))
+        latency_t0_to_device_avg = \
+                (float(sum(latency_t0_to_device_list)) / \
+                 len(latency_ofp_to_device_list))
+
+        main.log.report("Switch add - End-to-end latency: \n"+\
+                "Min: "+str(latency_end_to_end_min)+"\n"+\
+                "Max: "+str(latency_end_to_end_max)+"\n"+\
+                "Avg: "+str(latency_end_to_end_avg))
+        main.log.report("Switch add - OFP-to-Graph latency: \n"+\
+                "Min: "+str(latency_ofp_to_graph_min)+"\n"+\
+                "Max: "+str(latency_ofp_to_graph_max)+"\n"+\
+                "Avg: "+str(latency_ofp_to_graph_avg))
+        main.log.report("Switch add - t0-to-Device latency: \n"+\
+                "Min: "+str(latency_t0_to_device_min)+"\n"+\
+                "Max: "+str(latency_t0_to_device_max)+"\n"+\
+                "Avg: "+str(latency_t0_to_device_avg))
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass="Switch latency test successful",
+                onfail="Switch latency test failed")
+
+    def CASE3(self, main):
+        '''
+        Bring port up / down and measure latency.
+        Port enable / disable is simulated by ifconfig up / down
+        
+        In ONOS-next, we must ensure that the port we are 
+        manipulating is connected to another switch with a valid
+        connection. Otherwise, graph view will not be updated.
+        '''
+        import time
+        import subprocess
+        import os
+        import requests
+        import json
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+      
+        assertion = main.TRUE
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+       
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+
+        #NOTE: Some hardcoded variables you may need to configure
+        #      besides the params
+            
+        tshark_port_status = "OFP 130 Port Status"
+
+        tshark_port_up = "/tmp/tshark_port_up.txt"
+        tshark_port_down = "/tmp/tshark_port_down.txt"
+        interface_config = "s1-eth1"
+
+        main.log.report("Port enable / disable latency")
+
+        main.step("Assign switches s1 and s2 to controller 1")
+        main.Mininet1.assign_sw_controller(sw="1",ip1=ONOS1_ip,
+                port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(sw="2",ip1=ONOS1_ip,
+                port1=default_sw_port)
+
+        #Give enough time for metrics to propagate the 
+        #assign controller event. Otherwise, these events may
+        #carry over to our measurements
+        time.sleep(10)
+
+        main.step("Verify switch is assigned correctly")
+        result_s1 = main.Mininet1.get_sw_controller(sw="s1")
+        result_s2 = main.Mininet1.get_sw_controller(sw="s2")
+        if result_s1 == main.FALSE or result_s2 == main.FALSE:
+            main.log.info("Switch s1 was not assigned correctly")
+            assertion = main.FALSE
+        else:
+            main.log.info("Switch s1 was assigned correctly")
+
+        port_up_device_to_ofp_list = []
+        port_up_graph_to_ofp_list = []
+        port_down_device_to_ofp_list = []
+        port_down_graph_to_ofp_list = []
+
+        for i in range(0, int(num_iter)):
+            main.step("Starting wireshark capture for port status down")
+            main.ONOS1.tshark_grep(tshark_port_status,
+                    tshark_port_down)
+            
+            time.sleep(10)
+
+            #Disable interface that is connected to switch 2
+            main.step("Disable port: "+interface_config)
+            main.Mininet2.handle.sendline("sudo ifconfig "+
+                    interface_config+" down")
+            main.Mininet2.handle.expect("\$")
+            time.sleep(10)
+
+            main.ONOS1.tshark_stop()
+            time.sleep(5)
+            
+            #Copy tshark output file from ONOS to TestON instance
+            #/tmp directory
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_port_down+" /tmp/")
+
+            f_port_down = open(tshark_port_down, 'r')
+            #Get first line of port down event from tshark
+            f_line = f_port_down.readline()
+            obj_down = f_line.split(" ")
+            if len(f_line) > 0:
+                timestamp_begin_pt_down = int(float(obj_down[1]))*1000
+                main.log.info("Port down begin timestamp: "+
+                        str(timestamp_begin_pt_down))
+            else:
+                main.log.info("Tshark output file returned unexpected"+
+                        " results: "+str(obj_down))
+                timestamp_begin_pt_down = 0
+            
+            f_port_down.close()
+
+            main.log.info("TEST tshark obj: "+str(obj_down))
+
+            main.step("Obtain t1 by REST call")
+            json_str_1 = main.ONOS1cli.topology_events_metrics()
+
+            main.log.info("TEST json_str 1: "+str(json_str_1))
+
+            json_obj_1 = json.loads(json_str_1)
+           
+            time.sleep(5)
+
+            #Obtain graph timestamp. This timestsamp captures
+            #the epoch time at which the topology graph was updated.
+            graph_timestamp_1 = \
+                    json_obj_1[graphTimestamp]['value']
+
+            #Obtain device timestamp. This timestamp captures
+            #the epoch time at which the device event happened
+            device_timestamp_1 = \
+                    json_obj_1[deviceTimestamp]['value'] 
+
+            #Get delta between graph event and OFP 
+            pt_down_graph_to_ofp_1 = int(graph_timestamp_1) -\
+                    int(timestamp_begin_pt_down)
+
+            #Get delta between device event and OFP
+            pt_down_device_to_ofp_1 = int(device_timestamp_1) -\
+                    int(timestamp_begin_pt_down)
+       
+            #Caluclate average across clusters
+            pt_down_graph_to_ofp_avg = int(pt_down_graph_to_ofp_1)
+            pt_down_device_to_ofp_avg = int(pt_down_device_to_ofp_1) 
+
+            if pt_down_graph_to_ofp_avg > 0.0 and \
+                    pt_down_graph_to_ofp_avg < 1000:
+                port_down_graph_to_ofp_list.append(
+                    pt_down_graph_to_ofp_avg)
+                main.log.info("Port down: graph to ofp avg: "+
+                    str(pt_down_graph_to_ofp_avg) + " ms")
+            else:
+                main.log.info("Average port down graph-to-ofp result" +
+                        " exceeded the threshold: "+
+                        str(pt_down_graph_to_ofp_avg))
+
+            if pt_down_device_to_ofp_avg > 0 and \
+                    pt_down_device_to_ofp_avg < 1000:
+                port_down_device_to_ofp_list.append(
+                    pt_down_device_to_ofp_avg)
+                main.log.info("Port down: device to ofp avg: "+
+                    str(pt_down_device_to_ofp_avg) + " ms")
+            else:
+                main.log.info("Average port down device-to-ofp result" +
+                        " exceeded the threshold: "+
+                        str(pt_down_device_to_ofp_avg))
+
+            #Port up events 
+            main.step("Enable port and obtain timestamp")
+            main.step("Starting wireshark capture for port status up")
+            main.ONOS1.tshark_grep("OFP 130 Port Status", tshark_port_up)
+            time.sleep(5)
+
+            main.Mininet2.handle.sendline("sudo ifconfig "+
+                    interface_config+" up")
+            main.Mininet2.handle.expect("\$")
+            time.sleep(10)
+            
+            main.ONOS1.tshark_stop()
+
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_port_up+" /tmp/")
+
+            f_port_up = open(tshark_port_up, 'r')
+            f_line = f_port_up.readline()
+            obj_up = f_line.split(" ")
+            if len(f_line) > 0:
+                timestamp_begin_pt_up = int(float(obj_up[1]))*1000
+                main.log.info("Port up begin timestamp: "+
+                        str(timestamp_begin_pt_up))
+            else:
+                main.log.info("Tshark output file returned unexpected"+
+                        " results.")
+                timestamp_begin_pt_up = 0
+            
+            f_port_up.close()
+
+            main.step("Obtain t1 by REST call")
+            json_str_1 = main.ONOS1cli.topology_events_metrics()
+
+            json_obj_1 = json.loads(json_str_1)
+
+            #Obtain graph timestamp. This timestsamp captures
+            #the epoch time at which the topology graph was updated.
+            graph_timestamp_1 = \
+                    json_obj_1[graphTimestamp]['value']
+
+            #Obtain device timestamp. This timestamp captures
+            #the epoch time at which the device event happened
+            device_timestamp_1 = \
+                    json_obj_1[deviceTimestamp]['value'] 
+            
+            #Get delta between graph event and OFP 
+            pt_up_graph_to_ofp_1 = int(graph_timestamp_1) -\
+                    int(timestamp_begin_pt_up)
+
+            #Get delta between device event and OFP
+            pt_up_device_to_ofp_1 = int(device_timestamp_1) -\
+                    int(timestamp_begin_pt_up)
+
+            pt_up_graph_to_ofp_avg = float(pt_up_graph_to_ofp_1) 
+
+            pt_up_device_to_ofp_avg = float(pt_up_device_to_ofp_1) 
+
+            if pt_up_graph_to_ofp_avg > 0 and \
+                    pt_up_graph_to_ofp_avg < 1000:
+                port_up_graph_to_ofp_list.append(
+                        pt_up_graph_to_ofp_avg)
+                main.log.info("Port down: graph to ofp avg: "+
+                    str(pt_up_graph_to_ofp_avg) + " ms")
+            else:
+                main.log.info("Average port up graph-to-ofp result"+
+                        " exceeded the threshold: "+
+                        str(pt_up_graph_to_ofp_avg))
+            
+            if pt_up_device_to_ofp_avg > 0 and \
+                    pt_up_device_to_ofp_avg < 1000:
+                port_up_device_to_ofp_list.append(
+                        pt_up_device_to_ofp_avg)
+                main.log.info("Port up: device to ofp avg: "+
+                    str(pt_up_device_to_ofp_avg) + " ms")
+            else:
+                main.log.info("Average port up device-to-ofp result"+
+                        " exceeded the threshold: "+
+                        str(pt_up_device_to_ofp_avg))
+            
+            #END ITERATION FOR LOOP
+        
+        #Check all list for latency existence and set assertion
+        if (port_down_graph_to_ofp_list and port_down_device_to_ofp_list\
+           and port_up_graph_to_ofp_list and port_up_device_to_ofp_list):
+            assertion = main.TRUE
+
+        #Calculate and report latency measurements
+        port_down_graph_to_ofp_min = min(port_down_graph_to_ofp_list)
+        port_down_graph_to_ofp_max = max(port_down_graph_to_ofp_list)
+        port_down_graph_to_ofp_avg = \
+                (sum(port_down_graph_to_ofp_list) / 
+                 len(port_down_graph_to_ofp_list))
+        
+        main.log.report("Port down graph-to-ofp Min: "+
+                str(port_down_graph_to_ofp_min)+" ms  Max: "+
+                str(port_down_graph_to_ofp_max)+" ms  Avg: "+
+                str(port_down_graph_to_ofp_avg))
+        
+        port_down_device_to_ofp_min = min(port_down_device_to_ofp_list)
+        port_down_device_to_ofp_max = max(port_down_device_to_ofp_list)
+        port_down_device_to_ofp_avg = \
+                (sum(port_down_device_to_ofp_list) /\
+                 len(port_down_device_to_ofp_list))
+        
+        main.log.report("Port down device-to-ofp Min: "+
+                str(port_down_device_to_ofp_min)+" ms  Max: "+
+                str(port_down_device_to_ofp_max)+" ms  Avg: "+
+                str(port_down_device_to_ofp_avg))
+        
+        port_up_graph_to_ofp_min = min(port_up_graph_to_ofp_list)
+        port_up_graph_to_ofp_max = max(port_up_graph_to_ofp_list)
+        port_up_graph_to_ofp_avg = \
+                (sum(port_up_graph_to_ofp_list) /\
+                 len(port_up_graph_to_ofp_list))
+        
+        main.log.report("Port up graph-to-ofp Min: "+
+                str(port_up_graph_to_ofp_min)+" ms  Max: "+
+                str(port_up_graph_to_ofp_max)+" ms  Avg: "+
+                str(port_up_graph_to_ofp_avg))
+          
+        port_up_device_to_ofp_min = min(port_up_device_to_ofp_list)
+        port_up_device_to_ofp_max = max(port_up_device_to_ofp_list)
+        port_up_device_to_ofp_avg = \
+                (sum(port_up_device_to_ofp_list) /\
+                 len(port_up_device_to_ofp_list))
+        
+        main.log.report("Port up device-to-ofp Min: "+
+                str(port_up_device_to_ofp_min)+" ms  Max: "+
+                str(port_up_device_to_ofp_max)+" ms  Avg: "+
+                str(port_up_device_to_ofp_avg))
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass="Port discovery latency calculation successful",
+                onfail="Port discovery test failed")
+
+    def CASE4(self, main):
+        '''
+        Link down event using loss rate 100%
+        
+        Important:
+            Use a simple 2 switch topology with 1 link between
+            the two switches. Ensure that mac addresses of the 
+            switches are 1 / 2 respectively
+        '''
+        import time
+        import subprocess
+        import os
+        import requests
+        import json
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+       
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+       
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        linkTimestamp = main.params['JSON']['linkTimestamp'] 
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+
+        assertion = main.TRUE
+        #Link event timestamp to system time list
+        link_down_link_to_system_list = []
+        link_up_link_to_system_list = []
+        #Graph event timestamp to system time list
+        link_down_graph_to_system_list = []
+        link_up_graph_to_system_list = [] 
+
+        main.log.report("Add / remove link latency between "+
+                "two switches")
+
+        main.step("Assign all switches")
+        main.Mininet1.assign_sw_controller(sw="1",
+                ip1=ONOS1_ip, port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(sw="2",
+                ip1=ONOS1_ip, port1=default_sw_port)
+
+        main.step("Verifying switch assignment")
+        result_s1 = main.Mininet1.get_sw_controller(sw="s1")
+        result_s2 = main.Mininet1.get_sw_controller(sw="s2")
+          
+        #Allow time for events to finish before taking measurements
+        time.sleep(10)
+
+        link_down = False
+        #Start iteration of link event test
+        for i in range(0, int(num_iter)):
+            main.step("Getting initial system time as t0")
+            
+            timestamp_link_down_t0 = time.time() * 1000
+            #Link down is simulated by 100% loss rate using traffic 
+            #control command
+            main.Mininet1.handle.sendline(
+                    "sh tc qdisc add dev s1-eth1 root netem loss 100%")
+
+            #TODO: Iterate through 'links' command to verify that
+            #      link s1 -> s2 went down (loop timeout 30 seconds) 
+            #      on all 3 ONOS instances
+            main.log.info("Checking ONOS for link update")
+            loop_count = 0
+            while( not link_down and loop_count < 30 ):
+                json_str = main.ONOS1cli.links()
+                
+                if not json_str:
+                    main.log.error("CLI command returned error ")
+                    break
+                else:
+                    json_obj = json.loads(json_str)
+                for obj in json_obj:
+                    if '01' not in obj['src']['device']:
+                        link_down = True
+                        main.log.report("Link down from "+
+                                "s1 -> s2 on ONOS1 detected")
+                loop_count += 1
+                #If CLI doesn't like the continuous requests
+                #and exits in this loop, increase the sleep here.
+                #Consequently, while loop timeout will increase
+                time.sleep(1)
+    
+            #Give time for metrics measurement to catch up
+            #NOTE: May need to be configured more accurately
+            time.sleep(10)
+            #If we exited the while loop and link down 1,2,3 are still 
+            #false, then ONOS has failed to discover link down event
+            if not link_down:
+                main.log.info("Link down discovery failed")
+                
+                link_down_lat_graph1 = 0
+                link_down_lat_device1 = 0
+                assertion = main.FALSE
+            else:
+                json_topo_metrics_1 =\
+                        main.ONOS1cli.topology_events_metrics()
+                json_topo_metrics_1 = json.loads(json_topo_metrics_1)
+                
+                main.log.info("Obtaining graph and device timestamp")
+                graph_timestamp_1 = \
+                    json_topo_metrics_1[graphTimestamp]['value']
+
+                link_timestamp_1 = \
+                    json_topo_metrics_1[linkTimestamp]['value']
+
+                if graph_timestamp_1 and link_timestamp_1:
+                    link_down_lat_graph1 = int(graph_timestamp_1) -\
+                            timestamp_link_down_t0
+                
+                    link_down_lat_link1 = int(link_timestamp_1) -\
+                            timestamp_link_down_t0
+                else:
+                    main.log.error("There was an error calculating"+
+                        " the delta for link down event")
+                    link_down_lat_graph1 = 0
+                    
+                    link_down_lat_device1 = 0
+        
+            main.log.report("Link down latency ONOS1 iteration "+
+                    str(i)+" (end-to-end): "+
+                    str(link_down_lat_graph1)+" ms")
+            
+            main.log.report("Link down latency ONOS1 iteration "+
+                    str(i)+" (link-event-to-system-timestamp): "+
+                    str(link_down_lat_link1)+" ms")
+      
+            #Calculate avg of node calculations
+            link_down_lat_graph_avg = link_down_lat_graph1
+            link_down_lat_link_avg = link_down_lat_link1
+
+            #Set threshold and append latency to list
+            if link_down_lat_graph_avg > 0.0 and\
+               link_down_lat_graph_avg < 30000:
+                link_down_graph_to_system_list.append(
+                        link_down_lat_graph_avg)
+            else:
+                main.log.info("Link down latency exceeded threshold")
+                main.log.info("Results for iteration "+str(i)+
+                        "have been omitted")
+            if link_down_lat_link_avg > 0.0 and\
+               link_down_lat_link_avg < 30000:
+                link_down_link_to_system_list.append(
+                        link_down_lat_link_avg)
+            else:
+                main.log.info("Link down latency exceeded threshold")
+                main.log.info("Results for iteration "+str(i)+
+                        "have been omitted")
+
+            #NOTE: To remove loss rate and measure latency:
+            #       'sh tc qdisc del dev s1-eth1 root'
+            timestamp_link_up_t0 = time.time() * 1000
+            main.Mininet1.handle.sendline("sh tc qdisc del dev "+
+                    "s1-eth1 root")
+            main.Mininet1.handle.expect("mininet>")
+            
+            main.log.info("Checking ONOS for link update")
+            
+            link_down1 = True
+            loop_count = 0
+            while( link_down1 and loop_count < 30 ):
+                json_str1 = main.ONOS1cli.links()
+                if not json_str1:
+                    main.log.error("CLI command returned error ")
+                    break
+                else:
+                    json_obj1 = json.loads(json_str1)
+                
+                for obj1 in json_obj1:
+                    if '01' in obj1['src']['device']:
+                        link_down1 = False 
+                        main.log.report("Link up from "+
+                            "s1 -> s2 on ONOS1 detected")
+                loop_count += 1
+                time.sleep(1)
+            
+            if link_down1:
+                main.log.info("Link up discovery failed")
+                link_up_lat_graph1 = 0
+                link_up_lat_device1 = 0
+                assertion = main.FALSE
+            else:
+                json_topo_metrics_1 =\
+                        main.ONOS1cli.topology_events_metrics()
+                json_topo_metrics_1 = json.loads(json_topo_metrics_1)
+
+                main.log.info("Obtaining graph and device timestamp")
+                graph_timestamp_1 = \
+                    json_topo_metrics_1[graphTimestamp]['value']
+                
+                link_timestamp_1 = \
+                    json_topo_metrics_1[linkTimestamp]['value']
+
+                if graph_timestamp_1 and link_timestamp_1:
+                    link_up_lat_graph1 = int(graph_timestamp_1) -\
+                            timestamp_link_up_t0
+                    link_up_lat_link1 = int(link_timestamp_1) -\
+                            timestamp_link_up_t0
+                else:
+                    main.log.error("There was an error calculating"+
+                        " the delta for link down event")
+                    link_up_lat_graph1 = 0
+                    link_up_lat_device1 = 0
+        
+            main.log.info("Link up latency ONOS1 iteration "+
+                    str(i)+" (end-to-end): "+
+                    str(link_up_lat_graph1)+" ms")
+            
+            main.log.info("Link up latency ONOS1 iteration "+
+                    str(i)+" (link-event-to-system-timestamp): "+
+                    str(link_up_lat_link1)+" ms")
+      
+            #Calculate avg of node calculations
+            link_up_lat_graph_avg = link_up_lat_graph1
+            link_up_lat_link_avg = link_up_lat_link1
+
+            #Set threshold and append latency to list
+            if link_up_lat_graph_avg > 0.0 and\
+               link_up_lat_graph_avg < 30000:
+                link_up_graph_to_system_list.append(
+                        link_up_lat_graph_avg)
+            else:
+                main.log.info("Link up latency exceeded threshold")
+                main.log.info("Results for iteration "+str(i)+
+                        "have been omitted")
+            if link_up_lat_link_avg > 0.0 and\
+               link_up_lat_link_avg < 30000:
+                link_up_link_to_system_list.append(
+                        link_up_lat_link_avg)
+            else:
+                main.log.info("Link up latency exceeded threshold")
+                main.log.info("Results for iteration "+str(i)+
+                        "have been omitted")
+
+        #Calculate min, max, avg of list and report
+        link_down_min = min(link_down_graph_to_system_list)
+        link_down_max = max(link_down_graph_to_system_list)
+        link_down_avg = sum(link_down_graph_to_system_list) / \
+                        len(link_down_graph_to_system_list)
+        link_up_min = min(link_up_graph_to_system_list)
+        link_up_max = max(link_up_graph_to_system_list)
+        link_up_avg = sum(link_up_graph_to_system_list) / \
+                        len(link_up_graph_to_system_list)
+
+        main.log.report("Link down latency - Min: "+
+                str(link_down_min)+"ms  Max: "+
+                str(link_down_max)+"ms  Avg: "+
+                str(link_down_avg)+"ms")
+        main.log.report("Link up latency - Min: "+
+                str(link_up_min)+"ms  Max: "+
+                str(link_up_max)+"ms  Avg: "+
+                str(link_up_avg)+"ms")
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass="Link discovery latency calculation successful",
+                onfail="Link discovery latency case failed")
+
+    def CASE5(self, main):
+        '''
+        100 Switch discovery latency
+
+        Important:
+            This test case can be potentially dangerous if 
+            your machine has previously set iptables rules.
+            One of the steps of the test case will flush
+            all existing iptables rules.
+        Note:
+            You can specify the number of switches in the 
+            params file to adjust the switch discovery size
+            (and specify the corresponding topology in Mininet1 
+            .topo file)
+        '''
+        import time
+        import subprocess
+        import os
+        import requests
+        import json
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        MN1_ip = main.params['MN']['ip1']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+       
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+        num_sw = main.params['TEST']['numSwitch']
+
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+   
+        tshark_ofp_output = "/tmp/tshark_ofp_"+num_sw+"sw.txt"
+        tshark_tcp_output = "/tmp/tshark_tcp_"+num_sw+"sw.txt"
+
+        tshark_ofp_result_list = []
+        tshark_tcp_result_list = []
+
+        main.case(num_sw+" Switch discovery latency")
+        main.step("Assigning all switches to ONOS1")
+        for i in range(1, int(num_sw)+1):
+            main.Mininet1.assign_sw_controller(
+                    sw=str(i),
+                    ip1=ONOS1_ip,
+                    port1=default_sw_port)
+        
+        #Ensure that nodes are configured with ptpd
+        #Just a warning message
+        main.log.info("Please check ptpd configuration to ensure"+\
+                " All nodes' system times are in sync")
+        time.sleep(5)
+
+        for i in range(0, int(num_iter)):
+            
+            main.step("Set iptables rule to block incoming sw connections")
+            #Set iptables rule to block incoming switch connections
+            #The rule description is as follows:
+            #   Append to INPUT rule,
+            #   behavior DROP that matches following:
+            #       * packet type: tcp
+            #       * source IP: MN1_ip
+            #       * destination PORT: 6633
+            main.ONOS1.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+MN1_ip+
+                    " --dport "+default_sw_port+" -j DROP")
+            main.ONOS1.handle.expect("\$") 
+            #   Append to OUTPUT rule, 
+            #   behavior DROP that matches following:
+            #       * packet type: tcp
+            #       * source IP: MN1_ip
+            #       * destination PORT: 6633
+            main.ONOS1.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+MN1_ip+
+                    " --dport "+default_sw_port+" -j DROP")
+            main.ONOS1.handle.expect("\$")
+            #Give time to allow rule to take effect
+            #NOTE: Sleep period may need to be configured 
+            #      based on the number of switches in the topology
+            main.log.info("Please wait for switch connection to "+
+                    "time out")
+            time.sleep(60)
+            
+            #Gather vendor OFP with tshark
+            main.ONOS1.tshark_grep("OFP 86 Vendor", 
+                    tshark_ofp_output)
+            main.ONOS1.tshark_grep("TCP 74 ",
+                    tshark_tcp_output)
+
+            #NOTE: Remove all iptables rule quickly (flush)
+            #      Before removal, obtain TestON timestamp at which 
+            #      removal took place
+            #      (ensuring nodes are configured via ptp)
+            #      sudo iptables -F
+            
+            t0_system = time.time() * 1000
+            main.ONOS1.handle.sendline(
+                    "sudo iptables -F")
+
+            #Counter to track loop count
+            counter_loop = 0
+            counter_avail1 = 0
+            onos1_dev = False
+            while counter_loop < 60:
+                #Continue to check devices for all device 
+                #availability. When all devices in all 3
+                #ONOS instances indicate that devices are available
+                #obtain graph event timestamp for t1.
+                device_str_obj1 = main.ONOS1cli.devices()
+                device_json1 = json.loads(device_str_obj1)                
+                
+                for device1 in device_json1:
+                    if device1['available'] == True:
+                        counter_avail1 += 1
+                        if counter_avail1 == int(num_sw):
+                            onos1_dev = True
+                            main.log.info("All devices have been "+
+                                    "discovered on ONOS1")
+                    else:
+                        counter_avail1 = 0
+
+                if onos1_dev: 
+                    main.log.info("All devices have been discovered "+
+                            "on all ONOS instances")
+                    json_str_topology_metrics_1 =\
+                        main.ONOS1cli.topology_events_metrics()
+                    #Exit while loop if all devices discovered
+                    break 
+                
+                counter_loop += 1
+                #Give some time in between CLI calls
+                #(will not affect measurement)
+                time.sleep(3)
+
+            main.ONOS1.tshark_stop()
+            
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_ofp_output+" /tmp/") 
+            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    tshark_tcp_output+" /tmp/")
+            ofp_file = open(tshark_ofp_output, 'r')
+
+            #The following is for information purpose only.
+            #TODO: Automate OFP output analysis
+            main.log.info("Tshark OFP Vendor output: ")
+            for line in ofp_file:
+                tshark_ofp_result_list.append(line)
+                main.log.info(line)
+
+            ofp_file.close()
+
+            tcp_file = open(tshark_tcp_output, 'r')
+            main.log.info("Tshark TCP 74 output: ")
+            for line in tcp_file:
+                tshark_tcp_result_list.append(line)
+                main.log.info(line)
+
+            tcp_file.close()
+
+            json_obj_1 = json.loads(json_str_topology_metrics_1)
+
+            graph_timestamp_1 = \
+                    json_obj_1[graphTimestamp]['value']
+
+            main.log.info(
+                    int(graph_timestamp_1) - int(t0_system))
+
+
+
+
+
+
+
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
new file mode 100644
index 0000000..3fc7bdc
--- /dev/null
+++ b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
@@ -0,0 +1,55 @@
+<TOPOLOGY>
+    <COMPONENT>
+        
+        <ONOSbench>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1cli>
+        
+        <ONOS1>
+            <host>10.128.174.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <Mininet1>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+                <arg1> --custom topo-100sw.py </arg1>
+                <arg2> --arp --mac --topo mytopo</arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/scaleONOS7nodes/__init__.py b/TestON/tests/scaleONOS7nodes/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/scaleONOS7nodes/__init__.py
+++ /dev/null
diff --git a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.params b/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.params
deleted file mode 100644
index dc9aed2..0000000
--- a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.params
+++ /dev/null
@@ -1,92 +0,0 @@
-<PARAMS>
-    <testcases>1,31,33,4,41,43,5,51,53,6,61,63,7,71,73,103,105,8,61,63,9,51,53,10,41,43,11,31,33,104,106</testcases>
-    <tcpdump> 
-        <intf>eth0</intf>
-        <port>port 6633</port>
-        <filename>~/packet_captures/Sanity.pcap</filename>
-    </tcpdump>
-    <CASE1>       
-        <destination>h6</destination>
-        <target>h40</target>
-    </CASE1>       
-    <PING>
-        <source1>h7</source1>
-        <target1>h32</target1>
-        <source2>h8</source2>
-        <target2>h33</target2>
-    </PING>
-    <LINK>
-        <begin>s1</begin>
-        <end>s2</end>
-    </LINK>
-    <YANK>
-        <hostname>h1</hostname>
-        <hostip>10.0.0.1</hostip>
-        <hostmac>00:00:00:00:00:01</hostmac>
-	<sw1>s1</sw1>
-        <sw6>s6</sw6>
-        <intf>s1-eth1</intf>
-    </YANK>
-    <PLUG>
-        <intf>s1-eth1</intf>
-	<sw6>s6</sw6>
-	<sw1>s1</sw1>
-    </PLUG>
-    <CTRL>
-        <ip1>10.128.10.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.10.2</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.10.3</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.10.4</ip4>
-        <port4>6633</port4>
-        <ip5>10.128.10.5</ip5>
-        <port5>6633</port5>
-        <ip6>10.128.10.6</ip6>
-        <port6>6633</port6>
-        <ip7>10.128.10.7</ip7>
-        <port7>6633</port7>
-    </CTRL>
-    <INTENTREST>
-        <intentIP>10.128.10.1</intentIP>
-        <intentPort>8080</intentPort>
-        <intentURL>wm/onos/intent/high</intentURL>
-    </INTENTREST>
-    <RestIP>10.128.10.1</RestIP>
-    <RestIP2>10.128.10.2</RestIP2>
-    <RestIP3>10.128.10.3</RestIP3>
-    <RestIP4>10.128.10.4</RestIP4>
-    <RestIP5>10.128.10.5</RestIP5>
-    <RestIP6>10.128.10.6</RestIP6>
-    <RestIP7>10.128.10.7</RestIP7>
-    <NR_Switches>25</NR_Switches>
-    <NR_Links>50</NR_Links>
-    <RESTCALL>
-	<restIP1>10.128.10.1</restIP1>
-	<restIP2>10.128.10.2</restIP2>
-	<restPort>8080</restPort>
-	<restURL>/wm/onos/topology/hosts</restURL>
-    </RESTCALL>
-    <url1>http://10.128.10.1:8080/wm/onos/metrics</url1>
-    <url2>http://10.128.10.2:8080/wm/onos/metrics</url2>
-    <url3>http://10.128.10.3:8080/wm/onos/metrics</url3>
-    <url4>http://10.128.10.4:8080/wm/onos/metrics</url4>
-    <url5>http://10.128.10.5:8080/wm/onos/metrics</url5>
-    <url6>http://10.128.10.6:8080/wm/onos/metrics</url6>
-    <url7>http://10.128.10.7:8080/wm/onos/metrics</url7>
-    <switches_num>30</switches_num>
-    <RATE1>100</RATE1>
-    <RUN_DUR>600</RUN_DUR>
-    <sleep_t>6</sleep_t>
-    <loop>10</loop>
-    <port>10</port>
-    <sleep_init>540</sleep_init>
-    <int_num>40</int_num>
-    <addrate>1</addrate>
-    <NBdur>100</NBdur>
-    <NBsleep>5</NBsleep>
-    <NBloop>7</NBloop>
-    <NBsleep_init>60</NBsleep_init>
-    <db_script>/home/admin/TestON/scripts/./scaleoutdatagraph.py</db_script>
-</PARAMS>      
diff --git a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.py b/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.py
deleted file mode 100644
index ba21e61..0000000
--- a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.py
+++ /dev/null
@@ -1,1346 +0,0 @@
-#Author: Santhosh Jayashankar
-class scaleONOS7nodes :
-
-
-
-    def __init__(self) :
-        self.default = ''
-
-#        def print_hello_world(self,main):
-#            print("hello world")
-#*****************************************************************************************************************************************************************************************
-#Test startup
-#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
-    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
-        main.case("Initial setup")
-        main.log.report("Starting 3-node ONOS cluster.")
-        main.step("Stop ONOS")
-        import time
-        main.log.info("Stopping all ONOS nodes...")
-        main.ONOS1.stop_all()
-        main.ONOS2.stop_all()
-        main.ONOS3.stop_all()
-#        main.print_hello_world()
-        main.ONOS4.stop_all()
-        main.ONOS5.stop_all()
-        main.ONOS6.stop_all()
-        main.ONOS7.stop_all()
-        #main.ONOS2.stop_rest()
-        time.sleep(5)
-        #main.ONOS1.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        #main.ONOS2.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        #main.ONOS3.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
-        #main.ONOS4.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")        
-        #main.step("Start tcpdump on mn")
-        #main.Mininet2.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
-        main.step("Starting 3 ONOS nodes...")
-        main.Zookeeper1.start()
-        main.Zookeeper2.start()
-        main.Zookeeper3.start()
-        main.Zookeeper4.start()
-        main.Zookeeper5.start()
-        main.Zookeeper6.start()
-        main.Zookeeper7.start()
-        
-        time.sleep(5)
-        
-        """        
-        main.RamCloud1.del_db()
-        main.RamCloud2.del_db()
-        main.RamCloud3.del_db()
-       # main.RamCloud4.del_db()
-
-        time.sleep(5)
-        #main.log.report("Pulling latest code from github to all nodes")
-          
-        
-        for i in range(2):
-            uptodate = main.ONOS1.git_pull()
-            main.ONOS2.git_pull()
-            main.ONOS3.git_pull()
-        #    main.ONOS4.git_pull()
-            ver1 = main.ONOS1.get_version()
-            ver2 = main.ONOS3.get_version()
-            if ver1==ver2:
-                break
-            elif i==1:
-                main.ONOS2.git_pull("ONOS1 master")
-                main.ONOS3.git_pull("ONOS1 master")
-               # main.ONOS4.git_pull("ONOS1 master")
-        if uptodate==0:
-       # if 1:
-            main.ONOS1.git_compile()
-            main.ONOS2.git_compile()
-            main.ONOS3.git_compile()
-           # main.ONOS4.git_compile()
-        main.ONOS1.print_version()    
-       # main.RamCloud1.git_pull()
-       # main.RamCloud2.git_pull()
-       # main.RamCloud3.git_pull()
-       # main.RamCloud4.git_pull()
-       # main.ONOS1.get_version()
-       # main.ONOS2.get_version()
-       # main.ONOS3.get_version()
-       # main.ONOS4.get_version()
-       # main.ONOS1.start_all()
-       # main.ONOS2.start_all()
-       # main.ONOS3.start_all()
-       # main.ONOS4.start_all()
-
-        
-        main.RamCloud1.start_coor()
-        main.RamCloud1.start_serv()
-        main.RamCloud2.start_serv()
-        main.RamCloud3.start_serv()
-        time.sleep(5)
-        main.ONOS1.start()
-        main.ONOS2.start()
-        main.ONOS3.start()
-        #main.ONOS4.start()
-        time.sleep(5)
-        """
-        main.ONOS1.handle.sendline("./onos.sh core start")
-        main.ONOS2.handle.sendline("./onos.sh core start")
-        main.ONOS3.handle.sendline("./onos.sh core start")
-
-        main.ONOS1.start_rest()
-        main.ONOS2.start_rest()
-        main.ONOS3.start_rest()
-        test= main.ONOS2.rest_status()
-        if test == main.FALSE:
-            main.ONOS1.start_rest()
-        main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper, and ONOS connections")
-        main.step("Testing startup Zookeeper")   
-        data =  main.Zookeeper1.isup() and main.Zookeeper2.isup() and main.Zookeeper3.isup()
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
-        """
-        main.step("Testing startup RamCloud")   
-        data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() #and main.RamCloud4.status_serv()
-        if data == main.FALSE:
-            main.RamCloud1.stop_coor()
-            main.RamCloud1.stop_serv()
-            main.RamCloud2.stop_serv()
-            main.RamCloud3.stop_serv()
-        #    main.RamCloud4.stop_serv()
-
-            time.sleep(5)
-            main.RamCloud1.start_coor()
-            main.RamCloud1.start_serv()
-            main.RamCloud2.start_serv()
-            main.RamCloud3.start_serv()
-         #   main.RamCloud4.start_serv()
-            time.sleep(5)
-            data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() #and main.RamCloud4.status_serv()
-            
-
-        
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
-        """
-        main.step("Testing startup ONOS")   
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() #and main.ONOS4.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                #main.log.report("Something is funny... restarting ONOS")
-                #main.ONOS1.stop()
-                time.sleep(3)
-                #main.ONOS1.start()
-                #time.sleep(5) 
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() #and main.ONOS4.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
-        time.sleep(10)
-
-
-    def CASE31(self,main):
-        main.log.report("SB Throughput test: loading ONOS cluster with 740 Topo Events/s")
-        main.case("Staring SB load with 3 ONOS nodes")
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        rate1 = main.params['RATE1']
-        run_dur = main.params['RUN_DUR']
-        loop = int( main.params['loop'])
-        port = main.params['port']
-        switches_num = main.params['switches_num']
-        print loop
-        sleep_init = int(main.params['sleep_init'])
-        sleep_t =int( main.params['sleep_t'])
-        main.case("Starting SB load on 3 nodes from mininet with " + rate1 +"  added/removed/s for " + run_dur)
-        main.Mininet2.handle.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + "\"" + " -s " + switches_num + " -p " + port + " -a " + rate1 + " -d " + rate1 + " -l " + run_dur)
-        main.log.info("Adding switches and ports.....")
-        main.Mininet2.handle.expect("Starting SB load....", timeout=400)
-        main.log.info("Starting SB load....")
-        import time
-        import json
-        import math
-        time.sleep(sleep_init)
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale3nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale3nodesrate1", "a")
-        #time.sleep(10)
-        tpval = 0.0
-        global tpavg3n
-        tpavg3n = 0.0
-        for i in range(int (loop)):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            #float jval = 0
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "":
-                # write_str = str(json_str["meters"][4]["meter"][2])
-                #print str(json_str["meters"][4])
-                #f.write(str(json_str["meters"][4]))
-                #f.write('\n')
-                #time.sleep(3)
-                for j in range(1,4):
-                    f.write("ONOS" + str(j) + "\n")
-                    f.write(str(json_str[j]["meters"][4]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['mean_rate']))
-                    f.write('\n')
-                    if j == 3:
-                        tpval += float(json_str[j]["meters"][4]['meter']['m1_rate']) 
-                        #print tpval
-                        #print ("\n")
-                            
-                
-                f.write('\n')
-                f.write('\n')
-                
-                f.write("--------------------------------------------------------------------------------- \n") 
-                time.sleep(sleep_t)
-        f.close() 
-       # print tpval
-        print("\n")
-        tpavg3n = round(tpval)/loop
-        print tpavg3n
-        main.log.report("Topology Event Throughput for 3-node ONOS cluster = " +str(tpavg3n) + " Events/sec")
-        main.Mininet2.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        
-    def CASE33(self,main):
-        
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        import time
-        import json
-        int_num = int(main.params['int_num'])
-        addrate = main.params['addrate']
-        NBdur = main.params['NBdur']
-        NBsleep = int(main.params['NBsleep'])
-        NBsleep_init = int(main.params['NBsleep_init'])
-        NBloop = int(main.params['NBloop'])
-        int_r = 3 * int_num
-        main.log.report("Starting NB Throughput test: loading 3-node ONOS cluster with " + str(int_num) + " Intents/s on each node" )
-        main.Mininet4.handle.expect("\$")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s1 tcp:" + ip1 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:" + ip1 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:" + ip2 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:" + ip2 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:" + ip3 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:" + ip3 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:" + ip3 + ":6633")
-        
-        main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
-        main.ONOS3.handle.expect("\$")
-
-        main.ONOS3.handle.sendline("./loadgen_NB.py -n 3 -u \"" + ip1 + ":8080 " + ip2 + ":8080 " + ip3 + ":8080 \" -i " + str(int_r) + " -a " + addrate + " -l " + NBdur + " -p 20")
-        main.ONOS3.handle.expect("Pause between add and delete:", timeout=900)
-        time.sleep(NBsleep_init)
-        import json
-        nbtpval = 0.0
-        global nbtpavg3n
-        nbtpavg3n = 0.0
-        
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale3nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale3nodesrate1", "a")
-        for i in range(NBloop):
-            j1 = main.ONOS1.get_json(url1)
-            j2 = main.ONOS1.get_json(url2)
-            j3 = main.ONOS1.get_json(url3)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "":
-                for j in range(1,4):
-                    f.write("*****************ONOS" + str(j) + " INCOMING RATE****************************" "\n")
-                    f.write(str(json_str[j]["meters"][0]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['mean_rate']))
-                    f.write('\n')
-                
-                    f.write('\n')
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                
-                    f.write("***************** ONOS" + str(j) + " PROCESSING RATE************************" + " \n ")
-                    f.write(str(json_str[j]["meters"][1]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['mean_rate']))
-                    f.write('\n')
-                    f.write('\n')
-                    f.write('\n')
-                    nbtpval += float(json_str[j]["meters"][1]['meter']['m1_rate']) 
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                    f.write("--------------------------------------------------------------------------------- \n \n") 
-                    time.sleep(NBsleep)
-        f.close()
-        print("\n")
-        nbtpavg3n = round(round(nbtpval)/NBloop,2)
-        print nbtpavg3n
-        
-        main.ONOS3.handle.expect("\$", timeout=900)
-        #time.sleep(180) 
-        main.log.report("Intent Throughput for 3-node ONOS cluster = " + str(nbtpavg3n) + " Intents/sec")
-        
-    def CASE4(self,main):
-        
-        main.log.report("Scale-up ONOS to 4-nodes ")
-        main.case("Starting ONOS scale-up to 4 nodes ")
-        import time
-       # main.RamCloud4.start_serv()
-        main.ONOS5.handle.sendline("./onos.sh core stop")
-        main.ONOS6.handle.sendline("./onos.sh core stop")
-        main.ONOS7.handle.sendline("./onos.sh core stop")
-    
-            
-        main.Zookeeper4.start()
-        time.sleep(5)
-        """ 
-        main.RamCloud4.del_db()
-        time.sleep(3)
-        main.RamCloud4.start_serv()
-        time.sleep(3)
-        """
-        main.ONOS4.start()
-        main.ONOS4.start_rest()
-        time.sleep(5)
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                time.sleep(3)
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Scale up successful - 4-node ONOS cluster is up and running!",onfail="ONOS didn't start...")
-        
-        time.sleep(10)
-    
-    def CASE5(self,main):
-        main.log.report("Scale-up ONOS to 5-nodes")
-        main.case("Starting ONOS scale-up/down to 5 nodes ")
-        import time
-        main.ONOS6.handle.sendline("./onos.sh core stop")
-        main.ONOS7.handle.sendline("./onos.sh core stop")
-    
-        main.Zookeeper5.start()
-        time.sleep(5)
-        """
-        main.RamCloud5.del_db()
-        time.sleep(3)
-        main.RamCloud5.start_serv()
-        time.sleep(3)
-        """
-        main.ONOS5.start()
-        main.ONOS5.start_rest()
-        time.sleep(5)
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                time.sleep(3)
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup() 
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Scale up successful - 5-node ONOS cluster is up and running!",onfail="ONOS didn't start...")
-        time.sleep(10)
-
-    def CASE6(self,main):
-        main.log.report("Scale-up ONOS to 6-nodes")
-        main.case("Starting ONOS scale-up/down to 6 nodes ")
-        import time
-        main.ONOS7.handle.sendline("./onos.sh core stop")
-
-        main.Zookeeper6.start()
-        time.sleep(5)
-        """
-        main.RamCloud6.del_db()
-        time.sleep(3)
-        main.RamCloud6.start_serv()
-        time.sleep(3)
-        """
-        main.ONOS6.start()
-        main.ONOS6.start_rest()
-        time.sleep(5)
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup() and main.ONOS6.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                time.sleep(3)
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup() and main.ONOS6.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Scale up successful - 6-node ONOS cluster is up and running!",onfail="ONOS didn't start...")
-        time.sleep(10)
-
-    def CASE7(self,main):
-        main.log.report("Scale-up ONOS to 7-nodes")
-        main.case("Starting ONOS scale-up/down to 7 nodes ")
-        import time
-    
-        main.Zookeeper7.start()
-        time.sleep(5)
-        """
-        main.RamCloud7.del_db()            
-        time.sleep(3)
-        main.RamCloud7.start_serv()
-        time.sleep(3)
-        """
-        main.ONOS7.start()
-        main.ONOS7.start_rest()
-        time.sleep(5)
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup() and main.ONOS6.isup() and main.ONOS7.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                time.sleep(3)
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup() and main.ONOS6.isup() and main.ONOS7.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Scale up successful - 7-node ONOS cluster is up and running!",onfail="ONOS didn't start...")
-        time.sleep(10)
-
-
-
-    def CASE41(self,main):
-        main.case("Starting SB test for 4 nodes")
-        main.log.report("SB Throughput test: loading 4-node ONOS cluster with 740 Topo Events/s")
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-        rate1 = main.params['RATE1']
-        run_dur = main.params['RUN_DUR']
-        loop = int( main.params['loop'])
-        switches_num = main.params['switches_num']
-        port = main.params['port']
-        print loop
-        sleep_init = int(main.params['sleep_init'])
-        sleep_t =int( main.params['sleep_t'])
-        main.case("Starting SB load on 4 nodes from mininet with " + rate1 +"  added/removed/s for " + run_dur)
-        main.Mininet2.handle.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 +  "\"" + " -s " + switches_num + " -p " + port + " -a " + rate1 + " -d " + rate1 + " -l " + run_dur)
-        main.Mininet2.handle.expect("Starting SB load....", timeout=900)
-        import time
-        import json
-        import math
-        time.sleep(sleep_init)
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale4nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        url4 = main.params['url4']
-        tpval = 0.0
-        global tpavg4n 
-        tpavg4n = 0.0
-
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale4nodesrate1", "a")
-        for i in range(int (loop)):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            j4 = main.ONOS2.get_json(url4)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            json_str.append(j4)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "":
-                for j in range(1,5):
-                    f.write("ONOS" + str(j) + "\n")
-                    f.write(str(json_str[j]["meters"][4]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['mean_rate']))
-                    f.write('\n')
-                    if j == 4:
-                        tpval += float(json_str[j]["meters"][4]['meter']['m1_rate']) 
-                
-                f.write('\n')
-                f.write('\n')
-                
-                f.write("--------------------------------------------------------------------------------- \n") 
-                time.sleep(sleep_t)
-        f.close() 
-        print("\n")
-        tpavg4n = round(tpval)/loop
-        print tpavg4n
-        main.log.report("Topology Event Throughput for 4-node ONOS cluster = " + str(tpavg4n) + " Events/sec")
-        
-        time.sleep(5)
-        main.Mininet2.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        
-
-    def CASE43(self,main):
-        
-        main.case("Starting NB Throughput test after scaling up to 4 onos nodes")
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-
-        import time
-        import json
-        int_num = int(main.params['int_num'])
-        addrate = main.params['addrate']
-        NBdur = main.params['NBdur']
-        NBsleep = int(main.params['NBsleep'])
-        NBsleep_init = int(main.params['NBsleep_init'])
-        NBloop = int(main.params['NBloop'])
-        nbtpval = 0.0
-        main.log.report("Starting NB Throughput test: loading 4-node ONOS cluster with " +str(int_num) + " Intents/s on each node" )
-        global nbtpavg4n
-        nbtpavg4n = 0.0
-        int_r = 4 * int_num
-        main.Mininet4.handle.expect("\$")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s1 tcp:" + ip1 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:" + ip2 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:" + ip3 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:" + ip4 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:" + ip1 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:" + ip2 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:" + ip4 + ":6633")
-        
-        main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
-        main.ONOS3.handle.expect("\$")
-
-        main.ONOS3.handle.sendline("./loadgen_NB.py -n 4 -u \"" + ip1 + ":8080 " + ip2 + ":8080 " + ip3 + ":8080 " + ip4 + ":8080  \" -i " + str(int_r) + " -a " + addrate + " -l " + NBdur + " -p 20")
-        main.ONOS3.handle.expect("Pause between add and delete:", timeout=900)
-
-        
-        time.sleep(NBsleep_init)
-        import json
-        
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale4nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        url4 = main.params['url4']
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale4nodesrate1", "a")
-        for i in range(NBloop):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            j4 = main.ONOS2.get_json(url4)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            json_str.append(j4)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "":
-                for j in range(1,5):
-                    f.write("*****************ONOS" + str(j) + " INCOMING RATE****************************" "\n")
-                    f.write(str(json_str[j]["meters"][0]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['mean_rate']))
-                    f.write('\n')
-                
-                    f.write('\n')
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                
-                    f.write("***************** ONOS" + str(j) + " PROCESSING RATE************************" + " \n ")
-                    f.write(str(json_str[j]["meters"][1]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['mean_rate']))
-                    f.write('\n')
-                    f.write('\n')
-                    f.write('\n')
-                    
-                    nbtpval += float(json_str[j]["meters"][1]['meter']['m1_rate']) 
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                    f.write("--------------------------------------------------------------------------------- \n \n") 
-                    time.sleep(NBsleep)
-        f.close()
-        print("\n")
-        nbtpavg4n = round(round(nbtpval)/NBloop,2)
-        print nbtpavg4n
-        
-
-        main.ONOS3.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        main.log.report("Intent Throughput for 4-node ONOS cluster = " + str(nbtpavg4n) + " Intents/sec")
-    
-    def CASE51(self,main):
-        main.case("Starting SB test for 5 nodes")
-        main.log.report("SB Throughput test: loading 5-node ONOS cluster with 740 Topo Events/s")
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-        ip5 = main.params['CTRL']['ip5']
-        rate1 = main.params['RATE1']
-        run_dur = main.params['RUN_DUR']
-        loop = int( main.params['loop'])
-        switches_num = main.params['switches_num']
-        port = main.params['port']
-        print loop
-        sleep_init = int(main.params['sleep_init'])
-        sleep_t =int( main.params['sleep_t'])
-        main.case("Starting SB load on 5 nodes from mininet with " + rate1 +"  added/removed/s for " + run_dur)
-        main.Mininet2.handle.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + " " + ip5 + "\"" + " -s " + switches_num + " -p " + port + " -a " + rate1 + " -d " + rate1 + " -l " + run_dur)
-        main.Mininet2.handle.expect("Starting SB load....", timeout=900)
-        import time
-        import json
-        tpval = 0.0
-        global tpavg5n 
-        tpavg5n = 0.0
-        time.sleep(sleep_init)
-
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale5nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        url4 = main.params['url4']
-        url5 = main.params['url5']
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale5nodesrate1", "a")
-        for i in range(int (loop)):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            j4 = main.ONOS2.get_json(url4)
-            j5 = main.ONOS2.get_json(url5)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            json_str.append(j4)
-            json_str.append(j5)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "" and json_str[5] != "":
-                for j in range(1,6):
-                    f.write("ONOS" + str(j) + "\n")
-                    f.write(str(json_str[j]["meters"][4]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['mean_rate']))
-                    f.write('\n')
-                    if j == 4:
-                        tpval += float(json_str[j]["meters"][4]['meter']['m1_rate']) 
-                
-                f.write('\n')
-                f.write('\n')
-                
-                f.write("--------------------------------------------------------------------------------- \n") 
-                time.sleep(sleep_t)
-        f.close() 
-        print("\n")
-        tpavg5n = round(tpval)/loop
-        print tpavg5n
-        
-        time.sleep(5)
-        main.Mininet2.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        main.log.report("Topology Event Throughput for 5-node ONOS cluster = " + str(tpavg5n) + " Events/sec")
-        
-
-    def CASE53(self,main):
-        
-        main.case("Starting NB Throughput test after scaling up to 5 onos nodes")
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-        ip5 = main.params['CTRL']['ip5']
-
-        import time
-        import json
-        int_num = int(main.params['int_num'])
-        addrate = main.params['addrate']
-        NBdur = main.params['NBdur']
-        NBsleep = int(main.params['NBsleep'])
-        NBsleep_init = int(main.params['NBsleep_init'])
-        NBloop = int(main.params['NBloop'])
-        nbtpval = 0.0
-        main.log.report("Starting NB Throughput test: loading 5-node ONOS cluster with " + str(int_num) + " Intents/s on each node" )
-        global nbtpavg5n
-        nbtpavg5n = 0.0
-        int_r = 5 * int_num
-        main.Mininet4.handle.expect("\$")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s1 tcp:" + ip1 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:" + ip2 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:" + ip3 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:" + ip4 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:" + ip5 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:" + ip3 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:" + ip5 + ":6633")
-        
-        main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
-        main.ONOS3.handle.expect("\$")
-
-        main.ONOS3.handle.sendline("./loadgen_NB.py -n 5 -u \"" + ip1 + ":8080 " + ip2 + ":8080 " + ip3 + ":8080 " + ip4 + ":8080 " + ip5 + ":8080  \" -i " + str(int_r) + " -a " + addrate + " -l " + NBdur + " -p 20")
-        main.ONOS3.handle.expect("Pause between add and delete:", timeout=900)
-
-        
-        time.sleep(NBsleep_init)
-        import json
-        
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale5nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        url4 = main.params['url4']
-        url5 = main.params['url5']
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale5nodesrate1", "a")
-        for i in range(NBloop):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            j4 = main.ONOS2.get_json(url4)
-            j5 = main.ONOS2.get_json(url5)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            json_str.append(j4)
-            json_str.append(j5)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "" and json_str[5] != "":
-                for j in range(1,6):
-                    f.write("*****************ONOS" + str(j) + " INCOMING RATE****************************" "\n")
-                    f.write(str(json_str[j]["meters"][0]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['mean_rate']))
-                    f.write('\n')
-                
-                    f.write('\n')
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                
-                    f.write("***************** ONOS" + str(j) + " PROCESSING RATE************************" + " \n ")
-                    f.write(str(json_str[j]["meters"][1]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['mean_rate']))
-                    f.write('\n')
-                    f.write('\n')
-                    f.write('\n')
-                    
-                    nbtpval += float(json_str[j]["meters"][1]['meter']['m1_rate']) 
-
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                    f.write("--------------------------------------------------------------------------------- \n \n") 
-                    time.sleep(NBsleep)
-        f.close()
-        print("\n")
-        nbtpavg5n = round(round(nbtpval)/NBloop,2)
-        print nbtpavg5n
-        
-
-        main.ONOS3.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        main.log.report("Intent Throughput for 5-node ONOS cluster = " + str(nbtpavg5n) + " Intents/sec")
-    
-    def CASE61(self,main):
-        main.case("Starting SB test for 5 nodes")
-        ip1 = main.params['CTRL']['ip1']
-        main.log.report("SB Throughput test: loading 6-node ONOS cluster with 740 Topo Events/s")
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-        ip5 = main.params['CTRL']['ip5']
-        ip6 = main.params['CTRL']['ip6']
-        rate1 = main.params['RATE1']
-        run_dur = main.params['RUN_DUR']
-        loop = int( main.params['loop'])
-        switches_num = main.params['switches_num']
-        port = main.params['port']
-        print loop
-        sleep_t =int( main.params['sleep_t'])
-        sleep_init = int(main.params['sleep_init'])
-        main.case("Starting SB load on 6 nodes from mininet with " + rate1 +"  added/removed/s for " + run_dur)
-        main.Mininet2.handle.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + " " + ip5 + " " + ip6 +  "\"" + " -s " + switches_num + " -p " + port + " -a " + rate1 + " -d " + rate1 + " -l " + run_dur)
-        main.Mininet2.handle.expect("Starting SB load....", timeout=900)
-        
-        import time
-        import json
-        tpval = 0.0
-        global tpavg6n
-        tpavg6n = 0.0
-        time.sleep(sleep_init)
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale6nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        url4 = main.params['url4']
-        url5 = main.params['url5']
-        url6 = main.params['url6']
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale6nodesrate1", "a")
-        for i in range(int (loop)):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            j4 = main.ONOS2.get_json(url4)
-            j5 = main.ONOS2.get_json(url5)
-            j6 = main.ONOS2.get_json(url6)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            json_str.append(j4)
-            json_str.append(j5)
-            json_str.append(j6)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "" and json_str[5] != "" and json_str[6] != "":
-                for j in range(1,7):
-                    f.write("ONOS" + str(j) + "\n")
-                    f.write(str(json_str[j]["meters"][4]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['mean_rate']))
-                    f.write('\n')
-                    if j == 4:
-                        tpval += float(json_str[j]["meters"][4]['meter']['m1_rate']) 
-                
-                f.write('\n')
-                f.write('\n')
-                
-                f.write("--------------------------------------------------------------------------------- \n") 
-                time.sleep(sleep_t)
-        f.close() 
-        print("\n")
-        tpavg6n = round(tpval)/loop
-        print tpavg6n
-        
-        time.sleep(5)
-        main.Mininet2.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        main.log.report("Topology Event Throughput for 6-node ONOS cluster = " + str(tpavg6n) + " Events/sec")
-        
-
-    def CASE63(self,main):
-        
-        main.case("Starting NB Throughput test after scaling up to 4 onos nodes")
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-        ip5 = main.params['CTRL']['ip5']
-        ip6 = main.params['CTRL']['ip6']
-
-        import time
-        import json
-        int_num = int(main.params['int_num'])
-        addrate = main.params['addrate']
-        NBdur = main.params['NBdur']
-        NBsleep = int(main.params['NBsleep'])
-        NBsleep_init = int(main.params['NBsleep_init'])
-        NBloop = int(main.params['NBloop'])
-        nbtpval = 0.0
-        main.log.report("Starting NB Throughput test: loading 6-node ONOS cluster with " + str(int_num) + " Intents/s" )
-        global nbtpavg6n
-        nbtpavg6n = 0.0
-        int_r = 6 * int_num
-        main.Mininet4.handle.expect("\$")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s1 tcp:" + ip1 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:" + ip2 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:" + ip3 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:" + ip4 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:" + ip5 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:" + ip6 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:" + ip6 + ":6633")
-        
-        main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
-        main.ONOS3.handle.expect("\$")
-
-        main.ONOS3.handle.sendline("./loadgen_NB.py -n 6 -u \"" + ip1 + ":8080 " + ip2 + ":8080 " + ip3 + ":8080 " + ip4 + ":8080 " + ip5 + ":8080 " + ip6 + ":8080 \" -i " + str(int_r) + " -a " + addrate + " -l " + NBdur + " -p 20")
-        main.ONOS3.handle.expect("Pause between add and delete:", timeout=900)
-
-        
-        time.sleep(NBsleep_init)
-        import json
-        
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale6nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        url4 = main.params['url4']
-        url5 = main.params['url5']
-        url6 = main.params['url6']
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale6nodesrate1", "a")
-        for i in range(NBloop):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            j4 = main.ONOS2.get_json(url4)
-            j5 = main.ONOS2.get_json(url5)
-            j6 = main.ONOS2.get_json(url6)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            json_str.append(j4)
-            json_str.append(j5)
-            json_str.append(j6)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "" and json_str[5] != "" and json_str[6] != "":
-                for j in range(1,7):
-                    f.write("*****************ONOS" + str(j) + " INCOMING RATE****************************" "\n")
-                    f.write(str(json_str[j]["meters"][0]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['mean_rate']))
-                    f.write('\n')
-                
-                    f.write('\n')
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                
-                    f.write("***************** ONOS" + str(j) + " PROCESSING RATE************************" + " \n ")
-                    f.write(str(json_str[j]["meters"][1]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['mean_rate']))
-                    f.write('\n')
-                    f.write('\n')
-                    f.write('\n')
-                    
-                    nbtpval += float(json_str[j]["meters"][1]['meter']['m1_rate']) 
-
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                    f.write("--------------------------------------------------------------------------------- \n \n") 
-                    time.sleep(NBsleep)
-        f.close()
-        print("\n")
-        nbtpavg6n = round(round(nbtpval)/NBloop,2)
-        print nbtpavg6n
-        
-        
-
-        main.ONOS3.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        main.log.report("Intent Throughput for 6-node ONOS cluster = " + str(nbtpavg6n) + " Intents/sec")
-    
-    def CASE71(self,main):
-        main.case("Starting SB test for 7 nodes")
-        main.log.report("SB Throughput test: loading 7-node ONOS cluster with 740 Topo Events/s")
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-        ip5 = main.params['CTRL']['ip5']
-        ip6 = main.params['CTRL']['ip6']
-        ip7 = main.params['CTRL']['ip7']
-        rate1 = main.params['RATE1']
-        run_dur = main.params['RUN_DUR']
-        loop = int( main.params['loop'])
-        switches_num = main.params['switches_num']
-        port = main.params['port']
-        print loop
-        sleep_t =int( main.params['sleep_t'])
-        sleep_init = int(main.params['sleep_init'])
-        main.case("Starting SB load on 6 nodes from mininet with " + rate1 +"  added/removed/s for " + run_dur)
-        main.Mininet2.handle.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + " " + ip5 +  " " + ip6 + " " + ip7 + "\"" + " -s " + switches_num + " -p " + port + " -a " + rate1 + " -d " + rate1 + " -l " + run_dur)
-        main.Mininet2.handle.expect("Starting SB load....", timeout=900)
-        import time
-        import json
-        tpval = 0.0
-        global tpavg7n
-        tpavg7n = 0.0
-        time.sleep(sleep_init)
-        
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale7nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        url4 = main.params['url4']
-        url5 = main.params['url5']
-        url6 = main.params['url6']
-        url7 = main.params['url7']
-
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale7nodesrate1", "a")
-        for i in range(int (loop)):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            j4 = main.ONOS2.get_json(url4)
-            j5 = main.ONOS2.get_json(url5)
-            j6 = main.ONOS2.get_json(url6)
-            j7 = main.ONOS2.get_json(url7)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            json_str.append(j4)
-            json_str.append(j5)
-            json_str.append(j6)
-            json_str.append(j7)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "" and json_str[5] != "" and json_str[6] != "" and json_str[7] != "":
-                for j in range(1,8):
-                    f.write("ONOS" + str(j) + "\n")
-                    f.write(str(json_str[j]["meters"][4]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][4]['meter']['mean_rate']))
-                    f.write('\n')
-                    if j == 4:
-                        tpval += float(json_str[j]["meters"][4]['meter']['m1_rate']) 
-                
-                f.write('\n')
-                f.write('\n')
-                
-                f.write("--------------------------------------------------------------------------------- \n") 
-                time.sleep(sleep_t)
-        f.close() 
-        print("\n")
-        tpavg7n = round(tpval)/loop
-        print tpavg7n
-        
-        time.sleep(5)
-        main.Mininet2.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        main.log.report("Topology Event Throughput for 7-node ONOS cluster = " + str(tpavg7n) + " Events/sec")
-        
-
-    def CASE73(self,main):
-        
-        main.case("Starting NB Throughput test after scaling up to 7 onos nodes")
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-        ip5 = main.params['CTRL']['ip5']
-        ip6 = main.params['CTRL']['ip6']
-        ip7 = main.params['CTRL']['ip7']
-
-        import time
-        import json
-        int_num = int(main.params['int_num'])
-        addrate = main.params['addrate']
-        NBdur = main.params['NBdur']
-        NBsleep = int(main.params['NBsleep'])
-        NBsleep_init = int(main.params['NBsleep_init'])
-        NBloop = int(main.params['NBloop'])
-        main.log.report("Starting NB Throughput test: loading 7-node ONOS cluster with " + str(int_num) + " Intents/s" )
-        nbtpval = 0.0
-        global nbtpavg7n
-        nbtpavg7n = 0.0
-        int_r = 7 * int_num
-        main.Mininet4.handle.expect("\$")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s1 tcp:" + ip1 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:" + ip2 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:" + ip3 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:" + ip4 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:" + ip5 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:" + ip6 + ":6633")
-        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:" + ip7 + ":6633")
-        
-        main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
-        main.ONOS3.handle.expect("\$")
-
-        main.ONOS3.handle.sendline("./loadgen_NB.py -n 7 -u \"" + ip1 + ":8080 " + ip2 + ":8080 " + ip3 + ":8080 " + ip4 + ":8080 " + ip6 + ":8080 " + ip5 + ":8080 " + ip7 + ":8080  \" -i " + str(int_r) + " -a " + addrate + " -l " + NBdur + " -p 20")
-        main.ONOS3.handle.expect("Pause between add and delete:", timeout=900)
-
-        
-        time.sleep(NBsleep_init)
-        import json
-        
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale7nodesrate1", 'w').close()
-        url1 = main.params['url1']
-        url2 = main.params['url2']
-        url3 = main.params['url3']
-        url4 = main.params['url4']
-        url5 = main.params['url5']
-        url6 = main.params['url6']
-        url7 = main.params['url7']
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale7nodesrate1", "a")
-        for i in range(NBloop):
-            j1 = main.ONOS2.get_json(url1)
-            j2 = main.ONOS2.get_json(url2)
-            j3 = main.ONOS2.get_json(url3)
-            j4 = main.ONOS2.get_json(url4)
-            j5 = main.ONOS2.get_json(url5)
-            j6 = main.ONOS2.get_json(url6)
-            j7 = main.ONOS2.get_json(url7)
-            json_str = []
-            json_str.append(0)
-            json_str.append(j1)
-            json_str.append(j2)
-            json_str.append(j3)
-            json_str.append(j4)
-            json_str.append(j5)
-            json_str.append(j6)
-            json_str.append(j7)
-            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "" and json_str[5] != "" and json_str[6] != "" and json_str[6] != "":
-                for j in range(1,8):
-                    f.write("*****************ONOS" + str(j) + " INCOMING RATE****************************" "\n")
-                    f.write(str(json_str[j]["meters"][0]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][0]['meter']['mean_rate']))
-                    f.write('\n')
-                
-                    f.write('\n')
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                
-                    f.write("***************** ONOS" + str(j) + " PROCESSING RATE************************" + " \n ")
-                    f.write(str(json_str[j]["meters"][1]['meter']['count']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m1_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m5_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['m15_rate']))
-                    f.write('\t')
-                    f.write(str(json_str[j]["meters"][1]['meter']['mean_rate']))
-                    f.write('\n')
-                    f.write('\n')
-                    f.write('\n')
-                    
-                    nbtpval += float(json_str[j]["meters"][1]['meter']['m1_rate']) 
-
-
-                    f.write("--------------------------------------------------------------------------------- \n") 
-                    f.write("--------------------------------------------------------------------------------- \n \n") 
-                    time.sleep(NBsleep)
-        f.close()
-        print("\n")
-        nbtpavg7n = round(round(nbtpval)/NBloop,2)
-        print nbtpavg7n
-        
-
-        main.ONOS3.handle.expect("\$", timeout=900)
-        time.sleep(180)
-        main.log.report("Intent Throughput for 7-node ONOS cluster = " + str(nbtpavg7n) + " Intents/sec")
-    
-    def CASE8(self,main):
-        import time
-        main.log.report("Scaling ONOS down to 6 ONOS instances")
-        main.ONOS7.handle.sendline("./onos.sh core stop")
-        time.sleep(8)
-        pdata = main.ONOS7.isup()
-        utilities.assert_equals(expect=main.FALSE,actual=pdata,onpass="ONOS7 stopped... ",onfail="ONOS scale down failed...")
-        time.sleep(3)
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup() and main.ONOS6.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                time.sleep(3)
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup() and main.ONOS6.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Scale down successfull -6-node ONOS cluster is up and running!",onfail="ONOS didn't start...")
-    
-    def CASE9(self,main):
-
-        main.log.report("Scaling ONOS down to 5 ONOS instances")
-        main.ONOS6.handle.sendline("./onos.sh core stop")
-        time.sleep(8)
-        pdata = main.ONOS6.isup() and main.ONOS7.isup()
-        utilities.assert_equals(expect=main.FALSE,actual=pdata,onpass="ONOS7 stopped... ",onfail="ONOS scale down failed...")
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                time.sleep(3)
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup() and main.ONOS5.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Scale down successfull - 5 node ONOS clsuter is up and running!",onfail="ONOS didn't start...")
-
-    def CASE10(self,main):
-
-        main.log.report("Scaling ONOS down to 4 ONOS instances")
-        
-        main.ONOS5.handle.sendline("./onos.sh core stop ")
-        time.sleep(5)
-        pdata = main.ONOS5.isup() and main.ONOS6.isup() and main.ONOS7.isup()
-        utilities.assert_equals(expect=main.FALSE,actual=pdata,onpass="ONOS7 stopped... ",onfail="ONOS scale down failed...")
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                time.sleep(3)
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() and main.ONOS4.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Scale down successful - 4 node ONOS cluster is up and running!",onfail="ONOS didn't start...")
-
-    def CASE11(self,main):
-
-        main.log.report("Scaling ONOS down to 3 ONOS instances")
-        main.ONOS4.handle.sendline("./onos.sh core stop ")
-        time.sleep(5)
-        pdata = main.ONOS4.isup() and main.ONOS5.isup() and  main.ONOS6.isup() and main.ONOS7.isup()
-        utilities.assert_equals(expect=main.FALSE,actual=pdata,onpass="ONOS7 stopped... ",onfail="ONOS scale down failed...")
-        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup()
-        for i in range(3):
-            if data == main.FALSE: 
-                time.sleep(3)
-                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup()
-            else:
-                break
-        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Scale down successful - 3 node ONOS cluster is up and running!",onfail="ONOS didn't start...")
-
-    def CASE100(self,main):
-        import os
-        import time
-        global timestr
-        timestr = time.strftime("%Y%m%d-%H%M%S")
-        main.case("Scale-up tests complete...now making final changes")
-        main.log.info("moving logs....")
-        os.system("sudo mkdir ~admin/TestON/tests/scaleONOS7nodes/logs/ONOSscale_up" + timestr + "")
-        os.system("sudo mkdir ~admin/TestON/tests/scaleONOS7nodes/logs/NBONOSscale_up" + timestr + "")
-        time.sleep(2)
-        os.system("sudo  cp ~admin/TestON/tests/scaleONOS7nodes/logs/scale* ~admin/TestON/tests/scaleONOS7nodes/logs/ONOSscale_up" + timestr + "")
-        os.system("sudo  cp ~admin/TestON/tests/scaleONOS7nodes/logs/NBscale* ~admin/TestON/tests/scaleONOS7nodes/logs/NBONOSscale_up" + timestr + "")
-        time.sleep(2)
-        os.system("sudo rm ~admin/TestON/tests/scaleONOS7nodes/logs/*")
-        time.sleep(180)
-                        
-    def CASE101(self,main):
-        
-        import os
-        import time
-        main.case("Scale-down tests complete...now making final changes")
-        global timestr
-        main.case("Scale-down tests complete...now making final changes")
-        main.log.info("moving logs....")
-        os.system("sudo mkdir ~admin/TestON/tests/scaleONOS7nodes/logs/ONOSscale_dwn" + timestr + "")
-        os.system("sudo mkdir ~admin/TestON/tests/scaleONOS7nodes/logs/NBONOSscale_dwn" + timestr + "")
-        time.sleep(2)
-        os.system("sudo  cp ~admin/TestON/tests/scaleONOS7nodes/logs/scale* ~admin/TestON/tests/scaleONOS7nodes/logs/ONOSscale_dwn" + timestr + "")
-        os.system("sudo  cp ~admin/TestON/tests/scaleONOS7nodes/logs/NBscale* ~admin/TestON/tests/scaleONOS7nodes/logs/NBONOSscale_dwn" + timestr + "")
-        time.sleep(2)
-        os.system("sudo rm ~admin/TestON/tests/scaleONOS7nodes/logs/*")
-        time.sleep(2)
-
-    def CASE103(self,main):
-        import os
-        import time
-        main.log.report("Posting the results to http://10.128.5.54/scale.html")
-        db_script = main.params['db_script']
-        os.system(db_script + " -n='100SwitchScaleUp" + "' -rate3='" + str(tpavg3n) + "' -rate4='" + str(tpavg4n) + "' -rate5='" + str(tpavg5n) + "' -rate6='" + str(tpavg6n) + "' -rate7='" + str(tpavg7n) + "' -table='onos_scale'")
-        main.log.report("The graphical view of the tests can be viewed at http://10.128.5.54/scale.html")
-    
-    def CASE104(self,main):
-        import os
-        import time
-        main.log.report("Posting the results to http://10.128.5.54/scale.html ....")
-        db_script = main.params['db_script']
-        os.system(db_script + " -n='100SwitchScaleDown" + "' -rate3='" + str(tpavg3n) + "' -rate4='" + str(tpavg4n) + "' -rate5='" + str(tpavg5n) + "' -rate6='" + str(tpavg6n) + "' -rate7='" + str(tpavg7n) + "' -table='onos_scale'")
-
-        main.log.report("The graphical view of the tests can be viewed at http://10.128.5.54/scale.html")
-
-    def CASE105(self,main):
-        import os
-        import time
-        main.log.report("Posting the results to http://10.128.5.54/scale.html ....")
-        db_script = main.params['db_script']
-        os.system(db_script + " -n='1000IntentsScaleUp" + "' -rate3='" + str(nbtpavg3n) + "' -rate4='" + str(nbtpavg4n) + "' -rate5='" + str(nbtpavg5n) + "' -rate6='" + str(nbtpavg6n) + "' -rate7='" + str(nbtpavg7n) + "' -table='onos_scale'")
-
-        main.log.report("The graphical view of the tests can be viewed at http://10.128.5.54/scale.html")
-
-    def CASE106(self,main):
-        import os
-        import time
-        main.log.report("Posting the results to http://10.128.5.54/scale.html ....")
-        db_script = main.params['db_script']
-        os.system(db_script + " -n='1000IntentsScaleDown" + "' -rate3='" + str(nbtpavg3n) + "' -rate4='" + str(nbtpavg4n) + "' -rate5='" + str(nbtpavg5n) + "' -rate6='" + str(nbtpavg6n) + "' -rate7='" + str(nbtpavg7n) + "' -table='onos_scale'")
-
-        main.log.report("The graphical view of the tests can be viewed at http://10.128.5.54/scale.html")
-
-
diff --git a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.topo b/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.topo
deleted file mode 100644
index 5a4f78c..0000000
--- a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.topo
+++ /dev/null
@@ -1,258 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.10.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper1>
-
-        <Zookeeper2>
-            <host>10.128.10.2</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper2>
-
-        <Zookeeper3>
-            <host>10.128.10.3</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper3>
-       
-        <Zookeeper4>
-            <host>10.128.10.4</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper4>
-
-        <Zookeeper5>
-            <host>10.128.10.5</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper5>
-
-        <Zookeeper6>
-            <host>10.128.10.6</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper6>
-
-        <Zookeeper7>
-            <host>10.128.10.7</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </Zookeeper7>
-
-        <RamCloud1>
-            <host>10.128.10.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-       </RamCloud1>
-
-        <RamCloud2>
-            <host>10.128.10.2</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud2>
-       
-        <RamCloud3>
-            <host>10.128.10.3</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud3>
-       
-        <RamCloud4>
-            <host>10.128.10.4</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud4>
-
-        <RamCloud5>
-            <host>10.128.10.5</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud5>
-
-        <RamCloud6>
-            <host>10.128.10.6</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud6>
-
-        <RamCloud7>
-            <host>10.128.10.7</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RamCloudCliDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </RamCloud7>
-
-
-        <ONOS1>
-            <host>10.128.10.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.10.2</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>16</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.10.3</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>17</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS3>
-       
-        <ONOS4>
-            <host>10.128.10.4</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>18</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.10.5</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>19</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS5>
-
-        <ONOS6>
-            <host>10.128.10.6</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>20</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS6>
-
-        <ONOS7>
-            <host>10.128.10.7</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>21</connect_order>
-            <COMPONENTS>
-             </COMPONENTS>
-        </ONOS7>
-
-         <Mininet2>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>23</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
-        </Mininet2>
-        
-        <Mininet3>
-            <host>10.128.10.91</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>24</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom topo-intentTPtest.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet3>
-
-        <Mininet4>
-            <host>10.128.10.91</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>24</connect_order>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom topo-onos4node.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet4>
-
-    </COMPONENT>
-</TOPOLOGY>
