Merge branch 'master' of github.com:OPENNETWORKINGLAB/ONLabTest
diff --git a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params
new file mode 100644
index 0000000..f1fc56b
--- /dev/null
+++ b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params
@@ -0,0 +1,43 @@
+<PARAMS>
+ <testcases>1,2,3,4,5,6,7,4,8,7,4,9,7</testcases>
+ <Iterations>3</Iterations>
+ <WaitTime>60</WaitTime>
+ <RestIP>10.128.4.151</RestIP>
+ <MN_size>57</MN_size>
+ <TargetTime>30</TargetTime>
+ <NR_Switches>25</NR_Switches>
+ <NR_Links>50</NR_Links>
+ <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
+ <CTRL>
+ <ip1>10.128.4.151</ip1>
+ <port1>6633</port1>
+ <ip2>10.128.4.152</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.4.153</ip3>
+ <port3>6633</port3>
+ <ip4>10.128.4.154</ip4>
+ <port4>6633</port4>
+ </CTRL>
+ <PING>
+ <source1>h6</source1>
+ <source2>h7</source2>
+ <source3>h8</source3>
+ <source4>h9</source4>
+ <source5>h10</source5>
+ <source6>h11</source6>
+ <source7>h12</source7>
+ <source8>h13</source8>
+ <source9>h14</source9>
+ <source10>h15</source10>
+ <target1>10.0.0.16</target1>
+ <target2>10.0.0.17</target2>
+ <target3>10.0.0.18</target3>
+ <target4>10.0.0.19</target4>
+ <target5>10.0.0.20</target5>
+ <target6>10.0.0.21</target6>
+ <target7>10.0.0.22</target7>
+ <target8>10.0.0.23</target8>
+ <target9>10.0.0.24</target9>
+ <target10>10.0.0.25</target10>
+ </PING>
+</PARAMS>
diff --git a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params_nightly b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params_nightly
new file mode 100644
index 0000000..d99f6de
--- /dev/null
+++ b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.params_nightly
@@ -0,0 +1,43 @@
+<PARAMS>
+ <testcases>1,2,3,4,5,6,7,4,5,6,7,4,5,6,7,4,8,7,4,9,7</testcases>
+ <Iterations>3</Iterations>
+ <WaitTime>60</WaitTime>
+ <RestIP>10.128.4.151</RestIP>
+ <MN_size>57</MN_size>
+ <TargetTime>30</TargetTime>
+ <NR_Switches>25</NR_Switches>
+ <NR_Links>50</NR_Links>
+ <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
+ <CTRL>
+ <ip1>10.128.4.151</ip1>
+ <port1>6633</port1>
+ <ip2>10.128.4.152</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.4.153</ip3>
+ <port3>6633</port3>
+ <ip4>10.128.4.154</ip4>
+ <port4>6633</port4>
+ </CTRL>
+ <PING>
+ <source1>h6</source1>
+ <source2>h7</source2>
+ <source3>h8</source3>
+ <source4>h9</source4>
+ <source5>h10</source5>
+ <source6>h11</source6>
+ <source7>h12</source7>
+ <source8>h13</source8>
+ <source9>h14</source9>
+ <source10>h15</source10>
+ <target1>10.0.0.16</target1>
+ <target2>10.0.0.17</target2>
+ <target3>10.0.0.18</target3>
+ <target4>10.0.0.19</target4>
+ <target5>10.0.0.20</target5>
+ <target6>10.0.0.21</target6>
+ <target7>10.0.0.22</target7>
+ <target8>10.0.0.23</target8>
+ <target9>10.0.0.24</target9>
+ <target10>10.0.0.25</target10>
+ </PING>
+</PARAMS>
diff --git a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.py b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.py
new file mode 100644
index 0000000..bd0763d
--- /dev/null
+++ b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.py
@@ -0,0 +1,415 @@
+
+class RCOnosPerf4nodes:
+
+ def __init__(self) :
+ self.default = ''
+
+ def CASE1(self,main) :
+ '''
+ First case is to simply check if ONOS, ZK, and RamCloud are all running properly.
+ If ONOS if not running properly, it will restart ONOS once before continuing.
+ It will then check if the ONOS has a view of all the switches and links as defined in the params file.
+ The test will only pass if ONOS is running properly, and has a full view of all topology elements.
+ '''
+ import time
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ main.RamCloud1.start_coor()
+ main.RamCloud1.start_serv()
+ main.RamCloud2.start_serv()
+ main.RamCloud3.start_serv()
+ main.RamCloud4.start_serv()
+ time.sleep(20)
+ main.ONOS1.drop_keyspace()
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.start_rest()
+ time.sleep(5)
+ test= main.ONOS1.rest_status()
+ if test == main.FALSE:
+ main.ONOS1.start_rest()
+ main.ONOS1.get_version()
+ main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
+ main.case("Checking if the startup was clean...")
+ main.step("Testing startup Zookeeper")
+ data = main.Zookeeper1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
+ main.step("Testing startup RamCloud")
+ data = main.RamCloud1.isup()
+ if data == main.FALSE:
+ main.RamCloud1.stop_coor()
+ main.RamCloud1.stop_serv()
+ main.RamCloud2.stop_serv()
+ main.RamCloud3.stop_serv()
+ main.RamCloud4.stop_serv()
+
+ time.sleep(5)
+ main.RamCloud1.start_coor()
+ main.RamCloud1.start_serv()
+ main.RamCloud2.start_serv()
+ main.RamCloud3.start_serv()
+ main.RamCloud4.start_serv()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
+ main.step("Testing startup ONOS")
+ data = main.ONOS1.isup()
+ data = data and main.ONOS2.isup()
+ data = data and main.ONOS3.isup()
+ data = data and main.ONOS4.isup()
+ if data == main.FALSE:
+ main.log.report("Something is funny... restarting ONOS")
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ time.sleep(5)
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ data = main.ONOS1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
+
+ def CASE2(self,main) :
+ '''
+ Makes sure that the HW links are all up
+ Verifies that at least one mininet host exists.
+ Proves that there is actually a mininet that we are working with
+ '''
+ import time
+ main.step("Checking if MN switches exist")
+ main.log.report("Check if MN switches exist")
+ #result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ #for i in range(2):
+ # if result == main.FALSE:
+ # time.sleep(5)
+ # result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ # else:
+ # break
+ #main.step("Verifying the result")
+ #utilities.assert_equals(expect=main.TRUE,actual=result,onpass="MN switches exist",onfail="MN is missing switches and or links...")
+
+ main.step("assigning ONOS controllers to switches")
+ for i in range(25):
+ if i < 3:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ elif i >= 3 and i < 5:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ elif i >= 5 and i < 15:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ else:
+ j=i+16
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ main.Mininet1.get_sw_controller("s1")
+ time.sleep(5)
+
+ def CASE3(self,main) :
+ '''
+ Verifies that ONOS sees the right topology...
+ '''
+ import time
+ main.log.report("checking if ONOS sees the right topo...")
+ main.case("TOPO check")
+ main.step("calling rest calls")
+ for i in range(4):
+ result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ time.sleep(5)
+ if result == 1:
+ break
+ if result == 0:
+ main.ONOS1.start()
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ time.sleep(45)
+ for i in range(4):
+ result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ time.sleep(5)
+ if result == 1:
+ break
+ utilities.assert_equals(expect=1,actual=result)
+
+ def CASE4(self,main) :
+ '''
+ This Test case:
+ - Clears out any leftover flows
+ - Adds new flows into ONOS
+ - Checks flows up to 10 times waiting for each flow to be caluculated and no "NOT" statements inte get_flow
+ '''
+ import time
+ main.log.report("Deleting and adding flows")
+ main.case("Taking care of these flows!")
+ main.step("Cleaning out any leftover flows...")
+ main.log.info("deleting...")
+ main.ONOS1.delete_flow("all")
+ main.log.info("adding...")
+ t1 = time.time()
+ main.ONOS1.add_flow(main.params['FLOWDEF'])
+ main.log.info("Checking...")
+ for i in range(15):
+ result = main.ONOS1.check_flow()
+ if result == main.TRUE:
+ t2 = time.time()
+ main.log.info( 'Adding flows took %0.3f s' % (t2-t1))
+ break
+ time.sleep(5)
+ main.log.info("Checking Flows again...")
+
+ strtTime = time.time()
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 3:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
+ time.sleep(10)
+ elif ping == main.FALSE and count ==3:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.info("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.info("\tPING TEST FAIL")
+
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="flows are good",onfail="FLOWS not correct")
+
+ main.log.report("checking if ONOS sees the right topo...")
+ main.case("TOPO check")
+ main.step("calling rest calls")
+ for i in range(3):
+ result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ time.sleep(5)
+ if result == 1:
+ break
+
+ def CASE5(self,main) :
+ '''
+ Tests a single ping
+ '''
+ main.log.report("Testing a single ping")
+ main.case("Testing ping...")
+ ping_result = main.Mininet4.pingHost(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
+ utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+
+ def CASE6(self,main) :
+ '''
+ Starts continuous pings on the Mininet nodes
+ '''
+ main.log.report("Starting continuous ping, then toggle a single link in the center triangle")
+ import time
+ import os
+ main.case("Starting long ping... ")
+ main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
+ main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
+ main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
+ main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
+ main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
+ main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
+ main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
+ main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
+ main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
+ main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
+ main.step("Check that the pings are going")
+ result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
+ main.step( "Link down number of iterations: " + main.params['Iterations'] )
+ for i in range(int(main.params['Iterations'])):
+ main.log.info("Bringing Link down... ")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
+ main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
+ time.sleep( int(main.params['WaitTime']) )
+ main.log.info("Bringing Link up... ")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
+ main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
+ time.sleep( int(main.params['WaitTime']) )
+ main.case("Killing remote ping processes ")
+ result = result & main.Mininet4.pingKill()
+ utilities.assert_equals(expect=main.TRUE,actual=result)
+
+
+ def CASE7(self,main) :
+ '''
+ Processes all of the ping data and outputs raw data and an overall average
+ '''
+ import os
+ import time
+ main.log.report("Process ping data (Fail is time is >20 seconds)")
+ main.case("Processing Ping data")
+ time.sleep(3)
+ #result=os.popen("/home/admin/tools/shell.sh " + main.params['Iterations']).read()
+ try:
+ result=os.popen("/home/admin/ONLabTest/TestON/scripts/get_reroute_times.py").read()
+ average=result.split(":")[1]
+ main.log.info( "Reroute times are... " )
+ main.log.report( result + " seconds" )
+ try:
+ if float(average) < float(main.params['TargetTime']) :
+ test=main.TRUE
+ else:
+ test=main.FALSE
+ except ValueError:
+ main.log.error("Data is corrupted")
+ test=main.FALSE
+ except:
+ main.log.report("No data")
+ test=main.FALSE
+ utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ")
+
+ def CASE8(self,main) :
+ '''
+ Starts continuous pings on the Mininet nodes
+ '''
+ main.log.report("Start continuous pings, then toggle multiple links in center triangle")
+ import time
+ import os
+ time.sleep(20)
+ main.case("Starting long ping... ")
+ main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
+ main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
+ main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
+ main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
+ main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
+ main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
+ main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
+ main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
+ main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
+ main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
+ main.step("Check that the pings are going")
+ result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
+ main.step( "Making topo change while flows are rerouting")
+ main.step( "Link down number of iterations: " + main.params['Iterations'] )
+ for i in range(int(main.params['Iterations'])):
+ main.log.info("s1-s2 link down")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
+ main.Mininet1.link(END1="s1",END2="s3",OPTION="up")
+ main.Mininet1.link(END1="s2",END2="s3",OPTION="up")
+
+ time.sleep(5)
+
+ main.log.info("s1-s2 link up | s1-s3 link down | s2-s3 link down")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
+ main.Mininet1.link(END1="s1",END2="s3",OPTION="down")
+ main.Mininet1.link(END1="s2",END2="s3",OPTION="down")
+
+ main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
+ time.sleep( int(main.params['WaitTime']) + 60 )
+
+ main.case("Killing remote ping processes ")
+ result = result & main.Mininet4.pingKill()
+ utilities.assert_equals(expect=main.TRUE,actual=result)
+ main.log.info("Make sure all links in triangle are up")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
+ main.Mininet1.link(END1="s1",END2="s3",OPTION="up")
+ main.Mininet1.link(END1="s2",END2="s3",OPTION="up")
+
+ def CASE9(self,main) :
+ '''
+ Starts continuous pings on the Mininet nodes
+ '''
+ main.log.report("Start continuous pings, then toggle one link in center triangle and start/stop 1 ONOS node")
+ import time
+ import os
+
+ time.sleep(20)
+ main.case("Starting long ping... ")
+ main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
+ main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
+ main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
+ main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
+ main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
+ main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
+ main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
+ main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
+ main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
+ main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
+ main.step("Check that the pings are going")
+ result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
+ main.step( "Making topo change while flows are rerouting")
+ main.step( "Link down number of iterations: " + main.params['Iterations'] )
+ for i in range(int(main.params['Iterations'])):
+ main.log.info("s1-s2 link down | Onos 1 down")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
+ if i % 4 == 0:
+ main.ONOS1.stop()
+ elif i % 4 == 1:
+ main.ONOS2.stop()
+ elif i % 4 == 2:
+ main.ONOS3.stop()
+ else:
+ main.ONOS4.stop()
+
+ time.sleep(5)
+
+ main.log.info("s1-s2 link up | Onos 1 back up")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
+ if i % 4 == 0:
+ main.ONOS1.start()
+ main.ONOS1.isup()
+ elif i % 4 == 1:
+ main.ONOS2.start()
+ main.ONOS2.isup()
+ elif i % 4 == 2:
+ main.ONOS3.start()
+ main.ONOS3.isup()
+ else:
+ main.ONOS4.start()
+ main.ONOS4.isup()
+
+ main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
+ time.sleep( int(main.params['WaitTime']) )
+
+ main.case("Killing remote ping processes ")
+ result = result & main.Mininet4.pingKill()
+ utilities.assert_equals(expect=main.TRUE,actual=result)
+
diff --git a/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.topo b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.topo
new file mode 100644
index 0000000..90d7465
--- /dev/null
+++ b/TestON/tests/RCOnosPerf4nodes/RCOnosPerf4nodes.topo
@@ -0,0 +1,122 @@
+<TOPOLOGY>
+ <COMPONENT>
+ <Zookeeper1>
+ <host>10.128.4.151</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>1</connect_order>
+ </Zookeeper1>
+
+ <Zookeeper2>
+ <host>10.128.4.152</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Zookeeper2>
+
+ <Zookeeper3>
+ <host>10.128.4.153</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Zookeeper3>
+
+ <Zookeeper4>
+ <host>10.128.4.154</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Zookeeper4>
+
+
+ <RamCloud1>
+ <host>10.128.4.151</host>
+ <user>admin</user>
+ <password></password>
+ <type>RamCloudCliDriver</type>
+ <connect_order>5</connect_order>
+ </RamCloud1>
+ <RamCloud2>
+ <host>10.128.4.152</host>
+ <user>admin</user>
+ <password></password>
+ <type>RamCloudCliDriver</type>
+ <connect_order>6</connect_order>
+ </RamCloud2>
+ <RamCloud3>
+ <host>10.128.4.153</host>
+ <user>admin</user>
+ <password></password>
+ <type>RamCloudCliDriver</type>
+ <connect_order>7</connect_order>
+ </RamCloud3>
+ <RamCloud4>
+ <host>10.128.4.154</host>
+ <user>admin</user>
+ <password></password>
+ <type>RamCloudCliDriver</type>
+ <connect_order>8</connect_order>
+ </RamCloud4>
+
+ <ONOS1>
+ <host>10.128.4.151</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>9</connect_order>
+ </ONOS1>
+ <ONOS2>
+ <host>10.128.4.152</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>10</connect_order>
+ </ONOS2>
+ <ONOS3>
+ <host>10.128.4.153</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>11</connect_order>
+ </ONOS3>
+ <ONOS4>
+ <host>10.128.4.154</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>12</connect_order>
+ </ONOS4>
+
+ <Mininet1>
+ <host>10.128.4.159</host>
+ <user>admin</user>
+ <password></password>
+ <type>MininetCliDriver</type>
+ <connect_order>13</connect_order>
+ <COMPONENTS>
+ # Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
+ <arg2> --topo mytopo </arg2>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ <Mininet4>
+ <host>10.128.4.159</host>
+ <user>admin</user>
+ <password></password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>14</connect_order>
+ </Mininet4>
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/RCOnosPerf4nodes/__init__.py b/TestON/tests/RCOnosPerf4nodes/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/RCOnosPerf4nodes/__init__.py
diff --git a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.params b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.params
new file mode 100644
index 0000000..f04ef3a
--- /dev/null
+++ b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.params
@@ -0,0 +1,9 @@
+<PARAMS>
+ <testcases>1,2,3,4</testcases>
+ <Iterations>2</Iterations>
+ <WaitTime>50</WaitTime>
+ <TargetTime>50</TargetTime>
+ <RestIP>10.128.4.151</RestIP>
+ <NR_Switches>100</NR_Switches>
+ <NR_Links>198</NR_Links>
+</PARAMS>
diff --git a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.py b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.py
new file mode 100644
index 0000000..3081eed
--- /dev/null
+++ b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.py
@@ -0,0 +1,251 @@
+
+class RCOnosScale4nodes:
+
+ def __init__(self) :
+ self.default = ''
+
+ def CASE1(self,main) :
+ '''
+ First case is to simply check if ONOS, ZK, and RamCloud are all running properly.
+ If ONOS if not running properly, it will restart ONOS once before continuing.
+ It will then check if the ONOS has a view of all the switches and links as defined in the params file.
+ The test will only pass if ONOS is running properly, and has a full view of all topology elements.
+ '''
+ import time
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ main.RamCloud1.start_coor()
+ main.RamCloud1.start_serv()
+ main.RamCloud2.start_serv()
+ main.RamCloud3.start_serv()
+ main.RamCloud4.start_serv()
+ time.sleep(20)
+ main.ONOS1.drop_keyspace()
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.start_rest()
+ time.sleep(5)
+ test= main.ONOS1.rest_status()
+ if test == main.FALSE:
+ main.ONOS1.start_rest()
+ main.ONOS1.get_version()
+ main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
+ main.case("Checking if the startup was clean...")
+ main.step("Testing startup Zookeeper")
+ data = main.Zookeeper1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
+ main.step("Testing startup RamCloud")
+ data = main.RamCloud1.isup()
+ if data == main.FALSE:
+ main.RamCloud1.stop_coor()
+ main.RamCloud1.stop_serv()
+ main.RamCloud2.stop_serv()
+ main.RamCloud3.stop_serv()
+ main.RamCloud4.stop_serv()
+
+ time.sleep(5)
+
+ main.RamCloud1.start_coor()
+ main.RamCloud1.start_serv()
+ main.RamCloud2.start_serv()
+ main.RamCloud3.start_serv()
+ main.RamCloud4.start_serv()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
+ main.step("Testing startup ONOS")
+ data = main.ONOS1.isup()
+ data = data and main.ONOS2.isup()
+ data = data and main.ONOS3.isup()
+ data = data and main.ONOS4.isup()
+ if data == main.FALSE:
+ main.log.report("Something is funny... restarting ONOS")
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ time.sleep(5)
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ data = main.ONOS1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
+
+ def CASE2(self,main) :
+ '''
+ Second case is to time the convergence time of a topology for ONOS.
+ It shuts down the ONOS, drops keyspace, starts ONOS...
+ Then it points all the mininet switches at the ONOS node and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
+ '''
+ import time
+ main.log.report("Time convergence for switches -> single ONOS node in cluster")
+ main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
+ main.step("Bringing ONOS down...")
+ main.log.info("all switch no controllers")
+ main.Mininet1.ctrl_none()
+ main.log.info("bringing ONOS down")
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ main.log.info("Dropping keyspace...")
+ main.ONOS1.drop_keyspace()
+ time.sleep(5)
+ main.log.info("Bringing ONOS up")
+ main.ONOS1.start()
+ time.sleep(5)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.isup()
+ main.ONOS2.isup()
+ main.ONOS3.isup()
+ main.ONOS4.isup()
+ main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
+ main.Mininet1.ctrl_local()
+ t1 = time.time()
+ for i in range(15) :
+ result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ if result == 1 :
+ break
+ else :
+ time.sleep(1)
+ t2 = time.time()
+ conv_time = t2 - t1
+ main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ if result == 1 :
+ main.log.report( "Convergence time of : %f seconds" % conv_time )
+ if float(conv_time) < float(main.params['TargetTime']) :
+ test=main.TRUE
+ main.log.info("Time is less then supplied target time")
+ else:
+ test=main.FALSE
+ main.log.info("Time is greater then supplied target time")
+ else :
+ main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
+ test=main.FALSE
+
+ utilities.assert_equals(expect=main.TRUE,actual=test)
+
+ def CASE3(self,main) :
+ '''
+ Second case is to time the convergence time of a topology for ONOS.
+ It shuts down the ONOS, drops keyspace, starts ONOS...
+ Then it points all the mininet switches at all ONOS nodes and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
+ '''
+ import time
+ main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
+ main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
+ main.step("Bringing ONOS down...")
+ main.log.info("all switch no controllers")
+ main.Mininet1.ctrl_none()
+ main.log.info("bringing ONOS down")
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ #main.log.info("Dropping keyspace...")
+ #main.ONOS1.drop_keyspace()
+ time.sleep(5)
+ main.log.info("Bringing ONOS up")
+ main.ONOS1.start()
+ time.sleep(5)
+ main.ONOS2.start()
+ main.ONOS2.start_rest()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.isup()
+ main.ONOS2.isup()
+ main.ONOS3.isup()
+ main.ONOS4.isup()
+ main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
+ main.Mininet1.ctrl_all()
+ t1 = time.time()
+ for i in range(15) :
+ result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ if result == 1 :
+ break
+ else :
+ time.sleep(1)
+ t2 = time.time()
+ conv_time = t2 - t1
+ main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ if result == 1 :
+ main.log.report( "Convergence time of : %f seconds" % conv_time )
+ if float(conv_time) < float(main.params['TargetTime']) :
+ test=main.TRUE
+ main.log.info("Time is less then supplied target time")
+ else:
+ test=main.FALSE
+ main.log.info("Time is greater then supplied target time")
+ else :
+ main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
+ test=main.FALSE
+
+ utilities.assert_equals(expect=main.TRUE,actual=test)
+
+ def CASE4(self,main) :
+ '''
+ Second case is to time the convergence time of a topology for ONOS.
+ It shuts down the ONOS, drops keyspace, starts ONOS...
+ Then it evenly points all mininet switches to all ONOS nodes, but only one node, and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
+ '''
+ import time
+ main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
+ main.case("Timing Onos Convergence for even single controller distribution")
+ main.step("Bringing ONOS down...")
+ main.log.info("all switch no controllers")
+ main.Mininet1.ctrl_none()
+ main.log.info("bringing ONOS down")
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ #main.log.info("Dropping keyspace...")
+ #main.ONOS1.drop_keyspace()
+ time.sleep(5)
+ main.log.info("Bringing ONOS up")
+ main.ONOS1.start()
+ time.sleep(5)
+ main.ONOS2.start()
+ main.ONOS2.start_rest()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.isup()
+ main.ONOS2.isup()
+ main.ONOS3.isup()
+ main.ONOS4.isup()
+ main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
+ main.Mininet1.ctrl_divide()
+ t1 = time.time()
+ for i in range(15) :
+ result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ if result == 1 :
+ break
+ else :
+ time.sleep(1)
+ t2 = time.time()
+ conv_time = t2 - t1
+ main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ if result == 1 :
+ main.log.report( "Convergence time of : %f seconds" % conv_time )
+ if float(conv_time) < float(main.params['TargetTime']) :
+ test=main.TRUE
+ main.log.info("Time is less then supplied target time")
+ else:
+ test=main.FALSE
+ main.log.info("Time is greater then supplied target time")
+ else :
+ main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
+ test=main.FALSE
+
+ utilities.assert_equals(expect=main.TRUE,actual=test)
+
diff --git a/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.topo b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.topo
new file mode 100644
index 0000000..ae85268
--- /dev/null
+++ b/TestON/tests/RCOnosScale4nodes/RCOnosScale4nodes.topo
@@ -0,0 +1,87 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOS1>
+ <host>10.128.4.151</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>7</connect_order>
+ </ONOS1>
+ <ONOS2>
+ <host>10.128.4.152</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>8</connect_order>
+ </ONOS2>
+ <ONOS3>
+ <host>10.128.4.153</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>9</connect_order>
+ </ONOS3>
+ <ONOS4>
+ <host>10.128.4.154</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>10</connect_order>
+ </ONOS4>
+
+ <Zookeeper1>
+ <host>10.128.4.151</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Zookeeper1>
+
+ <RamCloud1>
+ <host>10.128.4.151</host>
+ <user>admin</user>
+ <password></password>
+ <type>RamCloudCliDriver</type>
+ <connect_order>3</connect_order>
+ </RamCloud1>
+ <RamCloud2>
+ <host>10.128.4.152</host>
+ <user>admin</user>
+ <password></password>
+ <type>RamCloudCliDriver</type>
+ <connect_order>4</connect_order>
+ </RamCloud2>
+ <RamCloud3>
+ <host>10.128.4.153</host>
+ <user>admin</user>
+ <password></password>
+ <type>RamCloudCliDriver</type>
+ <connect_order>5</connect_order>
+ </RamCloud3>
+ <RamCloud4>
+ <host>10.128.4.154</host>
+ <user>admin</user>
+ <password></password>
+ <type>RamCloudCliDriver</type>
+ <connect_order>6</connect_order>
+ </RamCloud4>
+
+ <Mininet1>
+ <host>10.128.4.159</host>
+ <user>admin</user>
+ <password></password>
+ <type>MininetCliDriver</type>
+ <connect_order>25</connect_order>
+ <COMPONENTS>
+ # Specify the Option for mininet
+ <arg1> </arg1>
+ <arg2> --topo linear,100 --arp</arg2>
+ <controller> remote,ip=10.128.4.151,port=6633 </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/RCOnosScale4nodes/__init__.py b/TestON/tests/RCOnosScale4nodes/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/RCOnosScale4nodes/__init__.py
diff --git a/TestON/tests/RCOnosScale4nodes/check_status.py b/TestON/tests/RCOnosScale4nodes/check_status.py
new file mode 100755
index 0000000..c725cec
--- /dev/null
+++ b/TestON/tests/RCOnosScale4nodes/check_status.py
@@ -0,0 +1,111 @@
+#! /usr/bin/env python
+import json
+import os
+import sys
+
+# http://localhost:8080/wm/core/topology/switches/all/json
+# http://localhost:8080/wm/core/topology/links/json
+# http://localhost:8080/wm/registry/controllers/json
+# http://localhost:8080/wm/registry/switches/json"
+
+def get_json(url):
+ try:
+ command = "curl -s %s" % (url)
+ result = os.popen(command).read()
+ parsedResult = json.loads(result)
+ except:
+ print "REST IF %s has issue" % command
+ parsedResult = ""
+
+ if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
+ print "REST %s returned code %s" % (command, parsedResult['code'])
+ parsedResult = ""
+
+ return parsedResult
+
+def check_switch(RestIP,correct_nr_switch ):
+ buf = ""
+ retcode = 0
+ RestPort="8080"
+
+ url="http://%s:%s/wm/core/topology/switches/all/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+ url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
+ registry = get_json(url)
+
+ if registry == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+
+ buf += "switch: total %d switches\n" % len(parsedResult)
+ cnt = 0
+ active = 0
+
+ for s in parsedResult:
+ cnt += 1
+
+ if s['state'] == "ACTIVE":
+ active += 1
+
+ if not s['dpid'] in registry:
+ buf += "switch: dpid %s lost controller\n" % (s['dpid'])
+
+ buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
+ if correct_nr_switch != cnt:
+ buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
+ retcode = 1
+
+ if correct_nr_switch != active:
+ buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
+ retcode = 1
+
+ return (retcode, buf)
+
+def check_link(RestIP, nr_links):
+ RestPort = "8080"
+ buf = ""
+ retcode = 0
+
+ url = "http://%s:%s/wm/core/topology/links/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+ buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
+ intra = 0
+ interlink=0
+
+ for s in parsedResult:
+ intra = intra + 1
+
+ if intra != nr_links:
+ buf += "link fail: network %d should have %d intra links but has %d\n" % (1, nr_links, intra)
+ retcode = 1
+
+ return (retcode, buf)
+
+#if __name__ == "__main__":
+def check_status(ip, numoswitch, numolink):
+
+ switch = check_switch(ip, numoswitch)
+ link = check_link(ip, numolink)
+ value = switch[0]
+ value += link[0]
+ if value != 0:
+ print "FAIL"
+ return 0
+ else:
+ print "PASS"
+ return 1
+ print "%s" % switch[1]
+ print "%s" % link[1]
+ # print "%s" % check_switch_local()[1]
+ # print "%s" % check_controllers(8)[1]