#Author: Santhosh Jayashankar
class scaleONOS7nodes :



    def __init__(self) :
        self.default = ''

#        def print_hello_world(self,main):
#            print("hello world")
#*****************************************************************************************************************************************************************************************
#Test startup
#Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully
    def CASE1(self,main) :  #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
        main.case("Initial setup")
        main.step("Stop ONOS")
        import time
        main.log.info("Stopping all ONOS nodes...")
        main.ONOS1.stop_all()
        main.ONOS2.stop_all()
        main.ONOS3.stop_all()
#        main.print_hello_world()
        main.ONOS4.stop_all()
        main.ONOS5.stop_all()
        main.ONOS6.stop_all()
        main.ONOS7.stop_all()
        #main.ONOS2.stop_rest()
        time.sleep(5)
        #main.ONOS1.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
        #main.ONOS2.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
        #main.ONOS3.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")
        #main.ONOS4.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties")        
        #main.step("Start tcpdump on mn")
        #main.Mininet2.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
        main.step("Starting 3 ONOS nodes...")
        main.Zookeeper1.start()
        main.Zookeeper2.start()
        main.Zookeeper3.start()
        main.Zookeeper4.start()
        main.Zookeeper5.start()
        main.Zookeeper6.start()
        main.Zookeeper7.start()
        
        time.sleep(5)
        
        
        main.RamCloud1.del_db()
        main.RamCloud2.del_db()
        main.RamCloud3.del_db()
       # main.RamCloud4.del_db()

        time.sleep(5)
        #main.log.report("Pulling latest code from github to all nodes")
          
        """
        for i in range(2):
            uptodate = main.ONOS1.git_pull()
            main.ONOS2.git_pull()
            main.ONOS3.git_pull()
        #    main.ONOS4.git_pull()
            ver1 = main.ONOS1.get_version()
            ver2 = main.ONOS3.get_version()
            if ver1==ver2:
                break
            elif i==1:
                main.ONOS2.git_pull("ONOS1 master")
                main.ONOS3.git_pull("ONOS1 master")
               # main.ONOS4.git_pull("ONOS1 master")
        if uptodate==0:
       # if 1:
            main.ONOS1.git_compile()
            main.ONOS2.git_compile()
            main.ONOS3.git_compile()
           # main.ONOS4.git_compile()
        main.ONOS1.print_version()    
       # main.RamCloud1.git_pull()
       # main.RamCloud2.git_pull()
       # main.RamCloud3.git_pull()
       # main.RamCloud4.git_pull()
       # main.ONOS1.get_version()
       # main.ONOS2.get_version()
       # main.ONOS3.get_version()
       # main.ONOS4.get_version()
       # main.ONOS1.start_all()
       # main.ONOS2.start_all()
       # main.ONOS3.start_all()
       # main.ONOS4.start_all()

        """
        main.RamCloud1.start_coor()
        main.RamCloud1.start_serv()
        main.RamCloud2.start_serv()
        main.RamCloud3.start_serv()
        time.sleep(5)
        main.ONOS1.start()
        main.ONOS2.start()
        main.ONOS3.start()
        #main.ONOS4.start()
        time.sleep(5)
        
        #main.ONOS1.handle.sendline("./onos.sh core start")
        #main.ONOS1.handle.sendline("./onos.sh core start")
        #main.ONOS1.handle.sendline("./onos.sh core start")

        main.ONOS1.start_rest()
        main.ONOS2.start_rest()
        main.ONOS3.start_rest()
        test= main.ONOS2.rest_status()
        if test == main.FALSE:
            main.ONOS1.start_rest()
        main.ONOS1.get_version()
        main.log.report("Startup check Zookeeper1, RamCloud1, 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:
            main.RamCloud1.stop_coor()
            main.RamCloud1.stop_serv()
            main.RamCloud2.stop_serv()
            main.RamCloud3.stop_serv()
        #    main.RamCloud4.stop_serv()

            time.sleep(5)
            main.RamCloud1.start_coor()
            main.RamCloud1.start_serv()
            main.RamCloud2.start_serv()
            main.RamCloud3.start_serv()
         #   main.RamCloud4.start_serv()
            time.sleep(5)
            data =  main.RamCloud1.status_serv() and main.RamCloud2.status_serv() and main.RamCloud3.status_serv() #and main.RamCloud4.status_serv()
            

        
        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
        
        main.step("Testing startup ONOS")   
        data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() #and main.ONOS4.isup()
        for i in range(3):
            if data == main.FALSE: 
                #main.log.report("Something is funny... restarting ONOS")
                #main.ONOS1.stop()
                time.sleep(3)
                #main.ONOS1.start()
                #time.sleep(5) 
                data = main.ONOS1.isup() and main.ONOS2.isup() and main.ONOS3.isup() #and main.ONOS4.isup()
            else:
                break
        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
        time.sleep(10)


    def CASE31(self,main):
        main.case("Staring SB load with 3 ONOS nodes")
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        rate1 = main.params['RATE1']
        run_dur = main.params['RUN_DUR']
        loop = int( main.params['loop'])
        port = main.params['port']
        switches_num = main.params['switches_num']
        print loop
        sleep_init = int(main.params['sleep_init'])
        sleep_t =int( main.params['sleep_t'])
        main.case("Starting SB load on 3 nodes from mininet with " + rate1 +"  added/removed/s for " + run_dur)
        main.Mininet2.handle.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + "\"" + " -s " + switches_num + " -p " + port + " -a " + rate1 + " -d " + rate1 + " -l " + run_dur)
        main.log.info("Adding switches and ports.....")
        main.Mininet2.handle.expect("Starting SB load....", timeout=400)
        main.log.info("Starting SB load....")
        import time
        import json
        import math
        time.sleep(sleep_init)
        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale3nodesrate1", 'w').close()
        url1 = "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)):
            j1 = main.ONOS2.get_json(url1)
            j2 = main.ONOS2.get_json(url2)
            j3 = main.ONOS2.get_json(url3)
            json_str = []
            json_str.append(0)
            json_str.append(j1)
            json_str.append(j2)
            json_str.append(j3)
            #float jval = 0
            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,4):
                    f.write("ONOS" + str(j) + "\n")
                    f.write(str(json_str[j]["meters"][4]['meter']['count']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][4]['meter']['m1_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][4]['meter']['m5_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][4]['meter']['m15_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][4]['meter']['mean_rate']))
                    f.write('\n')
                    if j == 3:
                        tpval += float(json_str[j]["meters"][4]['meter']['m1_rate']) 
                        #print tpval
                        #print ("\n")
                            
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
       # print tpval
        print("\n")
        tpavg3n = round(tpval)/loop
        print tpavg3n
        main.Mininet2.handle.expect("\$", timeout=900)
       # main.Mininet2.handle.sendline("sudo mn -c")
        #main.Mininet2.handle.expect("\$")
       # main.Mininet2.handle.expect("\$", timeout=900)
        time.sleep(180)
        

    def CASE32(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_init = int(main.params['sleep_init'])
        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("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + "\"" + " -s " + switches_num + " -p " + port + " -a " + rate2 + " -d " + rate2 + " -l " + run_dur)
       #main.Mininet2.handle.sendline("./loadgen_SB.sh startload \"10.128.10.1\" 100 50 1200 \"11\"")
        main.Mininet2.handle.expect("Starting SB load....", timeout=900 )
        time.sleep(sleep_init )
        import json
        time.sleep(sleep_init)
        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")
        for i in range(int (loop)):
            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] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,4):
                    f.write("ONOS" + str(j) + "\n")
                    f.write(str(json_str[j]["meters"][4]['meter']['count']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][4]['meter']['m1_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][4]['meter']['m5_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][4]['meter']['m15_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][4]['meter']['mean_rate']))
                    f.write('\n')
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
        #time.sleep(10)
        main.Mininet2.handle.expect("\$", timeout=900)
        time.sleep(180)
       # main.Mininet2.handle.sendline("sudo mn -c")
        #time.sleep(5)
       # main.Mininet2.handle.expect("\$", timeout=900)


    def CASE33(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 = 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.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")
        main.Mininet4.handle.sendline("sudo ovs-vsctl set-controller s4 tcp:10.128.10.2:6633")
        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("./loadgen_NB.py -n 3 -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3:8080 \" -i " + int_num + " -a " + addrate + " -l " + NBdur + " -p 20")
        main.ONOS3.handle.expect("Pause between add and delete:", timeout=900)
        time.sleep(NBsleep_init)
        #time.sleep(60)
        import json
        
        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(NBloop):
            j1 = main.ONOS1.get_json(url1)
            j2 = main.ONOS1.get_json(url2)
            j3 = main.ONOS1.get_json(url3)
            json_str = []
            json_str.append(0)
            json_str.append(j1)
            json_str.append(j2)
            json_str.append(j3)
            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "":
                for j in range(1,4):
                    f.write("*****************ONOS" + str(j) + " INCOMING RATE****************************" "\n")
                    f.write(str(json_str[j]["meters"][0]['meter']['count']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][0]['meter']['m1_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][0]['meter']['m5_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][0]['meter']['m15_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][0]['meter']['mean_rate']))
                    f.write('\n')
                
                    f.write('\n')

                    f.write("--------------------------------------------------------------------------------- \n") 
                
                    f.write("***************** ONOS" + str(j) + " PROCESSING RATE************************" + " \n ")
                    f.write(str(json_str[j]["meters"][1]['meter']['count']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][1]['meter']['m1_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][1]['meter']['m5_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][1]['meter']['m15_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][1]['meter']['mean_rate']))
                    f.write('\n')
                    f.write('\n')
                    f.write('\n')

                    f.write("--------------------------------------------------------------------------------- \n") 
                    f.write("--------------------------------------------------------------------------------- \n \n") 
                    time.sleep(NBsleep)
        f.close()
        
        main.ONOS3.handle.expect("\$", timeout=900)
   
        
    def CASE4(self,main):
        
        main.case("Starting ONOS scale-up to 4 nodes ")
        import time
       # main.RamCloud4.start_serv()
        main.ONOS5.stop_all()
        main.ONOS6.stop_all()
        main.ONOS7.stop_all()
    
            
        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...")
        
        time.sleep(10)
    
    def CASE5(self,main):
        
        main.case("Starting ONOS scale-up/down to 5 nodes ")
        import time
       # main.RamCloud4.start_serv()
        main.ONOS6.stop_all()
        main.ONOS7.stop_all()
        #pdata = main.ONOS5.isup()
    
        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: 
                #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() and main.ONOS5.isup() 
            else:
                break
        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
        time.sleep(10)

    def CASE6(self,main):
        
        main.case("Starting ONOS scale-up/down to 6 nodes ")
        import time
       # main.RamCloud4.start_serv()
        main.ONOS7.stop_all()
        #pdata = main.ONOS6.isup()

        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: 
                #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() and main.ONOS5.isup() and main.ONOS6.isup()
            else:
                break
        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
        time.sleep(10)

    def CASE7(self,main):
        
        main.case("Starting ONOS scale-up/down to 7 nodes ")
        import time
       # main.RamCloud4.start_serv()
        #pdata = main.ONOS7.isup()
    
        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: 
                #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() and main.ONOS5.isup() and main.ONOS6.isup() and main.ONOS7.isup()
            else:
                break
        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
        time.sleep(10)



    def CASE41(self,main):
        main.case("Starting SB test for 4 nodes")
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        ip4 = main.params['CTRL']['ip4']
        rate1 = main.params['RATE1']
        run_dur = main.params['RUN_DUR']
        loop = int( main.params['loop'])
        switches_num = main.params['switches_num']
        port = main.params['port']
        print loop
        sleep_init = int(main.params['sleep_init'])
        sleep_t =int( main.params['sleep_t'])
        main.case("Starting SB load on 4 nodes from mininet with " + rate1 +"  added/removed/s for " + run_dur)
        #main.Mininet2.handle.sendline("./loadgen_SB.sh startload \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + "\"" + " " + switches_num + " " + port + " " + rate1 + " " + run_dur +  "  \"11\"")
        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)):
            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] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,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']) 
                       # print tpval
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
       # print tpval
        print("\n")
        tpavg4n = round(tpval)/loop
        print tpavg4n
        
        #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 CASE42(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_init = int(main.params['sleep_init'])
        sleep_t = int(main.params['sleep_t'])
        switches_num = main.params['switches_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.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 +  "\"" + " -s " + switches_num + " -p " + port + " -a " + rate2 + " -d " + rate2 + " -l " + run_dur)
        main.Mininet2.handle.expect("Starting SB load....", timeout=900 )
        time.sleep(sleep_init)
        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)):
            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] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,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')
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
        time.sleep(180)

    def CASE43(self,main):
        
        main.case("Starting NB Throughput test after scaling up to 4 onos nodes")
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        ip4 = main.params['CTRL']['ip4']

        import time
        import json
        int_num = 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.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")
        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.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("./loadgen_NB.py -n 3 -u \"10.128.10.1:8080 10.128.10.2:8080 10.128.10.3:8080 10.128.10.4:8080  \" -i " + int_num + " -a " + addrate + " -l " + NBdur + " -p 20")
        main.ONOS3.handle.expect("Pause between add and delete:", timeout=900)

        
        time.sleep(NBsleep_init)
        import json
        
        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/NBscale4nodesrate1", 'w').close()
        url1 = "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/NBscale4nodesrate1", "a")
        #time.sleep(10)
        for i in range(NBloop):
            j1 = main.ONOS2.get_json(url1)
            j2 = main.ONOS2.get_json(url2)
            j3 = main.ONOS2.get_json(url3)
            j4 = main.ONOS2.get_json(url4)
            json_str = []
            json_str.append(0)
            json_str.append(j1)
            json_str.append(j2)
            json_str.append(j3)
            json_str.append(j4)
            if json_str[1] != "" and json_str[2] != "" and json_str[3] != "" and json_str[4] != "":
                for j in range(1,5):
                    f.write("*****************ONOS" + str(j) + " INCOMING RATE****************************" "\n")
                    f.write(str(json_str[j]["meters"][0]['meter']['count']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][0]['meter']['m1_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][0]['meter']['m5_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][0]['meter']['m15_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][0]['meter']['mean_rate']))
                    f.write('\n')
                
                    f.write('\n')

                    f.write("--------------------------------------------------------------------------------- \n") 
                
                    f.write("***************** ONOS" + str(j) + " PROCESSING RATE************************" + " \n ")
                    f.write(str(json_str[j]["meters"][1]['meter']['count']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][1]['meter']['m1_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][1]['meter']['m5_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][1]['meter']['m15_rate']))
                    f.write('\t')
                    f.write(str(json_str[j]["meters"][1]['meter']['mean_rate']))
                    f.write('\n')
                    f.write('\n')
                    f.write('\n')

                    f.write("--------------------------------------------------------------------------------- \n") 
                    f.write("--------------------------------------------------------------------------------- \n \n") 
                    time.sleep(NBsleep)
        f.close()
        

        main.ONOS3.handle.expect("\$", timeout=900)
    
    
    def CASE51(self,main):
        main.case("Starting SB test for 5 nodes")
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        ip4 = main.params['CTRL']['ip4']
        ip5 = main.params['CTRL']['ip5']
        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("./loadgen_SB.sh startload \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + "\"" + " " + switches_num + " " + port + " " + rate1 + " " + run_dur +  "  \"11\"")
        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")
        #time.sleep(10)
        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] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,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']) 
                        #print tpval
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
        #print tpval
        print("\n")
        tpavg5n = round(tpval)/loop
        print tpavg5n
        
        #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 CASE52(self,main):
        
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        ip4 = main.params['CTRL']['ip4']
        ip5 = main.params['CTRL']['ip5']
        
        import time
        import json
        rate2 = main.params['RATE2']
        run_dur = main.params['RUN_DUR']
        loop = int(main.params['loop'])
        sleep_t = int(main.params['sleep_t'])
        sleep_init = int(main.params['sleep_init'])
        switches_num = main.params['switches_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.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + " " + ip5 + "\"" + " -s " + switches_num + " -p " + port + " -a " + rate2 + " -d " + rate2 + " -l " + run_dur)
        main.Mininet2.handle.expect("Starting SB load....", timeout=900 )
        time.sleep(sleep_init)
        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale5nodesrate2", '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/scale5nodesrate2", "a")
        #time.sleep(10)
        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[4] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,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')
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
        time.sleep(180)

    def CASE53(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 = 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.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")
        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 3 -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 " + int_num + " -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")
        #time.sleep(10)
        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')

                    f.write("--------------------------------------------------------------------------------- \n") 
                    f.write("--------------------------------------------------------------------------------- \n \n") 
                    time.sleep(NBsleep)
        f.close()
        

        main.ONOS3.handle.expect("\$", timeout=900)
    
    def CASE61(self,main):
        main.case("Starting SB test for 5 nodes")
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        ip4 = main.params['CTRL']['ip4']
        ip5 = main.params['CTRL']['ip5']
        ip6 = main.params['CTRL']['ip6']
        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("./loadgen_SB.sh startload \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + "\"" + " " + switches_num + " " + port + " " + rate1 + " " + run_dur +  "  \"11\"")
        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")
        #time.sleep(10)
        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] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,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']) 
                        #print tpval
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
        #print tpval
        print("\n")
        tpavg6n = round(tpval)/loop
        print tpavg6n
        
        #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 CASE62(self,main):
        
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        ip4 = main.params['CTRL']['ip4']
        ip5 = main.params['CTRL']['ip5']
        ip6 = main.params['CTRL']['ip6']
        
        import time
        import json
        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['switches_num']
        sleep_init = int(main.params['sleep_init'])
        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.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + " " + ip5 + " " + ip6 + "\"" + " -s " + switches_num + " -p " + port + " -a " + rate2 + " -d " + rate2 + " -l " + run_dur)
        main.Mininet2.handle.expect("Starting SB load....", timeout=900 )
        time.sleep(sleep_init)
        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale6nodesrate2", '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/scale6nodesrate2", "a")
        #time.sleep(10)
        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] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,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')
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
        time.sleep(180)

    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 = 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.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")
        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 3 -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 " + int_num + " -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")
        #time.sleep(10)
        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')

                    f.write("--------------------------------------------------------------------------------- \n") 
                    f.write("--------------------------------------------------------------------------------- \n \n") 
                    time.sleep(NBsleep)
        f.close()
        

        main.ONOS3.handle.expect("\$", timeout=900)

    def CASE71(self,main):
        main.case("Starting SB test for 7 nodes")
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        ip4 = main.params['CTRL']['ip4']
        ip5 = main.params['CTRL']['ip5']
        ip6 = main.params['CTRL']['ip6']
        ip7 = main.params['CTRL']['ip7']
        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("./loadgen_SB.sh startload \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + "\"" + " " + switches_num + " " + port + " " + rate1 + " " + run_dur +  "  \"11\"")
        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")
        #time.sleep(10)
        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] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,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']) 
                        #print tpval
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
        #print tpval
        print("\n")
        tpavg7n = round(tpval)/loop
        print tpavg7n
        
        #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 CASE72(self,main):
        
        ip1 = main.params['CTRL']['ip1']
        ip2 = main.params['CTRL']['ip2']
        ip3 = main.params['CTRL']['ip3']
        ip4 = main.params['CTRL']['ip4']
        ip5 = main.params['CTRL']['ip5']
        ip6 = main.params['CTRL']['ip6']
        ip7 = main.params['CTRL']['ip7']
        
        import time
        import json
        rate2 = main.params['RATE2']
        run_dur = main.params['RUN_DUR']
        loop = int(main.params['loop'])
        sleep_t = int(main.params['sleep_t'])
        sleep_init = int(main.params['sleep_init'])
        switches_num = main.params['switches_num']
        port = main.params['port']
        main.case("Starting SB load on 7 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.sendline("sudo ./loadgen_SB.py -u \"" + ip1 + " " + ip2 + " " + ip3 + " " + ip4 + " " + ip5 + " " + ip6 + " " + ip7 + "\"" + " -s " + switches_num + " -p " + port + " -a " + rate2 + " -d " + rate2 + " -l " + run_dur)
        main.Mininet2.handle.expect("Starting SB load....", timeout=900 )
        
        time.sleep(sleep_init)

        open("/home/admin/TestON/tests/scaleONOS7nodes/logs/scale7nodesrate2", '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/scale6nodesrate2", "a")
        #time.sleep(10)
        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] != "":
                # write_str = str(json_str["meters"][4]["meter"][2])
                #print str(json_str["meters"][4])
                #f.write(str(json_str["meters"][4]))
                #f.write('\n')
                #time.sleep(3)
                for j in range(1,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')
                
                f.write('\n')
                f.write('\n')
                
                f.write("--------------------------------------------------------------------------------- \n") 
                time.sleep(sleep_t)
        f.close() 
        time.sleep(180)

    def CASE73(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 = 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.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")
        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 3 -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 " + int_num + " -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")
        #time.sleep(10)
        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')

                    f.write("--------------------------------------------------------------------------------- \n") 
                    f.write("--------------------------------------------------------------------------------- \n \n") 
                    time.sleep(NBsleep)
        f.close()
        

        main.ONOS3.handle.expect("\$", timeout=900)

    def CASE8(self,main):
        import time
        main.case("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: 
                #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() and main.ONOS5.isup() and main.ONOS6.isup()
            else:
                break
        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
    
    def CASE9(self,main):

        main.case("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: 
                #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() and main.ONOS5.isup()
            else:
                break
        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")

    def CASE10(self,main):

        main.case("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: 
                #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...")

    def CASE11(self,main):

        main.case("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: 
                #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()
            else:
                break
        utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS 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.case("Posting the results to http://10.128.5.54/scale.html ....")
        db_script = main.params['db_script']
        os.system(db_script + " -name='100SwitchScaleUp" + "' -rate3='" + str(tpavg3n) + "' -rate4='" + str(tpavg4n) + "' -rate5='" + str(tpavg5n) + "' -rate6='" + str(tpavg6n) + "' -rate7='" + str(tpavg7n) + "' -table='onos_scale'")

    def CASE104(self,main):
        import os
        import time
        main.case("Posting the results to http://10.128.5.54/scale.html ....")
        db_script = main.params['db_script']
        os.system(db_script + "-name='100SwitchScaleDown'" + " -rate3='" + str(tpavg7n) + "' -rate4='" + str(tpavg6n) + "' -rate5='" + str(tpavg5n) + "' -rate6='" + str(tpavg4n) + "' -rate7='" + str(tpavg3n) + "' -table='onos_scale'")




