Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONLabTest
Conflicts:
drivers/common/api/onosrestapidriver.py
drivers/common/api/onosrestapidriver.py_bak
drivers/common/api/onosrestapidriver.pyc
drivers/common/cli/emulator/mininetclidriver.py
drivers/common/cli/emulator/mininetclidriver.pyc
drivers/common/cli/onosclidriver.pyc
tests/OnosPerf4nodes/OnosPerf4nodes.params_nightly
tests/OnosSanity4nodes/OnosSanity4nodes.params
tests/OnosSanity4nodes/OnosSanity4nodes.py
diff --git a/TestON/drivers/common/api/onosrestapidriver.py b/TestON/drivers/common/api/onosrestapidriver.py
index 4af2603..39c649c 100644
--- a/TestON/drivers/common/api/onosrestapidriver.py
+++ b/TestON/drivers/common/api/onosrestapidriver.py
@@ -95,10 +95,10 @@
def find_host(self,RestIP,RestPort,RestAPI,hostIP):
retcode = 0
- retswitch = ''
- retport = ''
- retmac = ''
- foundIP = ''
+ retswitch = []
+ retport = []
+ retmac = []
+ foundIP = []
##### device rest API is: 'host:8080/wm/core/topology/switches/all/json' ###
url ="http://%s:%s%s" %(RestIP,RestPort,RestAPI)
@@ -122,10 +122,10 @@
except:
print "Error in detecting IP address."
if foundIP == hostIP:
+ retswitch.append(switch[1]['dpid'])
+ retport.append(port[1]['desc'])
+ retmac.append(port[1]['devices'][0]['mac'])
retcode = retcode +1
- retswitch = switch[1]['dpid']
- retport = port[1]['desc']
- retmac = port[1]['devices'][0]['mac']
foundIP =''
return(retcode, retswitch, retport, retmac)
diff --git a/TestON/drivers/common/api/onosrestapidriver.py_bak b/TestON/drivers/common/api/onosrestapidriver.py_bak
index 6194d1f..4af2603 100644
--- a/TestON/drivers/common/api/onosrestapidriver.py_bak
+++ b/TestON/drivers/common/api/onosrestapidriver.py_bak
@@ -93,8 +93,12 @@
'''
return response
- def find_host(self,RestIP,RestPort,RestAPI,hostMAC):
+ def find_host(self,RestIP,RestPort,RestAPI,hostIP):
retcode = 0
+ retswitch = ''
+ retport = ''
+ retmac = ''
+ foundIP = ''
##### device rest API is: 'host:8080/wm/core/topology/switches/all/json' ###
url ="http://%s:%s%s" %(RestIP,RestPort,RestAPI)
@@ -102,18 +106,26 @@
command = "curl -s %s" % (url)
result = os.popen(command).read()
parsedResult = json.loads(result)
- print parsedResult
+ # print parsedResult
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)
+ for switch in enumerate(parsedResult):
+ for port in enumerate(switch[1]['ports']):
+ if ( port[1]['devices'] != [] ):
+ try:
+ foundIP = port[1]['devices'][0]['ipv4addresses'][0]['ipv4']
+ except:
+ print "Error in detecting IP address."
+ if foundIP == hostIP:
+ retcode = retcode +1
+ retswitch = switch[1]['dpid']
+ retport = port[1]['desc']
+ retmac = port[1]['devices'][0]['mac']
+ foundIP =''
+ return(retcode, retswitch, retport, retmac)
diff --git a/TestON/drivers/common/api/onosrestapidriver.pyc b/TestON/drivers/common/api/onosrestapidriver.pyc
index 2476b24..5be32b9 100644
--- a/TestON/drivers/common/api/onosrestapidriver.pyc
+++ b/TestON/drivers/common/api/onosrestapidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 286b1c8..59fae79 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -77,7 +77,11 @@
#cmdString = "sudo mn --topo "+self.options['topo']+","+self.options['topocount']+" --mac --switch "+self.options['switch']+" --controller "+self.options['controller']
#cmdString = "sudo mn --custom ~/mininet/custom/topo-2sw-2host.py --controller remote --ip 192.168.56.102 --port 6633 --topo mytopo"
main.log.info("building fresh mininet")
+
+ #### for reactive/PARP enabled tests
cmdString = "sudo mn " + self.options['arg1'] + " " + self.options['arg2'] + " --mac --controller " + self.options['controller']
+ #### for proactive flow with static ARP entries
+ #cmdString = "sudo mn " + self.options['arg1'] + " " + self.options['arg2'] + " --mac --arp --controller " + self.options['controller']
#resultCommand = self.execute(cmd=cmdString,prompt='mininet>',timeout=120)
self.handle.sendline(cmdString)
self.handle.expect("sudo mn")
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.pyc b/TestON/drivers/common/cli/emulator/mininetclidriver.pyc
index 2dad7fb..4a295db 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.pyc
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.pyc
Binary files differ
diff --git a/TestON/drivers/common/cli/onosclidriver.pyc b/TestON/drivers/common/cli/onosclidriver.pyc
index fa26bd3..bd21253 100644
--- a/TestON/drivers/common/cli/onosclidriver.pyc
+++ b/TestON/drivers/common/cli/onosclidriver.pyc
Binary files differ
diff --git a/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params_nightly b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params_nightly
new file mode 100644
index 0000000..5bd4c49
--- /dev/null
+++ b/TestON/tests/OnosPerf4nodes/OnosPerf4nodes.params_nightly
@@ -0,0 +1,43 @@
+<PARAMS>
+ <testcases>1,2,3,4,5,6,7,4,5,6,7,4,5,6,7,4,8,7,4,9,7</testcases>
+ <Iterations>3</Iterations>
+ <WaitTime>60</WaitTime>
+ <RestIP>10.128.100.4</RestIP>
+ <MN_size>57</MN_size>
+ <TargetTime>30</TargetTime>
+ <NR_Switches>25</NR_Switches>
+ <NR_Links>50</NR_Links>
+ <FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
+ <CTRL>
+ <ip1>10.128.100.1</ip1>
+ <port1>6633</port1>
+ <ip2>10.128.100.4</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.100.5</ip3>
+ <port3>6633</port3>
+ <ip4>10.128.100.6</ip4>
+ <port4>6633</port4>
+ </CTRL>
+ <PING>
+ <source1>h6</source1>
+ <source2>h7</source2>
+ <source3>h8</source3>
+ <source4>h9</source4>
+ <source5>h10</source5>
+ <source6>h11</source6>
+ <source7>h12</source7>
+ <source8>h13</source8>
+ <source9>h14</source9>
+ <source10>h15</source10>
+ <target1>10.0.0.16</target1>
+ <target2>10.0.0.17</target2>
+ <target3>10.0.0.18</target3>
+ <target4>10.0.0.19</target4>
+ <target5>10.0.0.20</target5>
+ <target6>10.0.0.21</target6>
+ <target7>10.0.0.22</target7>
+ <target8>10.0.0.23</target8>
+ <target9>10.0.0.24</target9>
+ <target10>10.0.0.25</target10>
+ </PING>
+</PARAMS>
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params
index aa45121..2810c1a 100644
--- a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params
+++ b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,2,21,4,5,6,7,3,4,5,6,7</testcases>
+ <testcases>1,2,21,31,4,5,6,7,3,4,5,6,7</testcases>
<FLOWDEF>~/flowdef_files/Center_Triangle/flowdef_20.txt</FLOWDEF>
<CASE1>
<destination>h6</destination>
diff --git a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py
index 6efa702..6cd45fd 100644
--- a/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py
+++ b/TestON/tests/OnosSanity4nodes/OnosSanity4nodes.py
@@ -4,7 +4,7 @@
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
@@ -334,7 +334,7 @@
def CASE21(self,main) :
import json
from drivers.common.api.onosrestapidriver import *
- main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test. Wait time from topo change to ping is 5 seconds; wait time from ping to restcall is sleepT=20sec.")
+ main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
main.log.report("Check initially hostMAC/IP exist on the mininet...")
host = main.params['YANK']['hostname']
mac = main.params['YANK']['hostmac']
@@ -342,20 +342,27 @@
RestIP1 = main.params['RESTCALL']['restIP1']
RestPort = main.params['RESTCALL']['restPort']
url = main.params['RESTCALL']['restURL']
- sleepT = 20
- #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort)
+ t_topowait = 0
+ t_restwait = 10
+ main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
+ main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
+ #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort)
+ time.sleep(t_topowait)
main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
- time.sleep(sleepT)
+ time.sleep(t_restwait)
restcall = OnosRestApiDriver()
Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
if Reststatus == 1:
- main.log.report("\t PASSED - Found host IP = " + hostip + "; MAC = " + MAC + "; attached to switchDPID = " + Switch + "; at port = " + Port)
+ main.log.report("\t PASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
result1 = main.TRUE
elif Reststatus > 1:
main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
+ main.log.report("switches are: " + "; ".join(Switch))
+ main.log.report("Ports are: " + "; ".join(Port))
+ main.log.report("MACs are: " + "; ".join(MAC))
result1 = main.FALSE
else:
main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
@@ -367,21 +374,24 @@
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(5)
+ time.sleep(t_topowait)
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
- time.sleep(sleepT)
+ time.sleep(t_restwait)
restcall = OnosRestApiDriver()
Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
if Reststatus == 1:
- main.log.report("\tFAILED - Found host IP = " + hostip + "; MAC = " + MAC + "; attached to switchDPID = " + Switch + "; at port = " + Port)
+ main.log.report("\tFAILED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
result2 = main.FALSE
elif Reststatus > 1:
main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
+ main.log.report("switches are: " + "; ".join(Switch))
+ main.log.report("Ports are: " + "; ".join(Port))
+ main.log.report("MACs are: " + "; ".join(MAC))
result2 = main.FALSE
else:
main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
@@ -391,21 +401,24 @@
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(5)
+ time.sleep(t_topowait)
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
- time.sleep(sleepT)
+ time.sleep(t_restwait)
restcall = OnosRestApiDriver()
Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
if Reststatus == 1:
- main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + MAC + "; attached to switchDPID = " + Switch + "; at port = " + Port)
+ main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
result3 = main.TRUE
elif Reststatus > 1:
main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
+ main.log.report("switches are: " + "; ".join(Switch))
+ main.log.report("Ports are: " + "; ".join(Port))
+ main.log.report("MACs are: " + "; ".join(MAC))
result3 = main.FALSE
else:
main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
@@ -415,22 +428,25 @@
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(5)
+ time.sleep(t_topowait)
retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
- time.sleep(sleepT)
+ time.sleep(t_restwait)
restcall = OnosRestApiDriver()
Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
if Reststatus == 1:
- main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + MAC + "; attached to switchDPID = " + Switch + "; at port = " + Port)
+ main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
result4 = main.TRUE
elif Reststatus > 1:
main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
+ main.log.report("switches are: " + "; ".join(Switch))
+ main.log.report("Ports are: " + "; ".join(Port))
+ main.log.report("MACs are: " + "; ".join(MAC))
result4 = main.FALSE
else:
main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
@@ -439,4 +455,31 @@
result = result1 and result2 and result3 and result4
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
+# Run a pure ping test.
+
+ def CASE31(self, main):
+ main.log.report("Performing Ping Test")
+ count = 1
+ i = 6
+ while i < 16 :
+ main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
+ if ping == main.FALSE and count < 6:
+ count = count + 1
+ i = 6
+ main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
+ time.sleep(2)
+ elif ping == main.FALSE and count ==6:
+ main.log.error("Ping test failed")
+ i = 17
+ result = main.FALSE
+ elif ping == main.TRUE:
+ i = i + 1
+ result = main.TRUE
+ endTime = time.time()
+ if result == main.TRUE:
+ main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
+ else:
+ main.log.report("\tPING TEST FAIL")
+ utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")