All changes in the past month recovered after VM corruption
diff --git a/TestON/drivers/__init__.pyc b/TestON/drivers/__init__.pyc
new file mode 100644
index 0000000..3ce7bd4
--- /dev/null
+++ b/TestON/drivers/__init__.pyc
Binary files differ
diff --git a/TestON/drivers/common/__init__.pyc b/TestON/drivers/common/__init__.pyc
new file mode 100644
index 0000000..a344365
--- /dev/null
+++ b/TestON/drivers/common/__init__.pyc
Binary files differ
diff --git a/TestON/drivers/common/api/__init__.pyc b/TestON/drivers/common/api/__init__.pyc
new file mode 100644
index 0000000..d38bb6a
--- /dev/null
+++ b/TestON/drivers/common/api/__init__.pyc
Binary files differ
diff --git a/TestON/drivers/common/api/find_node2.py b/TestON/drivers/common/api/find_node2.py
new file mode 100755
index 0000000..eeb1504
--- /dev/null
+++ b/TestON/drivers/common/api/find_node2.py
@@ -0,0 +1,44 @@
+#! /usr/bin/env python
+import json
+import os
+import sys
+
+
+
+def find_host(RestIP,RestPort,RestAPI,hostMAC):
+ retcode = 0
+ url ="http://%s:%s/wm/device/" %(RestIP,RestPort)
+
+ 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 = ""
+
+
+
+ if parsedResult == "":
+ return (retcode, "Rest API has an error")
+ else:
+ found = [item for item in parsedResult if item['mac'] == [str(hostMAC)]]
+ retcode = 1
+ return (retcode, found)
+
+
+if __name__ == "__main__":
+ ip = "10.128.100.1"
+ port = 8080
+ hostMAC = "00:00:00:00:00:06"
+ RestAPI = "/wm/device/"
+ Reststat,Hoststat = find_host(ip,port,RestAPI,hostMAC)
+
+ if Reststat == 1:
+ print "Found device with MAC:" + hostMAC +" attached to switch(DPID):" + str(Hoststat[0]['attachmentPoint'][0]['switchDPID'])
+ else:
+ print " Device with MAC:" + hostMAC + " is not found!"
diff --git a/TestON/drivers/common/api/onosrestapidriver.pyc b/TestON/drivers/common/api/onosrestapidriver.pyc
new file mode 100644
index 0000000..f490913
--- /dev/null
+++ b/TestON/drivers/common/api/onosrestapidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/apidriver.pyc b/TestON/drivers/common/apidriver.pyc
new file mode 100644
index 0000000..9f71337
--- /dev/null
+++ b/TestON/drivers/common/apidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/__init__.pyc b/TestON/drivers/common/cli/__init__.pyc
new file mode 100644
index 0000000..b3adaf0
--- /dev/null
+++ b/TestON/drivers/common/cli/__init__.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/cassandraclidriver.pyc b/TestON/drivers/common/cli/cassandraclidriver.pyc
new file mode 100644
index 0000000..6b97df3
--- /dev/null
+++ b/TestON/drivers/common/cli/cassandraclidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/emulator/__init__.pyc b/TestON/drivers/common/cli/emulator/__init__.pyc
new file mode 100644
index 0000000..3c4df5e
--- /dev/null
+++ b/TestON/drivers/common/cli/emulator/__init__.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.pyc b/TestON/drivers/common/cli/emulator/mininetclidriver.pyc
new file mode 100644
index 0000000..1c8e9eb
--- /dev/null
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.pyc b/TestON/drivers/common/cli/emulator/remotemininetdriver.pyc
new file mode 100644
index 0000000..1a8d221
--- /dev/null
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/emulatordriver.pyc b/TestON/drivers/common/cli/emulatordriver.pyc
new file mode 100644
index 0000000..e0b0d97
--- /dev/null
+++ b/TestON/drivers/common/cli/emulatordriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/onoscli/__init__.pyc b/TestON/drivers/common/cli/onoscli/__init__.pyc
new file mode 100644
index 0000000..cfd99f1
--- /dev/null
+++ b/TestON/drivers/common/cli/onoscli/__init__.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/onoscli/cassandraclidriver.pyc b/TestON/drivers/common/cli/onoscli/cassandraclidriver.pyc
new file mode 100644
index 0000000..d83cc58
--- /dev/null
+++ b/TestON/drivers/common/cli/onoscli/cassandraclidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/onoscli/zookeeperclidriver.pyc b/TestON/drivers/common/cli/onoscli/zookeeperclidriver.pyc
new file mode 100644
index 0000000..777f64c
--- /dev/null
+++ b/TestON/drivers/common/cli/onoscli/zookeeperclidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 4861e05..a04309e 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -615,4 +615,13 @@
elif i == 3:
main.log.error("TIMEOUT!")
return main.FALSE
-
+
+ def tcpdump(self):
+ self.handle.sendline("")
+ self.handle.expect("\$")
+ self.handle.sendline("sudo tcpdump -n -i eth0 -s0 -w onos-logs/tcpdump &")
+
+ def kill_tcpdump(self):
+ self.handle.sendline("")
+ self.handle.expect("\$")
+ self.handle.sendline("sudo kill -9 `ps -ef | grep \"tcpdump -n\" | grep -v grep | awk '{print $2}'`")
diff --git a/TestON/drivers/common/cli/onosclidriver.pyc b/TestON/drivers/common/cli/onosclidriver.pyc
new file mode 100644
index 0000000..2b8dd44
--- /dev/null
+++ b/TestON/drivers/common/cli/onosclidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/zookeeperclidriver.pyc b/TestON/drivers/common/cli/zookeeperclidriver.pyc
new file mode 100644
index 0000000..7b8cdf3
--- /dev/null
+++ b/TestON/drivers/common/cli/zookeeperclidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/clidriver.pyc b/TestON/drivers/common/clidriver.pyc
new file mode 100644
index 0000000..859a758
--- /dev/null
+++ b/TestON/drivers/common/clidriver.pyc
Binary files differ
diff --git a/TestON/drivers/component.pyc b/TestON/drivers/component.pyc
new file mode 100644
index 0000000..38b1be9
--- /dev/null
+++ b/TestON/drivers/component.pyc
Binary files differ
diff --git a/TestON/tests/CassandraCheck/CassandraCheck.pyc b/TestON/tests/CassandraCheck/CassandraCheck.pyc
new file mode 100644
index 0000000..c2d5794
--- /dev/null
+++ b/TestON/tests/CassandraCheck/CassandraCheck.pyc
Binary files differ
diff --git a/TestON/tests/CassandraCheck/__init__.pyc b/TestON/tests/CassandraCheck/__init__.pyc
new file mode 100644
index 0000000..a4df73b
--- /dev/null
+++ b/TestON/tests/CassandraCheck/__init__.pyc
Binary files differ
diff --git a/TestON/tests/MininetTest/__init__.pyc b/TestON/tests/MininetTest/__init__.pyc
new file mode 100644
index 0000000..917ac46
--- /dev/null
+++ b/TestON/tests/MininetTest/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.params b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.params
index 2c95ef2..ebaf5d7 100644
--- a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.params
+++ b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,2,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7 </testcases>
+ <testcases>1,2,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7,3,4,5,6,7 </testcases>
<FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
<CASE1>
<destination>h6</destination>
diff --git a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.py b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.py
index 763791d..2964fd1 100644
--- a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.py
+++ b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.py
@@ -9,12 +9,34 @@
#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
def CASE1(self,main) : #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
import time
- main.log.report("Setting up fresh database")
main.ONOS1.stop()
main.ONOS2.stop()
main.ONOS3.stop()
main.ONOS4.stop()
- data = main.Cassandra1.isup()
+ main.Cassandra1.start()
+ main.Cassandra2.start()
+ main.Cassandra3.start()
+ main.Cassandra4.start()
+ time.sleep(20)
+ main.ONOS1.drop_keyspace()
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.start_rest()
+ time.sleep(5)
+ test= main.ONOS1.rest_status()
+ if test == main.FALSE:
+ main.ONOS1.start_rest()
+ main.ONOS1.get_version()
+ main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
+ main.case("Checking if the startup was clean...")
+ main.step("Testing startup Zookeeper")
+ data = main.Zookeeper1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
+ main.step("Testing startup Cassandra")
+ data = main.Cassandra1.isup()
if data == main.FALSE:
main.Cassandra1.stop()
main.Cassandra2.stop()
@@ -22,46 +44,34 @@
main.Cassandra4.stop()
time.sleep(5)
-
+
main.Cassandra1.start()
main.Cassandra2.start()
main.Cassandra3.start()
main.Cassandra4.start()
utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
- main.ONOS1.drop_keyspace()
- main.ONOS1.start()
- main.ONOS2.start()
- main.ONOS3.start()
- main.ONOS4.start()
- '''
- For embedded ONOS
- main.Cassandra1.stop()
- main.Cassandra1.stop()
- main.Cassandra1.stop()
- main.Cassandra1.stop()
- main.log.report("Starting embedded ONOS")
- main.ONOS1.start_embedded()
- time.sleep(30)
- main.ONOS2.start_embedded()
- main.ONOS3.start_embedded()
- main.ONOS4.start_embedded()
- '''
- main.ONOS1.start_rest()
- time.sleep(30)
- test= main.ONOS1.rest_status()
- if test == main.FALSE:
- main.ONOS1.start_rest()
- main.ONOS1.get_version()
- main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
- main.case("Checking if the startup was clean...")
- main.step("Testing startup Zookeeper")
- main.step("Testing startup Cassandra")
- data = main.Cassandra1.isup()
- utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
- data = main.Zookeeper1.isup()
- utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
main.step("Testing startup ONOS")
- data = main.ONOS1.isup()
+ 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()
+ main.ONOS1.tcpdump()
+ main.ONOS2.tcpdump()
+ main.ONOS3.tcpdump()
+ main.ONOS4.tcpdump()
utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
#**********************************************************************************************************************************************************************************************
@@ -102,6 +112,13 @@
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")
+
+ for i in range(9):
+ if result == main.FALSE:
+ time.sleep(3)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
# **********************************************************************************************************************************************************************************************
#Add Flows
@@ -111,6 +128,15 @@
def CASE3(self,main) : #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
import time
+
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ for i in range(9):
+ if result == main.FALSE:
+ time.sleep(3)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
+
main.case("Taking care of these flows!")
main.step("Cleaning out any leftover flows...")
main.ONOS1.delete_flow("all")
@@ -137,11 +163,10 @@
break
endTime = time.time()
if result1 == main.TRUE:
- main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2)))
+ main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
else:
main.log.report("\tFlows failed check")
- strtTime = time.time()
count = 1
i = 6
while i < 16 :
@@ -150,7 +175,7 @@
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")
+ main.log.report("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")
@@ -159,15 +184,13 @@
elif ping == main.TRUE:
i = i + 1
result2 = main.TRUE
- endTime = time.time()
if result2 == main.TRUE:
- main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2)))
+ main.log.info("Flows successfully added")
else:
main.log.report("\tPING TEST FAIL")
- result3 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
main.step("Verifying the result")
- utilities.assert_equals(expect=main.TRUE,actual=result1 and result2 and result3,onpass="Flow check PASS",onfail="Flow check FAIL")
+ utilities.assert_equals(expect=main.TRUE,actual=result1 and result2,onpass="Flow check PASS",onfail="Flow check FAIL")
#**********************************************************************************************************************************************************************************************
#This test case removes Controllers 2,3, and 4 then performs a ping test.
@@ -176,46 +199,21 @@
#If the ping test fails 6 times, then the test case will return false
def CASE4(self,main) :
- main.log.report("Remove all but one ONOS node then ping until all hosts are reachable or fail after 6 attempts")
+ main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
import time
- import random
-
- random.seed(None)
-
- rand = random.randrange(4)
-
- if rand == 0:
- main.log.info("Controller 1 will be the lone coontroller")
- ip = main.params['CTRL']['ip1']
- port = main.params['CTRL']['port1']
- elif rand == 1:
- main.log.info("Controller 2 will be the lone controller")
- ip = main.params['CTRL']['ip2']
- port = main.params['CTRL']['port2']
- elif rand == 2:
- main.log.info("Controller 3 will be the lone controller")
- ip = main.params['CTRL']['ip3']
- port = main.params['CTRL']['port3']
- elif rand == 3:
- main.log.info("Controller 4 will be the lone controller")
- ip = main.params['CTRL']['ip4']
- port = main.params['CTRL']['port4']
-
for i in range(25):
if i < 15:
j=i+1
- main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port) #Assigning a single controller removes all other controllers
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) #Assigning a single controller removes all other controllers
else:
j=i+16
- main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)
-
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+
+ strtTime = time.time()
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-
- strtTime = time.time()
-
- for i in range(2):
+ for i in range(9):
if result == main.FALSE:
- time.sleep(5)
+ time.sleep(3)
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
else:
break
@@ -228,7 +226,7 @@
if ping == main.FALSE and count < 6:
count = count + 1
i = 6
- main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ main.log.report("Ping failed, making attempt number "+str(count)+" in 5 seconds")
time.sleep(5)
elif ping == main.FALSE and count ==6:
main.log.error("Ping test failed")
@@ -239,7 +237,7 @@
result = main.TRUE
endTime = time.time()
if result == main.TRUE:
- main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2)))
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
else:
main.log.report("\tPING TEST FAIL")
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
@@ -257,14 +255,12 @@
else:
j=i+16
main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
-
+
+ strtTime = time.time()
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-
- strtTime = time.time()
-
- for i in range(2):
+ for i in range(9):
if result == main.FALSE:
- time.sleep(5)
+ time.sleep(3)
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
else:
break
@@ -277,7 +273,7 @@
if ping == main.FALSE and count < 6:
count = count + 1
i = 6
- main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ main.log.report("Ping failed, making attempt number "+str(count)+" in 5 seconds")
time.sleep(5)
elif ping == main.FALSE and count ==6:
main.log.error("Ping test failed")
@@ -288,7 +284,7 @@
result = main.TRUE
endTime = time.time()
if result == main.TRUE:
- main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2)))
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
else:
main.log.report("\tPING TEST FAILED")
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
@@ -301,15 +297,13 @@
import time
main.case("Bringing Link down... ")
result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
- time.sleep(15)
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
- strtTime = time.time()
-
+ strtTime = time.time()
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
- for i in range(2):
+ for i in range(9):
if result == main.FALSE:
- time.sleep(5)
+ time.sleep(3)
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
else:
break
@@ -321,7 +315,7 @@
ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
if ping == main.FALSE and count < 10:
count = count + 1
- main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ main.log.report("Ping failed, making attempt number "+str(count)+" in 5 seconds")
i = 6
time.sleep(5)
elif ping == main.FALSE and count == 10:
@@ -333,7 +327,7 @@
result = main.TRUE
endTime = time.time()
if result == main.TRUE:
- main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2)))
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
else:
main.log.report("\tPING TEST FAILED")
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
@@ -346,15 +340,13 @@
import time
main.case("Bringing Link up... ")
result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
- time.sleep(15)
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
-
- strtTime = time.time()
-
+
+ strtTime = time.time()
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
- for i in range(2):
+ for i in range(9):
if result == main.FALSE:
- time.sleep(5)
+ time.sleep(3)
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
else:
break
@@ -367,10 +359,10 @@
ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
if ping == main.FALSE and count < 10:
count = count + 1
- main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ main.log.report("Ping failed, making attempt number "+str(count)+" in 5 seconds")
i = 6
time.sleep(5)
- elif ping == main.FALSE and count == 10:
+ elif ping == main.FALSE and count ==10:
main.log.error("Ping test failed")
i = 17
result = main.FALSE
@@ -379,7 +371,7 @@
result = main.TRUE
endTime = time.time()
if result == main.TRUE:
- main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2)))
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
else:
main.log.report("\tPING TESTS FAILED")
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
@@ -407,11 +399,18 @@
Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
try:
attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
- except IndexError:
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
Reststatus = 0
+
if Reststatus == 1:
main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
- result = main.TRUE
+ if ip_found != None:
+ main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("\t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
else:
main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
result = main.FALSE
@@ -427,7 +426,7 @@
Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
try:
attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
- except IndexError:
+ except:
Reststatus = 0
if Reststatus == 0:
main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
@@ -446,14 +445,20 @@
Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
try:
attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
- except IndexError:
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
Reststatus = 0
if Reststatus == 0:
main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
result = main.FALSE
elif attachedSW == "00:00:00:00:00:00:00:06":
main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
- result = main.TRUE
+ if ip_found != None:
+ main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("\t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
else:
main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
result = main.FALSE
@@ -469,14 +474,20 @@
Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
try:
attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
- except IndexError:
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
Reststatus = 0
if Reststatus == 0:
main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
result = main.FALSE
elif attachedSW == "00:00:00:00:00:00:00:01":
main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
- result = main.TRUE
+ if ip_found != None:
+ main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("\t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
else:
main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
result = main.FALSE
@@ -484,3 +495,5 @@
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
+
+
diff --git a/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.pyc b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.pyc
new file mode 100644
index 0000000..2b81e87
--- /dev/null
+++ b/TestON/tests/OnosCHO4nodes/OnosCHO4nodes.pyc
Binary files differ
diff --git a/TestON/tests/OnosCHO4nodes/__init__.pyc b/TestON/tests/OnosCHO4nodes/__init__.pyc
new file mode 100644
index 0000000..73fab79
--- /dev/null
+++ b/TestON/tests/OnosCHO4nodes/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.pyc b/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.pyc
new file mode 100644
index 0000000..b10aa02
--- /dev/null
+++ b/TestON/tests/OnosCHO8nodes/OnosCHO8nodes.pyc
Binary files differ
diff --git a/TestON/tests/OnosCHO8nodes/__init__.pyc b/TestON/tests/OnosCHO8nodes/__init__.pyc
new file mode 100644
index 0000000..171aaa3
--- /dev/null
+++ b/TestON/tests/OnosCHO8nodes/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosDD_PARP/OnosDD_PARP.pyc b/TestON/tests/OnosDD_PARP/OnosDD_PARP.pyc
new file mode 100644
index 0000000..7e3c03c
--- /dev/null
+++ b/TestON/tests/OnosDD_PARP/OnosDD_PARP.pyc
Binary files differ
diff --git a/TestON/tests/OnosDD_PARP/__init__.pyc b/TestON/tests/OnosDD_PARP/__init__.pyc
new file mode 100644
index 0000000..06b4186
--- /dev/null
+++ b/TestON/tests/OnosDD_PARP/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosPerf/OnosPerf.pyc b/TestON/tests/OnosPerf/OnosPerf.pyc
new file mode 100644
index 0000000..549ad66
--- /dev/null
+++ b/TestON/tests/OnosPerf/OnosPerf.pyc
Binary files differ
diff --git a/TestON/tests/OnosPerf/__init__.pyc b/TestON/tests/OnosPerf/__init__.pyc
new file mode 100644
index 0000000..170443d
--- /dev/null
+++ b/TestON/tests/OnosPerf/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.py b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.py
index 29eef45..db0c60b 100644
--- a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.py
+++ b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.py
@@ -12,14 +12,30 @@
The test will only pass if ONOS is running properly, and has a full view of all topology elements.
'''
import time
- main.log.report("Checking if the startup was clean")
- main.case("Checking if the startup was clean...")
main.ONOS1.stop()
main.ONOS2.stop()
main.ONOS3.stop()
main.ONOS4.stop()
- main.step("Testing startup Zookeeper")
+ main.Cassandra1.start()
+ main.Cassandra2.start()
+ main.Cassandra3.start()
+ main.Cassandra4.start()
+ time.sleep(20)
+ main.ONOS1.drop_keyspace()
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.start_rest()
+ time.sleep(5)
+ test= main.ONOS1.rest_status()
+ if test == main.FALSE:
+ main.ONOS1.start_rest()
main.ONOS1.get_version()
+ main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
+ main.case("Checking if the startup was clean...")
+ main.step("Testing startup Zookeeper")
data = main.Zookeeper1.isup()
utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
main.step("Testing startup Cassandra")
@@ -37,33 +53,25 @@
main.Cassandra3.start()
main.Cassandra4.start()
utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
- main.ONOS1.drop_keyspace()
- time.sleep(5)
- main.ONOS1.start()
- time.sleep(5)
- main.ONOS2.start()
- main.ONOS3.start()
- main.ONOS4.start()
main.step("Testing startup ONOS")
data = main.ONOS1.isup()
+ data = data and main.ONOS2.isup()
+ data = data and main.ONOS3.isup()
+ data = data and main.ONOS4.isup()
if data == main.FALSE:
- main.log.info("Something is funny... restarting ONOS")
+ main.log.report("Something is funny... restarting ONOS")
main.ONOS1.stop()
- time.sleep(3)
- main.ONOS1.start()
+ 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()
- data = data & main.ONOS2.isup()
- data = data & main.ONOS3.isup()
- data = data & main.ONOS4.isup()
- main.ONOS1.start_rest()
- time.sleep(5)
- test= main.ONOS1.rest_status()
- if test == main.FALSE:
- main.ONOS1.start_rest()
- #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
-
- utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running ",onfail="ONOS didn't start ...")
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
def CASE2(self,main) :
'''
@@ -107,6 +115,7 @@
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) :
'''
@@ -116,7 +125,7 @@
main.log.report("checking if ONOS sees the right topo...")
main.case("TOPO check")
main.step("calling rest calls")
- for i in range(9):
+ 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:
@@ -126,7 +135,7 @@
main.ONOS2.start()
main.ONOS3.start()
main.ONOS4.start()
- for i in range(9):
+ 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:
@@ -185,6 +194,14 @@
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) :
'''
diff --git a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.pyc b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.pyc
new file mode 100644
index 0000000..9d3407b
--- /dev/null
+++ b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.pyc
Binary files differ
diff --git a/TestON/tests/OnosPerf4nodes/__init__.pyc b/TestON/tests/OnosPerf4nodes/__init__.pyc
new file mode 100644
index 0000000..ed9f676
--- /dev/null
+++ b/TestON/tests/OnosPerf4nodes/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosPerfTest/OnosPerfTest.params b/TestON/tests/OnosPerfTest/OnosPerfTest.params
new file mode 100644
index 0000000..05c11da
--- /dev/null
+++ b/TestON/tests/OnosPerfTest/OnosPerfTest.params
@@ -0,0 +1,43 @@
+<PARAMS>
+ <testcases>1,2,3,4,5,6,7,8,9</testcases>
+ <Iterations>3</Iterations>
+ <WaitTime>120</WaitTime>
+ <RestIP>10.128.100.4</RestIP>
+ <MN_size>57</MN_size>
+ <TargetTime>20</TargetTime>
+ <NR_Switches>25</NR_Switches>
+ <NR_Links>50</NR_Links>
+ <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
+ <CTRL>
+ <ip1>10.128.100.1</ip1>
+ <port1>6633</port1>
+ <ip2>10.128.100.4</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.100.5</ip3>
+ <port3>6633</port3>
+ <ip4>10.128.100.6</ip4>
+ <port4>6633</port4>
+ </CTRL>
+ <PING>
+ <source1>h6</source1>
+ <source2>h7</source2>
+ <source3>h8</source3>
+ <source4>h9</source4>
+ <source5>h10</source5>
+ <source6>h11</source6>
+ <source7>h12</source7>
+ <source8>h13</source8>
+ <source9>h14</source9>
+ <source10>h15</source10>
+ <target1>10.0.0.16</target1>
+ <target2>10.0.0.17</target2>
+ <target3>10.0.0.18</target3>
+ <target4>10.0.0.19</target4>
+ <target5>10.0.0.20</target5>
+ <target6>10.0.0.21</target6>
+ <target7>10.0.0.22</target7>
+ <target8>10.0.0.23</target8>
+ <target9>10.0.0.24</target9>
+ <target10>10.0.0.25</target10>
+ </PING>
+</PARAMS>
diff --git a/TestON/tests/OnosPerfTest/OnosPerfTest.py b/TestON/tests/OnosPerfTest/OnosPerfTest.py
new file mode 100644
index 0000000..70a3955
--- /dev/null
+++ b/TestON/tests/OnosPerfTest/OnosPerfTest.py
@@ -0,0 +1,337 @@
+
+class OnosPerfTest:
+
+ def __init__(self) :
+ self.default = ''
+
+ def CASE1(self,main) :
+ '''
+ First case is to simply check if ONOS, ZK, and Cassandra are all running properly.
+ If ONOS if not running properly, it will restart ONOS once before continuing.
+ It will then check if the ONOS has a view of all the switches and links as defined in the params file.
+ The test will only pass if ONOS is running properly, and has a full view of all topology elements.
+ '''
+ import time
+ main.log.report("Checking if the startup was clean")
+ main.case("Checking if the startup was clean...")
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ main.step("Testing startup Zookeeper")
+ main.ONOS1.get_version()
+ data = main.Zookeeper1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
+ main.step("Testing startup Cassandra")
+ main.Cassandra1.start()
+ main.Cassandra2.start()
+ main.Cassandra3.start()
+ main.Cassandra4.start()
+ data = main.Cassandra1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
+ main.ONOS1.drop_keyspace()
+ time.sleep(5)
+ main.ONOS1.start()
+ time.sleep(5)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.step("Testing startup ONOS")
+ data = main.ONOS1.isup()
+ if data == main.FALSE:
+ main.log.info("Something is funny... restarting ONOS")
+ main.ONOS1.stop()
+ time.sleep(3)
+ main.ONOS1.start()
+ time.sleep(5)
+ data = main.ONOS1.isup()
+ data = data & main.ONOS2.isup()
+ data = data & main.ONOS3.isup()
+ data = data & main.ONOS4.isup()
+ main.ONOS1.start_rest()
+ #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running ",onfail="ONOS didn't start ...")
+
+ def CASE2(self,main) :
+ '''
+ Makes sure that the HW links are all up
+ Verifies that at least one mininet host exists.
+ Proves that there is actually a mininet that we are working with
+ '''
+ import time
+ main.step("Checking if MN switches exist")
+ main.log.report("Check if MN switches exist")
+ #result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ #for i in range(2):
+ # if result == main.FALSE:
+ # time.sleep(5)
+ # result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ # else:
+ # break
+ #main.step("Verifying the result")
+ #utilities.assert_equals(expect=main.TRUE,actual=result,onpass="MN switches exist",onfail="MN is missing switches and or links...")
+
+ main.step("assigning ONOS controllers to switches")
+ for i in range(25):
+ if i < 3:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),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")
+
+ def CASE3(self,main) :
+ '''
+ Verifies that ONOS sees the right topology...
+ '''
+ import time
+ main.log.report("checking if ONOS sees the right topo...")
+ main.case("TOPO check")
+ main.step("calling rest calls")
+ for i in range(9):
+ result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ time.sleep(5)
+ if result == 1:
+ break
+ if result == 0:
+ main.ONOS1.start()
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ for i in range(9):
+ result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ time.sleep(5)
+ if result == 1:
+ break
+ utilities.assert_equals(expect=1,actual=result)
+
+ def CASE4(self,main) :
+ '''
+ This Test case:
+ - Clears out any leftover flows
+ - Adds new flows into ONOS
+ - Checks flows up to 10 times waiting for each flow to be caluculated and no "NOT" statements inte get_flow
+ '''
+ import time
+ main.log.report("Deleting and adding flows")
+ main.case("Taking care of these flows!")
+ main.step("Cleaning out any leftover flows...")
+ main.log.info("deleting...")
+ main.ONOS1.delete_flow("all")
+ main.log.info("adding...")
+ t1 = time.time()
+ main.ONOS1.add_flow(main.params['FLOWDEF'])
+ main.log.info("Checking...")
+ for i in range(15):
+ result = main.ONOS1.check_flow()
+ if result == main.TRUE:
+ t2 = time.time()
+ main.log.info( 'Adding flows took %0.3f s' % (t2-t1))
+ break
+ time.sleep(5)
+ main.log.info("Checking Flows again...")
+
+ strtTime = time.time()
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 3:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
+ time.sleep(10)
+ elif ping == main.FALSE and count ==3:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.info("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.info("\tPING TEST FAIL")
+
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="flows are good",onfail="FLOWS not correct")
+
+
+ def CASE5(self,main) :
+ '''
+ Tests a single ping
+ '''
+ main.log.report("Testing a single ping")
+ main.case("Testing ping...")
+ ping_result = main.Mininet4.pingHost(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
+ utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+
+ def CASE6(self,main) :
+ '''
+ Starts continuous pings on the Mininet nodes
+ '''
+ main.log.report("Start continuous pings, then toggle links in center triangle")
+ import time
+ import os
+
+ main.case("Starting long ping... ")
+ main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
+ main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
+ main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
+ main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
+ main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
+ main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
+ main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
+ main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
+ main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
+ main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
+ main.step("Check that the pings are going")
+ result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
+ main.step( "Making topo change while flows are rerouting")
+
+ for i in range(int(main.params['Iterations'])):
+ main.log.info("s1-s2 link down")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
+
+ time.sleep(3)
+
+ main.log.info("s1-s2 link up | s1-s3 link down | s2-s3 link down")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
+ main.Mininet1.link(END1="s1",END2="s3",OPTION="down")
+ main.Mininet1.link(END1="s2",END2="s3",OPTION="down")
+
+ main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
+ time.sleep( int(main.params['WaitTime']) )
+
+ main.case("Killing remote ping processes ")
+ result = result & main.Mininet4.pingKill()
+ utilities.assert_equals(expect=main.TRUE,actual=result)
+
+
+ def CASE7(self,main) :
+ '''
+ Processes all of the ping data and outputs raw data and an overall average
+ '''
+ import os
+ import time
+ main.log.report("Process ping data")
+ main.case("Processing Ping data")
+ time.sleep(3)
+ #result=os.popen("/home/admin/tools/shell.sh " + main.params['Iterations']).read()
+ result=os.popen("/home/admin/get_reroute_times.py").read()
+ average=result.split(":")[1]
+ main.log.info( "Reroute times are... " )
+ main.log.report( result )
+ try:
+ if float(average) < float(main.params['TargetTime']) :
+ test=main.TRUE
+ else:
+ test=main.FALSE
+ except ValueError:
+ main.log.error("Data is corrupted")
+ test=main.FALSE
+ utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ")
+
+ def CASE8(self,main) :
+ '''
+ Starts continuous pings on the Mininet nodes
+ '''
+ main.log.report("Start continuous pings, then toggle links in center triangle")
+ import time
+ import os
+
+ main.case("Starting long ping... ")
+ main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'])
+ main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'])
+ main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'])
+ main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'])
+ main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'])
+ main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'])
+ main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'])
+ main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'])
+ main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'])
+ main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'])
+ main.step("Check that the pings are going")
+ result = main.Mininet4.pingstatus(src=main.params['PING']['source1'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9'])
+ result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10'])
+ main.step( "Making topo change while flows are rerouting")
+
+ for i in range(int(main.params['Iterations'])):
+ main.log.info("s1-s2 link down | Onos 1 down")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="down")
+ main.ONOS1.stop()
+
+ time.sleep(3)
+
+ main.log.info("s1-s2 link up | Onos 1 back up")
+ main.Mininet1.link(END1="s1",END2="s2",OPTION="up")
+ main.ONOS1.start()
+ main.ONOS1.isup()
+
+ main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " )
+ time.sleep( int(main.params['WaitTime']) )
+
+ main.case("Killing remote ping processes ")
+ result = result & main.Mininet4.pingKill()
+ utilities.assert_equals(expect=main.TRUE,actual=result)
+
+
+ def CASE9(self,main) :
+ '''
+ Processes all of the ping data and outputs raw data and an overall average
+ '''
+ import os
+ import time
+ main.log.report("Process ping data")
+ main.case("Processing Ping data")
+ time.sleep(3)
+ #result=os.popen("/home/admin/tools/shell.sh " + main.params['Iterations']).read()
+ result=os.popen("/home/admin/get_reroute_times.py").read()
+ average=result.split(":")[1]
+ main.log.info( "Reroute times are... " )
+ main.log.report( result )
+ try:
+ if float(average) < float(main.params['TargetTime']) :
+ test=main.TRUE
+ else:
+ test=main.FALSE
+ except ValueError:
+ main.log.error("Data is corrupted")
+ test=main.FALSE
+ utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ")
+
diff --git a/TestON/tests/OnosPerfTest/OnosPerfTest.pyc b/TestON/tests/OnosPerfTest/OnosPerfTest.pyc
new file mode 100644
index 0000000..77d7ca0
--- /dev/null
+++ b/TestON/tests/OnosPerfTest/OnosPerfTest.pyc
Binary files differ
diff --git a/TestON/tests/OnosPerfTest/OnosPerfTest.topo b/TestON/tests/OnosPerfTest/OnosPerfTest.topo
new file mode 100644
index 0000000..eb6130f
--- /dev/null
+++ b/TestON/tests/OnosPerfTest/OnosPerfTest.topo
@@ -0,0 +1,99 @@
+<TOPOLOGY>
+ <COMPONENT>
+ <Zookeeper1>
+ <host>10.128.100.1</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>1</connect_order>
+ </Zookeeper1>
+
+ <Cassandra1>
+ <host>10.128.100.1</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>CassandraCliDriver</type>
+ <connect_order>2</connect_order>
+ </Cassandra1>
+ <Cassandra2>
+ <host>10.128.100.4</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>CassandraCliDriver</type>
+ <connect_order>3</connect_order>
+ </Cassandra2>
+ <Cassandra3>
+ <host>10.128.100.5</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>CassandraCliDriver</type>
+ <connect_order>4</connect_order>
+ </Cassandra3>
+ <Cassandra4>
+ <host>10.128.100.6</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>CassandraCliDriver</type>
+ <connect_order>5</connect_order>
+ </Cassandra4>
+
+ <ONOS1>
+ <host>10.128.100.1</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>6</connect_order>
+ </ONOS1>
+ <ONOS2>
+ <host>10.128.100.4</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>7</connect_order>
+ </ONOS2>
+ <ONOS3>
+ <host>10.128.100.5</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>8</connect_order>
+ </ONOS3>
+ <ONOS4>
+ <host>10.128.100.6</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>9</connect_order>
+ </ONOS4>
+
+ <Mininet1>
+ <host>10.128.100.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>10</connect_order>
+ <COMPONENTS>
+ # Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
+ <arg2> --topo mytopo</arg2>
+ <controller> remote,ip=10.128.100.1,port=6633 </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ <Mininet4>
+ <host>10.128.100.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>11</connect_order>
+ </Mininet4>
+ <Mininet8>
+ <host>10.128.100.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>12</connect_order>
+ </Mininet8>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/OnosPerfTest/__init__.py b/TestON/tests/OnosPerfTest/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/OnosPerfTest/__init__.py
diff --git a/TestON/tests/OnosPerfTest/__init__.pyc b/TestON/tests/OnosPerfTest/__init__.pyc
new file mode 100644
index 0000000..69a5962
--- /dev/null
+++ b/TestON/tests/OnosPerfTest/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosSanity/OnosSanity.pyc b/TestON/tests/OnosSanity/OnosSanity.pyc
new file mode 100644
index 0000000..cdd6c75
--- /dev/null
+++ b/TestON/tests/OnosSanity/OnosSanity.pyc
Binary files differ
diff --git a/TestON/tests/OnosSanity/__init__.pyc b/TestON/tests/OnosSanity/__init__.pyc
new file mode 100644
index 0000000..16aebc3
--- /dev/null
+++ b/TestON/tests/OnosSanity/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4node_testDD.py b/TestON/tests/OnosSanity4nodes/OnosSanity4node_testDD.py
new file mode 100644
index 0000000..a0c9f98
--- /dev/null
+++ b/TestON/tests/OnosSanity4nodes/OnosSanity4node_testDD.py
@@ -0,0 +1,456 @@
+
+class OnosSanity4nodes :
+
+ def __init__(self) :
+ self.default = ''
+
+#**********************************************************************************************************************************************************************************************
+#Test startup
+#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
+ def CASE1(self,main) : #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
+ import time
+ main.log.report("Pulling latest code from github to all nodes")
+ main.ONOS1.git_pull()
+ main.ONOS2.git_pull()
+ main.ONOS3.git_pull()
+ main.ONOS4.git_pull()
+ main.Cassandra1.start()
+ main.Cassandra2.start()
+ main.Cassandra3.start()
+ main.Cassandra4.start()
+ time.sleep(20)
+ main.ONOS1.drop_keyspace()
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.start_rest()
+ time.sleep(5)
+ test= main.ONOS1.rest_status()
+ if test == main.FALSE:
+ main.ONOS1.start_rest()
+ main.ONOS1.get_version()
+ main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
+ main.case("Checking if the startup was clean...")
+ main.step("Testing startup Zookeeper")
+ data = main.Zookeeper1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
+ main.step("Testing startup Cassandra")
+ data = main.Cassandra1.isup()
+ if data == main.FALSE:
+ main.Cassandra1.stop()
+ main.Cassandra2.stop()
+ main.Cassandra3.stop()
+ main.Cassandra4.stop()
+
+ time.sleep(5)
+
+ main.Cassandra1.start()
+ main.Cassandra2.start()
+ main.Cassandra3.start()
+ main.Cassandra4.start()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
+ main.step("Testing startup ONOS")
+ data = main.ONOS1.isup()
+ if data == main.FALSE:
+ main.log.report("Something is funny... restarting ONOS")
+ main.ONOS1.stop()
+ time.sleep(3)
+ main.ONOS1.start()
+ time.sleep(5)
+ data = main.ONOS1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
+
+#**********************************************************************************************************************************************************************************************
+#Assign Controllers
+#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
+#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
+#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
+# the controllers already assigned to the switch are not specified.
+
+ def CASE2(self,main) : #Make sure mininet exists, then assign controllers to switches
+ import time
+ main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
+ main.case("Checking if one MN host exists")
+ main.step("Host IP Checking using checkIP")
+ result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
+ main.step("Verifying the result")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
+ main.step("assigning ONOS controllers to switches")
+ for i in range(25):
+ if i < 3:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ elif i >= 3 and i < 5:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ elif i >= 5 and i < 15:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ else:
+ j=i+16
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ main.Mininet1.get_sw_controller("s1")
+
+# **********************************************************************************************************************************************************************************************
+#Add Flows
+#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
+#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
+
+ def CASE3(self,main) : #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
+ main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
+ import time
+ main.case("Taking care of these flows!")
+ main.step("Cleaning out any leftover flows...")
+ main.ONOS1.delete_flow("all")
+ time.sleep(5)
+ strtTime = time.time()
+ main.ONOS1.add_flow(main.params['FLOWDEF'])
+ main.case("Checking flows")
+ tmp = main.FALSE
+ count = 1
+ main.log.info("Wait for flows to be pushed to the switches, then check")
+ while tmp == main.FALSE:
+ main.step("Waiting")
+ time.sleep(10)
+ main.step("Checking")
+ tmp = main.ONOS1.check_flow()
+ if tmp == main.FALSE and count < 6:
+ count = count + 1
+ main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
+ elif tmp == main.FALSE and count == 6:
+ result1 = main.FALSE
+ break
+ else:
+ result1 = main.TRUE
+ break
+ endTime = time.time()
+ if result1 == main.TRUE:
+ main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tFlows failed check")
+
+ strtTime = time.time()
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 3:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
+ time.sleep(10)
+ elif ping == main.FALSE and count ==3:
+ main.log.error("Ping test failed")
+ i = 17
+ result2 = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result2 = main.TRUE
+ endTime = time.time()
+ if result2 == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAIL")
+
+ result3 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ main.step("Verifying the result")
+ utilities.assert_equals(expect=main.TRUE,actual=result1 and result2 and result3,onpass="Flow check PASS",onfail="Flow check FAIL")
+
+#**********************************************************************************************************************************************************************************************
+#This test case removes Controllers 2,3, and 4 then performs a ping test.
+#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
+#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
+#If the ping test fails 6 times, then the test case will return false
+
+ def CASE4(self,main) :
+ main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
+ import time
+ for i in range(25):
+ if i < 15:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) #Assigning a single controller removes all other controllers
+ else:
+ j=i+16
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+
+ strtTime = time.time()
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ for i in range(2):
+ if result == main.FALSE:
+ time.sleep(5)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
+
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 6:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ time.sleep(5)
+ elif ping == main.FALSE and count ==6:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAIL")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+# **********************************************************************************************************************************************************************************************
+#This test case restores the controllers removed by Case 4 then performs a ping test.
+
+ def CASE5(self,main) :
+ main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
+ import time
+ for i in range(25):
+ if i < 15:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ else:
+ j=i+16
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+
+ strtTime = time.time()
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ for i in range(2):
+ if result == main.FALSE:
+ time.sleep(5)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
+
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 6:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ time.sleep(5)
+ elif ping == main.FALSE and count ==6:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAILED")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+# **********************************************************************************************************************************************************************************************
+#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
+
+ def CASE6(self,main) :
+ main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
+ import time
+ main.case("Bringing Link down... ")
+ result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
+
+ strtTime = time.time()
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
+ for i in range(2):
+ if result == main.FALSE:
+ time.sleep(5)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
+ else:
+ break
+
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 10:
+ count = count + 1
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ i = 6
+ time.sleep(5)
+ elif ping == main.FALSE and count == 10:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAILED")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+# **********************************************************************************************************************************************************************************************
+#Brings the link that Case 6 took down back up, then runs a ping test to view reroute time
+
+ def CASE7(self,main) :
+ main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
+ import time
+ main.case("Bringing Link up... ")
+ result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
+
+ strtTime = time.time()
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ for i in range(2):
+ if result == main.FALSE:
+ time.sleep(5)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
+
+ strtTime = time.time()
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 10:
+ count = count + 1
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ i = 6
+ time.sleep(5)
+ elif ping == main.FALSE and count ==10:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TESTS FAILED")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+
+# ******************************************************************************************************************************************************************
+# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
+
+ def CASE21(self,main) :
+ import json
+ from drivers.common.api.onosrestapidriver import *
+ main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
+ main.log.report("Check initially hostMAC exist on the mininet...")
+ host = main.params['YANK']['hostname']
+ mac = main.params['YANK']['hostmac']
+ RestIP1 = main.params['RESTCALL']['restIP1']
+ RestIP2 = main.params['RESTCALL']['restIP2']
+ RestPort = main.params['RESTCALL']['restPort']
+ url = main.params['RESTCALL']['restURL']
+ #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort)
+
+ main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
+ ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
+ restcall = OnosRestApiDriver()
+ Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
+ try:
+ attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
+ host_ip = Hoststatus[0]['ipv4'][0]
+ except:
+ Reststatus = 0
+ if Reststatus == 1 and host_ip == '10.0.0.1':
+ main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
+ result = main.TRUE
+ else:
+ main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
+ result = main.FALSE
+
+ ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
+
+ main.log.report("Yank out s1-eth1")
+ main.case("Yankout s6-eth1 (link to h1) from s1")
+ result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
+ time.sleep(3)
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
+ ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
+ Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
+ try:
+ attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
+ except IndexError:
+ Reststatus = 0
+ if Reststatus == 0:
+ main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
+ result = main.TRUE
+ else:
+ main.log.report("Attempt to yank out s1-eht1 from s1 failed.")
+ result = main.FALSE
+
+ ##### Step to plug "s1-eth1" to s6, which is on autoONOS3 ######
+ main.log.report("Plug s1-eth1 into s6")
+ main.case("Plug s1-eth1 to s6")
+ result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
+ time.sleep(3)
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
+ ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
+ Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
+ try:
+ attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
+ host_ip = Hoststatus[0]['ipv4'][0]
+ except:
+ Reststatus = 0
+ if Reststatus == 0:
+ main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
+ result = main.FALSE
+ elif attachedSW == "00:00:00:00:00:00:00:06"and host_ip == '10.0.0.1':
+ main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
+ result = main.TRUE
+ else:
+ main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
+ result = main.FALSE
+
+ ###### Step to put interface "s1-eth1" back to s1"#####
+ main.log.report("Move s1-eth1 back on to s1")
+ main.case("Move s1-eth1 back to s1")
+ result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
+ time.sleep(3)
+ retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
+ ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
+ Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
+ try:
+ attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
+ host_ip = Hoststatus[0]['ipv4'][0]
+ except:
+ Reststatus = 0
+ if Reststatus == 0:
+ main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
+ result = main.FALSE
+ elif attachedSW == "00:00:00:00:00:00:00:01" and host_ip == '10.0.0.1':
+ main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
+ result = main.TRUE
+ else:
+ main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
+ result = main.FALSE
+
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
+
+
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params_old b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params_old
new file mode 100644
index 0000000..2eea988
--- /dev/null
+++ b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params_old
@@ -0,0 +1,30 @@
+<PARAMS>
+ <testcases>1,2,21,21,3,4,5,6,7</testcases>
+ <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
+ <CASE1>
+ <destination>h6</destination>
+ </CASE1>
+ <PING>
+ <source1>h6</source1>
+ <target1>h31</target1>
+ <source2>h8</source2>
+ <target2>h33</target2>
+ </PING>
+ <LINK>
+ <begin>s1</begin>
+ <end>s2</end>
+ </LINK>
+ <CTRL>
+ <ip1>10.128.100.1</ip1>
+ <port1>6633</port1>
+ <ip2>10.128.100.4</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.100.5</ip3>
+ <port3>6633</port3>
+ <ip4>10.128.100.6</ip4>
+ <port4>6633</port4>
+ </CTRL>
+ <RestIP> 10.128.100.1 </RestIP>
+ <NR_Switches>25</NR_Switches>
+ <NR_Links>50</NR_Links>
+</PARAMS>
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py
index 1da2ac4..10cdc58 100644
--- a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py
+++ b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py
@@ -100,6 +100,13 @@
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")
+
+ for i in range(9):
+ if result == main.FALSE:
+ time.sleep(3)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
# **********************************************************************************************************************************************************************************************
#Add Flows
@@ -109,6 +116,15 @@
def CASE3(self,main) : #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
import time
+
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ for i in range(9):
+ if result == main.FALSE:
+ time.sleep(3)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
+
main.case("Taking care of these flows!")
main.step("Cleaning out any leftover flows...")
main.ONOS1.delete_flow("all")
@@ -121,7 +137,7 @@
main.log.info("Wait for flows to be pushed to the switches, then check")
while tmp == main.FALSE:
main.step("Waiting")
- time.sleep(10)
+ time.sleep(5)
main.step("Checking")
tmp = main.ONOS1.check_flow()
if tmp == main.FALSE and count < 6:
@@ -139,7 +155,6 @@
else:
main.log.report("\tFlows failed check")
- strtTime = time.time()
count = 1
i = 6
while i < 16 :
@@ -157,15 +172,13 @@
elif ping == main.TRUE:
i = i + 1
result2 = main.TRUE
- endTime = time.time()
if result2 == main.TRUE:
- main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ main.log.info("Flows successfully added")
else:
main.log.report("\tPING TEST FAIL")
- result3 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
main.step("Verifying the result")
- utilities.assert_equals(expect=main.TRUE,actual=result1 and result2 and result3,onpass="Flow check PASS",onfail="Flow check FAIL")
+ utilities.assert_equals(expect=main.TRUE,actual=result1 and result2,onpass="Flow check PASS",onfail="Flow check FAIL")
#**********************************************************************************************************************************************************************************************
#This test case removes Controllers 2,3, and 4 then performs a ping test.
@@ -186,9 +199,9 @@
strtTime = time.time()
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
- for i in range(2):
+ for i in range(9):
if result == main.FALSE:
- time.sleep(5)
+ time.sleep(3)
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
else:
break
@@ -233,9 +246,9 @@
strtTime = time.time()
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
- for i in range(2):
+ for i in range(9):
if result == main.FALSE:
- time.sleep(5)
+ time.sleep(3)
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
else:
break
@@ -276,9 +289,9 @@
strtTime = time.time()
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
- for i in range(2):
+ for i in range(9):
if result == main.FALSE:
- time.sleep(5)
+ time.sleep(3)
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
else:
break
@@ -319,9 +332,9 @@
strtTime = time.time()
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
- for i in range(2):
+ for i in range(9):
if result == main.FALSE:
- time.sleep(5)
+ time.sleep(3)
result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
else:
break
@@ -374,11 +387,18 @@
Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
try:
attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
- except IndexError:
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
Reststatus = 0
+
if Reststatus == 1:
main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
- result = main.TRUE
+ if ip_found != None:
+ main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("\t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
else:
main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
result = main.FALSE
@@ -394,7 +414,7 @@
Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
try:
attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
- except IndexError:
+ except:
Reststatus = 0
if Reststatus == 0:
main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
@@ -413,14 +433,20 @@
Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
try:
attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
- except IndexError:
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
Reststatus = 0
if Reststatus == 0:
main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
result = main.FALSE
elif attachedSW == "00:00:00:00:00:00:00:06":
main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
- result = main.TRUE
+ if ip_found != None:
+ main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("\t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
else:
main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
result = main.FALSE
@@ -436,14 +462,20 @@
Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
try:
attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
- except IndexError:
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
Reststatus = 0
if Reststatus == 0:
main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
result = main.FALSE
elif attachedSW == "00:00:00:00:00:00:00:01":
main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
- result = main.TRUE
+ if ip_found != None:
+ main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("\t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
else:
main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
result = main.FALSE
@@ -451,3 +483,5 @@
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
+
+
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.pyc b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.pyc
new file mode 100644
index 0000000..1b6abc8
--- /dev/null
+++ b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.pyc
Binary files differ
diff --git a/TestON/tests/OnosSanity4nodes/__init__.pyc b/TestON/tests/OnosSanity4nodes/__init__.pyc
new file mode 100644
index 0000000..81ca0a2
--- /dev/null
+++ b/TestON/tests/OnosSanity4nodes/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.pyc b/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.pyc
new file mode 100644
index 0000000..79b49b2
--- /dev/null
+++ b/TestON/tests/OnosSanity8nodes/OnosSanity8nodes.pyc
Binary files differ
diff --git a/TestON/tests/OnosSanity8nodes/__init__.pyc b/TestON/tests/OnosSanity8nodes/__init__.pyc
new file mode 100644
index 0000000..4a5710a
--- /dev/null
+++ b/TestON/tests/OnosSanity8nodes/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosScale/OnosScale.pyc b/TestON/tests/OnosScale/OnosScale.pyc
new file mode 100644
index 0000000..19dfdf5
--- /dev/null
+++ b/TestON/tests/OnosScale/OnosScale.pyc
Binary files differ
diff --git a/TestON/tests/OnosScale/__init__.pyc b/TestON/tests/OnosScale/__init__.pyc
new file mode 100644
index 0000000..40dd87d
--- /dev/null
+++ b/TestON/tests/OnosScale/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosScale/check_status.pyc b/TestON/tests/OnosScale/check_status.pyc
new file mode 100644
index 0000000..d8aa1f1
--- /dev/null
+++ b/TestON/tests/OnosScale/check_status.pyc
Binary files differ
diff --git a/TestON/tests/OnosScale4nodes/OnosScale4nodes.py b/TestON/tests/OnosScale4nodes/OnosScale4nodes.py
index 06778da..29b56e2 100644
--- a/TestON/tests/OnosScale4nodes/OnosScale4nodes.py
+++ b/TestON/tests/OnosScale4nodes/OnosScale4nodes.py
@@ -12,10 +12,30 @@
The test will only pass if ONOS is running properly, and has a full view of all topology elements.
'''
import time
- main.log.report("Checking is startup was clean")
+ main.ONOS1.stop()
+ main.ONOS2.stop()
+ main.ONOS3.stop()
+ main.ONOS4.stop()
+ main.Cassandra1.start()
+ main.Cassandra2.start()
+ main.Cassandra3.start()
+ main.Cassandra4.start()
+ time.sleep(20)
+ main.ONOS1.drop_keyspace()
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.start_rest()
+ time.sleep(5)
+ test= main.ONOS1.rest_status()
+ if test == main.FALSE:
+ main.ONOS1.start_rest()
+ main.ONOS1.get_version()
+ main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
main.case("Checking if the startup was clean...")
main.step("Testing startup Zookeeper")
- main.ONOS1.get_version()
data = main.Zookeeper1.isup()
utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
main.step("Testing startup Cassandra")
@@ -27,38 +47,31 @@
main.Cassandra4.stop()
time.sleep(5)
-
+
main.Cassandra1.start()
main.Cassandra2.start()
main.Cassandra3.start()
main.Cassandra4.start()
utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
main.step("Testing startup ONOS")
- main.ONOS1.start()
- main.ONOS2.start()
- main.ONOS2.start_rest()
- time.sleep(5)
- test= main.ONOS2.rest_status()
- if test == main.FALSE:
- main.ONOS2.start_rest()
- main.ONOS3.start()
- main.ONOS4.start()
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.info("Something is funny... restarting ONOS")
+ main.log.report("Something is funny... restarting ONOS")
main.ONOS1.stop()
- time.sleep(3)
- main.ONOS1.start()
+ 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()
- #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
- topoview = main.TRUE
- if topoview == main.TRUE & data == main.TRUE :
- data = main.TRUE
- else:
- data = main.FALSE
-
- utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running and has full view of topology",onfail="ONOS didn't start or has fragmented view of topology...")
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
def CASE2(self,main) :
'''
diff --git a/TestON/tests/OnosScale4nodes/OnosScale4nodes.pyc b/TestON/tests/OnosScale4nodes/OnosScale4nodes.pyc
new file mode 100644
index 0000000..6ed2d1a
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/OnosScale4nodes.pyc
Binary files differ
diff --git a/TestON/tests/OnosScale4nodes/__init__.pyc b/TestON/tests/OnosScale4nodes/__init__.pyc
new file mode 100644
index 0000000..3d19c8b
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/__init__.pyc
Binary files differ
diff --git a/TestON/tests/OnosScale4nodes/check_status.pyc b/TestON/tests/OnosScale4nodes/check_status.pyc
new file mode 100644
index 0000000..d8aa1f1
--- /dev/null
+++ b/TestON/tests/OnosScale4nodes/check_status.pyc
Binary files differ
diff --git a/TestON/tests/OnosTest/OnosTest.pyc b/TestON/tests/OnosTest/OnosTest.pyc
new file mode 100644
index 0000000..4ea207b
--- /dev/null
+++ b/TestON/tests/OnosTest/OnosTest.pyc
Binary files differ
diff --git a/TestON/tests/OnosTest/__init__.pyc b/TestON/tests/OnosTest/__init__.pyc
new file mode 100644
index 0000000..63f5103
--- /dev/null
+++ b/TestON/tests/OnosTest/__init__.pyc
Binary files differ
diff --git a/TestON/tests/TimsDeathTest/TimsDeathTest.pyc b/TestON/tests/TimsDeathTest/TimsDeathTest.pyc
new file mode 100644
index 0000000..a731d92
--- /dev/null
+++ b/TestON/tests/TimsDeathTest/TimsDeathTest.pyc
Binary files differ
diff --git a/TestON/tests/TimsDeathTest/__init__.pyc b/TestON/tests/TimsDeathTest/__init__.pyc
new file mode 100644
index 0000000..b23656b
--- /dev/null
+++ b/TestON/tests/TimsDeathTest/__init__.pyc
Binary files differ
diff --git a/TestON/tests/__init__.pyc b/TestON/tests/__init__.pyc
new file mode 100644
index 0000000..275a7e0
--- /dev/null
+++ b/TestON/tests/__init__.pyc
Binary files differ
diff --git a/TestON/tests/testDD/.OnosSanity4nodes.py.swn b/TestON/tests/testDD/.OnosSanity4nodes.py.swn
new file mode 100644
index 0000000..cb578ac
--- /dev/null
+++ b/TestON/tests/testDD/.OnosSanity4nodes.py.swn
Binary files differ
diff --git a/TestON/tests/testDD/.OnosSanity4nodes.py.swo b/TestON/tests/testDD/.OnosSanity4nodes.py.swo
new file mode 100644
index 0000000..5389b47
--- /dev/null
+++ b/TestON/tests/testDD/.OnosSanity4nodes.py.swo
Binary files differ
diff --git a/TestON/tests/testDD/__init__.py b/TestON/tests/testDD/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/testDD/__init__.py
diff --git a/TestON/tests/testDD/__init__.pyc b/TestON/tests/testDD/__init__.pyc
new file mode 100644
index 0000000..16a9123
--- /dev/null
+++ b/TestON/tests/testDD/__init__.pyc
Binary files differ
diff --git a/TestON/tests/testDD/testDD.params b/TestON/tests/testDD/testDD.params
new file mode 100644
index 0000000..9a1732b
--- /dev/null
+++ b/TestON/tests/testDD/testDD.params
@@ -0,0 +1,48 @@
+<PARAMS>
+ <testcases>1,2,21</testcases>
+ <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
+ <CASE1>
+ <destination>h6</destination>
+ </CASE1>
+ <PING>
+ <source1>h6</source1>
+ <target1>h31</target1>
+ <source2>h8</source2>
+ <target2>h33</target2>
+ </PING>
+ <LINK>
+ <begin>s1</begin>
+ <end>s2</end>
+ </LINK>
+ <YANK>
+ <hostname>h1</hostname>
+ <hostmac>00:00:00:00:00:01</hostmac>
+ <sw1>s1</sw1>
+ <sw6>s6</sw6>
+ <intf>s1-eth1</intf>
+ </YANK>
+ <PLUG>
+ <intf>s1-eth1</intf>
+ <sw6>s6</sw6>
+ <sw1>s1</sw1>
+ </PLUG>
+ <CTRL>
+ <ip1>10.128.100.1</ip1>
+ <port1>6633</port1>
+ <ip2>10.128.100.4</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.100.5</ip3>
+ <port3>6633</port3>
+ <ip4>10.128.100.6</ip4>
+ <port4>6633</port4>
+ </CTRL>
+ <RestIP>10.128.100.1</RestIP>
+ <NR_Switches>25</NR_Switches>
+ <NR_Links>50</NR_Links>
+ <RESTCALL>
+ <restIP1>10.128.100.1</restIP1>
+ <restIP2>10.128.100.5</restIP2>
+ <restPort>8080</restPort>
+ <restURL>/wm/device/</restURL>
+ </RESTCALL>
+</PARAMS>
diff --git a/TestON/tests/testDD/testDD.py b/TestON/tests/testDD/testDD.py
new file mode 100644
index 0000000..2a823f9
--- /dev/null
+++ b/TestON/tests/testDD/testDD.py
@@ -0,0 +1,472 @@
+
+class testDD :
+
+ def __init__(self) :
+ self.default = ''
+
+#**********************************************************************************************************************************************************************************************
+#Test startup
+#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
+ def CASE1(self,main) : #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
+ import time
+ main.log.report("Pulling latest code from github to all nodes")
+ main.ONOS1.git_pull()
+ main.ONOS2.git_pull()
+ main.ONOS3.git_pull()
+ main.ONOS4.git_pull()
+ main.Cassandra1.start()
+ main.Cassandra2.start()
+ main.Cassandra3.start()
+ main.Cassandra4.start()
+ time.sleep(20)
+ main.ONOS1.drop_keyspace()
+ main.ONOS1.start()
+ time.sleep(10)
+ main.ONOS2.start()
+ main.ONOS3.start()
+ main.ONOS4.start()
+ main.ONOS1.start_rest()
+ time.sleep(5)
+ test= main.ONOS1.rest_status()
+ if test == main.FALSE:
+ main.ONOS1.start_rest()
+ main.ONOS1.get_version()
+ main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
+ main.case("Checking if the startup was clean...")
+ main.step("Testing startup Zookeeper")
+ data = main.Zookeeper1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
+ main.step("Testing startup Cassandra")
+ data = main.Cassandra1.isup()
+ if data == main.FALSE:
+ main.Cassandra1.stop()
+ main.Cassandra2.stop()
+ main.Cassandra3.stop()
+ main.Cassandra4.stop()
+
+ time.sleep(5)
+
+ main.Cassandra1.start()
+ main.Cassandra2.start()
+ main.Cassandra3.start()
+ main.Cassandra4.start()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
+ main.step("Testing startup ONOS")
+ data = main.ONOS1.isup()
+ if data == main.FALSE:
+ main.log.report("Something is funny... restarting ONOS")
+ main.ONOS1.stop()
+ time.sleep(3)
+ main.ONOS1.start()
+ time.sleep(5)
+ data = main.ONOS1.isup()
+ utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
+
+#**********************************************************************************************************************************************************************************************
+#Assign Controllers
+#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
+#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
+#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
+# the controllers already assigned to the switch are not specified.
+
+ def CASE2(self,main) : #Make sure mininet exists, then assign controllers to switches
+ import time
+ main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
+ main.case("Checking if one MN host exists")
+ main.step("Host IP Checking using checkIP")
+ result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
+ main.step("Verifying the result")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
+ main.step("assigning ONOS controllers to switches")
+ for i in range(25):
+ if i < 3:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ elif i >= 3 and i < 5:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ elif i >= 5 and i < 15:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ else:
+ j=i+16
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
+ time.sleep(1)
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ main.Mininet1.get_sw_controller("s1")
+
+# **********************************************************************************************************************************************************************************************
+#Add Flows
+#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
+#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
+
+ def CASE3(self,main) : #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
+ main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
+ import time
+ main.case("Taking care of these flows!")
+ main.step("Cleaning out any leftover flows...")
+ main.ONOS1.delete_flow("all")
+ time.sleep(5)
+ strtTime = time.time()
+ main.ONOS1.add_flow(main.params['FLOWDEF'])
+ main.case("Checking flows")
+ tmp = main.FALSE
+ count = 1
+ main.log.info("Wait for flows to be pushed to the switches, then check")
+ while tmp == main.FALSE:
+ main.step("Waiting")
+ time.sleep(10)
+ main.step("Checking")
+ tmp = main.ONOS1.check_flow()
+ if tmp == main.FALSE and count < 6:
+ count = count + 1
+ main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
+ elif tmp == main.FALSE and count == 6:
+ result1 = main.FALSE
+ break
+ else:
+ result1 = main.TRUE
+ break
+ endTime = time.time()
+ if result1 == main.TRUE:
+ main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tFlows failed check")
+
+ strtTime = time.time()
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 3:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
+ time.sleep(10)
+ elif ping == main.FALSE and count ==3:
+ main.log.error("Ping test failed")
+ i = 17
+ result2 = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result2 = main.TRUE
+ endTime = time.time()
+ if result2 == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAIL")
+
+ result3 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ main.step("Verifying the result")
+ utilities.assert_equals(expect=main.TRUE,actual=result1 and result2 and result3,onpass="Flow check PASS",onfail="Flow check FAIL")
+
+#**********************************************************************************************************************************************************************************************
+#This test case removes Controllers 2,3, and 4 then performs a ping test.
+#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
+#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
+#If the ping test fails 6 times, then the test case will return false
+
+ def CASE4(self,main) :
+ main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
+ import time
+ for i in range(25):
+ if i < 15:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) #Assigning a single controller removes all other controllers
+ else:
+ j=i+16
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+
+ strtTime = time.time()
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ for i in range(2):
+ if result == main.FALSE:
+ time.sleep(5)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
+
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 6:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ time.sleep(5)
+ elif ping == main.FALSE and count ==6:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAIL")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+# **********************************************************************************************************************************************************************************************
+#This test case restores the controllers removed by Case 4 then performs a ping test.
+
+ def CASE5(self,main) :
+ main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
+ import time
+ for i in range(25):
+ if i < 15:
+ j=i+1
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+ else:
+ j=i+16
+ main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
+
+ strtTime = time.time()
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ for i in range(2):
+ if result == main.FALSE:
+ time.sleep(5)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
+
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 6:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ time.sleep(5)
+ elif ping == main.FALSE and count ==6:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAILED")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+# **********************************************************************************************************************************************************************************************
+#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
+
+ def CASE6(self,main) :
+ main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
+ import time
+ main.case("Bringing Link down... ")
+ result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
+
+ strtTime = time.time()
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
+ for i in range(2):
+ if result == main.FALSE:
+ time.sleep(5)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
+ else:
+ break
+
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 10:
+ count = count + 1
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ i = 6
+ time.sleep(5)
+ elif ping == main.FALSE and count == 10:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAILED")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+# **********************************************************************************************************************************************************************************************
+#Brings the link that Case 6 took down back up, then runs a ping test to view reroute time
+
+ def CASE7(self,main) :
+ main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
+ import time
+ main.case("Bringing Link up... ")
+ result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
+
+ strtTime = time.time()
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ for i in range(2):
+ if result == main.FALSE:
+ time.sleep(5)
+ result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
+ else:
+ break
+
+ strtTime = time.time()
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 10:
+ count = count + 1
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
+ i = 6
+ time.sleep(5)
+ elif ping == main.FALSE and count ==10:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TESTS FAILED")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+
+
+# ******************************************************************************************************************************************************************
+# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
+
+ def CASE21(self,main) :
+ import json
+ from drivers.common.api.onosrestapidriver import *
+ main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
+ main.log.report("Check initially hostMAC exist on the mininet...")
+ host = main.params['YANK']['hostname']
+ mac = main.params['YANK']['hostmac']
+ RestIP1 = main.params['RESTCALL']['restIP1']
+ RestIP2 = main.params['RESTCALL']['restIP2']
+ RestPort = main.params['RESTCALL']['restPort']
+ url = main.params['RESTCALL']['restURL']
+ #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort)
+
+ main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
+ ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
+ restcall = OnosRestApiDriver()
+ Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
+ try:
+ attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
+ Reststatus = 0
+
+ if Reststatus == 1:
+ main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
+ if ip_found != None:
+ main.log.report("/t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("/t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
+ else:
+ main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
+ result = main.FALSE
+
+ ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
+
+ main.log.report("Yank out s1-eth1")
+ main.case("Yankout s6-eth1 (link to h1) from s1")
+ result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
+ time.sleep(3)
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
+ ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
+ Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
+ try:
+ attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
+ except:
+ Reststatus = 0
+ if Reststatus == 0:
+ main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
+ result = main.TRUE
+ else:
+ main.log.report("Attempt to yank out s1-eht1 from s1 failed.")
+ result = main.FALSE
+
+ ##### Step to plug "s1-eth1" to s6, which is on autoONOS3 ######
+ main.log.report("Plug s1-eth1 into s6")
+ main.case("Plug s1-eth1 to s6")
+ result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
+ time.sleep(3)
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
+ ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
+ Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
+ try:
+ attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
+ Reststatus = 0
+ if Reststatus == 0:
+ main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
+ result = main.FALSE
+ elif attachedSW == "00:00:00:00:00:00:00:06":
+ main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
+ if ip_found != None:
+ main.log.report("/t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("/t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
+ else:
+ main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
+ result = main.FALSE
+
+ ###### Step to put interface "s1-eth1" back to s1"#####
+ main.log.report("Move s1-eth1 back on to s1")
+ main.case("Move s1-eth1 back to s1")
+ result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
+ time.sleep(3)
+ retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
+ ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
+ Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
+ try:
+ attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
+ ip_found = Hoststatus[0]['ipv4'][0]
+ except:
+ Reststatus = 0
+ if Reststatus == 0:
+ main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
+ result = main.FALSE
+ elif attachedSW == "00:00:00:00:00:00:00:01":
+ main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
+ if ip_found != None:
+ main.log.report("/t IP discovered is ip_found ( " + ip_found + " ).")
+ result = main.TRUE
+ else:
+ main.log.report("/t Found host attached to switch, but no IP address discovered.")
+ result = main.FALSE
+ else:
+ main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
+ result = main.FALSE
+
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
+
+
diff --git a/TestON/tests/testDD/testDD.pyc b/TestON/tests/testDD/testDD.pyc
new file mode 100644
index 0000000..973430e
--- /dev/null
+++ b/TestON/tests/testDD/testDD.pyc
Binary files differ
diff --git a/TestON/tests/testDD/testDD.topo b/TestON/tests/testDD/testDD.topo
new file mode 100644
index 0000000..0c77a3b
--- /dev/null
+++ b/TestON/tests/testDD/testDD.topo
@@ -0,0 +1,139 @@
+<TOPOLOGY>
+
+ <COMPONENT>
+ <Zookeeper1>
+ <host>10.128.100.1</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Zookeeper1>
+
+ <Zookeeper2>
+ <host>10.128.100.4</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Zookeeper2>
+
+ <Zookeeper3>
+ <host>10.128.100.5</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Zookeeper3>
+
+ <Zookeeper4>
+ <host>10.128.100.6</host>
+ <user>admin</user>
+ <password></password>
+ <type>ZookeeperCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Zookeeper4>
+
+ <Cassandra1>
+ <host>10.128.100.1</host>
+ <user>admin</user>
+ <password></password>
+ <type>CassandraCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Cassandra1>
+
+ <Cassandra2>
+ <host>10.128.100.4</host>
+ <user>admin</user>
+ <password></password>
+ <type>CassandraCliDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Cassandra2>
+
+ <Cassandra3>
+ <host>10.128.100.5</host>
+ <user>admin</user>
+ <password></password>
+ <type>CassandraCliDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Cassandra3>
+
+ <Cassandra4>
+ <host>10.128.100.6</host>
+ <user>admin</user>
+ <password></password>
+ <type>CassandraCliDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Cassandra4>
+
+ <ONOS1>
+ <host>10.128.100.1</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>9</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOS1>
+
+ <ONOS2>
+ <host>10.128.100.4</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>10</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOS2>
+
+ <ONOS3>
+ <host>10.128.100.5</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>11</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOS3>
+
+ <ONOS4>
+ <host>10.128.100.6</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>12</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOS4>
+
+ <Mininet1>
+ <host>10.128.100.11</host>
+ <user>admin</user>
+ <password></password>
+ <type>MininetCliDriver</type>
+ <connect_order>13</connect_order>
+ <COMPONENTS>
+ # Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
+ <arg2> --topo mytopo</arg2>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>