Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONLabTest
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 1b63f87..d6e839d 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -75,6 +75,11 @@
 #*********************************************************************************************
 
     def checkForLoss(self, pingList):
+        '''
+        Returns main.FALSE for 0% packet loss and
+        Returns main.ERROR if "found multiple mininet" is found and
+        Returns main.TRUE else
+        '''
         import os
         self.handle.sendline("")
         self.handle.expect("\$")
@@ -93,23 +98,31 @@
         '''
         Starts a continuous ping on the mininet host outputing to a file in the /tmp dir. 
         '''
+        self.handle.sendline("")
+        self.handle.expect("\$")
         args = utilities.parse_args(["SRC","TARGET","PINGTIME"],**pingParams)
-        precmd = "rm /tmp/ping." + args["SRC"]
+        precmd = "sudo rm /tmp/ping." + args["SRC"]
         self.execute(cmd=precmd,prompt="(.*)",timeout=10)
-        command = "mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -i .2 -w " + str(args['PINGTIME']) + " > /tmp/ping." + args["SRC"] + " &"
+        command = "sudo mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -i .2 -w " + str(args['PINGTIME']) + " > /tmp/ping." + args["SRC"] + " &"
         main.log.info( command ) 
         self.execute(cmd=command,prompt="(.*)",timeout=10)
+        self.handle.sendline("")
+        self.handle.expect("\$")
         return main.TRUE
 
     def pingstatus(self,**pingParams):
         '''
         Tails the respective ping output file and check that there is a moving "64 bytes"
         '''
+        self.handle.sendline("")
+        self.handle.expect("\$")
         args = utilities.parse_args(["SRC"],**pingParams)
         self.handle.sendline("tail /tmp/ping." + args["SRC"])
         self.handle.expect("tail")
         self.handle.expect("\$")
         result = self.handle.before + self.handle.after
+        self.handle.sendline("")
+        self.handle.expect("\$")
         if re.search('Unreachable', result ):
             main.log.info("Unreachable found in ping logs...") 
             return main.FALSE
@@ -120,40 +133,52 @@
             main.log.info("No, or faulty ping data...") 
             return main.FALSE
          
-    def pingKill(self):
+    def pingKill(self, testONUser, testONIP):
         '''
         Kills all continuous ping processes.
         Then copies all the ping files to the TestStation.
         '''
         import time
+        self.handle.sendline("")
+        self.handle.expect("\$")
         command = "sudo kill -SIGINT `pgrep ping`" 
         main.log.info( command ) 
         self.execute(cmd=command,prompt="(.*)",timeout=10)
-        main.log.info( "Removing old ping data" )
-        command = "rm /tmp/ping.*"
-        os.popen(command) 
-        time.sleep(2)      
+        #Commenting out in case TestON and MN are on the same machine. scp overrights the file anyways
+        #main.log.info( "Removing old ping data" )
+        #command = "rm /tmp/ping.*"
+        #os.popen(command) 
+        #time.sleep(2)      
         main.log.info( "Transferring ping files to TestStation" )
-        command = "scp /tmp/ping.* admin@10.128.7.7:/tmp/" 
+        command = "scp /tmp/ping.* "+ str(testONUser) + "@" + str(testONIP) + ":/tmp/" 
         self.execute(cmd=command,prompt="100%",timeout=20)
-        print("finished kill")
+        self.handle.sendline("")
+        self.handle.expect("\$")
         return main.TRUE
     
     def pingLongKill(self):
         import time
+        self.handle.sendline("")
+        self.handle.expect("\$")
         command = "sudo kill -SIGING `pgrep ping`"
         main.log.info(command)
         self.execute(cmd=command,prompt="(.*)",timeout=10)
+        self.handle.sendline("")
+        self.handle.expect("\$")
         return main.TRUE
         
     def pingHost(self,**pingParams):
         ''' 
         Pings between two hosts on remote mininet  
         ''' 
+        self.handle.sendline("")
+        self.handle.expect("\$")
         args = utilities.parse_args(["SRC","TARGET"],**pingParams)
         command = "mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -c 4 -W 1 -i .2"
         main.log.info ( command ) 
         response = self.execute(cmd=command,prompt="rtt",timeout=10 )
+        self.handle.sendline("")
+        self.handle.expect("\$")
         if utilities.assert_matches(expect=',\s0\%\spacket\sloss',actual=response,onpass="No Packet loss",onfail="Host is not reachable"):
             main.log.info("NO PACKET LOSS, HOST IS REACHABLE")
             main.last_result = main.TRUE 
@@ -450,7 +475,11 @@
     def get_flowTable(self,sw):
         self.handle.sendline("cd")
         self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        command = "sudo ovs-ofctl dump-flows " + sw + " | awk '{OFS=\",\" ; print $1 $6 $7 }' |sort -n -k1"
+        #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])
@@ -462,6 +491,11 @@
         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)
             return main.FALSE
 
 if __name__ != "__main__":
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 44c9df3..fafc7e7 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -323,8 +323,8 @@
             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)
+            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")
@@ -354,8 +354,8 @@
             self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
             self.handle.sendline("cd "+self.home)
             self.handle.sendline("./onos.sh core stop")
-            i=self.handle.expect(["Stop",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT], 60)
+            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")
diff --git a/TestON/tests/HATestZK/HATestZK.params b/TestON/tests/HATestZK/HATestZK.params
index 6952d1b..24f1a29 100644
--- a/TestON/tests/HATestZK/HATestZK.params
+++ b/TestON/tests/HATestZK/HATestZK.params
@@ -1,19 +1,19 @@
 <PARAMS>
     <testcases>1,2,3,4,5,6,7,8</testcases>
     <CTRL>
-        <ip1>10.128.9.1</ip1>
+        <ip1>10.128.11.1</ip1>
         <port1>6633</port1>
         <restPort1>8080</restPort1>
-        <ip2>10.128.9.2</ip2>
+        <ip2>10.128.11.2</ip2>
         <port2>6633</port2>
         <restPort2>8080</restPort2>
-        <ip3>10.128.9.3</ip3>
+        <ip3>10.128.11.3</ip3>
         <port3>6633</port3>
         <restPort3>8080</restPort3>
-        <ip4>10.128.9.4</ip4>
+        <ip4>10.128.11.4</ip4>
         <port4>6633</port4>
         <restPort4>8080</restPort4>
-        <ip5>10.128.9.5</ip5>
+        <ip5>10.128.11.5</ip5>
         <port5>6633</port5>
         <restPort5>8080</restPort5>
         <switchURL>/wm/onos/registry/switches/json</switchURL>
@@ -25,6 +25,8 @@
         <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>
diff --git a/TestON/tests/HATestZK/HATestZK.py b/TestON/tests/HATestZK/HATestZK.py
index 18e55ea..2f8c462 100644
--- a/TestON/tests/HATestZK/HATestZK.py
+++ b/TestON/tests/HATestZK/HATestZK.py
@@ -6,12 +6,6 @@
 '''
 class HATestZK:
 
-    global topology
-    global masterSwitchList
-    global highIntentList
-    global lowIntentList
-    global flows
-    flows = []
 
     def __init__(self) :
         self.default = ''
@@ -56,7 +50,7 @@
         main.ONOS3.start_all()
         main.ONOS4.start_all()
         main.ONOS5.start_all()
-       # main.ONOS1.start_rest()
+        main.ONOS1.start_rest()
         main.step("Testing Startup")
         result1 = main.ONOS1.rest_status()
         vm1 = main.RC1.status_coor and main.RC1.status_serv and \
@@ -198,28 +192,8 @@
     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 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()
@@ -269,11 +243,15 @@
                 count = count + 1
             else:
                 break
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
         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
@@ -352,20 +330,24 @@
         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
+        #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()
@@ -403,7 +385,7 @@
         result4 = result
         
         main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
-        main.Mininet2.pingKill()
+        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))
@@ -431,12 +413,13 @@
             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!!")
 
@@ -457,7 +440,7 @@
         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.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")
@@ -467,7 +450,7 @@
         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.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))
@@ -478,9 +461,9 @@
         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!!!")
+        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!!!")
         
 
     
@@ -502,11 +485,11 @@
         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.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(31)
+        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!")
 
@@ -514,13 +497,13 @@
         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)
+        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.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))
diff --git a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.topo b/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.topo
index 988e8af..bf88550 100644
--- a/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.topo
+++ b/TestON/tests/RRCOnosSanity4nodesJ/RRCOnosSanity4nodesJ.topo
@@ -129,8 +129,9 @@
             <connect_order>13</connect_order>
             <COMPONENTS>
                 # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-onos4nodeNEW.py </arg1>
+                <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>
diff --git a/TestON/tests/scaleONOS7nodes/logs/scale3nodesrate1 b/TestON/tests/scaleONOS7nodes/logs/scale3nodesrate1
deleted file mode 100644
index 9bf2f2d..0000000
--- a/TestON/tests/scaleONOS7nodes/logs/scale3nodesrate1
+++ /dev/null
@@ -1,176 +0,0 @@
-ONOS1 
-1	0.0	0.0	0.0	0.00239947245396
-ONOS2 
-1	0.0	0.0	0.0	0.00240234871667
-ONOS3 
-5	0.0	0.0	0.0	0.0121141862312
-
---------------------------------------------------------------------------------- 
-ONOS1 
-1629	18.7889293392	4.48449607458	1.54147719592	3.62505307741
-ONOS2 
-1629	19.2261277938	4.60475972875	1.58370323175	3.62941581988
-ONOS3 
-1629	17.8382714302	4.24867153003	1.459765156	3.66161718472
-
---------------------------------------------------------------------------------- 
-ONOS1 
-3183	31.2994548933	9.22645211247	3.29904481351	6.61046866244
-ONOS2 
-3183	32.7606424407	9.56283317479	3.41481907462	6.61796407638
-ONOS3 
-3183	31.5861689913	9.24594010149	3.30141569916	6.673448832
-
---------------------------------------------------------------------------------- 
-ONOS1 
-4842	39.9442818508	13.4074669965	4.93312182074	9.42788406221
-ONOS2 
-4842	39.9501179617	13.4738095108	4.96166898609	9.43793553665
-ONOS3 
-4842	38.0249857507	12.9562504618	4.77594497277	9.51213793959
-
---------------------------------------------------------------------------------- 
-ONOS1 
-6333	43.3326254024	17.1545676648	6.55334823824	11.6061812929
-ONOS2 
-6333	43.1025815278	17.1367790337	6.5530511963	11.6177361571
-ONOS3 
-6333	43.777667171	17.1929221224	6.55828955792	11.7036190253
-
---------------------------------------------------------------------------------- 
-ONOS1 
-7959	46.9561811449	20.4581350129	8.03528568305	13.7759524559
-ONOS2 
-7959	46.3408669423	20.4108823645	8.02922603097	13.7889504862
-ONOS3 
-7959	45.6410475294	20.1576242077	7.92726689795	13.8850824339
-
---------------------------------------------------------------------------------- 
-ONOS1 
-9531	45.9906744738	22.7715112677	9.24095510988	15.6290021503
-ONOS2 
-9531	48.055448081	23.2523557438	9.41177895671	15.6430625973
-ONOS3 
-9531	47.4942907039	23.4438740596	9.53345804013	15.746412627
-
---------------------------------------------------------------------------------- 
-ONOS1 
-11178	48.3540408864	25.9507802704	10.8600911453	17.4138152199
-ONOS2 
-11178	47.5616430096	25.8795464358	10.8505372729	17.4285967804
-ONOS3 
-11178	48.7458886411	25.9965007518	10.8666758121	17.5380150699
-
---------------------------------------------------------------------------------- 
-ONOS1 
-12694	49.6724719708	28.3431418559	12.1755703493	18.8343463719
-ONOS2 
-12694	49.0146328907	28.2907017805	12.1735446036	18.849661524
-ONOS3 
-12694	48.6960578175	28.1228412863	12.0936097846	18.9623561373
-
---------------------------------------------------------------------------------- 
-ONOS1 
-14292	48.8589089419	30.4653291422	13.5261901847	20.242085149
-ONOS2 
-14292	49.3030435553	30.5976153949	13.5848633365	20.2578017737
-ONOS3 
-14292	48.9109659895	30.4555207991	13.5139122893	20.3733211479
-
---------------------------------------------------------------------------------- 
-ONOS1 
-15855	49.2637510688	32.350154998	14.7329286521	21.479967821
-ONOS2 
-15855	48.80087594	32.2746234064	14.721362789	21.4958003475
-ONOS3 
-15855	49.7070084114	32.4071423037	14.741735047	21.6129479915
-
---------------------------------------------------------------------------------- 
-ONOS1 
-17479	49.7954667568	34.2769555101	16.0681836861	22.6938152648
-ONOS2 
-17479	48.5948066323	33.8055349065	15.8243597438	22.71001968
-ONOS3 
-17479	50.1286934521	34.3315901641	16.077099823	22.8287509266
-
---------------------------------------------------------------------------------- 
-ONOS1 
-18996	50.4089945863	35.8426346551	17.200968186	23.6775401881
-ONOS2 
-18996	49.8422938084	35.7578440385	17.1873611818	23.6935523664
-ONOS3 
-18996	48.7482979129	35.4720353826	17.0666482037	23.8124199695
-
---------------------------------------------------------------------------------- 
-ONOS1 
-20565	48.5587834324	36.7329685213	18.1159622539	24.647671921
-ONOS2 
-20565	48.3110087382	36.676081054	18.1094495228	24.6638443055
-ONOS3 
-20565	48.93297292	36.793631721	18.1262156419	24.7827468466
-
---------------------------------------------------------------------------------- 
-ONOS1 
-22167	49.0508150775	38.1245132609	19.3059350415	25.5841260816
-ONOS2 
-22170	48.5221636661	38.0385655774	19.2912194483	25.6036562614
-ONOS3 
-22171	48.5824052178	37.9982884305	19.2528429078	25.7236458284
-
---------------------------------------------------------------------------------- 
-ONOS1 
-23639	47.9777788333	38.8926943034	20.1868609754	26.308941697
-ONOS2 
-23639	48.1528601732	38.9174026097	20.2069767591	26.3249181854
-ONOS3 
-23639	48.3280130991	38.9561603833	20.1981646715	26.4427299331
-
---------------------------------------------------------------------------------- 
-ONOS1 
-25268	49.8567068142	40.3154609814	21.3906394143	27.1525946206
-ONOS2 
-25268	49.260910735	40.2252713754	21.3745229372	27.1686258006
-ONOS3 
-25268	48.6285982236	40.0672365492	21.2987719637	27.2860637996
-
---------------------------------------------------------------------------------- 
-ONOS1 
-26786	48.5713107436	40.8577368773	22.194671911	27.82491922
-ONOS2 
-26786	48.2099421547	40.7761299471	22.1790837949	27.8408111321
-ONOS3 
-26786	48.806830681	40.9159842596	22.2060400391	27.9570400311
-
---------------------------------------------------------------------------------- 
-ONOS1 
-28345	49.5354143965	41.7745390383	23.1196161385	28.4949893223
-ONOS2 
-28345	48.9994356563	41.7084318627	23.1119888217	28.5101088539
-ONOS3 
-28352	48.8058937866	41.7666073305	23.2132849025	28.6323389508
-
---------------------------------------------------------------------------------- 
-ONOS1 
-29429	42.7205926401	41.133551867	23.6205125079	28.6600165985
-ONOS2 
-29429	42.3177151851	41.0468840661	23.6034227045	28.6753451692
-ONOS3 
-29429	43.0359873942	41.1940339927	23.632692912	28.7876408357
-
---------------------------------------------------------------------------------- 
-ONOS1 
-29429	25.9113492373	37.219176866	22.8461399993	27.7919878574
-ONOS2 
-29429	25.6669917087	37.1407565968	22.8296104663	27.8064105758
-ONOS3 
-29429	26.1026458256	37.2739033564	22.8579210822	27.9119214291
-
---------------------------------------------------------------------------------- 
-ONOS1 
-29429	14.4594435488	33.1206670242	21.9747328469	26.9749583673
-ONOS2 
-29429	14.3230834597	33.0508822562	21.9588337904	26.9884033819
-ONOS3 
-29429	14.5661937683	33.1693671304	21.9860645708	27.0878504545
-
---------------------------------------------------------------------------------- 
diff --git a/TestON/tests/scaleONOS7nodes/scale3nodesrate1 b/TestON/tests/scaleONOS7nodes/scale3nodesrate1
deleted file mode 100644
index 9caaa19..0000000
--- a/TestON/tests/scaleONOS7nodes/scale3nodesrate1
+++ /dev/null
@@ -1,176 +0,0 @@
-ONOS1 
-46	0.0159911170741	0.00330570923568	0.00110803039902	0.441388322918
-ONOS2 
-169	1.4232094196	0.294208121975	0.0986147055128	1.51983829287
-ONOS3 
-171	0.0	0.0	0.0	1.55826946014
-
---------------------------------------------------------------------------------- 
-ONOS1 
-1798	22.6349154776	5.65275867857	1.9589352278	12.3275451079
-ONOS2 
-1798	20.8145837636	5.10869633674	1.76466018187	12.4714931153
-ONOS3 
-1798	22.0791171081	5.47471756204	1.8948008043	12.6620550588
-
---------------------------------------------------------------------------------- 
-ONOS1 
-3426	32.6111034518	9.70067081694	3.47552137643	19.2298566624
-ONOS2 
-3426	34.2140340329	10.1493268369	3.63676115043	19.4125205852
-ONOS3 
-3426	33.2868110325	9.74024939592	3.48023473974	19.6519137751
-
---------------------------------------------------------------------------------- 
-ONOS1 
-5055	41.1154795596	14.3295561289	5.31573150012	24.0283473918
-ONOS2 
-5055	40.2618482051	13.877993799	5.13339673365	24.228413302
-ONOS3 
-5055	40.3643986592	14.0755662838	5.21932817392	24.4842903967
-
---------------------------------------------------------------------------------- 
-ONOS1 
-6648	44.0476719882	17.5652363011	6.72454316035	27.4144919114
-ONOS2 
-6648	42.837315358	17.4660161912	6.71183843666	27.6117430147
-ONOS3 
-6660	44.6253917733	17.5746713259	6.71339463557	27.9185886652
-
---------------------------------------------------------------------------------- 
-ONOS1 
-8223	45.5204851503	20.4781124794	8.08545718874	29.9446955545
-ONOS2 
-8223	47.0478790956	20.9180018605	8.25491048977	30.134904835
-ONOS3 
-8223	46.0539241762	20.9125541798	8.28383012594	30.3823258358
-
---------------------------------------------------------------------------------- 
-ONOS1 
-9761	48.2472730422	23.9163379895	9.74938162547	31.8260874816
-ONOS2 
-9761	47.8554206671	23.5746897161	9.5837979702	32.0069787799
-ONOS3 
-9761	47.9086582813	23.7657314867	9.68161495588	32.2419983542
-
---------------------------------------------------------------------------------- 
-ONOS1 
-11390	48.2977231982	26.23623474	11.0124446377	33.6205734759
-ONOS2 
-11390	48.6817460585	26.4263736828	11.1034039314	33.7938746975
-ONOS3 
-11390	48.9914985281	26.3026447756	11.0160590425	34.0180954514
-
---------------------------------------------------------------------------------- 
-ONOS1 
-13019	49.5587788244	28.9609886715	12.535952061	35.1042945838
-ONOS2 
-13019	49.7703686117	28.7704010275	12.4112682408	35.2671782942
-ONOS3 
-13019	48.3486366824	28.6472976101	12.4114088561	35.4806994928
-
---------------------------------------------------------------------------------- 
-ONOS1 
-14618	49.576578555	30.8922696843	13.7378230586	36.2757731409
-ONOS2 
-14618	48.5440020686	30.7811465304	13.7316956109	36.4328337041
-ONOS3 
-14618	49.4866717797	30.8087248031	13.6891587016	36.6357205954
-
---------------------------------------------------------------------------------- 
-ONOS1 
-16187	49.4907941638	32.9074922652	15.0888963838	37.2077993376
-ONOS2 
-16187	49.6285423582	32.7484269078	14.9693742032	37.3552104338
-ONOS3 
-16187	48.8755660723	32.7250364726	15.0063681262	37.5478060295
-
---------------------------------------------------------------------------------- 
-ONOS1 
-17725	49.8836746982	34.5479805791	16.2364648337	37.9435104425
-ONOS2 
-17725	48.99884514	34.4732673007	16.246116043	38.0836022622
-ONOS3 
-17725	49.4211281632	34.4116883879	16.1694233436	38.2662174542
-
---------------------------------------------------------------------------------- 
-ONOS1 
-19354	49.8626223455	35.9745646504	17.3266700853	38.7671511869
-ONOS2 
-19354	48.4587733895	35.7738406011	17.2944948224	38.9024055739
-ONOS3 
-19354	49.6238625297	36.107629579	17.4523301701	39.0742037951
-
---------------------------------------------------------------------------------- 
-ONOS1 
-20949	48.7735412886	37.2334176044	18.4738354902	39.4261732644
-ONOS2 
-20949	49.2808245039	37.2112430739	18.3974292802	39.5555564351
-ONOS3 
-20949	49.0412343145	37.2603304894	18.4613220964	39.7222890977
-
---------------------------------------------------------------------------------- 
-ONOS1 
-22518	49.2233054229	38.459058778	19.5122554055	39.9666332511
-ONOS2 
-22518	49.3199190997	38.5500864358	19.5788242673	40.0902311981
-ONOS3 
-22518	48.5868586294	38.3006063004	19.437642791	40.2494766808
-
---------------------------------------------------------------------------------- 
-ONOS1 
-24059	49.2130863162	39.6417956777	20.6446125264	40.4016538809
-ONOS2 
-24059	48.8272590697	39.4712361736	20.518926366	40.5198056741
-ONOS3 
-24059	48.7738335012	39.5215088361	20.5824985986	40.6715650211
-
---------------------------------------------------------------------------------- 
-ONOS1 
-25687	48.7438034983	40.4560575512	21.5487100295	40.9303516742
-ONOS2 
-25687	49.5471148575	40.6750208451	21.6586836347	41.0440523285
-ONOS3 
-25687	49.5528136103	40.5962066501	21.5740317285	41.1905085161
-
---------------------------------------------------------------------------------- 
-ONOS1 
-27208	48.3440895308	41.1892039746	22.4234679597	41.246260379
-ONOS2 
-27208	49.7248389814	41.5217226735	22.5714921035	41.3552443508
-ONOS3 
-27208	48.9489326527	41.4186969689	22.5835508207	41.4954641517
-
---------------------------------------------------------------------------------- 
-ONOS1 
-28764	48.636023504	42.0763468157	23.4482599273	41.5834003461
-ONOS2 
-28764	49.5204659279	42.2043214958	23.4251146139	41.6880977866
-ONOS3 
-28764	48.7203412028	42.0949248759	23.4349162749	41.822682997
-
---------------------------------------------------------------------------------- 
-ONOS1 
-29669	41.3110354992	41.1541779314	23.753983268	40.9907471033
-ONOS2 
-29669	40.0637318705	40.9112993447	23.707965358	41.0894107566
-ONOS3 
-29669	41.8871662556	41.2877306835	23.7807095826	41.2163432863
-
---------------------------------------------------------------------------------- 
-ONOS1 
-29669	23.0530097167	36.6223527412	22.847948773	39.2515156116
-ONOS2 
-29669	24.299881722	37.0180744675	22.9307258039	39.3420203293
-ONOS3 
-29669	23.3745109274	36.7411989007	22.8736556812	39.4584630811
-
---------------------------------------------------------------------------------- 
-ONOS1 
-29669	13.9823571918	33.1372750967	22.0989039162	37.6540346
-ONOS2 
-29669	13.5601880389	32.9417096657	22.0560923439	37.7370627214
-ONOS3 
-29669	14.1773575332	33.2448115489	22.1237680517	37.8440976097
-
---------------------------------------------------------------------------------- 
diff --git a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.params b/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.params
index d485ee8..276e272 100644
--- a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.params
+++ b/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.params
@@ -1,5 +1,5 @@
 <PARAMS>
-    <testcases>1,2</testcases>
+    <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>
@@ -68,11 +68,18 @@
 	<restPort>8080</restPort>
 	<restURL>/wm/onos/topology/hosts</restURL>
     </RESTCALL>
-    <switches_num>50</switches_num>
-    <RATE1>30</RATE1>
-    <RATE2>50</RATE2>
-    <RUN_DUR>600</RUN_DUR>
-    <sleep_t>32</sleep_t>
-    <loop>22</loop>
+    <switches_num>30</switches_num>
+    <RATE1>100</RATE1>
+    <RUN_DUR>240</RUN_DUR>
+    <sleep_t>8</sleep_t>
+    <loop>10</loop>
     <port>10</port>
+    <sleep_init>160</sleep_init>
+    <int_num>300</int_num>
+    <addrate>1</addrate>
+    <NBdur>90</NBdur>
+    <NBsleep>5</NBsleep>
+    <NBloop>7</NBloop>
+    <NBsleep_init>50</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
index e8a286e..475f931 100644
--- a/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.py
+++ b/TestON/tests/scaleONOS7nodes/scaleONOS7nodes.py
@@ -1,3 +1,4 @@
+#Author: Santhosh Jayashankar
 class scaleONOS7nodes :
 
 
@@ -12,40 +13,47 @@
 #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()
+        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("Start ONOS")
+        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()
+       # 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()
@@ -79,19 +87,21 @@
        # main.ONOS3.start_all()
        # main.ONOS4.start_all()
 
-        """
+        
         main.RamCloud1.start_coor()
         main.RamCloud1.start_serv()
         main.RamCloud2.start_serv()
         main.RamCloud3.start_serv()
-        #main.RamCloud4.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()
@@ -100,11 +110,11 @@
         if test == main.FALSE:
             main.ONOS1.start_rest()
         main.ONOS1.get_version()
-        main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
+        main.log.report("Startup check Zookeeper1, and ONOS1 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:
@@ -126,7 +136,7 @@
 
         
         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):
@@ -143,7 +153,9 @@
         time.sleep(10)
 
 
-    def CASE2(self,main) :
+    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']
@@ -153,162 +165,90 @@
         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("./loadgen_SB.sh startload \"" + ip1 + " " + ip2 + " " + ip3 + "\"" + " " + switches_num + " " + port +  " " + rate1 + " " + run_dur +  "  \"11\"")
-        main.Mininet2.handle.expect("starting to generate south bound load ....", timeout=400)
+        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 = "http://10.128.10.1:8080/wm/onos/metrics"
         url2 = "http://10.128.10.2:8080/wm/onos/metrics"
         url3 = "http://10.128.10.3:8080/wm/onos/metrics"
         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)):
-            json_str1 = main.ONOS1.get_json(url1)
-            json_str2 = main.ONOS2.get_json(url2)
-            json_str3 = main.ONOS3.get_json(url3)
-            if json_str1 != "" and json_str2 != "" and json_str3 != "":
+            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)
-                f.write("ONOS1 \n")
-                f.write(str(json_str1["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS2 \n")
-                f.write(str(json_str2["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS3 \n")
-                f.write(str(json_str3["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['mean_rate']))
+                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)
-       # main.Mininet2.handle.sendline("sudo mn -c")
-        #main.Mininet2.handle.expect("\$")
-        time.sleep(5)
-       # main.Mininet2.handle.expect("\$", timeout=900)
+        time.sleep(180)
         
-
-    def CASE3(self,main):
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        import time
-        rate2 = main.params['RATE2']
-        run_dur = main.params['RUN_DUR']
-        loop = int(main.params['loop'])
-        sleep_t = int(main.params['sleep_t'])
-        port = main.params['port']
-        switches_num = main.params['switches_num']
-        main.case("Starting SB load on 3 nodes from mininet with " + rate2 +"  added/removed/s for " + run_dur)
-        main.Mininet2.handle.sendline("./loadgen_SB.sh startload \"" + ip1 + " " + ip2 + " " + ip3 + "\"" + " " + switches_num + " " + port + " " + rate2 + " " + run_dur +  "  \"11\"")
-       #main.Mininet2.handle.sendline("./loadgen_SB.sh startload \"10.128.10.1\" 100 50 1200 \"11\"")
-        main.Mininet2.handle.expect("starting to generate south bound load ....", timeout=900 )
+    def CASE33(self,main):
         
-        import json
-        
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale3nodesrate2", 'w').close()
-        url1 = "http://10.128.10.1:8080/wm/onos/metrics"
-        url2 = "http://10.128.10.2:8080/wm/onos/metrics"
-        url3 = "http://10.128.10.3:8080/wm/onos/metrics"
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale3nodesrate2", "a")
-        #time.sleep(10)
-        for i in range(int (loop)):
-            json_str1 = main.ONOS1.get_json(url1)
-            json_str2 = main.ONOS2.get_json(url2)
-            json_str3 = main.ONOS3.get_json(url3)
-            if json_str1 != "" and json_str2 != "" and json_str3 != "":
-                # 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)
-                f.write("ONOS1 \n")
-                f.write(str(json_str1["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS2 \n")
-                f.write(str(json_str2["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS3 \n")
-                f.write(str(json_str3["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-                f.write('\n')
-                f.write("--------------------------------------------------------------------------------- \n") 
-                time.sleep(sleep_t)
-        f.close()
-        main.Mininet2.handle.expect("\$", timeout=900)
-       # main.Mininet2.handle.sendline("sudo mn -c")
-        #time.sleep(5)
-       # main.Mininet2.handle.expect("\$", timeout=900)
-
-
-    def CASE4(self,main):
-        
-        main.case("Starting NB Throughput test")
         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.Mininet2.handle.sendline("sudo mn --custom topo-intentTPtest.py --topo mytopo --mac --arp")
-        #main.Mininet2.handle.expect("mininet>" , timeout=400)
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s1 tcp:10.128.10.1:6633")
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:10.128.10.1:6633")
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:10.128.10.2:6633")
@@ -316,130 +256,196 @@
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:10.128.10.3:6633")
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:10.128.10.3:6633")
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:10.128.10.3:6633")
-
+        
         main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
         main.ONOS3.handle.expect("\$")
 
-        main.ONOS3.handle.sendline("./multiLoadgen_NB.py -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3:8080 \" -i 4 -g 100 -a 1 -d 1 -p 0")
-        main.ONOS3.handle.expect("intent group is : 0", timeout=900)
-
-        
+        main.ONOS3.handle.sendline("./loadgen_NB.py -n 3 -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3: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 = "http://10.128.10.1:8080/wm/onos/metrics"
         url2 = "http://10.128.10.2:8080/wm/onos/metrics"
         url3 = "http://10.128.10.3:8080/wm/onos/metrics"
         f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale3nodesrate1", "a")
-        #time.sleep(10)
-        for i in range(8):
-            json_str1 = main.ONOS1.get_json(url1)
-            json_str2 = main.ONOS2.get_json(url2)
-            json_str3 = main.ONOS3.get_json(url3)
-            if json_str1 != "" and json_str2 != "" and json_str3 != "":
-                f.write("ONOS1......IncomingRate \n ")
-                f.write(str(json_str1["meters"][0]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][0]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][0]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][0]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][0]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS2......IncomingRate \n")
-                f.write(str(json_str2["meters"][0]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][0]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][0]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][0]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][0]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS3......IncomingRate \n")
-                f.write(str(json_str3["meters"][0]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][0]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][0]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][0]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][0]['meter']['mean_rate']))
-                f.write('\n')
-                f.write('\n')
-
-                f.write("--------------------------------------------------------------------------------- \n") 
+        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("ONOS1......ProcessingRate \n ")
-                f.write(str(json_str1["meters"][1]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][1]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][1]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][1]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][1]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS2......ProcessingRate \n")
-                f.write(str(json_str2["meters"][1]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][1]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][1]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][1]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][1]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS3......ProcessingRate \n")
-                f.write(str(json_str3["meters"][1]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][1]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][1]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][1]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][1]['meter']['mean_rate']))
-                f.write('\n')
-                f.write('\n')
+                    f.write('\n')
 
-                f.write("--------------------------------------------------------------------------------- \n") 
-                time.sleep(10)
+                    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 CASE5(self,main):
+    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.Zookeeper1.start()
+        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: 
-                #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...")
+        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']
@@ -450,178 +456,69 @@
         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("./loadgen_SB.sh startload \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + "\"" + " " + switches_num + " " + port + " " + rate1 + " " + run_dur +  "  \"11\"")
-        main.Mininet2.handle.expect("starting to generate south bound load ....", timeout=900)
+        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 = "http://10.128.10.1:8080/wm/onos/metrics"
         url2 = "http://10.128.10.2:8080/wm/onos/metrics"
         url3 = "http://10.128.10.3:8080/wm/onos/metrics"
         url4 = "http://10.128.10.4:8080/wm/onos/metrics"
+        tpval = 0.0
+        global tpavg4n 
+        tpavg4n = 0.0
 
         f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale4nodesrate1", "a")
-        #time.sleep(10)
         for i in range(int (loop)):
-            json_str1 = main.ONOS1.get_json(url1)
-            json_str2 = main.ONOS2.get_json(url2)
-            json_str3 = main.ONOS3.get_json(url3)
-            json_str4 = main.ONOS4.get_json(url4)
-            if json_str1 != "" and json_str2 != "" and json_str3 != "" and json_str4 != "":
-                # 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)
-
-                f.write("ONOS1 \n")
-                f.write(str(json_str1["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['mean_rate']))
+            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 == 3:
+                        tpval += float(json_str[j]["meters"][4]['meter']['m1_rate']) 
+                
                 f.write('\n')
-
-                f.write("ONOS2 \n")
-                f.write(str(json_str2["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-
-                f.write("ONOS3 \n")
-                f.write(str(json_str3["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-
-                f.write("ONOS4 \n")
-                f.write(str(json_str4["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-
                 f.write('\n')
                 
+                f.write("--------------------------------------------------------------------------------- \n") 
                 time.sleep(sleep_t)
         f.close() 
-        #main.Mininet2.handle.expect("\$", timeout=900)
-        #main.Mininet2.handle.sendline("sudo mn -c")
-        #main.Mininet2.handle.expect("\$")
+        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 CASE7(self,main):
-        
-        ip1 = main.params['CTRL']['ip1']
-        ip2 = main.params['CTRL']['ip2']
-        ip3 = main.params['CTRL']['ip3']
-        ip4 = main.params['CTRL']['ip4']
-        
-        import time
-        import json
-        rate2 = main.params['RATE2']
-        run_dur = main.params['RUN_DUR']
-        loop = int(main.params['loop'])
-        sleep_t = int(main.params['sleep_t'])
-        switches_num = main.params['sitches_num']
-        port = main.params['port']
-        main.case("Starting SB load on 4 nodes from mininet with " + rate2 +"  added/removed/s for " + run_dur)
-        main.Mininet2.handle.sendline("./loadgen_SB.sh startload \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 +  "\"" + " " + switches_num + " " + port +  " " + rate2 + " " + run_dur +  "  \"11\"")
-        main.Mininet2.handle.expect("starting to generate south bound load ....", timeout=900 )
-        
-        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale4nodesrate2", 'w').close()
-        url1 = "http://10.128.10.1:8080/wm/onos/metrics"
-        url2 = "http://10.128.10.2:8080/wm/onos/metrics"
-        url3 = "http://10.128.10.3:8080/wm/onos/metrics"
-        url4 = "http://10.128.10.4:8080/wm/onos/metrics"
-        f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale4nodesrate2", "a")
-        #time.sleep(10)
-        for i in range(int (loop)):
-            json_str1 = main.ONOS1.get_json(url1)
-            json_str2 = main.ONOS2.get_json(url2)
-            json_str3 = main.ONOS3.get_json(url3)
-            json_str4 = main.ONOS4.get_json(url4)
-            if json_str1 != "" and json_str2 != "" and json_str3 != "" and json_str4 != "":
-
-                f.write("ONOS1 \n")
-                f.write(str(json_str1["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-                
-                f.write("ONOS2 \n")
-                f.write(str(json_str2["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-                
-                f.write("ONOS3 \n")
-                f.write(str(json_str3["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-                
-                f.write("ONOS4 \n")
-                f.write(str(json_str4["meters"][4]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][4]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][4]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][4]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][4]['meter']['mean_rate']))
-                f.write('\n')
-
-                f.write('\n')
-                
-                time.sleep(sleep_t)
-        f.close()
-
-    def CASE8(self,main):
+    def CASE43(self,main):
         
         main.case("Starting NB Throughput test after scaling up to 4 onos nodes")
         ip1 = main.params['CTRL']['ip1']
@@ -631,10 +528,18 @@
 
         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.Mininet2.handle.sendline("sudo mn --custom topo-intentTPtest.py --topo mytopo --mac --arp")
-        #main.Mininet2.handle.expect("mininet>" , timeout=400)
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s1 tcp:10.128.10.1:6633")
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:10.128.10.2:6633")
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:10.128.10.3:6633")
@@ -642,14 +547,15 @@
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:10.128.10.1:6633")
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:10.128.10.2:6633")
         main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:10.128.10.4:6633")
-
+        
         main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
         main.ONOS3.handle.expect("\$")
 
-        main.ONOS3.handle.sendline("./multiLoadgen_NB.py -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3:8080 10.128.10.4:8080  \" -i 4 -g 100 -a 1 -d 1 -p 0")
-        main.ONOS3.handle.expect("intent group is : 0", timeout=900)
+        main.ONOS3.handle.sendline("./loadgen_NB.py -n 4 -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3:8080 10.128.10.4: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()
@@ -658,114 +564,781 @@
         url3 = "http://10.128.10.3:8080/wm/onos/metrics"
         url4 = "http://10.128.10.4:8080/wm/onos/metrics"
         f = open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale4nodesrate1", "a")
-        #time.sleep(10)
-        for i in range(8):
-            json_str1 = main.ONOS1.get_json(url1)
-            json_str2 = main.ONOS2.get_json(url2)
-            json_str3 = main.ONOS3.get_json(url3)
-            json_str4 = main.ONOS4.get_json(url4)
-
-            if json_str1 != "" and json_str2 != "" and json_str3 != "":
-                f.write("ONOS1......IncomingRate \n ")
-                f.write(str(json_str1["meters"][0]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][0]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][0]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][0]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][0]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS2......IncomingRate \n")
-                f.write(str(json_str2["meters"][0]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][0]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][0]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][0]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][0]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS3......IncomingRate \n")
-                f.write(str(json_str3["meters"][0]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][0]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][0]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][0]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][0]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS4......IncomingRate \n")
-                f.write(str(json_str4["meters"][0]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][0]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][0]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][0]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][0]['meter']['mean_rate']))
-                f.write('\n')
-                f.write('\n')
-
-                f.write("--------------------------------------------------------------------------------- \n") 
+        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("ONOS1......ProcessingRate \n ")
-                f.write(str(json_str1["meters"][1]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][1]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][1]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][1]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str1["meters"][1]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS2......ProcessingRate \n")
-                f.write(str(json_str2["meters"][1]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][1]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][1]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][1]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str2["meters"][1]['meter']['mean_rate']))
-                f.write('\n')
-                f.write("ONOS3......ProcessingRate \n")
-                f.write(str(json_str3["meters"][1]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][1]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][1]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][1]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str3["meters"][1]['meter']['mean_rate']))
-                f.write('\n')
+                    f.write('\n')
 
-                f.write("ONOS4......ProcessingRate \n")
-                f.write(str(json_str4["meters"][1]['meter']['count']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][1]['meter']['m1_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][1]['meter']['m5_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][1]['meter']['m15_rate']))
-                f.write('\t')
-                f.write(str(json_str4["meters"][1]['meter']['mean_rate']))
-                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") 
-       
-                time.sleep(10)
+                    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 = "http://10.128.10.1:8080/wm/onos/metrics"
+        url2 = "http://10.128.10.2:8080/wm/onos/metrics"
+        url3 = "http://10.128.10.3:8080/wm/onos/metrics"
+        url4 = "http://10.128.10.4:8080/wm/onos/metrics"
+        url5 = "http://10.128.10.5:8080/wm/onos/metrics"
+
+        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 == 3:
+                        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']
+
+        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:10.128.10.1:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:10.128.10.2:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:10.128.10.3:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:10.128.10.4:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:10.128.10.5:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:10.128.10.3:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:10.128.10.5:6633")
+        
+        main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
+        main.ONOS3.handle.expect("\$")
+
+        main.ONOS3.handle.sendline("./loadgen_NB.py -n 5 -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3:8080 10.128.10.4:8080 10.128.10.5: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 = "http://10.128.10.1:8080/wm/onos/metrics"
+        url2 = "http://10.128.10.2:8080/wm/onos/metrics"
+        url3 = "http://10.128.10.3:8080/wm/onos/metrics"
+        url4 = "http://10.128.10.4:8080/wm/onos/metrics"
+        url5 = "http://10.128.10.5:8080/wm/onos/metrics"
+        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 = "http://10.128.10.1:8080/wm/onos/metrics"
+        url2 = "http://10.128.10.2:8080/wm/onos/metrics"
+        url3 = "http://10.128.10.3:8080/wm/onos/metrics"
+        url4 = "http://10.128.10.4:8080/wm/onos/metrics"
+        url5 = "http://10.128.10.5:8080/wm/onos/metrics"
+        url5 = "http://10.128.10.5:8080/wm/onos/metrics"
+        url6 = "http://10.128.10.6:8080/wm/onos/metrics"
+
+        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 == 3:
+                        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']
+
+        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:10.128.10.1:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:10.128.10.2:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:10.128.10.3:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:10.128.10.4:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:10.128.10.5:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:10.128.10.6:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:10.128.10.6:6633")
+        
+        main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
+        main.ONOS3.handle.expect("\$")
+
+        main.ONOS3.handle.sendline("./loadgen_NB.py -n 6 -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3:8080 10.128.10.4:8080 10.128.10.5:8080 10.128.10.6: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 = "http://10.128.10.1:8080/wm/onos/metrics"
+        url2 = "http://10.128.10.2:8080/wm/onos/metrics"
+        url3 = "http://10.128.10.3:8080/wm/onos/metrics"
+        url4 = "http://10.128.10.4:8080/wm/onos/metrics"
+        url5 = "http://10.128.10.5:8080/wm/onos/metrics"
+        url6 = "http://10.128.10.6:8080/wm/onos/metrics"
+        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 = "http://10.128.10.1:8080/wm/onos/metrics"
+        url2 = "http://10.128.10.2:8080/wm/onos/metrics"
+        url3 = "http://10.128.10.3:8080/wm/onos/metrics"
+        url4 = "http://10.128.10.4:8080/wm/onos/metrics"
+        url5 = "http://10.128.10.5:8080/wm/onos/metrics"
+        url5 = "http://10.128.10.5:8080/wm/onos/metrics"
+        url6 = "http://10.128.10.6:8080/wm/onos/metrics"
+        url7 = "http://10.128.10.7:8080/wm/onos/metrics"
+
+        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 == 3:
+                        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']
+
+        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:10.128.10.1:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s2 tcp:10.128.10.2:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s3 tcp:10.128.10.3:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:10.128.10.4:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s5 tcp:10.128.10.5:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s6 tcp:10.128.10.6:6633")
+        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s7 tcp:10.128.10.7:6633")
+        
+        main.ONOS3.handle.sendline("cd ~admin/suibin-dev")
+        main.ONOS3.handle.expect("\$")
+
+        main.ONOS3.handle.sendline("./loadgen_NB.py -n 7 -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3:8080 10.128.10.4:8080 10.128.10.6:8080 10.128.10.5:8080 10.128.10.7: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 = "http://10.128.10.1:8080/wm/onos/metrics"
+        url2 = "http://10.128.10.2:8080/wm/onos/metrics"
+        url3 = "http://10.128.10.3:8080/wm/onos/metrics"
+        url4 = "http://10.128.10.4:8080/wm/onos/metrics"
+        url5 = "http://10.128.10.5:8080/wm/onos/metrics"
+        url6 = "http://10.128.10.6:8080/wm/onos/metrics"
+        url7 = "http://10.128.10.7:8080/wm/onos/metrics"
+        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/scaleResults b/TestON/tests/scaleONOS7nodes/scaleResults
deleted file mode 100644
index 2488306..0000000
--- a/TestON/tests/scaleONOS7nodes/scaleResults
+++ /dev/null
@@ -1,51 +0,0 @@
-[2014-07-25 15:15:35.933098] [scaleONOS7nodes] [CASE]  Starting SB load from mininet with 20sw added/removed 10/s duration: 360s
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4, u'mean_rate': 0.059200312795650786, u'm5_rate': 0.0, u'm15_rate': 0.0, u'units': u'events/second', u'm1_rate': 0.0}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 189, u'mean_rate': 2.4356254535500663, u'm5_rate': 0.41843186533973237, u'm15_rate': 1.9369051806194815, u'units': u'events/second', u'm1_rate': 0.14129996658762756}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 305, u'mean_rate': 3.4808906901728482, u'm5_rate': 0.9457303370098417, u'm15_rate': 4.174524246234802, u'units': u'events/second', u'm1_rate': 0.3220664415995731}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 470, u'mean_rate': 4.813391854440621, u'm5_rate': 1.3653129541121973, u'm15_rate': 5.67074120039854, u'units': u'events/second', u'm1_rate': 0.47005007387755343}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 554, u'mean_rate': 5.145399853971431, u'm5_rate': 1.6878416231510096, u'm15_rate': 6.5221406321995365, u'units': u'events/second', u'm1_rate': 0.5886241207705653}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 670, u'mean_rate': 5.692871627444301, u'm5_rate': 1.9211151858691953, u'm15_rate': 6.874390831538807, u'units': u'events/second', u'm1_rate': 0.6793689049109783}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 782, u'mean_rate': 6.122985062753683, u'm5_rate': 2.298585202117126, u'm15_rate': 7.903041256773227, u'units': u'events/second', u'm1_rate': 0.8200558382406801}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 928, u'mean_rate': 6.737355933051502, u'm5_rate': 2.5440190839839243, u'm15_rate': 8.182751878849528, u'units': u'events/second', u'm1_rate': 0.9192254774790037}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 1068, u'mean_rate': 7.2277027669966225, u'm5_rate': 3.0582120448420502, u'm15_rate': 9.742318376899973, u'units': u'events/second', u'm1_rate': 1.1102756658184045}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 1178, u'mean_rate': 7.465643586983538, u'm5_rate': 3.3117994889825484, u'm15_rate': 9.89957751878761, u'units': u'events/second', u'm1_rate': 1.2173187929330158}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 1272, u'mean_rate': 7.579869789467111, u'm5_rate': 3.491942657341365, u'm15_rate': 9.73588659125985, u'units': u'events/second', u'm1_rate': 1.3011290230067005}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 1372, u'mean_rate': 7.714903896910294, u'm5_rate': 3.744533557606514, u'm15_rate': 9.958097598081375, u'units': u'events/second', u'm1_rate': 1.410495416418516}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 1502, u'mean_rate': 7.995257880751603, u'm5_rate': 3.9832156189264327, u'm15_rate': 10.137227344552151, u'units': u'events/second', u'm1_rate': 1.5165477887836256}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 1618, u'mean_rate': 8.17649661132665, u'm5_rate': 4.232923512725775, u'm15_rate': 10.361789679493679, u'units': u'events/second', u'm1_rate': 1.6279660102909048}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 1796, u'mean_rate': 8.638436983286626, u'm5_rate': 4.625961247189527, u'm15_rate': 11.274683186266738, u'units': u'events/second', u'm1_rate': 1.7890611156116576}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 1898, u'mean_rate': 8.70908577788645, u'm5_rate': 4.940218041617326, u'm15_rate': 11.732722831544308, u'units': u'events/second', u'm1_rate': 1.9262401293788511}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2014, u'mean_rate': 8.834979322143473, u'm5_rate': 5.086044615238827, u'm15_rate': 11.36565719225259, u'units': u'events/second', u'm1_rate': 2.00877929586214}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2096, u'mean_rate': 8.80741944058602, u'm5_rate': 5.23446678354358, u'm15_rate': 11.104825178674638, u'units': u'events/second', u'm1_rate': 2.092708438681387}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2212, u'mean_rate': 8.919169787587151, u'm5_rate': 5.42342880661179, u'm15_rate': 11.087454018930082, u'units': u'events/second', u'm1_rate': 2.1911244042226627}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2302, u'mean_rate': 8.921505549289213, u'm5_rate': 5.527733113130847, u'm15_rate': 10.709420105909206, u'units': u'events/second', u'm1_rate': 2.261958400590161}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2424, u'mean_rate': 9.043024690304492, u'm5_rate': 5.7730856298958795, u'm15_rate': 11.070016034135019, u'units': u'events/second', u'm1_rate': 2.3806525506070884}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2558, u'mean_rate': 9.198907190307924, u'm5_rate': 5.977993104861085, u'm15_rate': 11.230685676223507, u'units': u'events/second', u'm1_rate': 2.487028536364942}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2652, u'mean_rate': 9.205141639750474, u'm5_rate': 6.102910924894121, u'm15_rate': 11.002099225101214, u'units': u'events/second', u'm1_rate': 2.567791053544984}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2758, u'mean_rate': 9.251221641461491, u'm5_rate': 6.236628457203367, u'm15_rate': 10.864897965206772, u'units': u'events/second', u'm1_rate': 2.6520564660056722}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 2866, u'mean_rate': 9.300808867298466, u'm5_rate': 6.4461734461098965, u'm15_rate': 11.153003681875704, u'units': u'events/second', u'm1_rate': 2.7620817265483906}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3000, u'mean_rate': 9.428962629183438, u'm5_rate': 6.549131070407777, u'm15_rate': 10.904360602384472, u'units': u'events/second', u'm1_rate': 2.837588952255399}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3114, u'mean_rate': 9.488273497253953, u'm5_rate': 6.760779624902542, u'm15_rate': 11.22991528533686, u'units': u'events/second', u'm1_rate': 2.9498980541385973}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3232, u'mean_rate': 9.555939548927737, u'm5_rate': 6.971335992976415, u'm15_rate': 11.519573501287377, u'units': u'events/second', u'm1_rate': 3.0630963037697176}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3322, u'mean_rate': 9.539302128630185, u'm5_rate': 7.005059610420453, u'm15_rate': 10.979254648249038, u'units': u'events/second', u'm1_rate': 3.117647167706458}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3426, u'mean_rate': 9.562668411317048, u'm5_rate': 7.168703957115292, u'm15_rate': 11.13340055572298, u'units': u'events/second', u'm1_rate': 3.2157814313436766}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3556, u'mean_rate': 9.6553664830416, u'm5_rate': 7.30835119706793, u'm15_rate': 11.196064287702198, u'units': u'events/second', u'm1_rate': 3.3063182176268193}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3690, u'mean_rate': 9.753744409437841, u'm5_rate': 7.436043897518086, u'm15_rate': 11.19922564971827, u'units': u'events/second', u'm1_rate': 3.3935526056733525}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3862, u'mean_rate': 9.94485575877501, u'm5_rate': 7.716475942451841, u'm15_rate': 11.928560772404543, u'units': u'events/second', u'm1_rate': 3.5328121098263545}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 3962, u'mean_rate': 9.945657010947713, u'm5_rate': 7.921927978095857, u'm15_rate': 12.23377875835498, u'units': u'events/second', u'm1_rate': 3.6484090746318865}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4074, u'mean_rate': 9.975814947863958, u'm5_rate': 8.00901532078311, u'm15_rate': 11.966342332818853, u'units': u'events/second', u'm1_rate': 3.7251416456063717}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4156, u'mean_rate': 9.932800200694953, u'm5_rate': 8.054999692711906, u'm15_rate': 11.58131193842906, u'units': u'events/second', u'm1_rate': 3.7878895918323345}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4290, u'mean_rate': 10.013202869430945, u'm5_rate': 8.197664300462709, u'm15_rate': 11.712109833999651, u'units': u'events/second', u'm1_rate': 3.8830746138276506}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 9.97133516767342, u'm5_rate': 8.191184093898045, u'm15_rate': 11.142233135267437, u'units': u'events/second', u'm1_rate': 3.928565036650824}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 9.748514038149732, u'm5_rate': 8.052687964347193, u'm15_rate': 10.02019824138421, u'units': u'events/second', u'm1_rate': 3.9292315920501197}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 9.535437429356055, u'm5_rate': 7.788689451274274, u'm15_rate': 8.481914691112806, u'units': u'events/second', u'm1_rate': 3.885815112583944}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 9.331367778702917, u'm5_rate': 7.533345838926838, u'm15_rate': 7.179785778108208, u'units': u'events/second', u'm1_rate': 3.842878368314098}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 9.135919987284627, u'm5_rate': 7.286373385909162, u'm15_rate': 6.077557449798136, u'units': u'events/second', u'm1_rate': 3.80041605835342}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 8.948532183901525, u'm5_rate': 7.047497652974929, u'm15_rate': 5.144541313226928, u'units': u'events/second', u'm1_rate': 3.758422940387489}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 8.76863771104249, u'm5_rate': 6.8164531980665, u'm15_rate': 4.354760204591356, u'units': u'events/second', u'm1_rate': 3.7168938300274155}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 8.59583194470271, u'm5_rate': 6.592983281351978, u'm15_rate': 3.6862249294674947, u'units': u'events/second', u'm1_rate': 3.6758236001697906}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 8.429632452341373, u'm5_rate': 6.37683957993232, u'm15_rate': 3.120322036630427, u'units': u'events/second', u'm1_rate': 3.635207180363701}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 8.269862736358995, u'm5_rate': 6.167781911901452, u'm15_rate': 2.6412955797811177, u'units': u'events/second', u'm1_rate': 3.595039556184744}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 8.115976079788764, u'm5_rate': 5.965577969452773, u'm15_rate': 2.2358084383190753, u'units': u'events/second', u'm1_rate': 3.5553157686159524}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 7.967761632050002, u'm5_rate': 5.770003060735474, u'm15_rate': 1.892570983393321, u'units': u'events/second', u'm1_rate': 3.516030913435567}}
-{u'name': u'Topology.EventNotification.ListenerEventRate', u'meter': {u'count': 4372, u'mean_rate': 7.8248239429659785, u'm5_rate': 5.580839860173803, u'm15_rate': 1.6020267505007044, u'units': u'events/second', u'm1_rate': 3.477180140611569}}