Merge pull request #38 from opennetworkinglab/HA-rebase
Ha rebase
diff --git a/TestON/core/logger.py b/TestON/core/logger.py
index 9c5ad4d..80fe0de 100644
--- a/TestON/core/logger.py
+++ b/TestON/core/logger.py
@@ -111,7 +111,7 @@
main.LogFileName = main.logdir + "/" + main.TEST + "_" +str(currentTime) + ".log"
main.ReportFileName = main.logdir + "/" + main.TEST + "_" + str(currentTime) + ".rpt"
main.JenkinsCSV = main.logdir + "/" + main.TEST + ".csv"
-
+
#### Add log-level - Report
logging.addLevelName(9, "REPORT")
logging.addLevelName(7, "EXACT")
@@ -234,7 +234,7 @@
#NOTE: the elements were orded based on the colors assigned to the data
logfile = open(main.JenkinsCSV ,"w")
logfile.write(",".join( ['Tests Failed', 'Tests Passed', 'Tests Planned'] ) + "\n")
- logfile.write(",".join( [str(main.TOTAL_TC_FAIL), str(main.TOTAL_TC_PASS), str(main.TOTAL_TC_PLANNED)] ))
+ logfile.write(",".join( [str(int(main.TOTAL_TC_FAIL)), str(int(main.TOTAL_TC_PASS)), str(int(main.TOTAL_TC_PLANNED))] ))
logfile.close()
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index b0752ca..8934e50 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -628,7 +628,7 @@
try :
testModule = __import__(main.classPath, globals(), locals(), [main.TEST], -1)
except(ImportError):
- print "There is no test like "+main.TEST
+ print "There was an import error, it might mean that there is no test like "+main.TEST
main.exit()
testClass = getattr(testModule, main.TEST)
diff --git a/TestON/dependencies/rotate.sh b/TestON/dependencies/rotate.sh
index 235d138..c685a14 100755
--- a/TestON/dependencies/rotate.sh
+++ b/TestON/dependencies/rotate.sh
@@ -51,4 +51,4 @@
#Maybe this should be an argument? pack-and-rotate supports that
nr_max=20
-pack-rotate-log ${root_dir}'/'${base_name} "${root_dir}/${base_name}*.pcap" ${nr_max}
+pack-rotate-log ${root_dir}'/'${base_name} "${root_dir}/${base_name}*.pcap ${root_dir}/${base_name}*.log " ${nr_max}
diff --git a/TestON/drivers/common/cli/emulator/lincoedriver.py b/TestON/drivers/common/cli/emulator/lincoedriver.py
index 6f7ce3a..8da1700 100644
--- a/TestON/drivers/common/cli/emulator/lincoedriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoedriver.py
@@ -10,6 +10,7 @@
list your email here for future contact:
andrew@onlab.us
+ shreya@onlab.us
OCT 20 2014
'''
@@ -23,6 +24,7 @@
import re
import sys
import core.teston
+import time
sys.path.append("../")
from math import pow
from drivers.common.cli.emulatordriver import Emulator
@@ -60,9 +62,16 @@
if self.handle :
main.log.info("Handle successfully created")
self.home = "~/linc-oe"
+
self.handle.sendline("cd "+self.home)
self.handle.expect("oe$")
-
+
+ #self.handle.sendline("pgrep -g linc")
+ #self.handle.expect("\$")
+ print "handle = ", self.handle.before
+
+ return main.TRUE
+ '''
main.log.info("Building Linc-OE")
self.handle.sendline("make rel")
i = self.handle.expect(["ERROR","linc-oe\$"],timeout=60)
@@ -73,15 +82,15 @@
x = self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
main.log.info("make rel returned: "+ str(x))
else:
- main.log.info(self.name+": Starting Linc-OE CLI.. This may take a while")
- time.sleep(30)
- self.handle.sendline("sudo ./rel/linc/bin/linc console")
- j = self.handle.expect(["linc@",pexpect.EOF,pexpect.TIMEOUT])
-
+
+ main.log.info(self.name+": Starting Linc-OE CLI.. This may take a while")
+ time.sleep(30)
+ self.handle.sendline("sudo ./rel/linc/bin/linc console")
+ j = self.handle.expect(["linc@",pexpect.EOF,pexpect.TIMEOUT])
if j == 0:
main.log.info("Linc-OE CLI started")
return main.TRUE
-
+ '''
else:
main.log.error(self.name+
": Connection failed to the host "+
@@ -90,6 +99,26 @@
": Failed to connect to Linc-OE")
return main.FALSE
+
+ def start_console(self):
+ import time
+ main.log.info(self.name+": Starting Linc-OE CLI.. This may take a while")
+ time.sleep(30)
+ self.handle.sendline("sudo ./rel/linc/bin/linc console")
+ j = self.handle.expect(["linc@",pexpect.EOF,pexpect.TIMEOUT])
+ start_result = self.handle.before
+ if j == 0:
+ main.log.info("Linc-OE CLI started")
+ return main.TRUE
+ else:
+ main.log.error(self.name+
+ ": Connection failed to the host "+self.user_name+"@"+self.ip_address)
+ main.log.error(self.name+
+ ": Failed to connect to Linc-OE")
+ return main.FALSE
+
+
+
def build(self):
'''
Build Linc-OE with the specified settings
@@ -285,18 +314,42 @@
main.log.info(self.name+" :::::::")
main.cleanup()
main.exit()
+
+ def stopLincOEConsole(self):
+ '''
+ This function is only used for packet optical testing
+ Send disconnect prompt to Linc-OE CLI
+ (CTRL+C) and kill the linc process
+ '''
+ try:
+ cmd = "pgrep -f linc"
+ self.handle.sendline("pgrep -f linc")
+ self.handle.expect("linc")
+ print "stophandle = ", self.handle.before
+ except pexpect.EOF:
+ main.log.error(self.name+ ": EOF exception")
+ main.log.error(self.name+ ": " + self.handle.before)
def disconnect(self):
'''
Send disconnect prompt to Linc-OE CLI
- (CTRL+C)
+ (CTRL+C) and kill the linc process
'''
try:
#Send CTRL+C twice to exit CLI
self.handle.send("\x03")
self.handle.send("\x03")
self.handle.expect("\$")
-
+ handle1 = self.handle.before
+ cmd = "pgrep -f linc"
+ self.handle.sendline(cmd)
+ self.handle.expect("\$")
+ handle2 = self.handle.before
+ main.log.info("pid's = "+handle2)
+ cmd = "sudo kill -9 `pgrep -f linc`"
+ self.handle.sendline(cmd)
+ self.handle.expect("\$")
+
except pexpect.EOF:
main.log.error(self.name+ ": EOF exception")
main.log.error(self.name+ ": " + self.handle.before)
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 2f31b7d..bf3a2c6 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -287,7 +287,87 @@
return main.FALSE
else :
return main.TRUE
+
+
+
+ def changeIP(self,host,intf,newIP,newNetmask):
+ '''
+ Changes the ip address of a host on the fly
+ Ex: h2 ifconfig h2-eth0 10.0.1.2 netmask 255.255.255.0
+ '''
+ if self.handle:
+ try:
+ cmd = host+" ifconfig "+intf+" "+newIP+" "+'netmask'+" "+newNetmask
+ self.handle.sendline(cmd)
+ self.handle.expect("mininet>")
+ response = self.handle.before
+ main.log.info("response = "+response)
+ main.log.info("Ip of host "+host+" changed to new IP "+newIP)
+ return main.TRUE
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ return main.FALSE
+
+ def changeDefaultGateway(self,host,newGW):
+ '''
+ Changes the default gateway of a host
+ Ex: h1 route add default gw 10.0.1.2
+ '''
+ if self.handle:
+ try:
+ cmd = host+" route add default gw "+newGW
+ self.handle.sendline(cmd)
+ self.handle.expect("mininet>")
+ response = self.handle.before
+ main.log.info("response = "+response)
+ main.log.info("Default gateway of host "+host+" changed to "+newGW)
+ return main.TRUE
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ return main.FALSE
+
+ def addStaticMACAddress(self,host,GW,macaddr):
+ '''
+ Changes the mac address of a geateway host
+ '''
+ if self.handle:
+ try:
+ #h1 arp -s 10.0.1.254 00:00:00:00:11:11
+ cmd = host+" arp -s "+GW+" "+macaddr
+ self.handle.sendline(cmd)
+ self.handle.expect("mininet>")
+ response = self.handle.before
+ main.log.info("response = "+response)
+ main.log.info("Mac adrress of gateway "+GW+" changed to "+macaddr)
+ return main.TRUE
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ return main.FALSE
+
+ def verifyStaticGWandMAC(self,host):
+ '''
+ Verify if the static gateway and mac address assignment
+ '''
+ if self.handle:
+ try:
+ #h1 arp -an
+ cmd = host+" arp -an "
+ self.handle.sendline(cmd)
+ self.handle.expect("mininet>")
+ response = self.handle.before
+ main.log.info(host+" arp -an = "+response)
+ return main.TRUE
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ return main.FALSE
+
+
+
def getMacAddress(self,host):
'''
Verifies the host's ip configured or not.
@@ -443,17 +523,40 @@
main.cleanup()
main.exit()
return response
-
- def iperf(self):
+ '''
+ def iperf(self,host1,host2):
main.log.info(self.name+": Simple iperf TCP test between two (optionally specified) hosts")
try:
- response = self.execute(cmd = 'iperf',prompt = 'mininet>',timeout = 10)
+ if not host1 and not host2:
+ response = self.execute(cmd = 'iperf',prompt = 'mininet>',timeout = 10)
+ else:
+ cmd1 = 'iperf '+ host1 + " " + host2
+ response = self.execute(cmd = cmd1, prompt = '>',timeout = 20)
except pexpect.EOF:
main.log.error(self.name + ": EOF exception found")
main.log.error(self.name + ": " + self.handle.before)
main.cleanup()
main.exit()
return response
+ '''
+ def iperf(self,host1,host2):
+ main.log.info(self.name+": Simple iperf TCP test between two hosts")
+ try:
+ cmd1 = 'iperf '+ host1 + " " + host2
+ self.handle.sendline(cmd1)
+ self.handle.expect("mininet>")
+ response = self.handle.before
+ if re.search('Results:',response):
+ main.log.info(self.name+": iperf test succssful")
+ return main.TRUE
+ else:
+ main.log.error(self.name+": iperf test failed")
+ return main.FALSE
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
def iperfudp(self):
main.log.info(self.name+": Simple iperf TCP test between two (optionally specified) hosts")
@@ -1104,7 +1207,7 @@
break
mn_ports.sort(key=float)
onos_ports.sort(key=float)
- #print "\nPorts for Switch %s:" % (switch['name'])
+ #print "\nPorts for Switch %s:" % (mn_switch['name'])
#print "\tmn_ports[] = ", mn_ports
#print "\tonos_ports[] = ", onos_ports
mn_ports_log = mn_ports
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 1795a16..ae0f599 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -114,7 +114,7 @@
args = utilities.parse_args(["SRC","TARGET","PINGTIME"],**pingParams)
precmd = "sudo rm /tmp/ping." + args["SRC"]
self.execute(cmd=precmd,prompt="(.*)",timeout=10)
- command = "sudo mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -i .2 -w " + str(args['PINGTIME']) + " > /tmp/ping." + args["SRC"] + " &"
+ command = "sudo mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -i .2 -w " + str(args['PINGTIME']) + " -D > /tmp/ping." + args["SRC"] + " &"
main.log.info( command )
self.execute(cmd=command,prompt="(.*)",timeout=10)
self.handle.sendline("")
@@ -372,57 +372,40 @@
def get_flowTable(self, protoVersion, sw):
#TODO document usage
- #FIXME: clean up print statements and such
+ #TODO add option to look at cookies. ignoreing them for now
self.handle.sendline("cd")
self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
- #TODO: Write seperate versions of the function for this, possibly a string that tells it which switch is in use?
- #For 1.0 version of OVS
- #command = "sudo ovs-ofctl dump-flows " + sw + " | awk '{OFS=\",\" ; print $1 $6 $7 }' |sort -n -k1"
- #for 1.3 version of OVS
- #command = "sudo ovs-ofctl dump-flows " + sw + " | awk '{OFS=\",\" ; print $1 $3 $7 $8}' |sort -n -k1"
+ #print "get_flowTable(" + str(protoVersion) +" " + str(sw) +")"
#NOTE: Use format to force consistent flow table output across versions
if protoVersion==1.0:
- command = "sudo ovs-ofctl dump-flows " + sw + " -F OpenFlow10-table_id | awk '{OFS=\",\" ; print $1 $3 $6 $7 $8}' |sort -n -k1"
+ command = "sudo ovs-ofctl dump-flows " + sw + " -F OpenFlow10-table_id | awk '{OFS=\",\" ; print $1 $3 $6 $7 $8}' | cut -d ',' -f 2- | sort -n -k1 -r"
self.handle.sendline(command)
- self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
+ self.handle.expect(["k1 -r",pexpect.EOF,pexpect.TIMEOUT])
self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
response = self.handle.before
#print "response=", response
return response
elif protoVersion==1.3:
- command = "sudo ovs-ofctl dump-flows " + sw + " -O OpenFlow13 | awk '{OFS=\",\" ; print $1 $3 $6 $7}' |sort -n -k1"
+ command = "sudo ovs-ofctl dump-flows " + sw + " -O OpenFlow13 | awk '{OFS=\",\" ; print $1 $3 $6 $7}' | cut -d ',' -f 2- | sort -n -k1 -r"
self.handle.sendline(command)
- #print "ovs-vsctl Command sent status."
- #self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
- #print "sort return status: "
- #print self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
- #print self.handle.before
+ self.handle.expect(["k1 -r",pexpect.EOF,pexpect.TIMEOUT])
self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
- #print "OFPST_FLOW expected status: "
- #print self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
- #print self.handle.before
response = self.handle.before
#print "response=", response
- return response
-
+ return response
+ else:
+ main.log.error("Unknown protoVersion in get_flowTable(). given: ("+str(type(protoVersion))+") '"+str(protoVersion)+"'")
+
def flow_comp(self,flow1,flow2):
- #print "Inside flow compare function"
- #print "Flow1 Table:"
- #for flow in flow1:
- #print flow1
- #print "Flow2 Table"
- #for flow in flow2:
- #print flow2
-
if flow1==flow2:
return main.TRUE
else:
main.log.info("Flow tables do not match, printing tables:")
- #main.log.info("Flow Table 1:")
- #main.log.info(flow1)
- #main.log.info("Flow Table 2:")
- #main.log.info(flow2)
+ main.log.info("Flow Table 1:")
+ main.log.info(flow1)
+ main.log.info("Flow Table 2:")
+ main.log.info(flow2)
return main.FALSE
def setIpTablesOUTPUT(self, dst_ip, dst_port, action='add', packet_type='tcp',rule='DROP'):
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 4916ba5..358945f 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -693,7 +693,38 @@
main.log.info(self.name+" ::::::")
main.cleanup()
main.exit()
-
+
+ def roles_not_null(self):
+ '''
+ Iterates through each device and checks if there is a master assigned
+ Returns: main.TRUE if each device has a master
+ main.FALSE any device has no master
+ '''
+ try:
+ import json
+ raw_roles = self.roles()
+ roles_json = json.loads(raw_roles)
+ #search json for the device with id then return the device
+ for device in roles_json:
+ #print device
+ if device['master'] == "none":
+ main.log.warn("Device has no master: " + str(device) )
+ return main.FALSE
+ return main.TRUE
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
+
+
def paths(self, src_id, dst_id):
'''
Returns string of paths, and the cost.
@@ -1043,6 +1074,146 @@
main.cleanup()
main.exit()
+
+ def add_multipoint_to_singlepoint_intent(self, ingress_device1, ingress_device2,egress_device,
+ port_ingress="", port_egress="", ethType="", ethSrc="",
+ ethDst="", bandwidth="", lambda_alloc=False,
+ ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", setEthSrc="", setEthDst=""):
+ '''
+ Note:
+ This function assumes that there would be 2 ingress devices and one egress device
+ For more number of ingress devices, this function needs to be modified
+ Required:
+ * ingress_device1: device id of ingress device1
+ * ingress_device2: device id of ingress device2
+ * egress_device: device id of egress device
+ Optional:
+ * ethType: specify ethType
+ * ethSrc: specify ethSrc (i.e. src mac addr)
+ * ethDst: specify ethDst (i.e. dst mac addr)
+ * bandwidth: specify bandwidth capacity of link
+ * lambda_alloc: if True, intent will allocate lambda
+ for the specified intent
+ * ipProto: specify ip protocol
+ * ipSrc: specify ip source address
+ * ipDst: specify ip destination address
+ * tcpSrc: specify tcp source port
+ * tcpDst: specify tcp destination port
+ * setEthSrc: action to Rewrite Source MAC Address
+ * setEthDst: action to Rewrite Destination MAC Address
+ Description:
+ Adds a multipoint-to-singlepoint intent (uni-directional) by
+ specifying device id's and optional fields
+
+ NOTE: This function may change depending on the
+ options developers provide for multipointpoint-to-singlepoint
+ intent via cli
+ '''
+ try:
+ cmd = ""
+
+ #If there are no optional arguments
+ if not ethType and not ethSrc and not ethDst\
+ and not bandwidth and not lambda_alloc \
+ and not ipProto and not ipSrc and not ipDst \
+ and not tcpSrc and not tcpDst and not setEthSrc and not setEthDst:
+ cmd = "add-multi-to-single-intent"
+
+
+ else:
+ cmd = "add-multi-to-single-intent"
+
+ if ethType:
+ cmd += " --ethType " + str(ethType)
+ if ethSrc:
+ cmd += " --ethSrc " + str(ethSrc)
+ if ethDst:
+ cmd += " --ethDst " + str(ethDst)
+ if bandwidth:
+ cmd += " --bandwidth " + str(bandwidth)
+ if lambda_alloc:
+ cmd += " --lambda "
+ if ipProto:
+ cmd += " --ipProto " + str(ipProto)
+ if ipSrc:
+ cmd += " --ipSrc " + str(ipSrc)
+ if ipDst:
+ cmd += " --ipDst " + str(ipDst)
+ if tcpSrc:
+ cmd += " --tcpSrc " + str(tcpSrc)
+ if tcpDst:
+ cmd += " --tcpDst " + str(tcpDst)
+ if setEthSrc:
+ cmd += " --setEthSrc "+ str(setEthSrc)
+ if setEthDst:
+ cmd += " --setEthDst "+ str(setEthDst)
+
+ #Check whether the user appended the port
+ #or provided it as an input
+ if "/" in ingress_device1:
+ cmd += " "+str(ingress_device1)
+ else:
+ if not port_ingress1:
+ main.log.error("You must specify "+
+ "the ingress port1")
+ #TODO: perhaps more meaningful return
+ return main.FALSE
+
+ cmd += " "+ \
+ str(ingress_device1) + "/" +\
+ str(port_ingress1) + " "
+
+ if "/" in ingress_device2:
+ cmd += " "+str(ingress_device2)
+ else:
+ if not port_ingress2:
+ main.log.error("You must specify "+
+ "the ingress port2")
+ #TODO: perhaps more meaningful return
+ return main.FALSE
+
+ cmd += " "+ \
+ str(ingress_device2) + "/" +\
+ str(port_ingress2) + " "
+
+ if "/" in egress_device:
+ cmd += " "+str(egress_device)
+ else:
+ if not port_egress:
+ main.log.error("You must specify "+
+ "the egress port")
+ return main.FALSE
+
+ cmd += " "+\
+ str(egress_device) + "/" +\
+ str(port_egress)
+ print "cmd= ",cmd
+ self.handle.sendline(cmd)
+
+ main.log.info(cmd + " sent")
+ i = self.handle.expect([
+ "Error",
+ "onos>"])
+
+ if i == 0:
+ main.log.error("Error in adding point-to-point intent")
+ return self.handle
+ else:
+ return main.TRUE
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
+
+
def remove_intent(self, intent_id):
'''
Remove intent for specified intent id
@@ -1193,8 +1364,8 @@
main.cleanup()
main.exit()
- def push_test_intents(self, dpid_src, dpid_dst, num_intents,
- report=True):
+ def push_test_intents(self, dpid_src, dpid_dst, num_intents,
+ num_mult="", app_id="", report=True):
'''
Description:
Push a number of intents in a batch format to
@@ -1204,12 +1375,22 @@
* dpid_dst: specify destination dpid
* num_intents: specify number of intents to push
Optional:
+ * num_mult: number multiplier for multiplying
+ the number of intents specified
+ * app_id: specify the application id init to further
+ modularize the intents
* report: default True, returns latency information
'''
try:
cmd = "push-test-intents "+\
str(dpid_src)+" "+str(dpid_dst)+" "+\
str(num_intents)
+
+ if num_mult:
+ cmd += " " + str(num_mult)
+ if app_id:
+ cmd += " " + str(app_id)
+
self.handle.sendline(cmd)
self.handle.expect(cmd)
self.handle.expect("onos>")
@@ -1221,8 +1402,20 @@
handle = ansi_escape.sub('', handle)
if report:
+ lat_result = []
main.log.info(handle)
- return handle
+ #Split result by newline
+ newline = handle.split("\r\r\n")
+ #Ignore the first object of list, which is empty
+ newline = newline[1:]
+ #Some sloppy parsing method to get the latency
+ for result in newline:
+ result = result.split(": ")
+ #Append the first result of second parse
+ lat_result.append(result[1].split(" ")[0])
+
+ print lat_result
+ return lat_result
else:
return main.TRUE
@@ -1551,7 +1744,7 @@
onos_node is the ip of one of the onos nodes in the cluster
role must be either master, standby, or none
- Returns main.TRUE or main.FALSE based argument varification.
+ Returns main.TRUE or main.FALSE based on argument verification.
When device-role supports errors this should be extended to
support that output
'''
@@ -1643,5 +1836,115 @@
main.cleanup()
main.exit()
+ def election_test_leader(self):
+ '''
+ * CLI command to get the current leader for the Election test application.
+ #NOTE: Requires installation of the onos-app-election feature
+ Returns: Node IP of the leader if one exists
+ None if none exists
+ Main.FALSE on error
+ '''
+ try:
+ self.handle.sendline("election-test-leader")
+ self.handle.expect("election-test-leader")
+ self.handle.expect("onos>")
+ response = self.handle.before
+ #Leader
+ node_search = re.search("The\scurrent\sleader\sfor\sthe\sElection\sapp\sis\s(?P<node>.+)\.", response)
+ if node_search:
+ node = node_search.group('node')
+ main.log.info("Election-test-leader found " + node + " as the leader")
+ return node
+ #no leader
+ null_search = re.search("There\sis\scurrently\sno\sleader\selected\sfor\sthe\sElection\sapp", response)
+ if null_search:
+ main.log.info("Election-test-leader found no leader")
+ return None
+ #error
+ main.log.error("Error in election_test_leader: unexpected response")
+ main.log.error( repr(response) )
+ return main.FALSE
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
+
+ def election_test_run(self):
+ '''
+ * CLI command to run for leadership of the Election test application.
+ #NOTE: Requires installation of the onos-app-election feature
+ Returns: Main.TRUE on success
+ Main.FALSE on error
+ '''
+ try:
+ self.handle.sendline("election-test-run")
+ self.handle.expect("election-test-run")
+ self.handle.expect("onos>")
+ response = self.handle.before
+ #success
+ search = re.search("Entering\sleadership\selections\sfor\sthe\sElection\sapp.", response)
+ if search:
+ main.log.info("Entering leadership elections for the Election app.")
+ return main.TRUE
+ #error
+ main.log.error("Error in election_test_run: unexpected response")
+ main.log.error( repr(response) )
+ return main.FALSE
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
+
+ def election_test_withdraw(self):
+ '''
+ * CLI command to withdraw the local node from leadership election for
+ * the Election test application.
+ #NOTE: Requires installation of the onos-app-election feature
+ Returns: Main.TRUE on success
+ Main.FALSE on error
+ '''
+ try:
+ self.handle.sendline("election-test-withdraw")
+ self.handle.expect("election-test-withdraw")
+ self.handle.expect("onos>")
+ response = self.handle.before
+ #success
+ search = re.search("Withdrawing\sfrom\sleadership\selections\sfor\sthe\sElection\sapp.", response)
+ if search:
+ main.log.info("Withdrawing from leadership elections for the Election app.")
+ return main.TRUE
+ #error
+ main.log.error("Error in election_test_withdraw: unexpected response")
+ main.log.error( repr(response) )
+ return main.FALSE
+
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
#***********************************
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index e2625cf..678bae4 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -463,8 +463,7 @@
#Note that you may not want certain features listed
#on here.
core_feature_string = "export ONOS_FEATURES=webconsole,onos-api,"+\
- "onos-cli,onos-openflow,onos-app-mobility,onos-app-tvue,"+\
- "onos-app-proxyarp,"+extra_feature_string
+ "onos-cli,onos-openflow,"+extra_feature_string
mn_string = "export OCN="
onos_string = "export OC"
temp_count = 1
@@ -809,6 +808,40 @@
main.cleanup()
main.exit()
+ def onos_die(self, node_ip):
+ '''
+ Issues the command 'onos-die <node-ip>'
+ This command calls onos-kill and also stops the node
+ '''
+ try:
+ self.handle.sendline("")
+ self.handle.expect("\$")
+ cmd_str = "onos-kill "+str(node_ip)
+ self.handle.sendline(cmd_str)
+ i = self.handle.expect([
+ "Killing\sONOS",
+ "ONOS\sprocess\sis\snot\srunning",
+ pexpect.TIMEOUT], timeout=20)
+ if i == 0:
+ main.log.info("ONOS instance "+str(node_ip)+
+ " was killed and stopped")
+ return main.TRUE
+ elif i == 1:
+ main.log.info("ONOS process was not running")
+ return main.FALSE
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
+
+
def onos_kill(self, node_ip):
'''
Calls the command: 'onos-kill [<node-ip>]'
@@ -873,6 +906,8 @@
timeout=120)
if i == 1:
return main.FALSE
+ self.handle.sendline("")
+ self.handle.expect("\$")
return main.TRUE
except pexpect.EOF:
@@ -961,6 +996,61 @@
main.cleanup()
main.exit()
+ def push_test_intents_shell(self, dpid_src, dpid_dst, num_intents,
+ dir_file, onos_ip, num_mult="", app_id="", report=True,
+ options=""):
+ '''
+ Description:
+ Use the linux prompt to push test intents to
+ better parallelize the results than the CLI
+ Required:
+ * dpid_src: specify source dpid
+ * dpid_dst: specify destination dpid
+ * num_intents: specify number of intents to push
+ * dir_file: specify directory and file name to save
+ results
+ * onos_ip: specify the IP of ONOS to install on
+ NOTE:
+ You must invoke this command at linux shell prompt
+ '''
+ try:
+ #Create the string to sendline
+ if options:
+ base_cmd = "onos "+str(onos_ip)+" push-test-intents "+\
+ options+" "
+ else:
+ base_cmd = "onos "+str(onos_ip)+" push-test-intents "
+
+ add_dpid = base_cmd + str(dpid_src) + " " + str(dpid_dst)
+ if not num_mult:
+ add_intents = add_dpid + " " + str(num_intents)
+ elif num_mult:
+ add_intents = add_dpid + " " + str(num_intents) + " " +\
+ str(num_mult)
+ if app_id:
+ add_app = add_intents + " " + str(app_id)
+ else:
+ add_app = add_intents
+
+ if report:
+ send_cmd = add_app + " > " + str(dir_file) + " &"
+ else:
+ send_cmd = add_app + " &"
+ main.log.info("Send cmd: "+send_cmd)
+
+ self.handle.sendline(send_cmd)
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
def get_topology(self,topology_output):
'''
@@ -982,21 +1072,21 @@
if not line.startswith("time="):
continue
#else
- print line
+ #print line
for var in line.split(","):
#print "'"+var+"'"
#print "'"+var.strip()+"'"
key, value = var.strip().split("=")
topology[key] = value
- print "topology = ", topology
+ #print "topology = ", topology
devices = topology.get('devices', False)
- print "devices = ", devices
+ #print "devices = ", devices
links = topology.get('links', False)
- print "links = ", links
- clusters = topology.get('clusters', False)
- print "clusters = ", clusters
+ #print "links = ", links
+ SCCs = topology.get('SCC(s)', False)
+ #print "SCCs = ", SCCs
paths = topology.get('paths', False)
- print "paths = ", paths
+ #print "paths = ", paths
return topology
except pexpect.EOF:
@@ -1099,21 +1189,26 @@
str(dir_file))
- def run_onos_topo_cfg(self):
+ def run_onos_topo_cfg(self, instance_name, json_file):
'''
- On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
+ On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg $OC1 filename
which starts the rest and copies the json file to the onos instance
'''
- self.handle.sendline("")
- self.handle.expect("\$")
- self.handle.sendline("cd ~/ONOS/tools/test/bin")
- self.handle.expect("/bin$")
- self.handle.sendline("./onos-topo-cfg")
- self.handle.expect("{}")
- self.handle.sendline("cd ~")
- self.handle.expect("\$")
-
-
+ try:
+ self.handle.sendline("")
+ self.handle.expect("\$")
+ self.handle.sendline("cd ~/ONOS/tools/test/bin")
+ self.handle.expect("/bin$")
+ cmd = "./onos-topo-cfg " +instance_name +" " +json_file
+ print "cmd = ", cmd
+ self.handle.sendline(cmd)
+ self.handle.expect("\$")
+ self.handle.sendline("cd ~")
+ self.handle.expect("\$")
+ return main.TRUE
+ except:
+ return main.FALSE
+
def tshark_grep(self, grep, directory, interface='eth0'):
'''
Required:
@@ -1244,3 +1339,26 @@
main.log.error( traceback.print_exc())
main.log.info(self.name+" ::::::")
+ def check_logs(self, onos_ip):
+ '''
+ runs onos-check-logs on the given onos node
+ returns the response
+ '''
+ try:
+ cmd = "onos-check-logs " + str(onos_ip)
+ self.handle.sendline(cmd)
+ self.handle.expect(cmd)
+ self.handle.expect("\$")
+ response = self.handle.before
+ return response
+ except pexpect.EOF:
+ main.log.error("Lost ssh connection")
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ except:
+ main.log.error("Some error in check_logs:")
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+
+
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index 19717fb..8314941 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -14,32 +14,34 @@
def __init__(self):
super(CLI, self).__init__()
- #TODO: simplify this method
+ # TODO: simplify this method
def connect(self, **connectargs):
for key in connectargs:
vars(self)[key] = connectargs[key]
-
+
self.name = self.options['name']
- #self.handle = super(QuaggaCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
+ # self.handle = super(QuaggaCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
self.handle = super(QuaggaCliDriver, self).connect(user_name=self.user_name, ip_address="1.1.1.1", port=self.port, pwd=self.pwd)
main.log.info("connect parameters:" + str(self.user_name) + ";" + str(self.ip_address) + ";" + str(self.port) + ";" + str(self.pwd))
- if self.handle:
- self.handle.expect("")
- self.handle.expect("\$")
+ if self.handle:
+ #self.handle.expect("",timeout=10)
+ #self.handle.expect("\$",timeout=10)
self.handle.sendline("telnet localhost 2605")
- self.handle.expect("Password:", timeout = 5)
+ #self.handle.expect("Password:", timeout=5)
+ self.handle.expect("Password:")
self.handle.sendline("hello")
- self.handle.expect("bgpd",timeout = 5)
+ #self.handle.expect("bgpd", timeout=5)
+ self.handle.expect("bgpd")
self.handle.sendline("enable")
- self.handle.expect("bgpd#", timeout = 5)
+ #self.handle.expect("bgpd#", timeout=5)
+ self.handle.expect("bgpd#")
return self.handle
else :
main.log.info("NO HANDLE")
return main.FALSE
def loginQuagga(self, ip_address):
-
self.name = self.options['name']
self.handle = super(QuaggaCliDriver, self).connect(
user_name=self.user_name, ip_address=ip_address,
@@ -48,15 +50,18 @@
+ str(self.ip_address) + ";" + str(self.port) + ";" + str(self.pwd))
if self.handle:
- self.handle.expect("")
- self.handle.expect("\$")
+ #self.handle.expect("")
+ #self.handle.expect("\$")
self.handle.sendline("telnet localhost 2605")
- self.handle.expect("Password:", timeout=5)
+ #self.handle.expect("Password:", timeout=5)
+ self.handle.expect("Password:")
self.handle.sendline("hello")
- self.handle.expect("bgpd", timeout=5)
+ #self.handle.expect("bgpd", timeout=5)
+ self.handle.expect("bgpd")
self.handle.sendline("enable")
- self.handle.expect("bgpd#", timeout=5)
- main.log.info("I am inside BGP peer Quagga!")
+ #self.handle.expect("bgpd#", timeout=5)
+ self.handle.expect("bgpd#")
+ main.log.info("I in quagga on host " + str(ip_address))
return self.handle
else:
@@ -73,11 +78,11 @@
self.disconnect()
return main.FALSE
self.handle.sendline("configure terminal")
- self.handle.expect("config", timeout = 5)
+ self.handle.expect("config", timeout=5)
routerAS = "router bgp " + str(asn)
try:
self.handle.sendline(routerAS)
- self.handle.expect("config-router", timeout = 5)
+ self.handle.expect("config-router", timeout=5)
return main.TRUE
except:
return main.FALSE
@@ -118,9 +123,9 @@
if peer['ipAddress'] == nextHop:
egress = "of:" + str(peer['attachmentDpid']).replace(":", "") + ":" + str(peer['attachmentPort'])
else:
- ingress.append("of:" + str(peer['attachmentDpid']).replace(":", "") + ":" + str(peer['attachmentPort']) )
+ ingress.append("of:" + str(peer['attachmentDpid']).replace(":", "") + ":" + str(peer['attachmentPort']))
- selector = "[IPV4_DST{ip=" + prefix + "}, ETH_TYPE{ethType=800}]"
+ selector = "ETH_TYPE{ethType=800},IPV4_DST{ip=" + prefix + "}"
treatment = "[ETH_DST{mac=" + str(nextHopMac) + "}]"
intent = egress + "/" + str(sorted(ingress)) + "/" + selector + "/" + treatment
@@ -128,7 +133,7 @@
def generate_expected_onePeerRouteIntents(self, prefixes, nextHop, nextHopMac, sdnip_json_file_path):
intents = []
- sdnip_json_file=open(sdnip_json_file_path).read()
+ sdnip_json_file = open(sdnip_json_file_path).read()
sdnip_data = json.loads(sdnip_json_file)
@@ -158,18 +163,24 @@
def extract_actual_routeIntents(self, get_intents_result):
intents = []
# TODO: delete the line below when change to Mininet demo script
- get_intents_result=open("../tests/SdnIpTest/intents.json").read()
+ # get_intents_result=open("../tests/SdnIpTest/intents.json").read()
intents_json_obj = json.loads(get_intents_result)
for intent in intents_json_obj:
- if intent['appId'] != "org.onlab.onos.sdnip" :
+ if intent['appId'] != "org.onosproject.sdnip" :
continue
- if intent['type'] == "MultiPointToSinglePointIntent":
- egress = str(intent['egress']['device'])+ ":" + str(intent['egress']['port'])
+ if intent['type'] == "MultiPointToSinglePointIntent" and intent['state'] == 'INSTALLED':
+ egress = str(intent['egress']['device']) + ":" + str(intent['egress']['port'])
ingress = []
for attachmentPoint in intent['ingress']:
ingress.append(str(attachmentPoint['device']) + ":" + str(attachmentPoint['port']))
- intent = egress + "/" + str(sorted(ingress)) + "/" + intent['selector'] + "/" + intent['treatment']
+
+ selector = intent['selector'].replace("[" , "").replace("]" , "").replace(" ", "")
+ if str(selector).startswith("IPV4"):
+ str1, str2 = str(selector).split(",")
+ selector = str2 + "," + str1
+
+ intent = egress + "/" + str(sorted(ingress)) + "/" + selector + "/" + intent['treatment']
intents.append(intent)
return sorted(intents)
@@ -177,11 +188,11 @@
def extract_actual_bgpIntents(self, get_intents_result):
intents = []
# TODO: delete the line below when change to Mininet demo script
- get_intents_result=open("../tests/SdnIpTest/intents.json").read()
+ # get_intents_result=open("../tests/SdnIpTest/intents.json").read()
intents_json_obj = json.loads(get_intents_result)
for intent in intents_json_obj:
- if intent['appId'] != "org.onlab.onos.sdnip":
+ if intent['appId'] != "org.onosproject.sdnip":
continue
if intent['type'] == "PointToPointIntent" and "protocol=6" in str(intent['selector']):
ingress = str(intent['ingress']['device']) + ":" + str(intent['ingress']['port'])
@@ -196,37 +207,37 @@
def generate_expected_bgpIntents(self, sdnip_json_file_path):
from operator import eq
- sdnip_json_file=open(sdnip_json_file_path).read()
+ sdnip_json_file = open(sdnip_json_file_path).read()
sdnip_data = json.loads(sdnip_json_file)
intents = []
- bgpPeerAttachmentPoint=""
+ bgpPeerAttachmentPoint = ""
bgpSpeakerAttachmentPoint = "of:" + str(sdnip_data['bgpSpeakers'][0]['attachmentDpid']).replace(":", "") + ":" + str(sdnip_data['bgpSpeakers'][0]['attachmentPort'])
for peer in sdnip_data['bgpPeers']:
bgpPeerAttachmentPoint = "of:" + str(peer['attachmentDpid']).replace(":", "") + ":" + str(peer['attachmentPort'])
# find out the BGP speaker IP address for this BGP peer
- bgpSpeakerIpAddress=""
+ bgpSpeakerIpAddress = ""
for interfaceAddress in sdnip_data['bgpSpeakers'][0]['interfaceAddresses']:
- #if eq(interfaceAddress['interfaceDpid'],sdnip_data['bgpSpeakers'][0]['attachmentDpid']) and eq(interfaceAddress['interfacePort'], sdnip_data['bgpSpeakers'][0]['attachmentPort']):
- if eq(interfaceAddress['interfaceDpid'],peer['attachmentDpid']) and eq(interfaceAddress['interfacePort'], peer['attachmentPort']):
- bgpSpeakerIpAddress = interfaceAddress['ipAddress']
+ # if eq(interfaceAddress['interfaceDpid'],sdnip_data['bgpSpeakers'][0]['attachmentDpid']) and eq(interfaceAddress['interfacePort'], sdnip_data['bgpSpeakers'][0]['attachmentPort']):
+ if eq(interfaceAddress['interfaceDpid'], peer['attachmentDpid']) and eq(interfaceAddress['interfacePort'], peer['attachmentPort']):
+ bgpSpeakerIpAddress = interfaceAddress['ipAddress']
break
else:
continue
# from bgpSpeakerAttachmentPoint to bgpPeerAttachmentPoint direction
- selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer['ipAddress']+ "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
+ selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer['ipAddress'] + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
selector = selector_str.replace(" ", "").replace("[", "").replace("]", "").split(",")
intent = bgpSpeakerAttachmentPoint + "/" + bgpPeerAttachmentPoint + "/" + str(sorted(selector))
intents.append(intent)
- selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer['ipAddress']+ "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_SRC{tcpPort=179}"
+ selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer['ipAddress'] + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_SRC{tcpPort=179}"
selector = selector_str.replace(" ", "").replace("[", "").replace("]", "").split(",")
intent = bgpSpeakerAttachmentPoint + "/" + bgpPeerAttachmentPoint + "/" + str(sorted(selector))
intents.append(intent)
# from bgpPeerAttachmentPoint to bgpSpeakerAttachmentPoint direction
- selector_str = "IPV4_SRC{ip=" + peer['ipAddress'] + "/32}," + "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
+ selector_str = "IPV4_SRC{ip=" + peer['ipAddress'] + "/32}," + "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
selector = selector_str.replace(" ", "").replace("[", "").replace("]", "").split(",")
intent = bgpPeerAttachmentPoint + "/" + bgpSpeakerAttachmentPoint + "/" + str(sorted(selector))
intents.append(intent)
@@ -237,14 +248,14 @@
intents.append(intent)
return sorted(intents)
-
+
def add_routes(self, routes, routeRate):
main.log.info("I am in add_routes method!")
-
+
routes_added = 0
try:
self.handle.sendline("")
- #self.handle.expect("config-router")
+ # self.handle.expect("config-router")
self.handle.expect("config-router", timeout=5)
except:
main.log.warn("Probably not in config-router mode!")
@@ -265,7 +276,60 @@
main.log.info("Finished adding routes")
return main.TRUE
return main.FALSE
-
+
+ def delete_routes(self, routes, routeRate):
+ main.log.info("I am in delete_routes method!")
+
+ routes_added = 0
+ try:
+ self.handle.sendline("")
+ # self.handle.expect("config-router")
+ self.handle.expect("config-router", timeout=5)
+ except:
+ main.log.warn("Probably not in config-router mode!")
+ self.disconnect()
+ main.log.info("Start to delete routes")
+
+ for i in range(0, len(routes)):
+ routeCmd = "no network " + routes[i]
+ try:
+ self.handle.sendline(routeCmd)
+ self.handle.expect("bgpd", timeout=5)
+ except:
+ main.log.warn("Failed to add route")
+ self.disconnect()
+ waitTimer = 1.00 / routeRate
+ time.sleep(waitTimer)
+ if routes_added == len(routes):
+ main.log.info("Finished deleting routes")
+ return main.TRUE
+ return main.FALSE
+
+ def ping_test(self, ip_address, ping_test_file, ping_test_result_file):
+ main.log.info("Start the ping test on host:" + str(ip_address))
+
+ self.name = self.options['name']
+ self.handle = super(QuaggaCliDriver, self).connect(
+ user_name=self.user_name, ip_address=ip_address,
+ port=self.port, pwd=self.pwd)
+ main.log.info("connect parameters:" + str(self.user_name) + ";"
+ + str(self.ip_address) + ";" + str(self.port) + ";" + str(self.pwd))
+
+ if self.handle:
+ #self.handle.expect("")
+ #self.handle.expect("\$")
+ main.log.info("I in host " + str(ip_address))
+ main.log.info(ping_test_file + " > " + ping_test_result_file + " &")
+ self.handle.sendline(ping_test_file + " > " + ping_test_result_file + " &")
+ self.handle.expect("\$", timeout=60)
+ handle = self.handle.before
+
+ return handle
+ else:
+ main.log.info("NO HANDLE")
+ return main.FALSE
+
+
# Please use the generate_routes plus add_routes instead of this one
def add_route(self, net, numRoutes, routeRate):
try:
@@ -274,9 +338,9 @@
except:
main.log.warn("Probably not in config-router mode!")
self.disconnect()
- main.log.report("Adding Routes")
- j=0
- k=0
+ main.log.info("Adding Routes")
+ j = 0
+ k = 0
while numRoutes > 255:
numRoutes = numRoutes - 255
j = j + 1
@@ -284,8 +348,8 @@
routes_added = 0
if numRoutes > 255:
numRoutes = 255
- for m in range(1,j+1):
- for n in range(1, numRoutes+1):
+ for m in range(1, j + 1):
+ for n in range(1, numRoutes + 1):
network = str(net) + "." + str(m) + "." + str(n) + ".0/24"
routeCmd = "network " + network
try:
@@ -293,12 +357,12 @@
self.handle.expect("bgpd")
except:
main.log.warn("failed to add route")
- self.disconnect()
- waitTimer = 1.00/routeRate
+ self.disconnect()
+ waitTimer = 1.00 / routeRate
time.sleep(waitTimer)
routes_added = routes_added + 1
- for d in range(j+1,j+2):
- for e in range(1,k+1):
+ for d in range(j + 1, j + 2):
+ for e in range(1, k + 1):
network = str(net) + "." + str(d) + "." + str(e) + ".0/24"
routeCmd = "network " + network
try:
@@ -307,7 +371,7 @@
except:
main.log.warn("failed to add route")
self.disconnect
- waitTimer = 1.00/routeRate
+ waitTimer = 1.00 / routeRate
time.sleep(waitTimer)
routes_added = routes_added + 1
if routes_added == numRoutes:
@@ -321,9 +385,9 @@
except:
main.log.warn("Probably not in config-router mode!")
self.disconnect()
- main.log.report("Deleting Routes")
- j=0
- k=0
+ main.log.info("Deleting Routes")
+ j = 0
+ k = 0
while numRoutes > 255:
numRoutes = numRoutes - 255
j = j + 1
@@ -331,8 +395,8 @@
routes_deleted = 0
if numRoutes > 255:
numRoutes = 255
- for m in range(1,j+1):
- for n in range(1, numRoutes+1):
+ for m in range(1, j + 1):
+ for n in range(1, numRoutes + 1):
network = str(net) + "." + str(m) + "." + str(n) + ".0/24"
routeCmd = "no network " + network
try:
@@ -341,11 +405,11 @@
except:
main.log.warn("Failed to delete route")
self.disconnect()
- waitTimer = 1.00/routeRate
+ waitTimer = 1.00 / routeRate
time.sleep(waitTimer)
routes_deleted = routes_deleted + 1
- for d in range(j+1,j+2):
- for e in range(1,k+1):
+ for d in range(j + 1, j + 2):
+ for e in range(1, k + 1):
network = str(net) + "." + str(d) + "." + str(e) + ".0/24"
routeCmd = "no network " + network
try:
@@ -354,17 +418,18 @@
except:
main.log.warn("Failed to delete route")
self.disconnect()
- waitTimer = 1.00/routeRate
+ waitTimer = 1.00 / routeRate
time.sleep(waitTimer)
routes_deleted = routes_deleted + 1
if routes_deleted == numRoutes:
return main.TRUE
return main.FALSE
+
def check_routes(self, brand, ip, user, pw):
def pronto(ip, user, passwd):
print "Connecting to Pronto switch"
child = pexpect.spawn("telnet " + ip)
- i = child.expect(["login:", "CLI#",pexpect.TIMEOUT])
+ i = child.expect(["login:", "CLI#", pexpect.TIMEOUT])
if i == 0:
print "Username and password required. Passing login info."
child.sendline(user)
@@ -382,7 +447,7 @@
child.expect("Flow table show")
count = 0
while 1:
- i = child.expect(['17\d\.\d{1,3}\.\d{1,3}\.\d{1,3}','CLI#',pexpect.TIMEOUT])
+ i = child.expect(['17\d\.\d{1,3}\.\d{1,3}\.\d{1,3}', 'CLI#', pexpect.TIMEOUT])
if i == 0:
count = count + 1
elif i == 1:
@@ -390,10 +455,10 @@
break
else:
break
- def cisco(ip,user,passwd):
+ def cisco(ip, user, passwd):
print "Establishing Cisco switch connection"
- child = pexpect.spawn("ssh " + user + "@" + ip)
- i = child.expect(["Password:", "CLI#",pexpect.TIMEOUT])
+ child = pexpect.spawn("ssh " + user + "@" + ip)
+ i = child.expect(["Password:", "CLI#", pexpect.TIMEOUT])
if i == 0:
print "Password required. Passing now."
child.sendline(passwd)
@@ -404,7 +469,7 @@
print "Flow table retrieved. Counting flows"
count = 0
while 1:
- i = child.expect(["nw_src=17","#",pexpect.TIMEOUT])
+ i = child.expect(["nw_src=17", "#", pexpect.TIMEOUT])
if i == 0:
count = count + 1
elif i == 1:
@@ -413,9 +478,9 @@
else:
break
if brand == "pronto" or brand == "PRONTO":
- pronto(ip,user,passwd)
- #elif brand == "cisco" or brand == "CISCO":
- # cisco(ip,user,passwd)
+ pronto(ip, user, passwd)
+ # elif brand == "cisco" or brand == "CISCO":
+ # cisco(ip,user,passwd)
def disconnect(self):
'''
Called when Test is complete to disconnect the Quagga handle.
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 7bf7667..878839e 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -48,9 +48,9 @@
ssh_newkey = 'Are you sure you want to continue connecting'
refused = "ssh: connect to host "+self.ip_address+" port 22: Connection refused"
if self.port:
- self.handle =pexpect.spawn('ssh -p '+self.port+' '+self.user_name+'@'+self.ip_address,maxread=50000)
+ self.handle =pexpect.spawn('ssh -p '+self.port+' '+self.user_name+'@'+self.ip_address, env = {"TERM": "vt100"} , maxread=50000)
else :
- self.handle =pexpect.spawn('ssh -X '+self.user_name+'@'+self.ip_address,maxread=50000)
+ self.handle =pexpect.spawn('ssh -X '+self.user_name+'@'+self.ip_address,maxread=1000000,timeout=60)
self.handle.logfile = self.logfile_handler
i = 5
@@ -190,7 +190,9 @@
'''
ssh_newkey = 'Are you sure you want to continue connecting'
refused = "ssh: connect to host "+ip_address+" port 22: Connection refused"
- self.handle =pexpect.spawn('scp '+user_name+'@'+ip_address+':'+filepath+' '+dst_path)
+ cmd = 'scp '+str(user_name)+'@'+str(ip_address)+':'+str(filepath)+' '+str(dst_path)
+ main.log.info("Sending: " + cmd )
+ self.handle =pexpect.spawn( cmd )
i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT,refused],120)
if i==0:
@@ -212,7 +214,9 @@
main.log.error("ssh: connect to host "+ip_address+" port 22: Connection refused")
return main.FALSE
- self.handle.sendline("\r")
+ self.handle.sendline("")
+ self.handle.expect("$")
+ print self.handle.before
return self.handle
diff --git a/TestON/tests/ClassTest/ClassTest.params b/TestON/tests/ClassTest/ClassTest.params
new file mode 100644
index 0000000..456881b
--- /dev/null
+++ b/TestON/tests/ClassTest/ClassTest.params
@@ -0,0 +1,4 @@
+<PARAMS>
+ <testcases>1,2</testcases>
+
+</PARAMS>
diff --git a/TestON/tests/ClassTest/ClassTest.py b/TestON/tests/ClassTest/ClassTest.py
new file mode 100644
index 0000000..6d7a153
--- /dev/null
+++ b/TestON/tests/ClassTest/ClassTest.py
@@ -0,0 +1,26 @@
+
+import time
+import os
+import re
+
+class ClassTest:
+ def __init__(self):
+ self.default = ''
+
+ def CASE1(self, main):
+ import time
+ import imp
+
+ init = imp.load_source('ClassInit',
+ '/home/admin/ONLabTest/TestON/tests/ClassTest/Dependency/ClassInit.py')
+
+ ip1_from_class = init.getIp1()
+ init.printMain(main)
+
+ main.log.info(ip1_from_class)
+
+ def CASE2(self, main):
+
+
+ main.log.info("Case 2")
+
diff --git a/TestON/tests/ClassTest/ClassTest.topo b/TestON/tests/ClassTest/ClassTest.topo
new file mode 100644
index 0000000..4ecb7ed
--- /dev/null
+++ b/TestON/tests/ClassTest/ClassTest.topo
@@ -0,0 +1,26 @@
+<TOPOLOGY>
+ <COMPONENT>
+ <ONOSbench>
+ <host>10.128.174.10</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOSbench>
+
+ <Mininet1>
+ <host>10.128.10.90</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ <arg1> --custom topo-perf-2sw.py </arg1>
+ <arg2> --arp --mac --topo mytopo </arg2>
+ <arg3> </arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet1>
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/ClassTest/Dependency/ClassInit.py b/TestON/tests/ClassTest/Dependency/ClassInit.py
new file mode 100644
index 0000000..74ff627
--- /dev/null
+++ b/TestON/tests/ClassTest/Dependency/ClassInit.py
@@ -0,0 +1,11 @@
+
+
+def __init__(self):
+ self._ip1 = '1'
+ self._ip2 = '2'
+
+def getIp1():
+ print 'some ip'
+
+def printMain(main):
+ print main.log.info("Main from classinit")
diff --git a/TestON/tests/ClassTest/Dependency/__init__.py b/TestON/tests/ClassTest/Dependency/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/ClassTest/Dependency/__init__.py
diff --git a/TestON/tests/ClassTest/Dependencyc b/TestON/tests/ClassTest/Dependencyc
new file mode 100644
index 0000000..bafe4c9
--- /dev/null
+++ b/TestON/tests/ClassTest/Dependencyc
Binary files differ
diff --git a/TestON/tests/ClassTest/__init__.py b/TestON/tests/ClassTest/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/ClassTest/__init__.py
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
index 0a8bd57..68f12a8 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,2,8,3,4,5,[6],7,8,4,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+ <testcases>1,2,8,3,4,5,[6],8,3,7,4,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
<cellName>HA</cellName>
</ENV>
@@ -28,7 +28,7 @@
<port7>6633</port7>
</CTRL>
<TESTONUSER>admin</TESTONUSER>
- <TESTONIP>10.128.30.10</TESTONIP>
+ <TESTONIP>10.128.30.9</TESTONIP>
<PING>
<source1>h8</source1>
<source2>h9</source2>
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index 47dc744..3e0a055 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -82,7 +82,7 @@
cell_result = main.ONOSbench.set_cell(cell_name)
verify_result = main.ONOSbench.verify_cell()
- #FIXME:this is short term fix
+ #FIXME:this is short term fix
main.log.report("Removing raft logs")
main.ONOSbench.onos_remove_raft_logs()
main.log.report("Uninstalling ONOS")
@@ -145,29 +145,32 @@
main.step("Checking if ONOS is up yet")
#TODO: Refactor
# check bundle:list?
- onos1_isup = main.ONOSbench.isup(ONOS1_ip)
- if not onos1_isup:
- main.log.report("ONOS1 didn't start!")
- onos2_isup = main.ONOSbench.isup(ONOS2_ip)
- if not onos2_isup:
- main.log.report("ONOS2 didn't start!")
- onos3_isup = main.ONOSbench.isup(ONOS3_ip)
- if not onos3_isup:
- main.log.report("ONOS3 didn't start!")
- onos4_isup = main.ONOSbench.isup(ONOS4_ip)
- if not onos4_isup:
- main.log.report("ONOS4 didn't start!")
- onos5_isup = main.ONOSbench.isup(ONOS5_ip)
- if not onos5_isup:
- main.log.report("ONOS5 didn't start!")
- onos6_isup = main.ONOSbench.isup(ONOS6_ip)
- if not onos6_isup:
- main.log.report("ONOS6 didn't start!")
- onos7_isup = main.ONOSbench.isup(ONOS7_ip)
- if not onos7_isup:
- main.log.report("ONOS7 didn't start!")
- onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
- and onos4_isup and onos5_isup and onos6_isup and onos7_isup
+ for i in range(2):
+ onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+ if not onos1_isup:
+ main.log.report("ONOS1 didn't start!")
+ onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+ if not onos2_isup:
+ main.log.report("ONOS2 didn't start!")
+ onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+ if not onos3_isup:
+ main.log.report("ONOS3 didn't start!")
+ onos4_isup = main.ONOSbench.isup(ONOS4_ip)
+ if not onos4_isup:
+ main.log.report("ONOS4 didn't start!")
+ onos5_isup = main.ONOSbench.isup(ONOS5_ip)
+ if not onos5_isup:
+ main.log.report("ONOS5 didn't start!")
+ onos6_isup = main.ONOSbench.isup(ONOS6_ip)
+ if not onos6_isup:
+ main.log.report("ONOS6 didn't start!")
+ onos7_isup = main.ONOSbench.isup(ONOS7_ip)
+ if not onos7_isup:
+ main.log.report("ONOS7 didn't start!")
+ onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
+ and onos4_isup and onos5_isup and onos6_isup and onos7_isup
+ if onos_isup_result == main.TRUE:
+ break
# TODO: if it becomes an issue, we can retry this step a few times
@@ -197,9 +200,9 @@
onfail="Test startup NOT successful")
- #if case1_result==main.FALSE:
- # main.cleanup()
- # main.exit()
+ if case1_result==main.FALSE:
+ main.cleanup()
+ main.exit()
def CASE2(self,main) :
'''
@@ -209,25 +212,6 @@
import json
import re
-
- '''
- ONOS1_ip = main.params['CTRL']['ip1']
- ONOS1_port = main.params['CTRL']['port1']
- ONOS2_ip = main.params['CTRL']['ip2']
- ONOS2_port = main.params['CTRL']['port2']
- ONOS3_ip = main.params['CTRL']['ip3']
- ONOS3_port = main.params['CTRL']['port3']
- ONOS4_ip = main.params['CTRL']['ip4']
- ONOS4_port = main.params['CTRL']['port4']
- ONOS5_ip = main.params['CTRL']['ip5']
- ONOS5_port = main.params['CTRL']['port5']
- ONOS6_ip = main.params['CTRL']['ip6']
- ONOS6_port = main.params['CTRL']['port6']
- ONOS7_ip = main.params['CTRL']['ip7']
- ONOS7_port = main.params['CTRL']['port7']
- '''
-
-
main.log.report("Assigning switches to controllers")
main.case("Assigning Controllers")
main.step("Assign switches to controllers")
@@ -265,8 +249,217 @@
onpass="Switch mastership assigned correctly",
onfail="Switches not assigned correctly to controllers")
- #TODO: If assign roles is working reliably then manually
- # assign mastership to the controller we want
+ #Manually assign mastership to the controller we want
+ role_call = main.TRUE
+ role_check = main.TRUE
+
+ device_id = main.ONOScli1.get_device("1000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+ if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("2800")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+ if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("2000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+ if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+ if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("5000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+ if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+ if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3004")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS4_ip)
+ if ONOS4_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3008")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3009")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3010")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3011")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3012")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3013")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3014")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3015")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3016")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3017")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6007")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS6_ip)
+ if ONOS6_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6018")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6019")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6020")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6021")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6022")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6023")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6024")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6025")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6026")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6027")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ utilities.assert_equals(expect = main.TRUE,actual=role_call,
+ onpass="Re-assigned switch mastership to designated controller",
+ onfail="Something wrong with device_role calls")
+
+ utilities.assert_equals(expect = main.TRUE,actual=role_check,
+ onpass="Switches were successfully reassigned to designated controller",
+ onfail="Switches were not successfully reassigned")
+ mastership_check = mastership_check and role_call and role_check
+ utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch mastership")
def CASE3(self,main) :
@@ -274,6 +467,7 @@
Assign intents
"""
+ #FIXME: This should only be called once when we have persistence
import time
import json
import re
@@ -283,6 +477,16 @@
main.step("Discovering Hosts( Via pingall for now)")
#FIXME: Once we have a host discovery mechanism, use that instead
+ #install onos-app-fwd
+ main.log.info("Install reactive forwarding app")
+ main.ONOScli1.feature_install("onos-app-fwd")
+ main.ONOScli2.feature_install("onos-app-fwd")
+ main.ONOScli3.feature_install("onos-app-fwd")
+ main.ONOScli4.feature_install("onos-app-fwd")
+ main.ONOScli5.feature_install("onos-app-fwd")
+ main.ONOScli6.feature_install("onos-app-fwd")
+ main.ONOScli7.feature_install("onos-app-fwd")
+
#REACTIVE FWD test
ping_result = main.FALSE
time1 = time.time()
@@ -304,7 +508,7 @@
#TODO: move the host numbers to params
import json
intents_json= json.loads(main.ONOScli1.hosts())
- intent_add_result = main.FALSE
+ intent_add_result = True
for i in range(8,18):
main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
@@ -314,7 +518,10 @@
host1_id = main.ONOScli1.get_host(host1)['id']
host2_id = main.ONOScli1.get_host(host2)['id']
tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
- intent_add_result = intent_add_result and tmp_result
+ intent_add_result = bool(intent_add_result and tmp_result)
+ utilities.assert_equals(expect=True, actual=intent_add_result,
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch mastership")
#TODO Check if intents all exist in datastore
#NOTE: Do we need to print this once the test is working?
#main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
@@ -360,6 +567,25 @@
main.step("Get the Mastership of each switch from each controller")
global mastership_state
+ mastership_state = []
+
+ #Assert that each device has a master
+ ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+ ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+ ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+ ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+ ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+ ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+ ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+ roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+ ONOS3_master_not_null and ONOS4_master_not_null and\
+ ONOS5_master_not_null and ONOS6_master_not_null and\
+ ONOS7_master_not_null
+ utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+ onpass="Each device has a master",
+ onfail="Some devices don't have a master assigned")
+
+
ONOS1_mastership = main.ONOScli1.roles()
ONOS2_mastership = main.ONOScli2.roles()
ONOS3_mastership = main.ONOScli3.roles()
@@ -416,6 +642,7 @@
main.step("Get the intents from each controller")
global intent_state
+ intent_state = []
ONOS1_intents = main.ONOScli1.intents( json_format=True )
ONOS2_intents = main.ONOScli2.intents( json_format=True )
ONOS3_intents = main.ONOScli3.intents( json_format=True )
@@ -470,6 +697,7 @@
main.step("Get the flows from each controller")
global flow_state
+ flow_state = []
ONOS1_flows = main.ONOScli1.flows( json_format=True )
ONOS2_flows = main.ONOScli2.flows( json_format=True )
ONOS3_flows = main.ONOScli3.flows( json_format=True )
@@ -527,7 +755,7 @@
global flows
flows=[]
for i in range(1,29):
- flows.append(main.Mininet2.get_flowTable("s"+str(i),1.0))
+ flows.append(main.Mininet2.get_flowTable(1.3, "s"+str(i)))
#TODO: Compare switch flow tables with ONOS flow tables
@@ -578,7 +806,6 @@
devices.append( main.ONOScli5.devices() )
devices.append( main.ONOScli6.devices() )
devices.append( main.ONOScli7.devices() )
- '''
hosts = []
hosts.append( main.ONOScli1.hosts() )
hosts.append( main.ONOScli2.hosts() )
@@ -587,7 +814,6 @@
hosts.append( main.ONOScli5.hosts() )
hosts.append( main.ONOScli6.hosts() )
hosts.append( main.ONOScli7.hosts() )
- '''
ports = []
ports.append( main.ONOScli1.ports() )
ports.append( main.ONOScli2.ports() )
@@ -604,6 +830,91 @@
links.append( main.ONOScli5.links() )
links.append( main.ONOScli6.links() )
links.append( main.ONOScli7.links() )
+ clusters = []
+ clusters.append( main.ONOScli1.clusters() )
+ clusters.append( main.ONOScli2.clusters() )
+ clusters.append( main.ONOScli3.clusters() )
+ clusters.append( main.ONOScli4.clusters() )
+ clusters.append( main.ONOScli5.clusters() )
+ clusters.append( main.ONOScli6.clusters() )
+ clusters.append( main.ONOScli7.clusters() )
+ paths = []
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+ paths.append( temp_topo.get('paths', False) )
+
+ #Compare json objects for hosts, dataplane clusters and paths
+
+ #hosts
+ consistent_hosts_result = main.TRUE
+ for controller in range( len( hosts ) ):
+ if not "Error" in hosts[controller]:
+ if hosts[controller] == hosts[0]:
+ continue
+ else:#hosts not consistent
+ main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ main.log.warn( repr( hosts[controller] ) )
+ consistent_hosts_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+ consistent_hosts_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+ onpass="Hosts view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of hosts")
+
+ #Strongly connected clusters of devices
+ consistent_clusters_result = main.TRUE
+ for controller in range( len( clusters ) ):
+ if not "Error" in clusters[controller]:
+ if clusters[controller] == clusters[0]:
+ continue
+ else:#clusters not consistent
+ main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_clusters_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+ consistent_clusters_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+ onpass="Clusters view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of clusters")
+ num_clusters = len(json.loads(clusters[0])) #there should always only be one cluster
+ utilities.assert_equals(expect = 1, actual = num_clusters,
+ onpass="ONOS shows 1 SCC",
+ onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+ #paths
+ consistent_paths_result = main.TRUE
+ for controller in range( len( paths ) ):
+ if not "Error" in paths[controller]:
+ if paths[controller] == paths[0]:
+ continue
+ else:#paths not consistent
+ main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_paths_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+ consistent_paths_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+ onpass="Paths count is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different counts of paths")
main.step("Comparing ONOS topology to MN")
@@ -639,14 +950,16 @@
ports_results = ports_results and current_ports_result
links_results = links_results and current_links_result
- topo_result = devices_results and ports_results and links_results
+ topo_result = devices_results and ports_results and links_results\
+ and consistent_hosts_result and consistent_clusters_result\
+ and consistent_paths_result
utilities.assert_equals(expect=main.TRUE, actual=topo_result,
onpass="Topology Check Test successful",
onfail="Topology Check Test NOT successful")
final_assert = main.TRUE
final_assert = final_assert and topo_result and flow_check \
- and intent_check and consistent_mastership
+ and intent_check and consistent_mastership and roles_not_null
utilities.assert_equals(expect=main.TRUE, actual=final_assert,
onpass="State check successful",
onfail="State check NOT successful")
@@ -708,6 +1021,24 @@
import json
main.case("Running ONOS Constant State Tests")
+ #Assert that each device has a master
+ ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+ ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+ ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+ ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+ ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+ ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+ ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+ roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+ ONOS3_master_not_null and ONOS4_master_not_null and\
+ ONOS5_master_not_null and ONOS6_master_not_null and\
+ ONOS7_master_not_null
+ utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+ onpass="Each device has a master",
+ onfail="Some devices don't have a master assigned")
+
+
+
main.step("Check if switch roles are consistent across all nodes")
ONOS1_mastership = main.ONOScli1.roles()
ONOS2_mastership = main.ONOScli2.roles()
@@ -739,7 +1070,6 @@
and ONOS1_mastership == ONOS5_mastership\
and ONOS1_mastership == ONOS6_mastership\
and ONOS1_mastership == ONOS7_mastership:
- #mastership_state = ONOS1_mastership
consistent_mastership = main.TRUE
main.log.report("Switch roles are consistent across all ONOS nodes")
else:
@@ -822,25 +1152,36 @@
intent_check = main.TRUE
main.log.report("Intents are consistent across all ONOS nodes")
else:
- main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
+ main.log.warn("ONOS1 intents: ")
+ print json.dumps(json.loads(ONOS1_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS2 intents: ")
+ print json.dumps(json.loads(ONOS2_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS3 intents: ")
+ print json.dumps(json.loads(ONOS3_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS4 intents: ")
+ print json.dumps(json.loads(ONOS4_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS5 intents: ")
+ print json.dumps(json.loads(ONOS5_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS6 intents: ")
+ print json.dumps(json.loads(ONOS6_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS7 intents: ")
+ print json.dumps(json.loads(ONOS7_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
utilities.assert_equals(expect = main.TRUE,actual=intent_check,
onpass="Intents are consistent across all ONOS nodes",
onfail="ONOS nodes have different views of intents")
+ #NOTE: Hazelcast has no durability, so intents are lost
+ '''
main.step("Compare current intents with intents before the failure")
+ #NOTE: this requires case 5 to pass for intent_state to be set.
+ # maybe we should stop the test if that fails?
if intent_state == ONOS1_intents:
same_intents = main.TRUE
main.log.report("Intents are consistent with before failure")
@@ -851,6 +1192,7 @@
onpass="Intents are consistent with before failure",
onfail="The Intents changed during failure")
intent_check = intent_check and same_intents
+ '''
@@ -859,12 +1201,12 @@
flows2=[]
for i in range(28):
main.log.info("Checking flow table on s" + str(i+1))
- tmp_flows = main.Mininet2.get_flowTable("s"+str(i+1),1.0)
+ tmp_flows = main.Mininet2.get_flowTable(1.3, "s"+str(i+1))
flows2.append(tmp_flows)
- Flow_Tables = Flow_Tables and main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+ temp_result = main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+ Flow_Tables = Flow_Tables and temp_result
if Flow_Tables == main.FALSE:
main.log.info("Differences in flow table for switch: "+str(i+1))
- break
if Flow_Tables == main.TRUE:
main.log.report("No changes were found in the flow tables")
utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
@@ -880,7 +1222,7 @@
#NOTE: checkForLoss returns main.FALSE with 0% packet loss
for i in range(8,18):
main.log.info("Checking for a loss in pings along flow from s" + str(i))
- Loss_In_Pings = Loss_In_Pings or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
+ Loss_In_Pings = main.Mininet2.checkForLoss("/tmp/ping.h"+str(i)) or Loss_In_Pings
if Loss_In_Pings == main.TRUE:
main.log.info("Loss in ping detected")
elif Loss_In_Pings == main.ERROR:
@@ -891,10 +1233,12 @@
utilities.assert_equals(expect=main.FALSE,actual=Loss_In_Pings,
onpass="No Loss of connectivity",
onfail="Loss of dataplane connectivity detected")
+ #NOTE: Since intents are not persisted with Hazelcast, we expect this
+ Loss_In_Pings = main.FALSE
#TODO:add topology to this or leave as a seperate case?
- result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings)
+ result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings) and roles_not_null
result = int(result)
if result == main.TRUE:
main.log.report("Constant State Tests Passed")
@@ -936,87 +1280,173 @@
ports_results = main.TRUE
links_results = main.TRUE
topo_result = main.FALSE
- start_time = time.time()
elapsed = 0
count = 0
- while topo_result == main.FALSE and elapsed < 120:
+ main.step("Collecting topology information from ONOS")
+ start_time = time.time()
+ while topo_result == main.FALSE and elapsed < 60:
count = count + 1
- try:
- main.step("Collecting topology information from ONOS")
- devices = []
- devices.append( main.ONOScli1.devices() )
- devices.append( main.ONOScli2.devices() )
- devices.append( main.ONOScli3.devices() )
- devices.append( main.ONOScli4.devices() )
- devices.append( main.ONOScli5.devices() )
- devices.append( main.ONOScli6.devices() )
- devices.append( main.ONOScli7.devices() )
- '''
- hosts = []
- hosts.append( main.ONOScli1.hosts() )
- hosts.append( main.ONOScli2.hosts() )
- hosts.append( main.ONOScli3.hosts() )
- hosts.append( main.ONOScli4.hosts() )
- hosts.append( main.ONOScli5.hosts() )
- hosts.append( main.ONOScli6.hosts() )
- hosts.append( main.ONOScli7.hosts() )
- '''
- ports = []
- ports.append( main.ONOScli1.ports() )
- ports.append( main.ONOScli2.ports() )
- ports.append( main.ONOScli3.ports() )
- ports.append( main.ONOScli4.ports() )
- ports.append( main.ONOScli5.ports() )
- ports.append( main.ONOScli6.ports() )
- ports.append( main.ONOScli7.ports() )
- links = []
- links.append( main.ONOScli1.links() )
- links.append( main.ONOScli2.links() )
- links.append( main.ONOScli3.links() )
- links.append( main.ONOScli4.links() )
- links.append( main.ONOScli5.links() )
- links.append( main.ONOScli6.links() )
- links.append( main.ONOScli7.links() )
+ if count > 1:
+ MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+ cli_start = time.time()
+ devices = []
+ devices.append( main.ONOScli1.devices() )
+ devices.append( main.ONOScli2.devices() )
+ devices.append( main.ONOScli3.devices() )
+ devices.append( main.ONOScli4.devices() )
+ devices.append( main.ONOScli5.devices() )
+ devices.append( main.ONOScli6.devices() )
+ devices.append( main.ONOScli7.devices() )
+ hosts = []
+ hosts.append( main.ONOScli1.hosts() )
+ hosts.append( main.ONOScli2.hosts() )
+ hosts.append( main.ONOScli3.hosts() )
+ hosts.append( main.ONOScli4.hosts() )
+ hosts.append( main.ONOScli5.hosts() )
+ hosts.append( main.ONOScli6.hosts() )
+ hosts.append( main.ONOScli7.hosts() )
+ ports = []
+ ports.append( main.ONOScli1.ports() )
+ ports.append( main.ONOScli2.ports() )
+ ports.append( main.ONOScli3.ports() )
+ ports.append( main.ONOScli4.ports() )
+ ports.append( main.ONOScli5.ports() )
+ ports.append( main.ONOScli6.ports() )
+ ports.append( main.ONOScli7.ports() )
+ links = []
+ links.append( main.ONOScli1.links() )
+ links.append( main.ONOScli2.links() )
+ links.append( main.ONOScli3.links() )
+ links.append( main.ONOScli4.links() )
+ links.append( main.ONOScli5.links() )
+ links.append( main.ONOScli6.links() )
+ links.append( main.ONOScli7.links() )
+ clusters = []
+ clusters.append( main.ONOScli1.clusters() )
+ clusters.append( main.ONOScli2.clusters() )
+ clusters.append( main.ONOScli3.clusters() )
+ clusters.append( main.ONOScli4.clusters() )
+ clusters.append( main.ONOScli5.clusters() )
+ clusters.append( main.ONOScli6.clusters() )
+ clusters.append( main.ONOScli7.clusters() )
+ paths = []
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+ paths.append( temp_topo.get('paths', False) )
- for controller in range(7): #TODO parameterize the number of controllers
- if devices[controller] or not "Error" in devices[controller]:
- current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
- else:
- current_devices_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
- onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
- onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
- if ports[controller] or not "Error" in ports[controller]:
- current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
- else:
- current_ports_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
- onpass="ONOS"+str(int(controller+1))+" ports view is correct",
- onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+ elapsed = time.time() - start_time
+ cli_time = time.time() - cli_start
+ print "CLI time: " + str(cli_time)
- if links[controller] or not "Error" in links[controller]:
- current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
- else:
- current_links_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
- onpass="ONOS"+str(int(controller+1))+" links view is correct",
- onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
- except:
- main.log.error("something went wrong in topo comparison")
- main.log.warn( repr( devices ) )
- main.log.warn( repr( ports ) )
- main.log.warn( repr( links ) )
+ for controller in range(7): #TODO parameterize the number of controllers
+ if devices[controller] or not "Error" in devices[controller]:
+ current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+ else:
+ current_devices_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+ onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+ onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+ if ports[controller] or not "Error" in ports[controller]:
+ current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+ else:
+ current_ports_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+ onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+ onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+ if links[controller] or not "Error" in links[controller]:
+ current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+ else:
+ current_links_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+ onpass="ONOS"+str(int(controller+1))+" links view is correct",
+ onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
devices_results = devices_results and current_devices_result
ports_results = ports_results and current_ports_result
links_results = links_results and current_links_result
- topo_result = devices_results and ports_results and links_results
- elapsed = time.time() - start_time
- time_threshold = elapsed < 1
- topo_result = topo_result and time_threshold
- #TODO make sure this step is non-blocking. IE add a timeout
- main.log.report("Very crass estimate for topology discovery/convergence: " +\
+
+ #Compare json objects for hosts, dataplane clusters and paths
+
+ #hosts
+ consistent_hosts_result = main.TRUE
+ for controller in range( len( hosts ) ):
+ if not "Error" in hosts[controller]:
+ if hosts[controller] == hosts[0]:
+ continue
+ else:#hosts not consistent
+ main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ main.log.warn( repr( hosts[controller] ) )
+ consistent_hosts_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+ consistent_hosts_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+ onpass="Hosts view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of hosts")
+
+ #Strongly connected clusters of devices
+ consistent_clusters_result = main.TRUE
+ for controller in range( len( clusters ) ):
+ if not "Error" in clusters[controller]:
+ if clusters[controller] == clusters[0]:
+ continue
+ else:#clusters not consistent
+ main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_clusters_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+ consistent_clusters_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+ onpass="Clusters view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of clusters")
+ num_clusters = len(json.loads(clusters[0])) #there should always only be one cluster
+ utilities.assert_equals(expect = 1, actual = num_clusters,
+ onpass="ONOS shows 1 SCC",
+ onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+ #paths
+ consistent_paths_result = main.TRUE
+ for controller in range( len( paths ) ):
+ if not "Error" in paths[controller]:
+ if paths[controller] == paths[0]:
+ continue
+ else:#paths not consistent
+ main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_paths_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+ consistent_paths_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+ onpass="Paths count is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different counts of paths")
+
+
+ topo_result = devices_results and ports_results and links_results\
+ and consistent_hosts_result and consistent_clusters_result and consistent_paths_result
+
+ topo_result = topo_result and int(count <= 2)
+ note = "note it takes about "+str( int(cli_time) )+" seconds for the test to make all the cli calls to fetch the topology from each ONOS instance"
+ main.log.report("Very crass estimate for topology discovery/convergence("+ str(note) + "): " +\
str(elapsed) + " seconds, " + str(count) +" tries" )
utilities.assert_equals(expect=main.TRUE, actual=topo_result,
onpass="Topology Check Test successful",
@@ -1085,13 +1515,18 @@
#TODO: Make this switch parameterizable
main.step("Kill s28 ")
main.log.report("Deleting s28")
- #FIXME: use new dynamic topo functions
main.Mininet1.del_switch("s28")
main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
time.sleep(switch_sleep)
+ device = main.ONOScli1.get_device(dpid="0028")
#Peek at the deleted switch
- main.log.warn(main.ONOScli1.get_device(dpid="0028"))
- #TODO do some sort of check here
+ main.log.warn( str(device) )
+ result = main.FALSE
+ if device and device['available'] == False:
+ result = main.TRUE
+ utilities.assert_equals(expect=main.TRUE,actual=result,
+ onpass="Kill switch succesful",
+ onfail="Failed to kill switch?")
def CASE12 (self, main) :
'''
@@ -1099,7 +1534,6 @@
'''
#NOTE: You should probably run a topology check after this
import time
- #FIXME: use new dynamic topo functions
description = "Adding a switch to ensure it is discovered correctly"
main.log.report(description)
main.case(description)
@@ -1121,9 +1555,15 @@
ip7=ONOS7_ip,port7=ONOS7_port)
main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
time.sleep(switch_sleep)
- #Peek at the added switch
- main.log.warn(main.ONOScli1.get_device(dpid="0028"))
- #TODO do some sort of check here
+ device = main.ONOScli1.get_device(dpid="0028")
+ #Peek at the deleted switch
+ main.log.warn( str(device) )
+ result = main.FALSE
+ if device and device['available'] == True:
+ result = main.TRUE
+ utilities.assert_equals(expect=main.TRUE,actual=result,
+ onpass="add switch succesful",
+ onfail="Failed to add switch?")
def CASE13 (self, main) :
'''
@@ -1137,8 +1577,26 @@
main.step("Killing tcpdumps")
main.Mininet2.stop_tcpdump()
+ main.step("Checking ONOS Logs for errors")
+ print "Checking logs for errors on ONOS1:"
+ print main.ONOSbench.check_logs(ONOS1_ip)
+ print "Checking logs for errors on ONOS2:"
+ print main.ONOSbench.check_logs(ONOS2_ip)
+ print "Checking logs for errors on ONOS3:"
+ print main.ONOSbench.check_logs(ONOS3_ip)
+ print "Checking logs for errors on ONOS4:"
+ print main.ONOSbench.check_logs(ONOS4_ip)
+ print "Checking logs for errors on ONOS5:"
+ print main.ONOSbench.check_logs(ONOS5_ip)
+ print "Checking logs for errors on ONOS6:"
+ print main.ONOSbench.check_logs(ONOS6_ip)
+ print "Checking logs for errors on ONOS7:"
+ print main.ONOSbench.check_logs(ONOS7_ip)
+
main.step("Copying MN pcap and ONOS log files to test station")
testname = main.TEST
+ teststation_user = main.params['TESTONUSER']
+ teststation_IP = main.params['TESTONIP']
#NOTE: MN Pcap file is being saved to ~/packet_captures
# scp this file as MN and TestON aren't necessarily the same vm
#FIXME: scp
@@ -1150,19 +1608,26 @@
#NOTE: must end in /
dst_dir = "~/packet_captures/"
for f in log_files:
- main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS1-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS2_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS2-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS3_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS3-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS4_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS4-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS5_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS5-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS6_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS6-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS7_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS7-"+f )
#std*.log's
@@ -1172,24 +1637,29 @@
#NOTE: must end in /
dst_dir = "~/packet_captures/"
for f in log_files:
- main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS1-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS2_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS2-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS3_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS3-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS4_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS4-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS5_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS5-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS6_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS6-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS7_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS7-"+f )
-
-
#sleep so scp can finish
time.sleep(10)
main.step("Packing and rotating pcap archives")
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
index 0a8bd57..5b97b66 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,2,8,3,4,5,[6],7,8,4,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+ <testcases>1,2,8,3,4,5,[6],8,7,4,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
<cellName>HA</cellName>
</ENV>
@@ -28,7 +28,7 @@
<port7>6633</port7>
</CTRL>
<TESTONUSER>admin</TESTONUSER>
- <TESTONIP>10.128.30.10</TESTONIP>
+ <TESTONIP>10.128.30.9</TESTONIP>
<PING>
<source1>h8</source1>
<source2>h9</source2>
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
index 2af775d..3fbc29d 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -82,7 +82,7 @@
cell_result = main.ONOSbench.set_cell(cell_name)
verify_result = main.ONOSbench.verify_cell()
- #FIXME:this is short term fix
+ #FIXME:this is short term fix
main.log.report("Removing raft logs")
main.ONOSbench.onos_remove_raft_logs()
main.log.report("Uninstalling ONOS")
@@ -145,29 +145,32 @@
main.step("Checking if ONOS is up yet")
#TODO: Refactor
# check bundle:list?
- onos1_isup = main.ONOSbench.isup(ONOS1_ip)
- if not onos1_isup:
- main.log.report("ONOS1 didn't start!")
- onos2_isup = main.ONOSbench.isup(ONOS2_ip)
- if not onos2_isup:
- main.log.report("ONOS2 didn't start!")
- onos3_isup = main.ONOSbench.isup(ONOS3_ip)
- if not onos3_isup:
- main.log.report("ONOS3 didn't start!")
- onos4_isup = main.ONOSbench.isup(ONOS4_ip)
- if not onos4_isup:
- main.log.report("ONOS4 didn't start!")
- onos5_isup = main.ONOSbench.isup(ONOS5_ip)
- if not onos5_isup:
- main.log.report("ONOS5 didn't start!")
- onos6_isup = main.ONOSbench.isup(ONOS6_ip)
- if not onos6_isup:
- main.log.report("ONOS6 didn't start!")
- onos7_isup = main.ONOSbench.isup(ONOS7_ip)
- if not onos7_isup:
- main.log.report("ONOS7 didn't start!")
- onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
- and onos4_isup and onos5_isup and onos6_isup and onos7_isup
+ for i in range(2):
+ onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+ if not onos1_isup:
+ main.log.report("ONOS1 didn't start!")
+ onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+ if not onos2_isup:
+ main.log.report("ONOS2 didn't start!")
+ onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+ if not onos3_isup:
+ main.log.report("ONOS3 didn't start!")
+ onos4_isup = main.ONOSbench.isup(ONOS4_ip)
+ if not onos4_isup:
+ main.log.report("ONOS4 didn't start!")
+ onos5_isup = main.ONOSbench.isup(ONOS5_ip)
+ if not onos5_isup:
+ main.log.report("ONOS5 didn't start!")
+ onos6_isup = main.ONOSbench.isup(ONOS6_ip)
+ if not onos6_isup:
+ main.log.report("ONOS6 didn't start!")
+ onos7_isup = main.ONOSbench.isup(ONOS7_ip)
+ if not onos7_isup:
+ main.log.report("ONOS7 didn't start!")
+ onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
+ and onos4_isup and onos5_isup and onos6_isup and onos7_isup
+ if onos_isup_result == main.TRUE:
+ break
# TODO: if it becomes an issue, we can retry this step a few times
@@ -197,9 +200,9 @@
onfail="Test startup NOT successful")
- #if case1_result==main.FALSE:
- # main.cleanup()
- # main.exit()
+ if case1_result==main.FALSE:
+ main.cleanup()
+ main.exit()
def CASE2(self,main) :
'''
@@ -209,25 +212,6 @@
import json
import re
-
- '''
- ONOS1_ip = main.params['CTRL']['ip1']
- ONOS1_port = main.params['CTRL']['port1']
- ONOS2_ip = main.params['CTRL']['ip2']
- ONOS2_port = main.params['CTRL']['port2']
- ONOS3_ip = main.params['CTRL']['ip3']
- ONOS3_port = main.params['CTRL']['port3']
- ONOS4_ip = main.params['CTRL']['ip4']
- ONOS4_port = main.params['CTRL']['port4']
- ONOS5_ip = main.params['CTRL']['ip5']
- ONOS5_port = main.params['CTRL']['port5']
- ONOS6_ip = main.params['CTRL']['ip6']
- ONOS6_port = main.params['CTRL']['port6']
- ONOS7_ip = main.params['CTRL']['ip7']
- ONOS7_port = main.params['CTRL']['port7']
- '''
-
-
main.log.report("Assigning switches to controllers")
main.case("Assigning Controllers")
main.step("Assign switches to controllers")
@@ -265,8 +249,217 @@
onpass="Switch mastership assigned correctly",
onfail="Switches not assigned correctly to controllers")
- #TODO: If assign roles is working reliably then manually
- # assign mastership to the controller we want
+ #Manually assign mastership to the controller we want
+ role_call = main.TRUE
+ role_check = main.TRUE
+
+ device_id = main.ONOScli1.get_device("1000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+ if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("2800")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+ if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("2000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+ if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+ if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("5000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+ if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+ if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3004")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS4_ip)
+ if ONOS4_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3008")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3009")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3010")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3011")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3012")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3013")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3014")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3015")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3016")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3017")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6007")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS6_ip)
+ if ONOS6_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6018")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6019")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6020")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6021")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6022")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6023")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6024")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6025")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6026")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6027")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ utilities.assert_equals(expect = main.TRUE,actual=role_call,
+ onpass="Re-assigned switch mastership to designated controller",
+ onfail="Something wrong with device_role calls")
+
+ utilities.assert_equals(expect = main.TRUE,actual=role_check,
+ onpass="Switches were successfully reassigned to designated controller",
+ onfail="Switches were not successfully reassigned")
+ mastership_check = mastership_check and role_call and role_check
+ utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch mastership")
def CASE3(self,main) :
@@ -283,6 +476,16 @@
main.step("Discovering Hosts( Via pingall for now)")
#FIXME: Once we have a host discovery mechanism, use that instead
+ #install onos-app-fwd
+ main.log.info("Install reactive forwarding app")
+ main.ONOScli1.feature_install("onos-app-fwd")
+ main.ONOScli2.feature_install("onos-app-fwd")
+ main.ONOScli3.feature_install("onos-app-fwd")
+ main.ONOScli4.feature_install("onos-app-fwd")
+ main.ONOScli5.feature_install("onos-app-fwd")
+ main.ONOScli6.feature_install("onos-app-fwd")
+ main.ONOScli7.feature_install("onos-app-fwd")
+
#REACTIVE FWD test
ping_result = main.FALSE
time1 = time.time()
@@ -304,7 +507,7 @@
#TODO: move the host numbers to params
import json
intents_json= json.loads(main.ONOScli1.hosts())
- intent_add_result = main.FALSE
+ intent_add_result = True
for i in range(8,18):
main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
@@ -314,7 +517,10 @@
host1_id = main.ONOScli1.get_host(host1)['id']
host2_id = main.ONOScli1.get_host(host2)['id']
tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
- intent_add_result = intent_add_result and tmp_result
+ intent_add_result = bool(intent_add_result and tmp_result)
+ utilities.assert_equals(expect=True, actual=intent_add_result,
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch mastership")
#TODO Check if intents all exist in datastore
#NOTE: Do we need to print this once the test is working?
#main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
@@ -360,6 +566,25 @@
main.step("Get the Mastership of each switch from each controller")
global mastership_state
+ mastership_state = []
+
+ #Assert that each device has a master
+ ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+ ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+ ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+ ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+ ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+ ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+ ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+ roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+ ONOS3_master_not_null and ONOS4_master_not_null and\
+ ONOS5_master_not_null and ONOS6_master_not_null and\
+ ONOS7_master_not_null
+ utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+ onpass="Each device has a master",
+ onfail="Some devices don't have a master assigned")
+
+
ONOS1_mastership = main.ONOScli1.roles()
ONOS2_mastership = main.ONOScli2.roles()
ONOS3_mastership = main.ONOScli3.roles()
@@ -416,6 +641,7 @@
main.step("Get the intents from each controller")
global intent_state
+ intent_state = []
ONOS1_intents = main.ONOScli1.intents( json_format=True )
ONOS2_intents = main.ONOScli2.intents( json_format=True )
ONOS3_intents = main.ONOScli3.intents( json_format=True )
@@ -470,6 +696,7 @@
main.step("Get the flows from each controller")
global flow_state
+ flow_state = []
ONOS1_flows = main.ONOScli1.flows( json_format=True )
ONOS2_flows = main.ONOScli2.flows( json_format=True )
ONOS3_flows = main.ONOScli3.flows( json_format=True )
@@ -527,7 +754,7 @@
global flows
flows=[]
for i in range(1,29):
- flows.append(main.Mininet2.get_flowTable("s"+str(i),1.0))
+ flows.append(main.Mininet2.get_flowTable(1.3, "s"+str(i)))
#TODO: Compare switch flow tables with ONOS flow tables
@@ -578,7 +805,6 @@
devices.append( main.ONOScli5.devices() )
devices.append( main.ONOScli6.devices() )
devices.append( main.ONOScli7.devices() )
- '''
hosts = []
hosts.append( main.ONOScli1.hosts() )
hosts.append( main.ONOScli2.hosts() )
@@ -587,7 +813,6 @@
hosts.append( main.ONOScli5.hosts() )
hosts.append( main.ONOScli6.hosts() )
hosts.append( main.ONOScli7.hosts() )
- '''
ports = []
ports.append( main.ONOScli1.ports() )
ports.append( main.ONOScli2.ports() )
@@ -604,6 +829,91 @@
links.append( main.ONOScli5.links() )
links.append( main.ONOScli6.links() )
links.append( main.ONOScli7.links() )
+ clusters = []
+ clusters.append( main.ONOScli1.clusters() )
+ clusters.append( main.ONOScli2.clusters() )
+ clusters.append( main.ONOScli3.clusters() )
+ clusters.append( main.ONOScli4.clusters() )
+ clusters.append( main.ONOScli5.clusters() )
+ clusters.append( main.ONOScli6.clusters() )
+ clusters.append( main.ONOScli7.clusters() )
+ paths = []
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+ paths.append( temp_topo.get('paths', False) )
+
+ #Compare json objects for hosts, dataplane clusters and paths
+
+ #hosts
+ consistent_hosts_result = main.TRUE
+ for controller in range( len( hosts ) ):
+ if not "Error" in hosts[controller]:
+ if hosts[controller] == hosts[0]:
+ continue
+ else:#hosts not consistent
+ main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ main.log.warn( repr( hosts[controller] ) )
+ consistent_hosts_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+ consistent_hosts_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+ onpass="Hosts view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of hosts")
+
+ #Strongly connected clusters of devices
+ consistent_clusters_result = main.TRUE
+ for controller in range( len( clusters ) ):
+ if not "Error" in clusters[controller]:
+ if clusters[controller] == clusters[0]:
+ continue
+ else:#clusters not consistent
+ main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_clusters_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+ consistent_clusters_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+ onpass="Clusters view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of clusters")
+ num_clusters = len(json.loads(clusters[0])) #there should always only be one cluster
+ utilities.assert_equals(expect = 1, actual = num_clusters,
+ onpass="ONOS shows 1 SCC",
+ onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+ #paths
+ consistent_paths_result = main.TRUE
+ for controller in range( len( paths ) ):
+ if not "Error" in paths[controller]:
+ if paths[controller] == paths[0]:
+ continue
+ else:#paths not consistent
+ main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_paths_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+ consistent_paths_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+ onpass="Paths count is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different counts of paths")
main.step("Comparing ONOS topology to MN")
@@ -639,14 +949,16 @@
ports_results = ports_results and current_ports_result
links_results = links_results and current_links_result
- topo_result = devices_results and ports_results and links_results
+ topo_result = devices_results and ports_results and links_results\
+ and consistent_hosts_result and consistent_clusters_result\
+ and consistent_paths_result
utilities.assert_equals(expect=main.TRUE, actual=topo_result,
onpass="Topology Check Test successful",
onfail="Topology Check Test NOT successful")
final_assert = main.TRUE
final_assert = final_assert and topo_result and flow_check \
- and intent_check and consistent_mastership
+ and intent_check and consistent_mastership and roles_not_null
utilities.assert_equals(expect=main.TRUE, actual=final_assert,
onpass="State check successful",
onfail="State check NOT successful")
@@ -656,11 +968,14 @@
'''
The Failure case.
'''
+ import time
main.log.report("Killing 3 ONOS nodes")
main.log.case("Restart minority of ONOS nodes")
#TODO: Randomize these nodes
main.ONOSbench.onos_kill(ONOS1_ip)
+ time.sleep(10)
main.ONOSbench.onos_kill(ONOS2_ip)
+ time.sleep(10)
main.ONOSbench.onos_kill(ONOS3_ip)
main.step("Checking if ONOS is up yet")
@@ -694,6 +1009,24 @@
import json
main.case("Running ONOS Constant State Tests")
+ #Assert that each device has a master
+ ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+ ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+ ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+ ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+ ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+ ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+ ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+ roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+ ONOS3_master_not_null and ONOS4_master_not_null and\
+ ONOS5_master_not_null and ONOS6_master_not_null and\
+ ONOS7_master_not_null
+ utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+ onpass="Each device has a master",
+ onfail="Some devices don't have a master assigned")
+
+
+
main.step("Check if switch roles are consistent across all nodes")
ONOS1_mastership = main.ONOScli1.roles()
ONOS2_mastership = main.ONOScli2.roles()
@@ -702,20 +1035,6 @@
ONOS5_mastership = main.ONOScli5.roles()
ONOS6_mastership = main.ONOScli6.roles()
ONOS7_mastership = main.ONOScli7.roles()
- print type(ONOS1_mastership)
- print ONOS1_mastership
- print type(ONOS2_mastership)
- print ONOS2_mastership
- print type(ONOS3_mastership)
- print ONOS3_mastership
- print type(ONOS4_mastership)
- print ONOS4_mastership
- print type(ONOS5_mastership)
- print ONOS5_mastership
- print type(ONOS6_mastership)
- print ONOS6_mastership
- print type(ONOS7_mastership)
- print ONOS7_mastership
#print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
if "Error" in ONOS1_mastership or not ONOS1_mastership\
or "Error" in ONOS2_mastership or not ONOS2_mastership\
@@ -739,7 +1058,6 @@
and ONOS1_mastership == ONOS5_mastership\
and ONOS1_mastership == ONOS6_mastership\
and ONOS1_mastership == ONOS7_mastership:
- #mastership_state = ONOS1_mastership
consistent_mastership = main.TRUE
main.log.report("Switch roles are consistent across all ONOS nodes")
else:
@@ -822,25 +1140,35 @@
intent_check = main.TRUE
main.log.report("Intents are consistent across all ONOS nodes")
else:
- main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
+ main.log.warn("ONOS1 intents: ")
+ print json.dumps(json.loads(ONOS1_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS2 intents: ")
+ print json.dumps(json.loads(ONOS2_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS3 intents: ")
+ print json.dumps(json.loads(ONOS3_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS4 intents: ")
+ print json.dumps(json.loads(ONOS4_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS5 intents: ")
+ print json.dumps(json.loads(ONOS5_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS6 intents: ")
+ print json.dumps(json.loads(ONOS6_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS7 intents: ")
+ print json.dumps(json.loads(ONOS7_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
utilities.assert_equals(expect = main.TRUE,actual=intent_check,
onpass="Intents are consistent across all ONOS nodes",
onfail="ONOS nodes have different views of intents")
+ #NOTE: Hazelcast has no durability, so intents are lost
main.step("Compare current intents with intents before the failure")
+ #NOTE: this requires case 5 to pass for intent_state to be set.
+ # maybe we should stop the test if that fails?
if intent_state == ONOS1_intents:
same_intents = main.TRUE
main.log.report("Intents are consistent with before failure")
@@ -859,12 +1187,12 @@
flows2=[]
for i in range(28):
main.log.info("Checking flow table on s" + str(i+1))
- tmp_flows = main.Mininet2.get_flowTable("s"+str(i+1),1.0)
+ tmp_flows = main.Mininet2.get_flowTable(1.3, "s"+str(i+1))
flows2.append(tmp_flows)
- Flow_Tables = Flow_Tables and main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+ temp_result = main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+ Flow_Tables = Flow_Tables and temp_result
if Flow_Tables == main.FALSE:
main.log.info("Differences in flow table for switch: "+str(i+1))
- break
if Flow_Tables == main.TRUE:
main.log.report("No changes were found in the flow tables")
utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
@@ -880,7 +1208,7 @@
#NOTE: checkForLoss returns main.FALSE with 0% packet loss
for i in range(8,18):
main.log.info("Checking for a loss in pings along flow from s" + str(i))
- Loss_In_Pings = Loss_In_Pings or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
+ Loss_In_Pings = main.Mininet2.checkForLoss("/tmp/ping.h"+str(i)) or Loss_In_Pings
if Loss_In_Pings == main.TRUE:
main.log.info("Loss in ping detected")
elif Loss_In_Pings == main.ERROR:
@@ -894,7 +1222,7 @@
#TODO:add topology to this or leave as a seperate case?
- result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings)
+ result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings) and roles_not_null
result = int(result)
if result == main.TRUE:
main.log.report("Constant State Tests Passed")
@@ -936,87 +1264,175 @@
ports_results = main.TRUE
links_results = main.TRUE
topo_result = main.FALSE
- start_time = time.time()
elapsed = 0
count = 0
- while topo_result == main.FALSE and elapsed < 120:
+ main.step("Collecting topology information from ONOS")
+ start_time = time.time()
+ while topo_result == main.FALSE and elapsed < 60:
count = count + 1
- try:
- main.step("Collecting topology information from ONOS")
- devices = []
- devices.append( main.ONOScli1.devices() )
- devices.append( main.ONOScli2.devices() )
- devices.append( main.ONOScli3.devices() )
- devices.append( main.ONOScli4.devices() )
- devices.append( main.ONOScli5.devices() )
- devices.append( main.ONOScli6.devices() )
- devices.append( main.ONOScli7.devices() )
- '''
- hosts = []
- hosts.append( main.ONOScli1.hosts() )
- hosts.append( main.ONOScli2.hosts() )
- hosts.append( main.ONOScli3.hosts() )
- hosts.append( main.ONOScli4.hosts() )
- hosts.append( main.ONOScli5.hosts() )
- hosts.append( main.ONOScli6.hosts() )
- hosts.append( main.ONOScli7.hosts() )
- '''
- ports = []
- ports.append( main.ONOScli1.ports() )
- ports.append( main.ONOScli2.ports() )
- ports.append( main.ONOScli3.ports() )
- ports.append( main.ONOScli4.ports() )
- ports.append( main.ONOScli5.ports() )
- ports.append( main.ONOScli6.ports() )
- ports.append( main.ONOScli7.ports() )
- links = []
- links.append( main.ONOScli1.links() )
- links.append( main.ONOScli2.links() )
- links.append( main.ONOScli3.links() )
- links.append( main.ONOScli4.links() )
- links.append( main.ONOScli5.links() )
- links.append( main.ONOScli6.links() )
- links.append( main.ONOScli7.links() )
+ if count > 1:
+ MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+ cli_start = time.time()
+ devices = []
+ devices.append( main.ONOScli1.devices() )
+ devices.append( main.ONOScli2.devices() )
+ devices.append( main.ONOScli3.devices() )
+ devices.append( main.ONOScli4.devices() )
+ devices.append( main.ONOScli5.devices() )
+ devices.append( main.ONOScli6.devices() )
+ devices.append( main.ONOScli7.devices() )
+ hosts = []
+ hosts.append( main.ONOScli1.hosts() )
+ hosts.append( main.ONOScli2.hosts() )
+ hosts.append( main.ONOScli3.hosts() )
+ hosts.append( main.ONOScli4.hosts() )
+ hosts.append( main.ONOScli5.hosts() )
+ hosts.append( main.ONOScli6.hosts() )
+ hosts.append( main.ONOScli7.hosts() )
+ ports = []
+ ports.append( main.ONOScli1.ports() )
+ ports.append( main.ONOScli2.ports() )
+ ports.append( main.ONOScli3.ports() )
+ ports.append( main.ONOScli4.ports() )
+ ports.append( main.ONOScli5.ports() )
+ ports.append( main.ONOScli6.ports() )
+ ports.append( main.ONOScli7.ports() )
+ links = []
+ links.append( main.ONOScli1.links() )
+ links.append( main.ONOScli2.links() )
+ links.append( main.ONOScli3.links() )
+ links.append( main.ONOScli4.links() )
+ links.append( main.ONOScli5.links() )
+ links.append( main.ONOScli6.links() )
+ links.append( main.ONOScli7.links() )
+ clusters = []
+ clusters.append( main.ONOScli1.clusters() )
+ clusters.append( main.ONOScli2.clusters() )
+ clusters.append( main.ONOScli3.clusters() )
+ clusters.append( main.ONOScli4.clusters() )
+ clusters.append( main.ONOScli5.clusters() )
+ clusters.append( main.ONOScli6.clusters() )
+ clusters.append( main.ONOScli7.clusters() )
+ paths = []
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+ paths.append( temp_topo.get('paths', False) )
- for controller in range(7): #TODO parameterize the number of controllers
- if devices[controller] or not "Error" in devices[controller]:
- current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
- else:
- current_devices_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
- onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
- onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
- if ports[controller] or not "Error" in ports[controller]:
- current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
- else:
- current_ports_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
- onpass="ONOS"+str(int(controller+1))+" ports view is correct",
- onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+ elapsed = time.time() - start_time
+ cli_time = time.time() - cli_start
+ print "CLI time: " + str(cli_time)
- if links[controller] or not "Error" in links[controller]:
- current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
- else:
- current_links_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
- onpass="ONOS"+str(int(controller+1))+" links view is correct",
- onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
- except:
- main.log.error("something went wrong in topo comparison")
- main.log.warn( repr( devices ) )
- main.log.warn( repr( ports ) )
- main.log.warn( repr( links ) )
+ for controller in range(7): #TODO parameterize the number of controllers
+ if devices[controller] or not "Error" in devices[controller]:
+ current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+ else:
+ current_devices_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+ onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+ onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+ if ports[controller] or not "Error" in ports[controller]:
+ current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+ else:
+ current_ports_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+ onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+ onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+ if links[controller] or not "Error" in links[controller]:
+ current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+ else:
+ current_links_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+ onpass="ONOS"+str(int(controller+1))+" links view is correct",
+ onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
devices_results = devices_results and current_devices_result
ports_results = ports_results and current_ports_result
links_results = links_results and current_links_result
- topo_result = devices_results and ports_results and links_results
- elapsed = time.time() - start_time
- time_threshold = elapsed < 1
- topo_result = topo_result and time_threshold
- #TODO make sure this step is non-blocking. IE add a timeout
- main.log.report("Very crass estimate for topology discovery/convergence: " +\
+
+ #Compare json objects for hosts, dataplane clusters and paths
+
+ #hosts
+ consistent_hosts_result = main.TRUE
+ for controller in range( len( hosts ) ):
+ if not "Error" in hosts[controller]:
+ if hosts[controller] == hosts[0]:
+ continue
+ else:#hosts not consistent
+ main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ main.log.warn( repr( hosts[controller] ) )
+ consistent_hosts_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+ consistent_hosts_result = main.FALSE
+ if consistent_hosts_result == main.FALSE:
+ for controller in range( len( hosts ) ):
+ main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+ onpass="Hosts view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of hosts")
+
+ #Strongly connected clusters of devices
+ consistent_clusters_result = main.TRUE
+ for controller in range( len( clusters ) ):
+ if not "Error" in clusters[controller]:
+ if clusters[controller] == clusters[0]:
+ continue
+ else:#clusters not consistent
+ main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_clusters_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+ consistent_clusters_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+ onpass="Clusters view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of clusters")
+ num_clusters = len(json.loads(clusters[0])) #there should always only be one cluster
+ utilities.assert_equals(expect = 1, actual = num_clusters,
+ onpass="ONOS shows 1 SCC",
+ onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+ #paths
+ consistent_paths_result = main.TRUE
+ for controller in range( len( paths ) ):
+ if not "Error" in paths[controller]:
+ if paths[controller] == paths[0]:
+ continue
+ else:#paths not consistent
+ main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_paths_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+ consistent_paths_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+ onpass="Paths count is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different counts of paths")
+
+
+ topo_result = devices_results and ports_results and links_results\
+ and consistent_hosts_result and consistent_clusters_result and consistent_paths_result
+
+ topo_result = topo_result and int(count <= 2)
+ note = "note it takes about "+str( int(cli_time) )+" seconds for the test to make all the cli calls to fetch the topology from each ONOS instance"
+ main.log.report("Very crass estimate for topology discovery/convergence("+ str(note) + "): " +\
str(elapsed) + " seconds, " + str(count) +" tries" )
utilities.assert_equals(expect=main.TRUE, actual=topo_result,
onpass="Topology Check Test successful",
@@ -1085,13 +1501,18 @@
#TODO: Make this switch parameterizable
main.step("Kill s28 ")
main.log.report("Deleting s28")
- #FIXME: use new dynamic topo functions
main.Mininet1.del_switch("s28")
main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
time.sleep(switch_sleep)
+ device = main.ONOScli1.get_device(dpid="0028")
#Peek at the deleted switch
- main.log.warn(main.ONOScli1.get_device(dpid="0028"))
- #TODO do some sort of check here
+ main.log.warn( str(device) )
+ result = main.FALSE
+ if device and device['available'] == False:
+ result = main.TRUE
+ utilities.assert_equals(expect=main.TRUE,actual=result,
+ onpass="Kill switch succesful",
+ onfail="Failed to kill switch?")
def CASE12 (self, main) :
'''
@@ -1099,7 +1520,6 @@
'''
#NOTE: You should probably run a topology check after this
import time
- #FIXME: use new dynamic topo functions
description = "Adding a switch to ensure it is discovered correctly"
main.log.report(description)
main.case(description)
@@ -1121,9 +1541,15 @@
ip7=ONOS7_ip,port7=ONOS7_port)
main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
time.sleep(switch_sleep)
- #Peek at the added switch
- main.log.warn(main.ONOScli1.get_device(dpid="0028"))
- #TODO do some sort of check here
+ device = main.ONOScli1.get_device(dpid="0028")
+ #Peek at the deleted switch
+ main.log.warn( str(device) )
+ result = main.FALSE
+ if device and device['available'] == True:
+ result = main.TRUE
+ utilities.assert_equals(expect=main.TRUE,actual=result,
+ onpass="add switch succesful",
+ onfail="Failed to add switch?")
def CASE13 (self, main) :
'''
@@ -1137,8 +1563,26 @@
main.step("Killing tcpdumps")
main.Mininet2.stop_tcpdump()
+ main.step("Checking ONOS Logs for errors")
+ print "Checking logs for errors on ONOS1:"
+ print main.ONOSbench.check_logs(ONOS1_ip)
+ print "Checking logs for errors on ONOS2:"
+ print main.ONOSbench.check_logs(ONOS2_ip)
+ print "Checking logs for errors on ONOS3:"
+ print main.ONOSbench.check_logs(ONOS3_ip)
+ print "Checking logs for errors on ONOS4:"
+ print main.ONOSbench.check_logs(ONOS4_ip)
+ print "Checking logs for errors on ONOS5:"
+ print main.ONOSbench.check_logs(ONOS5_ip)
+ print "Checking logs for errors on ONOS6:"
+ print main.ONOSbench.check_logs(ONOS6_ip)
+ print "Checking logs for errors on ONOS7:"
+ print main.ONOSbench.check_logs(ONOS7_ip)
+
main.step("Copying MN pcap and ONOS log files to test station")
testname = main.TEST
+ teststation_user = main.params['TESTONUSER']
+ teststation_IP = main.params['TESTONIP']
#NOTE: MN Pcap file is being saved to ~/packet_captures
# scp this file as MN and TestON aren't necessarily the same vm
#FIXME: scp
@@ -1150,19 +1594,26 @@
#NOTE: must end in /
dst_dir = "~/packet_captures/"
for f in log_files:
- main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS1-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS2_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS2-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS3_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS3-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS4_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS4-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS5_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS5-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS6_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS6-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS7_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS7-"+f )
#std*.log's
@@ -1172,24 +1623,29 @@
#NOTE: must end in /
dst_dir = "~/packet_captures/"
for f in log_files:
- main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS1-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS2_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS2-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS3_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS3-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS4_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS4-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS5_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS5-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS6_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS6-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS7_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS7-"+f )
-
-
#sleep so scp can finish
time.sleep(10)
main.step("Packing and rotating pcap archives")
diff --git a/TestON/tests/HATestSanity/HATestSanity.params b/TestON/tests/HATestSanity/HATestSanity.params
index e1e75f9..5259a47 100644
--- a/TestON/tests/HATestSanity/HATestSanity.params
+++ b/TestON/tests/HATestSanity/HATestSanity.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,2,8,3,4,5,[6],7,8,4,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+ <testcases>1,2,8,3,4,5,[6],8,7,4,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
<cellName>HA</cellName>
</ENV>
@@ -28,7 +28,7 @@
<port7>6633</port7>
</CTRL>
<TESTONUSER>admin</TESTONUSER>
- <TESTONIP>10.128.30.10</TESTONIP>
+ <TESTONIP>10.128.30.9</TESTONIP>
<PING>
<source1>h8</source1>
<source2>h9</source2>
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
index 614d514..4e5b463 100644
--- a/TestON/tests/HATestSanity/HATestSanity.py
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -214,25 +214,6 @@
import json
import re
-
- '''
- ONOS1_ip = main.params['CTRL']['ip1']
- ONOS1_port = main.params['CTRL']['port1']
- ONOS2_ip = main.params['CTRL']['ip2']
- ONOS2_port = main.params['CTRL']['port2']
- ONOS3_ip = main.params['CTRL']['ip3']
- ONOS3_port = main.params['CTRL']['port3']
- ONOS4_ip = main.params['CTRL']['ip4']
- ONOS4_port = main.params['CTRL']['port4']
- ONOS5_ip = main.params['CTRL']['ip5']
- ONOS5_port = main.params['CTRL']['port5']
- ONOS6_ip = main.params['CTRL']['ip6']
- ONOS6_port = main.params['CTRL']['port6']
- ONOS7_ip = main.params['CTRL']['ip7']
- ONOS7_port = main.params['CTRL']['port7']
- '''
-
-
main.log.report("Assigning switches to controllers")
main.case("Assigning Controllers")
main.step("Assign switches to controllers")
@@ -270,8 +251,217 @@
onpass="Switch mastership assigned correctly",
onfail="Switches not assigned correctly to controllers")
- #TODO: If assign roles is working reliably then manually
- # assign mastership to the controller we want
+ #Manually assign mastership to the controller we want
+ role_call = main.TRUE
+ role_check = main.TRUE
+
+ device_id = main.ONOScli1.get_device("1000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+ if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("2800")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+ if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("2000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+ if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+ if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("5000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+ if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6000")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+ if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3004")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS4_ip)
+ if ONOS4_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3008")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3009")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3010")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3011")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3012")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3013")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3014")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3015")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3016")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("3017")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+ if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6007")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS6_ip)
+ if ONOS6_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6018")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6019")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6020")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6021")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6022")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6023")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6024")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6025")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6026")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ device_id = main.ONOScli1.get_device("6027")['id']
+ role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+ if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+ role_check = role_check and main.TRUE
+ else:
+ role_check = role_check and main.FALSE
+
+ utilities.assert_equals(expect = main.TRUE,actual=role_call,
+ onpass="Re-assigned switch mastership to designated controller",
+ onfail="Something wrong with device_role calls")
+
+ utilities.assert_equals(expect = main.TRUE,actual=role_check,
+ onpass="Switches were successfully reassigned to designated controller",
+ onfail="Switches were not successfully reassigned")
+ mastership_check = mastership_check and role_call and role_check
+ utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch mastership")
def CASE3(self,main) :
@@ -288,6 +478,16 @@
main.step("Discovering Hosts( Via pingall for now)")
#FIXME: Once we have a host discovery mechanism, use that instead
+ #install onos-app-fwd
+ main.log.info("Install reactive forwarding app")
+ main.ONOScli1.feature_install("onos-app-fwd")
+ main.ONOScli2.feature_install("onos-app-fwd")
+ main.ONOScli3.feature_install("onos-app-fwd")
+ main.ONOScli4.feature_install("onos-app-fwd")
+ main.ONOScli5.feature_install("onos-app-fwd")
+ main.ONOScli6.feature_install("onos-app-fwd")
+ main.ONOScli7.feature_install("onos-app-fwd")
+
#REACTIVE FWD test
ping_result = main.FALSE
time1 = time.time()
@@ -309,7 +509,7 @@
#TODO: move the host numbers to params
import json
intents_json= json.loads(main.ONOScli1.hosts())
- intent_add_result = main.FALSE
+ intent_add_result = True
for i in range(8,18):
main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
@@ -319,7 +519,10 @@
host1_id = main.ONOScli1.get_host(host1)['id']
host2_id = main.ONOScli1.get_host(host2)['id']
tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
- intent_add_result = intent_add_result and tmp_result
+ intent_add_result = bool(intent_add_result and tmp_result)
+ utilities.assert_equals(expect=True, actual=intent_add_result,
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch mastership")
#TODO Check if intents all exist in datastore
#NOTE: Do we need to print this once the test is working?
#main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
@@ -365,6 +568,25 @@
main.step("Get the Mastership of each switch from each controller")
global mastership_state
+ mastership_state = []
+
+ #Assert that each device has a master
+ ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+ ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+ ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+ ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+ ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+ ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+ ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+ roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+ ONOS3_master_not_null and ONOS4_master_not_null and\
+ ONOS5_master_not_null and ONOS6_master_not_null and\
+ ONOS7_master_not_null
+ utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+ onpass="Each device has a master",
+ onfail="Some devices don't have a master assigned")
+
+
ONOS1_mastership = main.ONOScli1.roles()
ONOS2_mastership = main.ONOScli2.roles()
ONOS3_mastership = main.ONOScli3.roles()
@@ -421,6 +643,7 @@
main.step("Get the intents from each controller")
global intent_state
+ intent_state = []
ONOS1_intents = main.ONOScli1.intents( json_format=True )
ONOS2_intents = main.ONOScli2.intents( json_format=True )
ONOS3_intents = main.ONOScli3.intents( json_format=True )
@@ -475,6 +698,7 @@
main.step("Get the flows from each controller")
global flow_state
+ flow_state = []
ONOS1_flows = main.ONOScli1.flows( json_format=True )
ONOS2_flows = main.ONOScli2.flows( json_format=True )
ONOS3_flows = main.ONOScli3.flows( json_format=True )
@@ -532,7 +756,7 @@
global flows
flows=[]
for i in range(1,29):
- flows.append(main.Mininet2.get_flowTable("s"+str(i),1.0))
+ flows.append(main.Mininet2.get_flowTable(1.3, "s"+str(i)))
#TODO: Compare switch flow tables with ONOS flow tables
@@ -583,7 +807,6 @@
devices.append( main.ONOScli5.devices() )
devices.append( main.ONOScli6.devices() )
devices.append( main.ONOScli7.devices() )
- '''
hosts = []
hosts.append( main.ONOScli1.hosts() )
hosts.append( main.ONOScli2.hosts() )
@@ -592,7 +815,6 @@
hosts.append( main.ONOScli5.hosts() )
hosts.append( main.ONOScli6.hosts() )
hosts.append( main.ONOScli7.hosts() )
- '''
ports = []
ports.append( main.ONOScli1.ports() )
ports.append( main.ONOScli2.ports() )
@@ -609,6 +831,91 @@
links.append( main.ONOScli5.links() )
links.append( main.ONOScli6.links() )
links.append( main.ONOScli7.links() )
+ clusters = []
+ clusters.append( main.ONOScli1.clusters() )
+ clusters.append( main.ONOScli2.clusters() )
+ clusters.append( main.ONOScli3.clusters() )
+ clusters.append( main.ONOScli4.clusters() )
+ clusters.append( main.ONOScli5.clusters() )
+ clusters.append( main.ONOScli6.clusters() )
+ clusters.append( main.ONOScli7.clusters() )
+ paths = []
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+ paths.append( temp_topo.get('paths', False) )
+
+ #Compare json objects for hosts, dataplane clusters and paths
+
+ #hosts
+ consistent_hosts_result = main.TRUE
+ for controller in range( len( hosts ) ):
+ if not "Error" in hosts[controller]:
+ if hosts[controller] == hosts[0]:
+ continue
+ else:#hosts not consistent
+ main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ main.log.warn( repr( hosts[controller] ) )
+ consistent_hosts_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+ consistent_hosts_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+ onpass="Hosts view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of hosts")
+
+ #Strongly connected clusters of devices
+ consistent_clusters_result = main.TRUE
+ for controller in range( len( clusters ) ):
+ if not "Error" in clusters[controller]:
+ if clusters[controller] == clusters[0]:
+ continue
+ else:#clusters not consistent
+ main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_clusters_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+ consistent_clusters_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+ onpass="Clusters view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of clusters")
+ num_clusters = len(json.loads(clusters[0])) #there should always only be one cluster
+ utilities.assert_equals(expect = 1, actual = num_clusters,
+ onpass="ONOS shows 1 SCC",
+ onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+ #paths
+ consistent_paths_result = main.TRUE
+ for controller in range( len( paths ) ):
+ if not "Error" in paths[controller]:
+ if paths[controller] == paths[0]:
+ continue
+ else:#paths not consistent
+ main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_paths_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+ consistent_paths_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+ onpass="Paths count is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different counts of paths")
main.step("Comparing ONOS topology to MN")
@@ -644,14 +951,16 @@
ports_results = ports_results and current_ports_result
links_results = links_results and current_links_result
- topo_result = devices_results and ports_results and links_results
+ topo_result = devices_results and ports_results and links_results\
+ and consistent_hosts_result and consistent_clusters_result\
+ and consistent_paths_result
utilities.assert_equals(expect=main.TRUE, actual=topo_result,
onpass="Topology Check Test successful",
onfail="Topology Check Test NOT successful")
final_assert = main.TRUE
final_assert = final_assert and topo_result and flow_check \
- and intent_check and consistent_mastership
+ and intent_check and consistent_mastership and roles_not_null
utilities.assert_equals(expect=main.TRUE, actual=final_assert,
onpass="State check successful",
onfail="State check NOT successful")
@@ -676,6 +985,24 @@
import json
main.case("Running ONOS Constant State Tests")
+ #Assert that each device has a master
+ ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+ ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+ ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+ ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+ ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+ ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+ ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+ roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+ ONOS3_master_not_null and ONOS4_master_not_null and\
+ ONOS5_master_not_null and ONOS6_master_not_null and\
+ ONOS7_master_not_null
+ utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+ onpass="Each device has a master",
+ onfail="Some devices don't have a master assigned")
+
+
+
main.step("Check if switch roles are consistent across all nodes")
ONOS1_mastership = main.ONOScli1.roles()
ONOS2_mastership = main.ONOScli2.roles()
@@ -707,7 +1034,6 @@
and ONOS1_mastership == ONOS5_mastership\
and ONOS1_mastership == ONOS6_mastership\
and ONOS1_mastership == ONOS7_mastership:
- #mastership_state = ONOS1_mastership
consistent_mastership = main.TRUE
main.log.report("Switch roles are consistent across all ONOS nodes")
else:
@@ -789,25 +1115,35 @@
intent_check = main.TRUE
main.log.report("Intents are consistent across all ONOS nodes")
else:
- main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
- main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents),
- sort_keys=True, indent=4, separators=(',', ': ')))
+ main.log.warn("ONOS1 intents: ")
+ print json.dumps(json.loads(ONOS1_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS2 intents: ")
+ print json.dumps(json.loads(ONOS2_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS3 intents: ")
+ print json.dumps(json.loads(ONOS3_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS4 intents: ")
+ print json.dumps(json.loads(ONOS4_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS5 intents: ")
+ print json.dumps(json.loads(ONOS5_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS6 intents: ")
+ print json.dumps(json.loads(ONOS6_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
+ main.log.warn("ONOS7 intents: ")
+ print json.dumps(json.loads(ONOS7_intents),
+ sort_keys=True, indent=4, separators=(',', ': '))
utilities.assert_equals(expect = main.TRUE,actual=intent_check,
onpass="Intents are consistent across all ONOS nodes",
onfail="ONOS nodes have different views of intents")
+ #NOTE: Hazelcast has no durability, so intents are lost
main.step("Compare current intents with intents before the failure")
+ #NOTE: this requires case 5 to pass for intent_state to be set.
+ # maybe we should stop the test if that fails?
if intent_state == ONOS1_intents:
same_intents = main.TRUE
main.log.report("Intents are consistent with before failure")
@@ -826,12 +1162,12 @@
flows2=[]
for i in range(28):
main.log.info("Checking flow table on s" + str(i+1))
- tmp_flows = main.Mininet2.get_flowTable("s"+str(i+1),1.0)
+ tmp_flows = main.Mininet2.get_flowTable(1.3, "s"+str(i+1))
flows2.append(tmp_flows)
- Flow_Tables = Flow_Tables and main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+ temp_result = main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+ Flow_Tables = Flow_Tables and temp_result
if Flow_Tables == main.FALSE:
main.log.info("Differences in flow table for switch: "+str(i+1))
- break
if Flow_Tables == main.TRUE:
main.log.report("No changes were found in the flow tables")
utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
@@ -847,7 +1183,7 @@
#NOTE: checkForLoss returns main.FALSE with 0% packet loss
for i in range(8,18):
main.log.info("Checking for a loss in pings along flow from s" + str(i))
- Loss_In_Pings = Loss_In_Pings or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
+ Loss_In_Pings = main.Mininet2.checkForLoss("/tmp/ping.h"+str(i)) or Loss_In_Pings
if Loss_In_Pings == main.TRUE:
main.log.info("Loss in ping detected")
elif Loss_In_Pings == main.ERROR:
@@ -861,7 +1197,7 @@
#TODO:add topology to this or leave as a seperate case?
- result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings)
+ result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings) and roles_not_null
result = int(result)
if result == main.TRUE:
main.log.report("Constant State Tests Passed")
@@ -903,89 +1239,173 @@
ports_results = main.TRUE
links_results = main.TRUE
topo_result = main.FALSE
- start_time = time.time()
elapsed = 0
count = 0
- while topo_result == main.FALSE and elapsed < 120:
- print "cond 1:" + str(topo_result == main.FALSE)
- print "cond 2:" + str(elapsed < 120)
+ main.step("Collecting topology information from ONOS")
+ start_time = time.time()
+ while topo_result == main.FALSE and elapsed < 60:
count = count + 1
- try:
- main.step("Collecting topology information from ONOS")
- devices = []
- devices.append( main.ONOScli1.devices() )
- devices.append( main.ONOScli2.devices() )
- devices.append( main.ONOScli3.devices() )
- devices.append( main.ONOScli4.devices() )
- devices.append( main.ONOScli5.devices() )
- devices.append( main.ONOScli6.devices() )
- devices.append( main.ONOScli7.devices() )
- '''
- hosts = []
- hosts.append( main.ONOScli1.hosts() )
- hosts.append( main.ONOScli2.hosts() )
- hosts.append( main.ONOScli3.hosts() )
- hosts.append( main.ONOScli4.hosts() )
- hosts.append( main.ONOScli5.hosts() )
- hosts.append( main.ONOScli6.hosts() )
- hosts.append( main.ONOScli7.hosts() )
- '''
- ports = []
- ports.append( main.ONOScli1.ports() )
- ports.append( main.ONOScli2.ports() )
- ports.append( main.ONOScli3.ports() )
- ports.append( main.ONOScli4.ports() )
- ports.append( main.ONOScli5.ports() )
- ports.append( main.ONOScli6.ports() )
- ports.append( main.ONOScli7.ports() )
- links = []
- links.append( main.ONOScli1.links() )
- links.append( main.ONOScli2.links() )
- links.append( main.ONOScli3.links() )
- links.append( main.ONOScli4.links() )
- links.append( main.ONOScli5.links() )
- links.append( main.ONOScli6.links() )
- links.append( main.ONOScli7.links() )
+ if count > 1:
+ MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+ cli_start = time.time()
+ devices = []
+ devices.append( main.ONOScli1.devices() )
+ devices.append( main.ONOScli2.devices() )
+ devices.append( main.ONOScli3.devices() )
+ devices.append( main.ONOScli4.devices() )
+ devices.append( main.ONOScli5.devices() )
+ devices.append( main.ONOScli6.devices() )
+ devices.append( main.ONOScli7.devices() )
+ hosts = []
+ hosts.append( main.ONOScli1.hosts() )
+ hosts.append( main.ONOScli2.hosts() )
+ hosts.append( main.ONOScli3.hosts() )
+ hosts.append( main.ONOScli4.hosts() )
+ hosts.append( main.ONOScli5.hosts() )
+ hosts.append( main.ONOScli6.hosts() )
+ hosts.append( main.ONOScli7.hosts() )
+ ports = []
+ ports.append( main.ONOScli1.ports() )
+ ports.append( main.ONOScli2.ports() )
+ ports.append( main.ONOScli3.ports() )
+ ports.append( main.ONOScli4.ports() )
+ ports.append( main.ONOScli5.ports() )
+ ports.append( main.ONOScli6.ports() )
+ ports.append( main.ONOScli7.ports() )
+ links = []
+ links.append( main.ONOScli1.links() )
+ links.append( main.ONOScli2.links() )
+ links.append( main.ONOScli3.links() )
+ links.append( main.ONOScli4.links() )
+ links.append( main.ONOScli5.links() )
+ links.append( main.ONOScli6.links() )
+ links.append( main.ONOScli7.links() )
+ clusters = []
+ clusters.append( main.ONOScli1.clusters() )
+ clusters.append( main.ONOScli2.clusters() )
+ clusters.append( main.ONOScli3.clusters() )
+ clusters.append( main.ONOScli4.clusters() )
+ clusters.append( main.ONOScli5.clusters() )
+ clusters.append( main.ONOScli6.clusters() )
+ clusters.append( main.ONOScli7.clusters() )
+ paths = []
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+ paths.append( temp_topo.get('paths', False) )
+ temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+ paths.append( temp_topo.get('paths', False) )
- for controller in range(7): #TODO parameterize the number of controllers
- if devices[controller] or not "Error" in devices[controller]:
- current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
- else:
- current_devices_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
- onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
- onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
- if ports[controller] or not "Error" in ports[controller]:
- current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
- else:
- current_ports_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
- onpass="ONOS"+str(int(controller+1))+" ports view is correct",
- onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+ elapsed = time.time() - start_time
+ cli_time = time.time() - cli_start
+ print "CLI time: " + str(cli_time)
- if links[controller] or not "Error" in links[controller]:
- current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
- else:
- current_links_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
- onpass="ONOS"+str(int(controller+1))+" links view is correct",
- onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
- except:
- main.log.error("something went wrong in topo comparison")
- main.log.warn( repr( devices ) )
- main.log.warn( repr( ports ) )
- main.log.warn( repr( links ) )
+ for controller in range(7): #TODO parameterize the number of controllers
+ if devices[controller] or not "Error" in devices[controller]:
+ current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+ else:
+ current_devices_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+ onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+ onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+ if ports[controller] or not "Error" in ports[controller]:
+ current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+ else:
+ current_ports_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+ onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+ onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+ if links[controller] or not "Error" in links[controller]:
+ current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+ else:
+ current_links_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+ onpass="ONOS"+str(int(controller+1))+" links view is correct",
+ onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
devices_results = devices_results and current_devices_result
ports_results = ports_results and current_ports_result
links_results = links_results and current_links_result
- topo_result = devices_results and ports_results and links_results
- elapsed = time.time() - start_time
- time_threshold = elapsed < 1
- topo_result = topo_result and time_threshold
- #TODO make sure this step is non-blocking. IE add a timeout
- main.log.report("Very crass estimate for topology discovery/convergence: " +\
+
+ #Compare json objects for hosts, dataplane clusters and paths
+
+ #hosts
+ consistent_hosts_result = main.TRUE
+ for controller in range( len( hosts ) ):
+ if not "Error" in hosts[controller]:
+ if hosts[controller] == hosts[0]:
+ continue
+ else:#hosts not consistent
+ main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ main.log.warn( repr( hosts[controller] ) )
+ consistent_hosts_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+ consistent_hosts_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+ onpass="Hosts view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of hosts")
+
+ #Strongly connected clusters of devices
+ consistent_clusters_result = main.TRUE
+ for controller in range( len( clusters ) ):
+ if not "Error" in clusters[controller]:
+ if clusters[controller] == clusters[0]:
+ continue
+ else:#clusters not consistent
+ main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_clusters_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+ consistent_clusters_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+ onpass="Clusters view is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of clusters")
+ num_clusters = len(json.loads(clusters[0])) #there should always only be one cluster
+ utilities.assert_equals(expect = 1, actual = num_clusters,
+ onpass="ONOS shows 1 SCC",
+ onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+ #paths
+ consistent_paths_result = main.TRUE
+ for controller in range( len( paths ) ):
+ if not "Error" in paths[controller]:
+ if paths[controller] == paths[0]:
+ continue
+ else:#paths not consistent
+ main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+ consistent_paths_result = main.FALSE
+
+ else:
+ main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+ consistent_paths_result = main.FALSE
+ main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+ utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+ onpass="Paths count is consistent across all ONOS nodes",
+ onfail="ONOS nodes have different counts of paths")
+
+
+ topo_result = devices_results and ports_results and links_results\
+ and consistent_hosts_result and consistent_clusters_result and consistent_paths_result
+
+ topo_result = topo_result and int(count <= 2)
+ note = "note it takes about "+str( int(cli_time) )+" seconds for the test to make all the cli calls to fetch the topology from each ONOS instance"
+ main.log.report("Very crass estimate for topology discovery/convergence("+ str(note) + "): " +\
str(elapsed) + " seconds, " + str(count) +" tries" )
utilities.assert_equals(expect=main.TRUE, actual=topo_result,
onpass="Topology Check Test successful",
@@ -1054,13 +1474,18 @@
#TODO: Make this switch parameterizable
main.step("Kill s28 ")
main.log.report("Deleting s28")
- #FIXME: use new dynamic topo functions
main.Mininet1.del_switch("s28")
main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
time.sleep(switch_sleep)
+ device = main.ONOScli1.get_device(dpid="0028")
#Peek at the deleted switch
- main.log.warn(main.ONOScli1.get_device(dpid="0028"))
- #TODO do some sort of check here
+ main.log.warn( str(device) )
+ result = main.FALSE
+ if device and device['available'] == False:
+ result = main.TRUE
+ utilities.assert_equals(expect=main.TRUE,actual=result,
+ onpass="Kill switch succesful",
+ onfail="Failed to kill switch?")
def CASE12 (self, main) :
'''
@@ -1068,7 +1493,6 @@
'''
#NOTE: You should probably run a topology check after this
import time
- #FIXME: use new dynamic topo functions
description = "Adding a switch to ensure it is discovered correctly"
main.log.report(description)
main.case(description)
@@ -1090,9 +1514,15 @@
ip7=ONOS7_ip,port7=ONOS7_port)
main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
time.sleep(switch_sleep)
- #Peek at the added switch
- main.log.warn(main.ONOScli1.get_device(dpid="0028"))
- #TODO do some sort of check here
+ device = main.ONOScli1.get_device(dpid="0028")
+ #Peek at the deleted switch
+ main.log.warn( str(device) )
+ result = main.FALSE
+ if device and device['available'] == True:
+ result = main.TRUE
+ utilities.assert_equals(expect=main.TRUE,actual=result,
+ onpass="add switch succesful",
+ onfail="Failed to add switch?")
def CASE13 (self, main) :
'''
@@ -1106,8 +1536,26 @@
main.step("Killing tcpdumps")
main.Mininet2.stop_tcpdump()
+ main.step("Checking ONOS Logs for errors")
+ print "Checking logs for errors on ONOS1:"
+ print main.ONOSbench.check_logs(ONOS1_ip)
+ print "Checking logs for errors on ONOS2:"
+ print main.ONOSbench.check_logs(ONOS2_ip)
+ print "Checking logs for errors on ONOS3:"
+ print main.ONOSbench.check_logs(ONOS3_ip)
+ print "Checking logs for errors on ONOS4:"
+ print main.ONOSbench.check_logs(ONOS4_ip)
+ print "Checking logs for errors on ONOS5:"
+ print main.ONOSbench.check_logs(ONOS5_ip)
+ print "Checking logs for errors on ONOS6:"
+ print main.ONOSbench.check_logs(ONOS6_ip)
+ print "Checking logs for errors on ONOS7:"
+ print main.ONOSbench.check_logs(ONOS7_ip)
+
main.step("Copying MN pcap and ONOS log files to test station")
testname = main.TEST
+ teststation_user = main.params['TESTONUSER']
+ teststation_IP = main.params['TESTONIP']
#NOTE: MN Pcap file is being saved to ~/packet_captures
# scp this file as MN and TestON aren't necessarily the same vm
#FIXME: scp
@@ -1119,19 +1567,26 @@
#NOTE: must end in /
dst_dir = "~/packet_captures/"
for f in log_files:
- main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS1-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS2_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS2-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS3_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS3-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS4_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS4-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS5_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS5-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS6_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS6-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS7_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS7-"+f )
#std*.log's
@@ -1141,24 +1596,29 @@
#NOTE: must end in /
dst_dir = "~/packet_captures/"
for f in log_files:
- main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS1-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS2_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS2-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS3_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS3-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS4_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS4-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS5_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS5-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS6_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS6-"+f )
- main.ONOSbench.secureCopy( "sdn", ONOS7_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS7-"+f )
-
-
#sleep so scp can finish
time.sleep(10)
main.step("Packing and rotating pcap archives")
@@ -1169,3 +1629,22 @@
utilities.assert_equals(expect=main.TRUE, actual=main.TRUE,
onpass="Test cleanup successful",
onfail="Test cleanup NOT successful")
+ def CASE14 ( self, main ) :
+ '''
+ start election app on all onos nodes
+ '''
+ #install app on onos 1
+ #wait for election
+ #check for leader
+ #install on other nodes
+ #check for leader. Should be onos1 and each app shows same leader
+ #
+
+
+
+
+
+ #Next Case
+ #add to reboot case?
+ #check for conistent leader
+ #new leader should have been elected
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.params b/TestON/tests/IntentPerfNext/IntentPerfNext.params
index 87e7998..cdf0766 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.params
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,4</testcases>
+ <testcases>1,5,2,3</testcases>
<ENV>
<cellName>intent_perf_test</cellName>
@@ -19,6 +19,10 @@
<port2>6633</port2>
<ip3>10.128.174.3</ip3>
<port3>6633</port3>
+ <ip4>10.128.174.4</ip4>
+ <ip5>10.128.174.5</ip5>
+ <ip6>10.128.174.6</ip6>
+ <ip7>10.128.174.7</ip7>
</CTRL>
<MN>
@@ -32,8 +36,13 @@
<TEST>
#Number of times to iterate each case
- <numIter>3</numIter>
- <batchIntentSize>50</batchIntentSize>
+ <numIter>15</numIter>
+ <numIgnore>3</numIgnore>
+ <numSwitch>9</numSwitch>
+ <batchThresholdMin>0</batchThresholdMin>
+ <batchThresholdMax>1000</batchThresholdMax>
+ <batchIntentSize>200</batchIntentSize>
+ <numMult>1</numMult>
</TEST>
<JSON>
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.py b/TestON/tests/IntentPerfNext/IntentPerfNext.py
index dc9fadc..c212e9e 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.py
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.py
@@ -14,6 +14,8 @@
'''
import time
+ global cluster_count
+ cluster_count = 1
cell_name = main.params['ENV']['cellName']
@@ -23,7 +25,19 @@
ONOS1_ip = main.params['CTRL']['ip1']
ONOS2_ip = main.params['CTRL']['ip2']
ONOS3_ip = main.params['CTRL']['ip3']
-
+ ONOS4_ip = main.params['CTRL']['ip4']
+ ONOS5_ip = main.params['CTRL']['ip5']
+ ONOS6_ip = main.params['CTRL']['ip6']
+ ONOS7_ip = main.params['CTRL']['ip7']
+
+ main.ONOSbench.onos_uninstall(node_ip=ONOS1_ip)
+ main.ONOSbench.onos_uninstall(node_ip=ONOS2_ip)
+ main.ONOSbench.onos_uninstall(node_ip=ONOS3_ip)
+ main.ONOSbench.onos_uninstall(node_ip=ONOS4_ip)
+ main.ONOSbench.onos_uninstall(node_ip=ONOS5_ip)
+ main.ONOSbench.onos_uninstall(node_ip=ONOS6_ip)
+ main.ONOSbench.onos_uninstall(node_ip=ONOS7_ip)
+
MN1_ip = main.params['MN']['ip1']
BENCH_ip = main.params['BENCH']['ip']
@@ -33,12 +47,16 @@
cell_file_result = main.ONOSbench.create_cell_file(
BENCH_ip, cell_name, MN1_ip,
"onos-core,onos-app-metrics,onos-gui",
- ONOS1_ip, ONOS2_ip, ONOS3_ip)
+ #ONOS1_ip, ONOS2_ip, ONOS3_ip)
+ ONOS1_ip)
main.step("Applying cell file to environment")
cell_apply_result = main.ONOSbench.set_cell(cell_name)
verify_cell_result = main.ONOSbench.verify_cell()
+ main.step("Removing raft logs")
+ main.ONOSbench.onos_remove_raft_logs()
+
main.step("Git checkout and pull "+checkout_branch)
if git_pull == 'on':
checkout_result = \
@@ -62,27 +80,27 @@
main.step("Installing ONOS package")
install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
- install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
- install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
+ #install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
+ #install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
main.step("Set cell for ONOScli env")
main.ONOS1cli.set_cell(cell_name)
- main.ONOS2cli.set_cell(cell_name)
- main.ONOS3cli.set_cell(cell_name)
+ #main.ONOS2cli.set_cell(cell_name)
+ #main.ONOS3cli.set_cell(cell_name)
time.sleep(5)
main.step("Start onos cli")
cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
- cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
- cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
+ #cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
+ #cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
utilities.assert_equals(expect=main.TRUE,
actual = cell_file_result and cell_apply_result and\
verify_cell_result and checkout_result and\
pull_result and build_result and\
- install1_result and install2_result and\
- install3_result,
+ install1_result, #and install2_result and\
+ #install3_result,
onpass="ONOS started successfully",
onfail="Failed to start ONOS")
@@ -95,6 +113,7 @@
import json
import requests
import os
+ import numpy
ONOS1_ip = main.params['CTRL']['ip1']
ONOS2_ip = main.params['CTRL']['ip2']
@@ -105,6 +124,7 @@
#number of iterations of case
num_iter = main.params['TEST']['numIter']
+ num_ignore = int(main.params['TEST']['numIgnore'])
#Timestamp keys for json metrics output
submit_time = main.params['JSON']['submittedTime']
@@ -128,6 +148,8 @@
time.sleep(10)
+ main.log.report("Single intent add latency test")
+
devices_json_str = main.ONOS1cli.devices()
devices_json_obj = json.loads(devices_json_str)
device_id_list = []
@@ -183,10 +205,10 @@
intent_install_lat_3 ) / 3
main.log.info("Intent add latency avg for iteration "+str(i)+
- ": "+str(intent_install_lat_avg))
+ ": "+str(intent_install_lat_avg)+" ms")
if intent_install_lat_avg > 0.0 and \
- intent_install_lat_avg < 1000:
+ intent_install_lat_avg < 1000 and i > num_ignore:
intent_add_lat_list.append(intent_install_lat_avg)
else:
main.log.info("Intent add latency exceeded "+
@@ -211,16 +233,14 @@
time.sleep(5)
- intent_add_lat_min = min(intent_add_lat_list)
- intent_add_lat_max = max(intent_add_lat_list)
intent_add_lat_avg = sum(intent_add_lat_list) /\
len(intent_add_lat_list)
+ intent_add_lat_std = \
+ round(numpy.std(intent_add_lat_list),1)
#END ITERATION FOR LOOP
main.log.report("Single intent add latency - \n"+
- "Min: "+str(intent_add_lat_min)+" ms\n"+
- "Max: "+str(intent_add_lat_max)+" ms\n"+
- "Avg: "+str(intent_add_lat_avg)+" ms\n")
-
+ "Avg: "+str(intent_add_lat_avg)+" ms\n"+
+ "Std Deviation: "+str(intent_add_lat_std)+" ms")
def CASE3(self, main):
'''
@@ -230,6 +250,7 @@
import json
import requests
import os
+ import numpy
ONOS1_ip = main.params['CTRL']['ip1']
ONOS2_ip = main.params['CTRL']['ip2']
@@ -240,6 +261,7 @@
#number of iterations of case
num_iter = main.params['TEST']['numIter']
+ num_ignore = int(main.params['TEST']['numIgnore'])
#Timestamp keys for json metrics output
submit_time = main.params['JSON']['submittedTime']
@@ -264,9 +286,12 @@
for i in range(0, int(num_iter)):
#add_point_intent(ingr_device, ingr_port,
# egr_device, egr_port)
- main.ONOS1cli.add_point_intent(
- device_id_list[0]+"/2", device_id_list[4]+"/1")
-
+ if len(device_id_list) > 0:
+ main.ONOS1cli.add_point_intent(
+ device_id_list[0]+"/2", device_id_list[4]+"/1")
+ else:
+ main.log.info("Failed to fetch devices from ONOS")
+
time.sleep(5)
intents_str = main.ONOS1cli.intents(json_format=True)
@@ -324,7 +349,7 @@
str(i)+": "+str(intent_reroute_lat_avg))
if intent_reroute_lat_avg > 0.0 and \
- intent_reroute_lat_avg < 1000:
+ intent_reroute_lat_avg < 1000 and i > num_ignore:
intent_reroute_lat_list.append(intent_reroute_lat_avg)
else:
main.log.info("Intent reroute latency exceeded "+
@@ -342,41 +367,127 @@
# determine what timestsamp to get
main.ONOS1cli.remove_intent(intent_id)
- #TODO: Report framework
- print intent_reroute_lat_list
-
-
+ main.log.info("Bringing Mininet interface up for next "+
+ "iteration")
+ main.Mininet1.handle.sendline(
+ "sh ifconfig s2-eth3 up")
+
+ intent_reroute_lat_avg = sum(intent_reroute_lat_list) /\
+ len(intent_reroute_lat_list)
+ intent_reroute_lat_std = \
+ round(numpy.std(intent_reroute_lat_list),1)
+ #END ITERATION FOR LOOP
+ main.log.report("Single intent reroute latency - \n"+
+ "Avg: "+str(intent_reroute_lat_avg)+" ms\n"+
+ "Std Deviation: "+str(intent_reroute_lat_std)+" ms")
+
def CASE4(self, main):
import time
import json
import requests
import os
+ import numpy
ONOS1_ip = main.params['CTRL']['ip1']
ONOS2_ip = main.params['CTRL']['ip2']
ONOS3_ip = main.params['CTRL']['ip3']
+ ONOS4_ip = main.params['CTRL']['ip4']
+ ONOS5_ip = main.params['CTRL']['ip5']
+ ONOS6_ip = main.params['CTRL']['ip6']
+ ONOS7_ip = main.params['CTRL']['ip7']
+
+ ONOS_ip_list = []
+ for i in range(1, 8):
+ ONOS_ip_list.append(main.params['CTRL']['ip'+str(i)])
+
ONOS_user = main.params['CTRL']['user']
default_sw_port = main.params['CTRL']['port1']
batch_intent_size = main.params['TEST']['batchIntentSize']
+ batch_thresh_min = int(main.params['TEST']['batchThresholdMin'])
+ batch_thresh_max = int(main.params['TEST']['batchThresholdMax'])
#number of iterations of case
num_iter = main.params['TEST']['numIter']
+ num_ignore = int(main.params['TEST']['numIgnore'])
+ num_switch = int(main.params['TEST']['numSwitch'])
+ n_thread = main.params['TEST']['numMult']
+ #n_thread = 105
+
+ #*****
+ global cluster_count
+ #*****
+
+ #Switch assignment NOTE: hardcoded
+ if cluster_count == 1:
+ for i in range(1, num_switch+1):
+ main.Mininet1.assign_sw_controller(
+ sw=str(i),
+ ip1=ONOS1_ip,
+ port1=default_sw_port)
+ if cluster_count == 3:
+ for i in range(1, 3):
+ main.Mininet1.assign_sw_controller(
+ sw=str(i),
+ ip1=ONOS1_ip,
+ port1=default_sw_port)
+ for i in range(3, 6):
+ main.Mininet1.assign_sw_controller(
+ sw=str(i),
+ ip1=ONOS2_ip,
+ port1=default_sw_port)
+ for i in range(6, 9):
+ main.Mininet1.assign_sw_controller(
+ sw=str(i),
+ ip1=ONOS3_ip,
+ port1=default_sw_port)
+ if cluster_count == 5:
+ main.Mininet1.assign_sw_controller(
+ sw="1",
+ ip1=ONOS1_ip,
+ port1=default_sw_port)
+ main.Mininet1.assign_sw_controller(
+ sw="2",
+ ip1=ONOS2_ip,
+ port1=default_sw_port)
+ for i in range(3, 6):
+ main.Mininet1.assign_sw_controller(
+ sw=str(i),
+ ip1=ONOS3_ip,
+ port1=default_sw_port)
+ main.Mininet1.assign_sw_controller(
+ sw="6",
+ ip1=ONOS4_ip,
+ port1=default_sw_port)
+ main.Mininet1.assign_sw_controller(
+ sw="7",
+ ip1=ONOS5_ip,
+ port1=default_sw_port)
+ main.Mininet1.assign_sw_controller(
+ sw="8",
+ ip1=ONOS5_ip,
+ port1=default_sw_port)
- main.Mininet1.assign_sw_controller(
- sw="1", ip1=ONOS1_ip,port1=default_sw_port)
- main.Mininet1.assign_sw_controller(
- sw="2", ip1=ONOS2_ip,port1=default_sw_port)
- main.Mininet1.assign_sw_controller(
- sw="3", ip1=ONOS2_ip,port1=default_sw_port)
- main.Mininet1.assign_sw_controller(
- sw="4", ip1=ONOS2_ip,port1=default_sw_port)
- main.Mininet1.assign_sw_controller(
- sw="5", ip1=ONOS3_ip,port1=default_sw_port)
+ if cluster_count == 7:
+ for i in range(1,9):
+ if i < 8:
+ main.Mininet1.assign_sw_controller(
+ sw=str(i),
+ ip1=ONOS_ip_list[i-1],
+ port1=default_sw_port)
+ elif i >= 8:
+ main.Mininet1.assign_sw_controller(
+ sw=str(i),
+ ip1=ONOS_ip_list[6],
+ port1=default_sw_port)
+
+ time.sleep(30)
main.log.report("Batch intent installation test of "+
- str(batch_intent_size) +" intents")
+ batch_intent_size +" intents")
+
+ batch_result_list = []
main.log.info("Getting list of available devices")
device_id_list = []
@@ -385,14 +496,223 @@
for device in json_obj:
device_id_list.append(device['id'])
+ batch_install_lat = []
+ batch_withdraw_lat = []
+ sleep_time = 10
+
+ base_dir = "/tmp/"
+ max_install_lat = []
+
for i in range(0, int(num_iter)):
- main.log.info("Pushing "+batch_intent_size+" intents")
-
- batch_result = main.ONOS1cli.push_test_intents(
- "of:0000000000000001/1", "of:0000000000000005/2",
- batch_intent_size)
+ main.log.info("Pushing "+
+ str(int(batch_intent_size)*int(n_thread))+
+ " intents. Iteration "+str(i))
+
+ for node in range(1, cluster_count+1):
+ save_dir = base_dir + "batch_intent_"+str(node)+".txt"
+ main.ONOSbench.push_test_intents_shell(
+ "of:0000000000000001/"+str(node),
+ "of:0000000000000008/"+str(node),
+ int(batch_intent_size),
+ save_dir, ONOS_ip_list[node-1],
+ num_mult=n_thread, app_id=node)
+
+ #Wait sufficient time for intents to start
+ #installing
+
+ time.sleep(sleep_time)
+ print sleep_time
+
+ intent = ""
+ counter = 300
+ while len(intent) > 0 and counter > 0:
+ main.ONOS1cli.handle.sendline(
+ "intents | wc -l")
+ main.ONOS1cli.handle.expect(
+ "intents | wc -l")
+ main.ONOS1cli.handle.expect(
+ "onos>")
+ intent_temp = main.ONOS1cli.handle.before()
+ print intent_temp
+
+ intent = main.ONOS1cli.intents()
+ intent = json.loads(intent)
+ counter = counter-1
+ time.sleep(1)
time.sleep(5)
+ for node in range(1, cluster_count+1):
+ save_dir = base_dir + "batch_intent_"+str(node)+".txt"
+ with open(save_dir) as f_onos:
+ line_count = 0
+ for line in f_onos:
+ line = line[1:]
+ line = line.split(": ")
+ result = line[1].split(" ")[0]
+ #TODO: add parameters before appending latency
+ if line_count == 0:
+ batch_install_lat.append(int(result))
+ elif line_count == 1:
+ batch_withdraw_lat.append(int(result))
+ line_count += 1
+ main.log.info("Batch install latency for ONOS"+
+ str(node)+" with "+\
+ str(batch_intent_size) + "intents: "+\
+ str(batch_install_lat))
+
+ if len(batch_install_lat) > 0 and int(i) > num_ignore:
+ max_install_lat.append(max(batch_install_lat))
+ elif len(batch_install_lat) == 0:
+ #If I failed to read anything from the file,
+ #increase the wait time before checking intents
+ sleep_time += 30
+ batch_install_lat = []
+ #Sleep in between iterations
+ time.sleep(5)
+
+ main.log.report("Avg of batch installation latency "+
+ ": "+
+ str(sum(max_install_lat) / len(max_install_lat)))
+ main.log.report("Std Deviation of batch installation latency "+
+ ": "+
+ str(numpy.std(max_install_lat)))
+
+ def CASE5(self,main):
+ '''
+ Increase number of nodes and initiate CLI
+ '''
+ import time
+ import json
+
+ ONOS1_ip = main.params['CTRL']['ip1']
+ ONOS2_ip = main.params['CTRL']['ip2']
+ ONOS3_ip = main.params['CTRL']['ip3']
+ ONOS4_ip = main.params['CTRL']['ip4']
+ ONOS5_ip = main.params['CTRL']['ip5']
+ ONOS6_ip = main.params['CTRL']['ip6']
+ ONOS7_ip = main.params['CTRL']['ip7']
+
+ global cluster_count
+ cluster_count += 2
+ main.log.info("Increasing cluster size to "+
+ str(cluster_count))
+
+ install_result = main.FALSE
+
+ if cluster_count == 3:
+ install_result1 = \
+ main.ONOSbench.onos_install(node=ONOS2_ip)
+ install_result2 = \
+ main.ONOSbench.onos_install(node=ONOS3_ip)
+ time.sleep(5)
+
+ main.log.info("Starting ONOS CLI")
+ main.ONOS2cli.start_onos_cli(ONOS2_ip)
+ main.ONOS3cli.start_onos_cli(ONOS3_ip)
+
+ install_result = install_result1 and install_result2
+
+ if cluster_count == 5:
+ main.log.info("Installing ONOS on node 4 and 5")
+ install_result1 = \
+ main.ONOSbench.onos_install(node=ONOS4_ip)
+ install_result2 = \
+ main.ONOSbench.onos_install(node=ONOS5_ip)
+
+ main.log.info("Starting ONOS CLI")
+ main.ONOS4cli.start_onos_cli(ONOS4_ip)
+ main.ONOS5cli.start_onos_cli(ONOS5_ip)
+
+ install_result = install_result1 and install_result2
+
+ if cluster_count == 7:
+ main.log.info("Installing ONOS on node 6 and 7")
+ install_result1 = \
+ main.ONOSbench.onos_install(node=ONOS6_ip)
+ install_result2 = \
+ main.ONOSbench.onos_install(node=ONOS7_ip)
+
+ main.log.info("Starting ONOS CLI")
+ main.ONOS6cli.start_onos_cli(ONOS6_ip)
+ main.ONOS7cli.start_onos_cli(ONOS7_ip)
+
+ install_result = install_result1 and install_result2
+
+ time.sleep(5)
+
+ if install_result == main.TRUE:
+ assertion = main.TRUE
+ else:
+ assertion = main.FALSE
+
+ utilities.assert_equals(expect=main.TRUE, actual=assertion,
+ onpass="Scale out to "+str(cluster_count)+\
+ " nodes successful",
+ onfail="Scale out to "+str(cluster_count)+\
+ " nodes failed")
+
+ def CASE9(self, main):
+ count = 0
+ sw_num1 = 1
+ sw_num2 = 1
+ appid = 0
+ port_num1 = 1
+ port_num2 = 1
+
+ time.sleep(30)
+
+ while True:
+ #main.ONOS1cli.push_test_intents(
+ #"of:0000000000001001/1",
+ #"of:0000000000002001/1",
+ # 100, num_mult="10", app_id="1")
+ #main.ONOS2cli.push_test_intents(
+ # "of:0000000000001002/1",
+ # "of:0000000000002002/1",
+ # 100, num_mult="10", app_id="2")
+ #main.ONOS2cli.push_test_intents(
+ # "of:0000000000001003/1",
+ # "of:0000000000002003/1",
+ # 100, num_mult="10", app_id="3")
+ count += 1
+
+ if count >= 100:
+ main.ONOSbench.handle.sendline(
+ "onos 10.128.174.1 intents-events-metrics >>"+\
+ " /tmp/metrics_intents_temp.txt &")
+ count = 0
+
+ arg1 = "of:000000000000100"+str(sw_num1)+"/"+str(port_num1)
+ arg2 = "of:000000000000200"+str(sw_num2)+"/"+str(port_num2)
+
+ sw_num1 += 1
+
+ if sw_num1 > 7:
+ sw_num1 = 1
+ sw_num2 += 1
+ if sw_num2 > 7:
+ appid += 1
+
+ if sw_num2 > 7:
+ sw_num2 = 1
+
+ main.ONOSbench.push_test_intents_shell(
+ arg1,
+ arg2,
+ 150, "/tmp/temp.txt", "10.128.174.1",
+ num_mult="10", app_id=appid,report=False)
+ #main.ONOSbench.push_test_intents_shell(
+ # "of:0000000000001002/1",
+ # "of:0000000000002002/1",
+ # 133, "/tmp/temp2.txt", "10.128.174.2",
+ # num_mult="6", app_id="2",report=False)
+ #main.ONOSbench.push_test_intents_shell(
+ # "of:0000000000001003/1",
+ # "of:0000000000002003/1",
+ # 133, "/tmp/temp3.txt", "10.128.174.3",
+ # num_mult="6", app_id="3",report=False)
+
+ time.sleep(0.1)
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.topo b/TestON/tests/IntentPerfNext/IntentPerfNext.topo
index 75cb259..048695d 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.topo
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.topo
@@ -36,6 +36,42 @@
<connect_order>2</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS3cli>
+
+ <ONOS4cli>
+ <host>10.128.174.10</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS4cli>
+
+ <ONOS5cli>
+ <host>10.128.174.10</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS5cli>
+
+ <ONOS6cli>
+ <host>10.128.174.10</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS6cli>
+
+ <ONOS7cli>
+ <host>10.128.174.10</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS7cli>
<ONOS1>
<host>10.128.174.1</host>
@@ -54,7 +90,7 @@
<connect_order>4</connect_order>
<COMPONENTS>
<arg1> --custom topo-intentFlower.py </arg1>
- <arg2> --arp --mac --topo mytopo</arg2>
+ <arg2> --arp --mac --topo mytopo </arg2>
<arg3> </arg3>
<controller> remote </controller>
</COMPONENTS>
diff --git a/TestON/tests/MultiProd/MultiProd.params b/TestON/tests/MultiProd/MultiProd.params
index 2f99555..8bf1600 100755
--- a/TestON/tests/MultiProd/MultiProd.params
+++ b/TestON/tests/MultiProd/MultiProd.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,4,5,6,7,8,9</testcases>
+ <testcases>1,4,10,5,6,7,8,6,8,9,31,32,8,33</testcases>
#Environment variables
<ENV>
@@ -16,6 +16,24 @@
<port3>6633</port3>
</CTRL>
+ <SDNIP>
+ <ethType>IPV4</ethType>
+ <tcpProto>6</tcpProto>
+ <icmpProto>1</icmpProto>
+ <srcPort>5001</srcPort>
+ <dstPort>5001</dstPort>
+ </SDNIP>
+
+ <MULTIPOINT_INTENT>
+ <device1>of:0000000000003008/1 </device1>
+ <device2>of:0000000000003009/1 </device2>
+ <device3>of:0000000000003010/1 </device3>
+ <mac1>00:00:00:00:00:0A </mac1>
+ <mac2>00:00:00:00:00:08 </mac2>
+ <ip1>10.0.3.0/24 </ip1>
+ <ip2>10.0.1.0/24 </ip2>
+ </MULTIPOINT_INTENT>
+
<PING>
<source1>h8</source1>
<source2>h9</source2>
diff --git a/TestON/tests/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
index 33d86b4..dda3ad4 100755
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -17,11 +17,12 @@
def CASE1(self, main):
'''
Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-logs
git pull
mvn clean install
onos-package
- cell <name>
- onos-verify-cell
onos-install -f
onos-wait-for-start
'''
@@ -32,11 +33,23 @@
ONOS3_ip = main.params['CTRL']['ip3']
ONOS1_port = main.params['CTRL']['port1']
ONOS2_port = main.params['CTRL']['port2']
- ONOS3_port = main.params['CTRL']['port3']
-
+ ONOS3_port = main.params['CTRL']['port3']
+
main.case("Setting up test environment")
main.log.report("This testcase is testing setting up test environment")
main.log.report("__________________________________")
+
+ main.step("Applying cell variable to environment")
+ cell_result1 = main.ONOSbench.set_cell(cell_name)
+ #cell_result2 = main.ONOScli1.set_cell(cell_name)
+ #cell_result3 = main.ONOScli2.set_cell(cell_name)
+ #cell_result4 = main.ONOScli3.set_cell(cell_name)
+ verify_result = main.ONOSbench.verify_cell()
+ cell_result = cell_result1
+
+ main.step("Removing raft logs before a clen installation of ONOS")
+ remove_log_Result = main.ONOSbench.onos_remove_raft_logs()
+
main.step("Git checkout and pull master and get version")
main.ONOSbench.git_checkout("master")
git_pull_result = main.ONOSbench.git_pull()
@@ -48,14 +61,6 @@
clean_install_result = main.ONOSbench.clean_install()
#clean_install_result = main.TRUE
- main.step("Applying cell variable to environment")
- cell_result1 = main.ONOSbench.set_cell(cell_name)
- #cell_result2 = main.ONOScli1.set_cell(cell_name)
- #cell_result3 = main.ONOScli2.set_cell(cell_name)
- #cell_result4 = main.ONOScli3.set_cell(cell_name)
- verify_result = main.ONOSbench.verify_cell()
- cell_result = cell_result1
-
main.step("Creating ONOS package")
package_result = main.ONOSbench.onos_package()
@@ -223,9 +228,9 @@
devices1 = main.ONOScli1.devices()
devices2 = main.ONOScli2.devices()
devices3 = main.ONOScli3.devices()
- print "devices1 = ", devices1
- print "devices2 = ", devices2
- print "devices3 = ", devices3
+ #print "devices1 = ", devices1
+ #print "devices2 = ", devices2
+ #print "devices3 = ", devices3
hosts1 = main.ONOScli1.hosts()
hosts2 = main.ONOScli2.hosts()
hosts3 = main.ONOScli3.hosts()
@@ -355,14 +360,36 @@
onpass="Topology Check Test successful",
onfail="Topology Check Test NOT successful")
+
+
+
+ def CASE10(self):
+ main.log.report("This testcase uninstalls the reactive forwarding app")
+ main.log.report("__________________________________")
+ main.case("Uninstalling reactive forwarding app")
+ #Unistall onos-app-fwd app to disable reactive forwarding
+ appUninstall_result1 = main.ONOScli1.feature_uninstall("onos-app-fwd")
+ appUninstall_result2 = main.ONOScli2.feature_uninstall("onos-app-fwd")
+ appUninstall_result3 = main.ONOScli3.feature_uninstall("onos-app-fwd")
+ main.log.info("onos-app-fwd uninstalled")
+
+ #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+ #So sleep for 15s
+ time.sleep(15)
+
+ hosts = main.ONOScli1.hosts()
+ main.log.info(hosts)
+
+ case10_result = appUninstall_result1 and appUninstall_result2 and appUninstall_result3
+ utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed")
+
+
def CASE6(self):
main.log.report("This testcase is testing the addition of host intents and then doing pingall")
main.log.report("__________________________________")
- main.case("Uninstalling reactive forwarding app and addhost intents")
+ main.case("Obtaining hostsfor adding host intents")
main.step("Get hosts")
- main.ONOScli1.handle.sendline("hosts")
- main.ONOScli1.handle.expect("onos>")
- hosts = main.ONOScli1.handle.before
+ hosts = main.ONOScli1.hosts()
main.log.info(hosts)
main.step("Get all devices id")
@@ -371,7 +398,8 @@
#ONOS displays the hosts in hex format unlike mininet which does in decimal format
#So take care while adding intents
-
+
+ '''
main.step("Add host intents for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)")
hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
@@ -383,16 +411,17 @@
hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1")
hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
+ '''
-
- #Unistall onos-app-fwd app to disable reactive forwarding
- main.step("Unistall onos-app-fwd app to disable reactive forwarding")
- appUninstall_result = main.ONOScli1.feature_uninstall("onos-app-fwd")
- main.log.info("onos-app-fwd uninstalled")
-
- #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
- #So sleep for 15s
- time.sleep(15)
+ for i in range(8,18):
+ main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+ host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+ host2 = "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+ #NOTE: get host can return None
+ #TODO: handle this
+ host1_id = main.ONOScli1.get_host(host1)['id']
+ host2_id = main.ONOScli1.get_host(host2)['id']
+ tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
flowHandle = main.ONOScli1.flows()
#print "flowHandle = ", flowHandle
@@ -634,56 +663,68 @@
def CASE8(self):
'''
- Host intents removal
+ Intent removal
'''
- main.log.report("This testcase removes host intents before adding the point intents")
+ main.log.report("This testcase removes host any previously added intents")
main.log.report("__________________________________")
- main.log.info("Host intents removal")
- main.case("Removing host intents")
+ main.log.info("Removing any previously installed intents")
+ main.case("Removing intents")
main.step("Obtain the intent id's")
- intent_result = main.ONOScli1.intents()
- #print "intent_result = ",intent_result
+ intent_result = main.ONOScli1.intents(json_format = False)
+
intent_linewise = intent_result.split("\n")
- intent_linewise = intent_linewise[1:-1] #ignore the first and last item of the list obtained from split
- #for line in intent_linewise:
- #print "line = ", line
- intentids = []
+ intentList = []
for line in intent_linewise:
+ if line.startswith("id="):
+ intentList.append(line)
+
+ intentids = []
+ for line in intentList:
intentids.append(line.split(",")[0].split("=")[1])
for id in intentids:
- print "id = ", id
-
+ main.log.info("id = " +id)
+
main.step("Iterate through the intentids list and remove each intent")
for id in intentids:
main.ONOScli1.remove_intent(intent_id = id)
-
- intent_result = main.ONOScli1.intents()
- intent_linewise = intent_result.split("\n")
- intent_linewise = intent_linewise[1:-1] #ignore the first and last item of the list obtained from split
-
- intentState = {}
- for id, line in zip(intentids, intent_linewise):
- #print "line after removing intent = ", line
- x = line.split(",")
- state = x[1].split("=")[1]
- intentState[id] = state
-
- case8_result = main.TRUE
- for key,value in intentState.iteritems():
- print "key,value = ", key, value
- if value == "WITHDRAWN":
- case8_result = case8_result and main.TRUE
- else:
- case8_result = case8_result and main.FALSE
- if case8_result == main.TRUE:
+ intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info("intent_result = " +intent_result)
+ case8_result = main.TRUE
+
+ i = 8
+ Ping_Result = main.TRUE
+ while i <18 :
+ main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+ if ping==main.TRUE:
+ i = 19
+ Ping_Result = main.TRUE
+ elif ping==main.FALSE:
+ i+=1
+ Ping_Result = main.FALSE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+
+ #Note: If the ping result failed, that means the intents have been withdrawn correctly.
+ if Ping_Result==main.TRUE:
+ main.log.report("Host intents have not been withdrawn correctly")
+ #main.cleanup()
+ #main.exit()
+ if Ping_Result==main.FALSE:
+ main.log.report("Host intents have been withdrawn correctly")
+
+ case8_result = case8_result and Ping_Result
+
+ if case8_result == main.FALSE:
main.log.report("Intent removal successful")
else:
main.log.report("Intent removal failed")
- utilities.assert_equals(expect=main.TRUE, actual=case8_result,
- onpass="Intent removal test successful",
- onfail="Intent removal test failed")
+ utilities.assert_equals(expect=main.FALSE, actual=case8_result,
+ onpass="Intent removal test failed",
+ onfail="Intent removal test successful")
def CASE9(self):
@@ -696,117 +737,117 @@
main.log.info("Adding point intents")
main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)")
main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006018", 1, "of:0000000000003008", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003009", 1, "of:0000000000006019", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006019", 1, "of:0000000000003009", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003010", 1, "of:0000000000006020", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006020", 1, "of:0000000000003010", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003011", 1, "of:0000000000006021", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006021", 1, "of:0000000000003011", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003012", 1, "of:0000000000006022", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006022", 1, "of:0000000000003012", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003013", 1, "of:0000000000006023", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006023", 1, "of:0000000000003013", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003014", 1, "of:0000000000006024", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006024", 1, "of:0000000000003014", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003015", 1, "of:0000000000006025", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006025", 1, "of:0000000000003015", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003016", 1, "of:0000000000006026", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006026", 1, "of:0000000000003016", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
@@ -814,13 +855,13 @@
main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003017", 1, "of:0000000000006027", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006027", 1, "of:0000000000003017", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
@@ -867,3 +908,256 @@
onpass="Ping all test after Point intents addition successful",
onfail="Ping all test after Point intents addition failed")
+ def CASE31(self):
+ '''
+ This test case adds point intent related to SDN-IP matching on ICMP (ethertype=IPV4, ipProto=1)
+ '''
+ import json
+
+ main.log.report("This test case adds point intent related to SDN-IP matching on ICMP")
+ main.case("Adding bidirectional point intent related to SDN-IP matching on ICMP")
+ main.step("Adding bidirectional point intent")
+ #add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=1 of:0000000000003008/1 of:0000000000006018/1
+
+ hosts_json = json.loads(main.ONOScli1.hosts())
+ for i in range(8,11):
+ main.log.info("Adding point intent between h"+str(i)+" and h"+str(i+10))
+ host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+ host2 = "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+ host1_id = main.ONOScli1.get_host(host1)['id']
+ host2_id = main.ONOScli1.get_host(host2)['id']
+ for host in hosts_json:
+ if host['id'] == host1_id:
+ ip1 = host['ips'][0]
+ ip1 = str(ip1+"/32")
+ device1 = host['location']['device']
+ device1 = str(device1+"/1")
+ elif host['id'] == host2_id:
+ ip2 = str(host['ips'][0])+"/32"
+ device2 = host['location']["device"]
+ device2 = str(device2+"/1")
+
+ p_intent_result1 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['icmpProto'])
+
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info(get_intent_result)
+
+ p_intent_result2 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['icmpProto'])
+
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info(get_intent_result)
+ if (p_intent_result1 and p_intent_result2) == main.TRUE:
+ #get_intent_result = main.ONOScli1.intents()
+ #main.log.info(get_intent_result)
+ main.log.info("Point intent related to SDN-IP matching on ICMP install successful")
+
+ time.sleep(15)
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info("intents = "+ get_intent_result)
+ get_flows_result = main.ONOScli1.flows()
+ main.log.info("flows = " + get_flows_result)
+
+ count = 1
+ i = 8
+ Ping_Result = main.TRUE
+ while i <11 :
+ main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+ if ping == main.FALSE and count <3:
+ count+=1
+ #i = 8
+ Ping_Result = main.FALSE
+ main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+ time.sleep(2)
+ elif ping==main.FALSE:
+ main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+ i=19
+ Ping_Result = main.FALSE
+ elif ping==main.TRUE:
+ main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+ i+=1
+ Ping_Result = main.TRUE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+ if Ping_Result==main.FALSE:
+ main.log.report("Ping test after Point intents related to SDN-IP matching on ICMP failed.")
+ #main.cleanup()
+ #main.exit()
+ if Ping_Result==main.TRUE:
+ main.log.report("Ping all test after Point intents related to SDN-IP matching on ICMP successful")
+
+ case31_result = Ping_Result and p_intent_result1 and p_intent_result2
+ utilities.assert_equals(expect=main.TRUE, actual=case31_result,
+ onpass="Point intent related to SDN-IP matching on ICMP and ping test successful",
+ onfail="Point intent related to SDN-IP matching on ICMP and ping test failed")
+
+ def CASE32(self):
+ '''
+ This test case adds point intent related to SDN-IP matching on TCP (ethertype=IPV4, ipProto=6, DefaultPort for iperf=5001)
+ Note: Although BGP port is 179, we are using 5001 because iperf is used for verifying and iperf's default port is 5001
+ '''
+ import json
+
+ main.log.report("This test case adds point intent related to SDN-IP matching on TCP")
+ main.case("Adding bidirectional point intent related to SDN-IP matching on TCP")
+ main.step("Adding bidirectional point intent")
+ """
+ add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000003008/1 of:0000000000006018/1
+
+ add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000006018/1 of:0000000000003008/1
+
+ add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000003008/1 of:0000000000006018/1
+
+ add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000006018/1 of:0000000000003008/1
+
+ """
+
+ hosts_json = json.loads(main.ONOScli1.hosts())
+ for i in range(8,9):
+ main.log.info("Adding point intent between h"+str(i)+" and h"+str(i+10))
+ host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+ host2 = "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+ host1_id = main.ONOScli1.get_host(host1)['id']
+ host2_id = main.ONOScli1.get_host(host2)['id']
+ for host in hosts_json:
+ if host['id'] == host1_id:
+ ip1 = host['ips'][0]
+ ip1 = str(ip1+"/32")
+ device1 = host['location']['device']
+ device1 = str(device1+"/1")
+ elif host['id'] == host2_id:
+ ip2 = str(host['ips'][0])+"/32"
+ device2 = host['location']["device"]
+ device2 = str(device2+"/1")
+
+ p_intent_result1 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpDst=main.params['SDNIP']['dstPort'])
+ p_intent_result2 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpDst=main.params['SDNIP']['dstPort'])
+
+ p_intent_result3 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpSrc=main.params['SDNIP']['srcPort'])
+ p_intent_result4 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpSrc=main.params['SDNIP']['srcPort'])
+
+ p_intent_result = p_intent_result1 and p_intent_result2 and p_intent_result3 and p_intent_result4
+ if p_intent_result ==main.TRUE:
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info(get_intent_result)
+ main.log.info("Point intent related to SDN-IP matching on TCP install successful")
+
+ iperf_result = main.Mininet1.iperf('h8', 'h18')
+ if iperf_result == main.TRUE:
+ main.log.report("iperf test successful")
+ else:
+ main.log.report("iperf test failed")
+
+
+ case32_result = p_intent_result and iperf_result
+ utilities.assert_equals(expect=main.TRUE, actual=case32_result,
+ onpass="Ping all test after Point intents addition related to SDN-IP on TCP match successful",
+ onfail="Ping all test after Point intents addition related to SDN-IP on TCP match failed")
+
+
+ def CASE33(self):
+ '''
+ This test case adds multipoint to singlepoint intent related to SDN-IP matching on destination ip and the action is to rewrite the mac address
+ Here the mac address to be rewritten is the mac address of the egress device
+ '''
+ import json
+ import time
+
+ main.log.report("This test case adds multipoint to singlepoint intent related to SDN-IP matching on destination ip and rewrite mac address action")
+ main.case("Adding multipoint to singlepoint intent related to SDN-IP matching on destination ip")
+ main.step("Adding bidirectional multipoint to singlepoint intent")
+ """
+ add-multi-to-single-intent --ipDst=10.0.3.0/24 --setEthDst=00:00:00:00:00:12 of:0000000000003008/1 0000000000003009/1 of:0000000000006018/1
+
+ add-multi-to-single-intent --ipDst=10.0.1.0/24 --setEthDst=00:00:00:00:00:08 of:0000000000006018/1 0000000000003009/1 of:0000000000003008/1
+ """
+
+ main.case("Installing multipoint to single point intent with rewrite mac address")
+ main.step("Uninstalling proxy arp app")
+ #Unistall onos-app-proxyarp app to disable reactive forwarding
+ appUninstall_result1 = main.ONOScli1.feature_uninstall("onos-app-proxyarp")
+ appUninstall_result2 = main.ONOScli2.feature_uninstall("onos-app-proxyarp")
+ appUninstall_result3 = main.ONOScli3.feature_uninstall("onos-app-proxyarp")
+ main.log.info("onos-app-proxyarp uninstalled")
+
+ main.step("Changing ipaddress of hosts h8,h9 and h18")
+ main.Mininet1.changeIP(host='h8', intf='h8-eth0', newIP='10.0.1.1', newNetmask='255.255.255.0')
+ main.Mininet1.changeIP(host='h9', intf='h9-eth0', newIP='10.0.2.1', newNetmask='255.255.255.0')
+ main.Mininet1.changeIP(host='h10', intf='h10-eth0', newIP='10.0.3.1', newNetmask='255.255.255.0')
+
+ main.step("Changing default gateway of hosts h8,h9 and h18")
+ main.Mininet1.changeDefaultGateway(host='h8', newGW='10.0.1.254')
+ main.Mininet1.changeDefaultGateway(host='h9', newGW='10.0.2.254')
+ main.Mininet1.changeDefaultGateway(host='h10', newGW='10.0.3.254')
+
+ main.step("Assigning random mac address to the default gateways since proxyarp app is uninstalled")
+ main.Mininet1.addStaticMACAddress(host='h8', GW='10.0.1.254', macaddr='00:00:00:00:11:11')
+ main.Mininet1.addStaticMACAddress(host='h9', GW='10.0.2.254', macaddr='00:00:00:00:22:22')
+ main.Mininet1.addStaticMACAddress(host='h10', GW='10.0.3.254', macaddr='00:00:00:00:33:33')
+
+ main.step("Verify static gateway and MAC address assignment")
+ main.Mininet1.verifyStaticGWandMAC(host='h8')
+ main.Mininet1.verifyStaticGWandMAC(host='h9')
+ main.Mininet1.verifyStaticGWandMAC(host='h10')
+
+ main.step("Adding multipoint to singlepoint intent")
+ p_intent_result1 = main.ONOScli1.add_multipoint_to_singlepoint_intent(ingress_device1=main.params['MULTIPOINT_INTENT']['device1'], ingress_device2=main.params['MULTIPOINT_INTENT']['device2'],
+ egress_device=main.params['MULTIPOINT_INTENT']['device3'], ipDst=main.params['MULTIPOINT_INTENT']['ip1'], setEthDst=main.params['MULTIPOINT_INTENT']['mac1'])
+
+ p_intent_result2 = main.ONOScli1.add_multipoint_to_singlepoint_intent(ingress_device1=main.params['MULTIPOINT_INTENT']['device3'], ingress_device2=main.params['MULTIPOINT_INTENT']['device2'],
+ egress_device=main.params['MULTIPOINT_INTENT']['device1'], ipDst=main.params['MULTIPOINT_INTENT']['ip2'], setEthDst=main.params['MULTIPOINT_INTENT']['mac2'])
+
+
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info("intents = "+ get_intent_result)
+
+ time.sleep(10)
+ get_flows_result = main.ONOScli1.flows(json_format = False)
+ main.log.info("flows = " + get_flows_result)
+
+ count = 1
+ i = 8
+ Ping_Result = main.TRUE
+
+ main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+2))
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+2))
+ if ping == main.FALSE and count <3:
+ count+=1
+ Ping_Result = main.FALSE
+ main.log.report("Ping between h" + str(i) + " and h" + str(i+2) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+ time.sleep(2)
+ elif ping==main.FALSE:
+ main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+ Ping_Result = main.FALSE
+ elif ping==main.TRUE:
+ main.log.info("Ping test between h" + str(i) + " and h" + str(i+2) + "passed!")
+ Ping_Result = main.TRUE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+
+ if Ping_Result==main.FALSE:
+ main.log.report("Ping test failed.")
+ #main.cleanup()
+ #main.exit()
+ if Ping_Result==main.TRUE:
+ main.log.report("Ping all successful")
+
+
+ p_intent_result = p_intent_result1 and p_intent_result2
+ if p_intent_result ==main.TRUE:
+ main.log.info("Multi point intent with rewrite mac address installation successful")
+ else:
+ main.log.info("Multi point intent with rewrite mac address installation failed")
+
+ case33_result = p_intent_result and Ping_Result
+ utilities.assert_equals(expect=main.TRUE, actual=case33_result,
+ onpass="Ping all test after multipoint to single point intent addition with rewrite mac address successful",
+ onfail="Ping all test after multipoint to single point intent addition with rewrite mac address failed")
diff --git a/TestON/tests/MultiProd13/MultiProd13.params b/TestON/tests/MultiProd13/MultiProd13.params
index b60f5cf..8bf1600 100755
--- a/TestON/tests/MultiProd13/MultiProd13.params
+++ b/TestON/tests/MultiProd13/MultiProd13.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,4,10,31</testcases>
+ <testcases>1,4,10,5,6,7,8,6,8,9,31,32,8,33</testcases>
#Environment variables
<ENV>
@@ -16,6 +16,24 @@
<port3>6633</port3>
</CTRL>
+ <SDNIP>
+ <ethType>IPV4</ethType>
+ <tcpProto>6</tcpProto>
+ <icmpProto>1</icmpProto>
+ <srcPort>5001</srcPort>
+ <dstPort>5001</dstPort>
+ </SDNIP>
+
+ <MULTIPOINT_INTENT>
+ <device1>of:0000000000003008/1 </device1>
+ <device2>of:0000000000003009/1 </device2>
+ <device3>of:0000000000003010/1 </device3>
+ <mac1>00:00:00:00:00:0A </mac1>
+ <mac2>00:00:00:00:00:08 </mac2>
+ <ip1>10.0.3.0/24 </ip1>
+ <ip2>10.0.1.0/24 </ip2>
+ </MULTIPOINT_INTENT>
+
<PING>
<source1>h8</source1>
<source2>h9</source2>
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index d825c62..1276d33 100755
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -17,11 +17,12 @@
def CASE1(self, main):
'''
Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-logs
git pull
mvn clean install
onos-package
- cell <name>
- onos-verify-cell
onos-install -f
onos-wait-for-start
'''
@@ -32,11 +33,23 @@
ONOS3_ip = main.params['CTRL']['ip3']
ONOS1_port = main.params['CTRL']['port1']
ONOS2_port = main.params['CTRL']['port2']
- ONOS3_port = main.params['CTRL']['port3']
-
+ ONOS3_port = main.params['CTRL']['port3']
+
main.case("Setting up test environment")
main.log.report("This testcase is testing setting up test environment")
main.log.report("__________________________________")
+
+ main.step("Applying cell variable to environment")
+ cell_result1 = main.ONOSbench.set_cell(cell_name)
+ #cell_result2 = main.ONOScli1.set_cell(cell_name)
+ #cell_result3 = main.ONOScli2.set_cell(cell_name)
+ #cell_result4 = main.ONOScli3.set_cell(cell_name)
+ verify_result = main.ONOSbench.verify_cell()
+ cell_result = cell_result1
+
+ main.step("Removing raft logs before a clen installation of ONOS")
+ remove_log_Result = main.ONOSbench.onos_remove_raft_logs()
+
main.step("Git checkout and pull master and get version")
main.ONOSbench.git_checkout("master")
git_pull_result = main.ONOSbench.git_pull()
@@ -48,14 +61,6 @@
clean_install_result = main.ONOSbench.clean_install()
#clean_install_result = main.TRUE
- main.step("Applying cell variable to environment")
- cell_result1 = main.ONOSbench.set_cell(cell_name)
- #cell_result2 = main.ONOScli1.set_cell(cell_name)
- #cell_result3 = main.ONOScli2.set_cell(cell_name)
- #cell_result4 = main.ONOScli3.set_cell(cell_name)
- verify_result = main.ONOSbench.verify_cell()
- cell_result = cell_result1
-
main.step("Creating ONOS package")
package_result = main.ONOSbench.onos_package()
@@ -371,7 +376,10 @@
#After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
#So sleep for 15s
time.sleep(15)
-
+
+ hosts = main.ONOScli1.hosts()
+ main.log.info(hosts)
+
case10_result = appUninstall_result1 and appUninstall_result2 and appUninstall_result3
utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed")
@@ -657,13 +665,12 @@
'''
Intent removal
'''
- main.log.report("This testcase removes host intents before adding the point intents")
+ main.log.report("This testcase removes host any previously added intents")
main.log.report("__________________________________")
- main.log.info("Host intents removal")
- main.case("Removing host intents")
+ main.log.info("Removing any previously installed intents")
+ main.case("Removing intents")
main.step("Obtain the intent id's")
- intent_result = main.ONOScli1.intents()
- #print "intent_result = ",intent_result
+ intent_result = main.ONOScli1.intents(json_format = False)
intent_linewise = intent_result.split("\n")
intentList = []
@@ -675,40 +682,23 @@
for line in intentList:
intentids.append(line.split(",")[0].split("=")[1])
for id in intentids:
- print "id = ", id
+ main.log.info("id = " +id)
main.step("Iterate through the intentids list and remove each intent")
for id in intentids:
main.ONOScli1.remove_intent(intent_id = id)
- intent_result = main.ONOScli1.intents()
- intent_linewise = intent_result.split("\n")
- list_afterRemoval = []
- for line in intent_linewise:
- if line.startswith("id="):
- list_afterRemoval.append(line)
-
- intentState = {}
- for id, line in zip(intentids, list_afterRemoval):
- #print "line after removing intent = ", line
- x = line.split(",")
- state = x[1].split("=")[1]
- intentState[id] = state
-
+ intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info("intent_result = " +intent_result)
case8_result = main.TRUE
- for key,value in intentState.iteritems():
- print "key,value = ", key, value
- if value == "WITHDRAWN":
- case8_result = case8_result and main.TRUE
- else:
- case8_result = case8_result and main.FALSE
-
+
i = 8
Ping_Result = main.TRUE
while i <18 :
main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
if ping==main.TRUE:
+ i = 19
Ping_Result = main.TRUE
elif ping==main.FALSE:
i+=1
@@ -733,8 +723,8 @@
main.log.report("Intent removal failed")
utilities.assert_equals(expect=main.FALSE, actual=case8_result,
- onpass="Intent removal test successful",
- onfail="Intent removal test failed")
+ onpass="Intent removal test failed",
+ onfail="Intent removal test successful")
def CASE9(self):
@@ -747,117 +737,117 @@
main.log.info("Adding point intents")
main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)")
main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006018", 1, "of:0000000000003008", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003009", 1, "of:0000000000006019", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006019", 1, "of:0000000000003009", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003010", 1, "of:0000000000006020", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006020", 1, "of:0000000000003010", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003011", 1, "of:0000000000006021", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006021", 1, "of:0000000000003011", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003012", 1, "of:0000000000006022", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006022", 1, "of:0000000000003012", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003013", 1, "of:0000000000006023", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006023", 1, "of:0000000000003013", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003014", 1, "of:0000000000006024", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006024", 1, "of:0000000000003014", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003015", 1, "of:0000000000006025", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006025", 1, "of:0000000000003015", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003016", 1, "of:0000000000006026", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006026", 1, "of:0000000000003016", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
@@ -865,13 +855,13 @@
main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003017", 1, "of:0000000000006027", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
#main.log.info(get_intent_result)
- ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006027", 1, "of:0000000000003017", 1)
+ ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOScli1.intents()
main.log.info("Point to point intent install successful")
@@ -925,6 +915,7 @@
import json
main.log.report("This test case adds point intent related to SDN-IP matching on ICMP")
+ main.case("Adding bidirectional point intent related to SDN-IP matching on ICMP")
main.step("Adding bidirectional point intent")
#add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=1 of:0000000000003008/1 of:0000000000006018/1
@@ -937,15 +928,236 @@
host2_id = main.ONOScli1.get_host(host2)['id']
for host in hosts_json:
if host['id'] == host1_id:
- ip1 = host['ips']+"/"+"32"
- device1 = str(host['location']['device'])
- port1 = 1
- print "ip1 = ", ip1
- print "device1 = ", device1
+ ip1 = host['ips'][0]
+ ip1 = str(ip1+"/32")
+ device1 = host['location']['device']
+ device1 = str(device1+"/1")
elif host['id'] == host2_id:
- ip2 = str(host['ips'])+"/"+"32"
- device2 = str(host['location']["device"])
- port2 = 1
- print "ip2 = ", ip2
- print "device2 = ", device2
-
+ ip2 = str(host['ips'][0])+"/32"
+ device2 = host['location']["device"]
+ device2 = str(device2+"/1")
+
+ p_intent_result1 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['icmpProto'])
+
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info(get_intent_result)
+
+ p_intent_result2 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['icmpProto'])
+
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info(get_intent_result)
+ if (p_intent_result1 and p_intent_result2) == main.TRUE:
+ #get_intent_result = main.ONOScli1.intents()
+ #main.log.info(get_intent_result)
+ main.log.info("Point intent related to SDN-IP matching on ICMP install successful")
+
+ time.sleep(15)
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info("intents = "+ get_intent_result)
+ get_flows_result = main.ONOScli1.flows()
+ main.log.info("flows = " + get_flows_result)
+
+ count = 1
+ i = 8
+ Ping_Result = main.TRUE
+ while i <11 :
+ main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+ if ping == main.FALSE and count <3:
+ count+=1
+ #i = 8
+ Ping_Result = main.FALSE
+ main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+ time.sleep(2)
+ elif ping==main.FALSE:
+ main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+ i=19
+ Ping_Result = main.FALSE
+ elif ping==main.TRUE:
+ main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+ i+=1
+ Ping_Result = main.TRUE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+ if Ping_Result==main.FALSE:
+ main.log.report("Ping test after Point intents related to SDN-IP matching on ICMP failed.")
+ #main.cleanup()
+ #main.exit()
+ if Ping_Result==main.TRUE:
+ main.log.report("Ping all test after Point intents related to SDN-IP matching on ICMP successful")
+
+ case31_result = Ping_Result and p_intent_result1 and p_intent_result2
+ utilities.assert_equals(expect=main.TRUE, actual=case31_result,
+ onpass="Point intent related to SDN-IP matching on ICMP and ping test successful",
+ onfail="Point intent related to SDN-IP matching on ICMP and ping test failed")
+
+ def CASE32(self):
+ '''
+ This test case adds point intent related to SDN-IP matching on TCP (ethertype=IPV4, ipProto=6, DefaultPort for iperf=5001)
+ Note: Although BGP port is 179, we are using 5001 because iperf is used for verifying and iperf's default port is 5001
+ '''
+ import json
+
+ main.log.report("This test case adds point intent related to SDN-IP matching on TCP")
+ main.case("Adding bidirectional point intent related to SDN-IP matching on TCP")
+ main.step("Adding bidirectional point intent")
+ """
+ add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000003008/1 of:0000000000006018/1
+
+ add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 --ethType=IPV4 --ipProto=6 --tcpDst=5001 of:0000000000006018/1 of:0000000000003008/1
+
+ add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000003008/1 of:0000000000006018/1
+
+ add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 --ethType=IPV4 --ipProto=6 --tcpSrc=5001 of:0000000000006018/1 of:0000000000003008/1
+
+ """
+
+ hosts_json = json.loads(main.ONOScli1.hosts())
+ for i in range(8,9):
+ main.log.info("Adding point intent between h"+str(i)+" and h"+str(i+10))
+ host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+ host2 = "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+ host1_id = main.ONOScli1.get_host(host1)['id']
+ host2_id = main.ONOScli1.get_host(host2)['id']
+ for host in hosts_json:
+ if host['id'] == host1_id:
+ ip1 = host['ips'][0]
+ ip1 = str(ip1+"/32")
+ device1 = host['location']['device']
+ device1 = str(device1+"/1")
+ elif host['id'] == host2_id:
+ ip2 = str(host['ips'][0])+"/32"
+ device2 = host['location']["device"]
+ device2 = str(device2+"/1")
+
+ p_intent_result1 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpDst=main.params['SDNIP']['dstPort'])
+ p_intent_result2 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpDst=main.params['SDNIP']['dstPort'])
+
+ p_intent_result3 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpSrc=main.params['SDNIP']['srcPort'])
+ p_intent_result4 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1,
+ ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpSrc=main.params['SDNIP']['srcPort'])
+
+ p_intent_result = p_intent_result1 and p_intent_result2 and p_intent_result3 and p_intent_result4
+ if p_intent_result ==main.TRUE:
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info(get_intent_result)
+ main.log.info("Point intent related to SDN-IP matching on TCP install successful")
+
+ iperf_result = main.Mininet1.iperf('h8', 'h18')
+ if iperf_result == main.TRUE:
+ main.log.report("iperf test successful")
+ else:
+ main.log.report("iperf test failed")
+
+
+ case32_result = p_intent_result and iperf_result
+ utilities.assert_equals(expect=main.TRUE, actual=case32_result,
+ onpass="Ping all test after Point intents addition related to SDN-IP on TCP match successful",
+ onfail="Ping all test after Point intents addition related to SDN-IP on TCP match failed")
+
+
+ def CASE33(self):
+ '''
+ This test case adds multipoint to singlepoint intent related to SDN-IP matching on destination ip and the action is to rewrite the mac address
+ Here the mac address to be rewritten is the mac address of the egress device
+ '''
+ import json
+ import time
+
+ main.log.report("This test case adds multipoint to singlepoint intent related to SDN-IP matching on destination ip and rewrite mac address action")
+ main.case("Adding multipoint to singlepoint intent related to SDN-IP matching on destination ip")
+ main.step("Adding bidirectional multipoint to singlepoint intent")
+ """
+ add-multi-to-single-intent --ipDst=10.0.3.0/24 --setEthDst=00:00:00:00:00:12 of:0000000000003008/1 0000000000003009/1 of:0000000000006018/1
+
+ add-multi-to-single-intent --ipDst=10.0.1.0/24 --setEthDst=00:00:00:00:00:08 of:0000000000006018/1 0000000000003009/1 of:0000000000003008/1
+ """
+
+ main.case("Installing multipoint to single point intent with rewrite mac address")
+ main.step("Uninstalling proxy arp app")
+ #Unistall onos-app-proxyarp app to disable reactive forwarding
+ appUninstall_result1 = main.ONOScli1.feature_uninstall("onos-app-proxyarp")
+ appUninstall_result2 = main.ONOScli2.feature_uninstall("onos-app-proxyarp")
+ appUninstall_result3 = main.ONOScli3.feature_uninstall("onos-app-proxyarp")
+ main.log.info("onos-app-proxyarp uninstalled")
+
+ main.step("Changing ipaddress of hosts h8,h9 and h18")
+ main.Mininet1.changeIP(host='h8', intf='h8-eth0', newIP='10.0.1.1', newNetmask='255.255.255.0')
+ main.Mininet1.changeIP(host='h9', intf='h9-eth0', newIP='10.0.2.1', newNetmask='255.255.255.0')
+ main.Mininet1.changeIP(host='h10', intf='h10-eth0', newIP='10.0.3.1', newNetmask='255.255.255.0')
+
+ main.step("Changing default gateway of hosts h8,h9 and h18")
+ main.Mininet1.changeDefaultGateway(host='h8', newGW='10.0.1.254')
+ main.Mininet1.changeDefaultGateway(host='h9', newGW='10.0.2.254')
+ main.Mininet1.changeDefaultGateway(host='h10', newGW='10.0.3.254')
+
+ main.step("Assigning random mac address to the default gateways since proxyarp app is uninstalled")
+ main.Mininet1.addStaticMACAddress(host='h8', GW='10.0.1.254', macaddr='00:00:00:00:11:11')
+ main.Mininet1.addStaticMACAddress(host='h9', GW='10.0.2.254', macaddr='00:00:00:00:22:22')
+ main.Mininet1.addStaticMACAddress(host='h10', GW='10.0.3.254', macaddr='00:00:00:00:33:33')
+
+ main.step("Verify static gateway and MAC address assignment")
+ main.Mininet1.verifyStaticGWandMAC(host='h8')
+ main.Mininet1.verifyStaticGWandMAC(host='h9')
+ main.Mininet1.verifyStaticGWandMAC(host='h10')
+
+ main.step("Adding multipoint to singlepoint intent")
+ p_intent_result1 = main.ONOScli1.add_multipoint_to_singlepoint_intent(ingress_device1=main.params['MULTIPOINT_INTENT']['device1'], ingress_device2=main.params['MULTIPOINT_INTENT']['device2'],
+ egress_device=main.params['MULTIPOINT_INTENT']['device3'], ipDst=main.params['MULTIPOINT_INTENT']['ip1'], setEthDst=main.params['MULTIPOINT_INTENT']['mac1'])
+
+ p_intent_result2 = main.ONOScli1.add_multipoint_to_singlepoint_intent(ingress_device1=main.params['MULTIPOINT_INTENT']['device3'], ingress_device2=main.params['MULTIPOINT_INTENT']['device2'],
+ egress_device=main.params['MULTIPOINT_INTENT']['device1'], ipDst=main.params['MULTIPOINT_INTENT']['ip2'], setEthDst=main.params['MULTIPOINT_INTENT']['mac2'])
+
+
+ get_intent_result = main.ONOScli1.intents(json_format = False)
+ main.log.info("intents = "+ get_intent_result)
+
+ time.sleep(10)
+ get_flows_result = main.ONOScli1.flows(json_format = False)
+ main.log.info("flows = " + get_flows_result)
+
+ count = 1
+ i = 8
+ Ping_Result = main.TRUE
+
+ main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+2))
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+2))
+ if ping == main.FALSE and count <3:
+ count+=1
+ Ping_Result = main.FALSE
+ main.log.report("Ping between h" + str(i) + " and h" + str(i+2) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+ time.sleep(2)
+ elif ping==main.FALSE:
+ main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+ Ping_Result = main.FALSE
+ elif ping==main.TRUE:
+ main.log.info("Ping test between h" + str(i) + " and h" + str(i+2) + "passed!")
+ Ping_Result = main.TRUE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+
+ if Ping_Result==main.FALSE:
+ main.log.report("Ping test failed.")
+ #main.cleanup()
+ #main.exit()
+ if Ping_Result==main.TRUE:
+ main.log.report("Ping all successful")
+
+
+ p_intent_result = p_intent_result1 and p_intent_result2
+ if p_intent_result ==main.TRUE:
+ main.log.info("Multi point intent with rewrite mac address installation successful")
+ else:
+ main.log.info("Multi point intent with rewrite mac address installation failed")
+
+ case33_result = p_intent_result and Ping_Result
+ utilities.assert_equals(expect=main.TRUE, actual=case33_result,
+ onpass="Ping all test after multipoint to single point intent addition with rewrite mac address successful",
+ onfail="Ping all test after multipoint to single point intent addition with rewrite mac address failed")
diff --git a/TestON/tests/ONOSNextTest/__init__.py b/TestON/tests/ONOSNextTest/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/ONOSNextTest/__init__.py
diff --git a/TestON/tests/ProdFunc/ProdFunc.params b/TestON/tests/ProdFunc/ProdFunc.params
index 9b44a53..6879c37 100755
--- a/TestON/tests/ProdFunc/ProdFunc.params
+++ b/TestON/tests/ProdFunc/ProdFunc.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,4,5,6,7,8,9</testcases>
+ <testcases>1,4,10,5,6,7,8,6,8,9</testcases>
#Environment variables
<ENV>
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index 67a2981..05c420e 100755
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -6,7 +6,6 @@
import sys
import os
import re
-import time
import json
time.sleep(1)
@@ -17,11 +16,12 @@
def CASE1(self, main):
'''
Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-log
git pull
mvn clean install
onos-package
- cell <name>
- onos-verify-cell
onos-install -f
onos-wait-for-start
'''
@@ -33,6 +33,14 @@
main.case("Setting up test environment")
main.log.report("This testcase is testing setting up test environment")
main.log.report("__________________________________")
+
+ main.step("Applying cell variable to environment")
+ cell_result = main.ONOSbench.set_cell(cell_name)
+ verify_result = main.ONOSbench.verify_cell()
+
+ main.step("Removing raft logs before a clen installation of ONOS")
+ main.ONOSbench.onos_remove_raft_logs()
+
main.step("Git checkout and pull master and get version")
main.ONOSbench.git_checkout("master")
git_pull_result = main.ONOSbench.git_pull()
@@ -43,21 +51,10 @@
main.step("Using mvn clean & install")
clean_install_result = main.ONOSbench.clean_install()
#clean_install_result = main.TRUE
-
- main.step("Applying cell variable to environment")
- cell_result1 = main.ONOSbench.set_cell(cell_name)
- verify_result = main.ONOSbench.verify_cell()
- cell_result2 = main.ONOS2.set_cell(cell_name)
- #verify_result = main.ONOS2.verify_cell()
- main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
- cell_result = cell_result1 and cell_result2
-
+
main.step("Creating ONOS package")
package_result = main.ONOSbench.onos_package()
- #main.step("Creating a cell")
- #cell_create_result = main.ONOSbench.create_cell_file(**************)
main.step("Installing ONOS package")
onos_install_result = main.ONOSbench.onos_install()
@@ -74,6 +71,8 @@
main.step("Starting ONOS service")
start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+ main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
case1_result = (package_result and\
cell_result and verify_result and onos_install_result and\
@@ -125,6 +124,281 @@
main.log.info("onos command returned: "+cmd_result2)
+ def CASE20(self):
+ '''
+ Exit from mininet cli
+ reinstall ONOS
+ '''
+ cell_name = main.params['ENV']['cellName']
+ ONOS1_ip = main.params['CTRL']['ip1']
+ ONOS1_port = main.params['CTRL']['port1']
+
+ main.log.report("This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology")
+ main.log.report("_____________________________________________")
+ main.case("Disconnecting mininet and restarting ONOS")
+ main.step("Disconnecting mininet and restarting ONOS")
+ mininet_disconnect = main.Mininet1.disconnect()
+
+ main.step("Removing raft logs before a clen installation of ONOS")
+ main.ONOSbench.onos_remove_raft_logs()
+
+ main.step("Applying cell variable to environment")
+ cell_result = main.ONOSbench.set_cell(cell_name)
+ verify_result = main.ONOSbench.verify_cell()
+
+ onos_install_result = main.ONOSbench.onos_install()
+ if onos_install_result == main.TRUE:
+ main.log.report("Installing ONOS package successful")
+ else:
+ main.log.report("Installing ONOS package failed")
+
+ onos1_isup = main.ONOSbench.isup()
+ if onos1_isup == main.TRUE:
+ main.log.report("ONOS instance is up and ready")
+ else:
+ main.log.report("ONOS instance may not be up")
+
+ main.step("Starting ONOS service")
+ start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+ main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+ print "mininet_disconnect =", mininet_disconnect
+ print "onos_install_result =", onos_install_result
+ print "onos1_isup =", onos1_isup
+ print "start_result =", start_result
+
+ case20_result = mininet_disconnect and cell_result and onos_install_result and onos1_isup and start_result
+ utilities.assert_equals(expect=main.TRUE, actual=case20_result,
+ onpass="Exiting functionality mininet topology and reinstalling ONOS successful",
+ onfail="Exiting functionality mininet topology and reinstalling ONOS failed")
+
+ def CASE21(self, main):
+ import time
+ '''
+ On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
+ which starts the rest and copies the links json file to the onos instance
+ Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt
+ from the json config file
+ '''
+ main.log.report("This testcase starts the packet layer topology and REST")
+ main.log.report("_____________________________________________")
+ main.case("Starting LINC-OE and other components")
+ main.step("Starting LINC-OE and other components")
+ start_console_result = main.LincOE1.start_console()
+ optical_mn_script = main.LincOE2.run_optical_mn_script()
+ onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(instance_name = main.params['CTRL']['ip1'], json_file = main.params['OPTICAL']['jsonfile'])
+
+ print "start_console_result =",start_console_result
+ print "optical_mn_script = ",optical_mn_script
+ print "onos_topo_cfg_result =",onos_topo_cfg_result
+
+ case21_result = start_console_result and optical_mn_script and onos_topo_cfg_result
+ utilities.assert_equals(expect=main.TRUE, actual=case21_result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed")
+
+
+ def CASE22(self, main):
+ '''
+ Curretly we use, 4 linear switch optical topology and 2 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 4, packetLayerSWCount variable = 2, hostCount =2
+ and this is hardcoded in the testcase. If the topology changes, these hardcoded values need to be changed
+ '''
+
+ main.log.report("This testcase compares the optical+packet topology against what is expected")
+ main.case("Topology comparision")
+ main.step("Topology comparision")
+ main.ONOS3.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+ devices_result = main.ONOS3.devices(json_format = False)
+
+ print "devices_result = ", devices_result
+ devices_linewise = devices_result.split("\n")
+ devices_linewise = devices_linewise[1:-1]
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devices_linewise:
+ components = line.split(",")
+ availability = components[1].split("=")[1]
+ type = components[3].split("=")[1]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type =='SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 4:
+ print "Number of Optical Switches = %d and is correctly detected" %roadmCount
+ main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is correctly detected")
+ opticalSW_result = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" %roadCount
+ main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is wrong")
+ opticalSW_result = main.FALSE
+
+ if packetLayerSWCount == 2:
+ print "Number of Packet layer or mininet Switches = %d and is correctly detected" %packetLayerSWCount
+ main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is correctly detected")
+ packetSW_result = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and is wrong" %packetLayerSWCount
+ main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is wrong")
+ packetSW_result = main.FALSE
+ print "_________________________________"
+
+ links_result = main.ONOS3.links(json_format = False)
+ print "links_result = ", links_result
+ print "_________________________________"
+
+
+
+ #Discover hosts using pingall
+ pingall_result = main.LincOE2.pingall()
+
+ hosts_result = main.ONOS3.hosts(json_format = False)
+ main.log.info("hosts_result = "+hosts_result)
+ main.log.info("_________________________________")
+ hosts_linewise = hosts_result.split("\n")
+ hosts_linewise = hosts_linewise[1:-1]
+ hostCount = 0
+ for line in hosts_linewise:
+ hostid = line.split(",")[0].split("=")[1]
+ hostCount +=1
+ if hostCount ==2:
+ print "Number of hosts = %d and is correctly detected" %hostCount
+ main.log.info("Number of hosts = " + str(hostCount) +" and is correctly detected")
+ hostDiscovery = main.TRUE
+ else:
+ print "Number of hosts = %d and is wrong" %hostCount
+ main.log.info("Number of hosts = " + str(hostCount) +" and is wrong")
+ hostDiscovery = main.FALSE
+
+ case22_result = opticalSW_result and packetSW_result and hostDiscovery
+ utilities.assert_equals(expect=main.TRUE, actual=case22_result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed")
+
+ def CASE23(self, main):
+ import time
+ '''
+ Add bidirectional point intents between 2 packet layer(mininet) devices and
+ ping mininet hosts
+ '''
+ main.log.report("This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts")
+ main.case("Topology comparision")
+ main.step("Adding point intents")
+ ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0001/1", "of:0000ffffffff0002/1")
+ if ptp_intent_result == main.TRUE:
+ get_intent_result = main.ONOS3.intents()
+ main.log.info("Point to point intent install successful")
+
+ ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0002/1", "of:0000ffffffff0001/1")
+ if ptp_intent_result == main.TRUE:
+ get_intent_result = main.ONOS3.intents()
+ main.log.info("Point to point intent install successful")
+
+ time.sleep(10)
+ flowHandle = main.ONOS3.flows()
+ main.log.info("flows :" + flowHandle)
+
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep(30)
+ intentHandle = main.ONOS3.intents()
+ main.log.info("intents :" + intentHandle)
+
+ Ping_Result = main.TRUE
+ count = 1
+ main.log.info("\n\nh1 is Pinging h2")
+ ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+ #ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count<5:
+ count+=1
+ Ping_Result = main.FALSE
+ main.log.info("Ping between h1 and h2 failed. Making attempt number "+str(count) + " in 2 seconds")
+ time.sleep(2)
+ ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+ #ping = main.LincOE2.pinghost()
+ elif ping==main.FALSE:
+ main.log.info("All ping attempts between h1 and h2 have failed")
+ Ping_Result = main.FALSE
+ elif ping==main.TRUE:
+ main.log.info("Ping test between h1 and h2 passed!")
+ Ping_Result = main.TRUE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+
+ if Ping_Result==main.FALSE:
+ main.log.report("Point intents for packet optical have not ben installed correctly. Cleaning up")
+ if Ping_Result==main.TRUE:
+ main.log.report("Point Intents for packet optical have been installed correctly")
+
+ case23_result = Ping_Result
+ utilities.assert_equals(expect=main.TRUE, actual=case23_result,
+ onpass="Point intents addition for packet optical and Pingall Test successful",
+ onfail="Point intents addition for packet optical and Pingall Test NOT successful")
+
+
+
+ def CASE24(self, main):
+ import time
+ import json
+ '''
+ Test Rerouting of Packet Optical by bringing a port down (port 22) of a switch(switchID=1), so that link (between switch1 port22 - switch4-port30) is inactive
+ and do a ping test. If rerouting is successful, ping should pass. also check the flows
+ '''
+ main.log.report("This testcase tests rerouting and pings mininet hosts")
+ main.step("Test rerouting and pings mininet hosts")
+ main.case("Bring a port down and verify the link state")
+ main.LincOE1.port_down(sw_id="1", pt_id="22")
+ links = main.ONOS3.links()
+ main.log.info(main.ONOS3.links)
+
+ links_result = json.loads(links)
+ links_state_result = main.FALSE
+ for item in links_result:
+ if item['src'] == "of:0000ffffffffff01/22" and item['dst'] == "of:0000ffffffffff04/30":
+ links_state = item['state']
+ if links_state == "INACTIVE":
+ main.log.info("Links state is inactive as expected due to one of the ports being down")
+ main.log.report("Links state is inactive as expected due to one of the ports being down")
+ links_state_result = main.TRUE
+ break
+ else:
+ main.log.info("Links state is not inactive as expected")
+ main.log.report("Links state is not inactive as expected")
+ links_state_result = main.FALSE
+
+ print "links_state_result = ", links_state_result
+ main.case("Verify Rerouting by a ping test")
+ Ping_Result = main.TRUE
+ count = 1
+ main.log.info("\n\nh1 is Pinging h2")
+ ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+ #ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count<5:
+ count+=1
+ Ping_Result = main.FALSE
+ main.log.info("Ping between h1 and h2 failed. Making attempt number "+str(count) + " in 2 seconds")
+ time.sleep(2)
+ ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+ #ping = main.LincOE2.pinghost()
+ elif ping==main.FALSE:
+ main.log.info("All ping attempts between h1 and h2 have failed")
+ Ping_Result = main.FALSE
+ elif ping==main.TRUE:
+ main.log.info("Ping test between h1 and h2 passed!")
+ Ping_Result = main.TRUE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+
+ if Ping_Result==main.FALSE:
+ main.log.report("Ping test successful ")
+ if Ping_Result==main.TRUE:
+ main.log.report("Ping test failed")
+
+ case24_result = Ping_Result and links_state_result
+ utilities.assert_equals(expect=main.TRUE, actual=case24_result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed")
def CASE4(self, main):
import re
@@ -235,26 +509,42 @@
else:
main.log.report("Pingall Test in reactive mode to discover the hosts failed")
- utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall T est successful",onfail="Controller assignment and Pingall Test NOT successful")
+ utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall Test successful",onfail="Controller assignment and Pingall Test NOT successful")
+
+ def CASE10(self):
+ main.log.report("This testcase uninstalls the reactive forwarding app")
+ main.log.report("__________________________________")
+ main.case("Uninstalling reactive forwarding app")
+ #Unistall onos-app-fwd app to disable reactive forwarding
+ appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
+ main.log.info("onos-app-fwd uninstalled")
+
+ #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+ #So sleep for 15s
+ time.sleep(15)
+
+ flows = main.ONOS2.flows()
+ main.log.info(flows)
+
+ case10_result = appUninstall_result
+ utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed")
def CASE6(self):
- main.log.report("This testcase is testing the addition of host intents and then doing pingall")
+ main.log.report("This testcase is testing the addition of host intents and then does pingall")
main.log.report("__________________________________")
- main.case("Uninstalling reactive forwarding app and addhost intents")
+ main.case("Obtaining host id's")
main.step("Get hosts")
- main.ONOS2.handle.sendline("hosts")
- main.ONOS2.handle.expect("onos>")
- hosts = main.ONOS2.handle.before
- main.log.info(hosts)
+ hosts = main.ONOS2.hosts()
+ #main.log.info(hosts)
main.step("Get all devices id")
devices_id_list = main.ONOS2.get_all_devices_id()
- main.log.info(devices_id_list)
+ #main.log.info(devices_id_list)
#ONOS displays the hosts in hex format unlike mininet which does in decimal format
#So take care while adding intents
-
+ '''
main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
@@ -266,22 +556,24 @@
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1")
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
-
-
-
print "_____________________________________________________________________________________"
+ '''
- #Unistall onos-app-fwd app to disable reactive forwarding
- appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
- main.log.info("onos-app-fwd uninstalled")
+ for i in range(8,18):
+ main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+ host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+ host2 = "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+ #NOTE: get host can return None
+ #TODO: handle this
+ host1_id = main.ONOS2.get_host(host1)['id']
+ host2_id = main.ONOS2.get_host(host2)['id']
+ tmp_result = main.ONOS2.add_host_intent(host1_id, host2_id )
- #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
- #So sleep for 15s
- time.sleep(15)
-
+ time.sleep(10)
+ h_intents = main.ONOS2.intents(json_format = False)
+ main.log.info("intents:" +h_intents)
flowHandle = main.ONOS2.flows()
- #print "flowHandle = ", flowHandle
- main.log.info("flow:" +flowHandle)
+ #main.log.info("flow:" +flowHandle)
count = 1
i = 8
@@ -315,7 +607,7 @@
main.log.report("Ping all test after Host intent addition successful")
case6_result = Ping_Result
- utilities.assert_equals(expect=main.TRUE, actual=case4_result,
+ utilities.assert_equals(expect=main.TRUE, actual=case6_result,
onpass="Pingall Test after Host intents addition successful",
onfail="Pingall Test after Host intents addition failed")
@@ -413,6 +705,7 @@
main.log.report("__________________________________")
main.log.report("Killing a link to ensure that link discovery is consistent")
main.case("Killing a link to Ensure that Link Discovery is Working Properly")
+ '''
main.step("Start continuous pings")
main.Mininet2.pingLong(src=main.params['PING']['source1'],
@@ -435,7 +728,7 @@
target=main.params['PING']['target9'],pingTime=500)
main.Mininet2.pingLong(src=main.params['PING']['source10'],
target=main.params['PING']['target10'],pingTime=500)
-
+ '''
main.step("Determine the current number of switches and links")
topology_output = main.ONOS2.topology()
@@ -470,30 +763,9 @@
onpass="Link up discovered properly",
onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
- #Check ping result here..add code for it
- main.step("Start continuous pings")
-
- main.Mininet2.pingLong(src=main.params['PING']['source1'],
- target=main.params['PING']['target1'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source2'],
- target=main.params['PING']['target2'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source3'],
- target=main.params['PING']['target3'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source4'],
- target=main.params['PING']['target4'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source5'],
- target=main.params['PING']['target5'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source6'],
- target=main.params['PING']['target6'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source7'],
- target=main.params['PING']['target7'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source8'],
- target=main.params['PING']['target8'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source9'],
- target=main.params['PING']['target9'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source10'],
- target=main.params['PING']['target10'],pingTime=500)
-
+ #NOTE Check ping result here..add code for it
+
+
main.step("Compare ONOS Topology to MN Topology")
Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
MNTopo = Topo
@@ -532,19 +804,22 @@
'''
Host intents removal
'''
- main.log.report("This testcase removes host intents before adding the point intents")
+ main.log.report("This testcase removes host intents before adding the same intents or point intents")
main.log.report("__________________________________")
main.log.info("Host intents removal")
main.case("Removing host intents")
main.step("Obtain the intent id's")
- intent_result = main.ONOS2.intents()
- #print "intent_result = ",intent_result
+ intent_result = main.ONOS2.intents(json_format = False)
+ main.log.info("intent_result = " +intent_result)
+
intent_linewise = intent_result.split("\n")
- intent_linewise = intent_linewise[1:-1] #ignore the first and last item of the list obtained from split
- #for line in intent_linewise:
- #print "line = ", line
- intentids = []
+ intentList = []
for line in intent_linewise:
+ if line.startswith("id="):
+ intentList.append(line)
+
+ intentids = []
+ for line in intentList:
intentids.append(line.split(",")[0].split("=")[1])
for id in intentids:
print "id = ", id
@@ -553,36 +828,49 @@
for id in intentids:
main.ONOS2.remove_intent(intent_id = id)
- intent_result = main.ONOS2.intents()
- intent_linewise = intent_result.split("\n")
- intent_linewise = intent_linewise[1:-1] #ignore the first and last item of the list obtained from split
-
- intentState = {}
- for id, line in zip(intentids, intent_linewise):
- #print "line after removing intent = ", line
- x = line.split(",")
- state = x[1].split("=")[1]
- intentState[id] = state
-
- case8_result = main.TRUE
- for key,value in intentState.iteritems():
- print "key,value = ", key, value
- if value == "WITHDRAWN":
- case8_result = case8_result and main.TRUE
- else:
- case8_result = case8_result and main.FALSE
+ intent_result = main.ONOS2.intents(json_format = False)
+ main.log.info("intent_result = " +intent_result)
+ case8_result = main.TRUE
if case8_result == main.TRUE:
main.log.report("Intent removal successful")
else:
main.log.report("Intent removal failed")
-
- utilities.assert_equals(expect=main.TRUE, actual=case8_result,
- onpass="Intent removal test successful",
- onfail="Intent removal test failed")
+
+ Ping_Result = main.TRUE
+ if case8_result == main.TRUE:
+ i = 8
+ while i <18 :
+ main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+ if ping==main.TRUE:
+ i = 19
+ Ping_Result = Ping_Result and main.TRUE
+ elif ping==main.FALSE:
+ i+=1
+ Ping_Result = Ping_Result and main.FALSE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+ #Note: If the ping result failed, that means the intents have been withdrawn correctly.
+ if Ping_Result==main.TRUE:
+ main.log.report("Host intents have not been withdrawn correctly")
+ #main.cleanup()
+ #main.exit()
+ if Ping_Result==main.FALSE:
+ main.log.report("Host intents have been withdrawn correctly")
-
+ case8_result = case8_result and Ping_Result
+
+ if case8_result == main.FALSE:
+ main.log.report("Intent removal successful")
+ else:
+ main.log.report("Intent removal failed")
+
+ utilities.assert_equals(expect=main.FALSE, actual=case8_result,
+ onpass="Intent removal test failed",
+ onfail="Intent removal test passed")
def CASE9(self):
@@ -591,135 +879,135 @@
main.log.info("Adding point intents")
main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)")
main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018", 1, "of:0000000000003008", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009", 1, "of:0000000000006019", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019", 1, "of:0000000000003009", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010", 1, "of:0000000000006020", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020", 1, "of:0000000000003010", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011", 1, "of:0000000000006021", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021", 1, "of:0000000000003011", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012", 1, "of:0000000000006022", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022", 1, "of:0000000000003012", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013", 1, "of:0000000000006023", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023", 1, "of:0000000000003013", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014", 1, "of:0000000000006024", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024", 1, "of:0000000000003014", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015", 1, "of:0000000000006025", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025", 1, "of:0000000000003015", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016", 1, "of:0000000000006026", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026", 1, "of:0000000000003016", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017", 1, "of:0000000000006027", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027", 1, "of:0000000000003017", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
print("_______________________________________________________________________________________")
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.params b/TestON/tests/ProdFunc13/ProdFunc13.params
index 9b44a53..2af3237 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.params
+++ b/TestON/tests/ProdFunc13/ProdFunc13.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,4,5,6,7,8,9</testcases>
+ <testcases>1,4,10,5,6,7,8,9,20,21,22,10,23,24</testcases>
#Environment variables
<ENV>
@@ -40,4 +40,10 @@
<SwitchDiscovery>31</SwitchDiscovery>
</timers>
+ <OPTICAL>
+ <jsonfile> /home/admin/ONOS/tools/test/topos/oe-nonlinear-4.json </jsonfile>
+ </OPTICAL>
+
+
+
</PARAMS>
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index 63a15cc..abb99d2 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -6,7 +6,6 @@
import sys
import os
import re
-import time
import json
time.sleep(1)
@@ -17,11 +16,12 @@
def CASE1(self, main):
'''
Startup sequence:
+ cell <name>
+ onos-verify-cell
+ onos-remove-raft-log
git pull
mvn clean install
onos-package
- cell <name>
- onos-verify-cell
onos-install -f
onos-wait-for-start
'''
@@ -33,6 +33,14 @@
main.case("Setting up test environment")
main.log.report("This testcase is testing setting up test environment")
main.log.report("__________________________________")
+
+ main.step("Applying cell variable to environment")
+ cell_result = main.ONOSbench.set_cell(cell_name)
+ verify_result = main.ONOSbench.verify_cell()
+
+ main.step("Removing raft logs before a clen installation of ONOS")
+ main.ONOSbench.onos_remove_raft_logs()
+
main.step("Git checkout and pull master and get version")
main.ONOSbench.git_checkout("master")
git_pull_result = main.ONOSbench.git_pull()
@@ -43,21 +51,10 @@
main.step("Using mvn clean & install")
clean_install_result = main.ONOSbench.clean_install()
#clean_install_result = main.TRUE
-
- main.step("Applying cell variable to environment")
- cell_result1 = main.ONOSbench.set_cell(cell_name)
- verify_result = main.ONOSbench.verify_cell()
- cell_result2 = main.ONOS2.set_cell(cell_name)
- #verify_result = main.ONOS2.verify_cell()
- main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
- cell_result = cell_result1 and cell_result2
-
+
main.step("Creating ONOS package")
package_result = main.ONOSbench.onos_package()
- #main.step("Creating a cell")
- #cell_create_result = main.ONOSbench.create_cell_file(**************)
main.step("Installing ONOS package")
onos_install_result = main.ONOSbench.onos_install()
@@ -74,6 +71,8 @@
main.step("Starting ONOS service")
start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+ main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
case1_result = (package_result and\
cell_result and verify_result and onos_install_result and\
@@ -125,6 +124,291 @@
main.log.info("onos command returned: "+cmd_result2)
+ def CASE20(self):
+ '''
+ Exit from mininet cli
+ reinstall ONOS
+ '''
+ cell_name = main.params['ENV']['cellName']
+ ONOS1_ip = main.params['CTRL']['ip1']
+ ONOS1_port = main.params['CTRL']['port1']
+
+ main.log.report("This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology")
+ main.log.report("_____________________________________________")
+ main.case("Disconnecting mininet and restarting ONOS")
+ main.step("Disconnecting mininet and restarting ONOS")
+ mininet_disconnect = main.Mininet1.disconnect()
+
+ main.step("Removing raft logs before a clen installation of ONOS")
+ main.ONOSbench.onos_remove_raft_logs()
+
+ main.step("Applying cell variable to environment")
+ cell_result = main.ONOSbench.set_cell(cell_name)
+ verify_result = main.ONOSbench.verify_cell()
+
+ onos_install_result = main.ONOSbench.onos_install()
+ if onos_install_result == main.TRUE:
+ main.log.report("Installing ONOS package successful")
+ else:
+ main.log.report("Installing ONOS package failed")
+
+ onos1_isup = main.ONOSbench.isup()
+ if onos1_isup == main.TRUE:
+ main.log.report("ONOS instance is up and ready")
+ else:
+ main.log.report("ONOS instance may not be up")
+
+ main.step("Starting ONOS service")
+ start_result = main.ONOSbench.onos_start(ONOS1_ip)
+
+ main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+ print "mininet_disconnect =", mininet_disconnect
+ print "onos_install_result =", onos_install_result
+ print "onos1_isup =", onos1_isup
+ print "start_result =", start_result
+
+ case20_result = mininet_disconnect and cell_result and onos_install_result and onos1_isup and start_result
+ utilities.assert_equals(expect=main.TRUE, actual=case20_result,
+ onpass="Exiting functionality mininet topology and reinstalling ONOS successful",
+ onfail="Exiting functionality mininet topology and reinstalling ONOS failed")
+
+ def CASE21(self, main):
+ import time
+ '''
+ On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
+ which starts the rest and copies the links json file to the onos instance
+ Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt
+ from the json config file
+ '''
+ main.log.report("This testcase starts the packet layer topology and REST")
+ main.log.report("_____________________________________________")
+ main.case("Starting LINC-OE and other components")
+ main.step("Starting LINC-OE and other components")
+ start_console_result = main.LincOE1.start_console()
+ optical_mn_script = main.LincOE2.run_optical_mn_script()
+ onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(instance_name = main.params['CTRL']['ip1'], json_file = main.params['OPTICAL']['jsonfile'])
+
+ print "start_console_result =",start_console_result
+ print "optical_mn_script = ",optical_mn_script
+ print "onos_topo_cfg_result =",onos_topo_cfg_result
+
+ case21_result = start_console_result and optical_mn_script and onos_topo_cfg_result
+ utilities.assert_equals(expect=main.TRUE, actual=case21_result,
+ onpass="Packet optical topology spawned successsfully",
+ onfail="Packet optical topology spawning failed")
+
+
+ def CASE22(self, main):
+ '''
+ Curretly we use, 4 linear switch optical topology and 2 packet layer mininet switches each with one host.
+ Therefore, the roadmCount variable = 4, packetLayerSWCount variable = 2, hostCount =2
+ and this is hardcoded in the testcase. If the topology changes, these hardcoded values need to be changed
+ '''
+
+ main.log.report("This testcase compares the optical+packet topology against what is expected")
+ main.case("Topology comparision")
+ main.step("Topology comparision")
+ main.ONOS3.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+ devices_result = main.ONOS3.devices(json_format = False)
+
+ print "devices_result = ", devices_result
+ devices_linewise = devices_result.split("\n")
+ devices_linewise = devices_linewise[1:-1]
+ roadmCount = 0
+ packetLayerSWCount = 0
+ for line in devices_linewise:
+ components = line.split(",")
+ availability = components[1].split("=")[1]
+ type = components[3].split("=")[1]
+ if availability == 'true' and type == 'ROADM':
+ roadmCount += 1
+ elif availability == 'true' and type =='SWITCH':
+ packetLayerSWCount += 1
+ if roadmCount == 4:
+ print "Number of Optical Switches = %d and is correctly detected" %roadmCount
+ main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is correctly detected")
+ opticalSW_result = main.TRUE
+ else:
+ print "Number of Optical Switches = %d and is wrong" %roadCount
+ main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is wrong")
+ opticalSW_result = main.FALSE
+
+ if packetLayerSWCount == 2:
+ print "Number of Packet layer or mininet Switches = %d and is correctly detected" %packetLayerSWCount
+ main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is correctly detected")
+ packetSW_result = main.TRUE
+ else:
+ print "Number of Packet layer or mininet Switches = %d and is wrong" %packetLayerSWCount
+ main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is wrong")
+ packetSW_result = main.FALSE
+ print "_________________________________"
+
+ links_result = main.ONOS3.links(json_format = False)
+ print "links_result = ", links_result
+ print "_________________________________"
+
+ #NOTE:Since only point intents are added, there is no requirement to discover the hosts
+ #Therfore, the below portion of the code is commented.
+ '''
+ #Discover hosts using pingall
+ pingall_result = main.LincOE2.pingall()
+
+ hosts_result = main.ONOS3.hosts(json_format = False)
+ main.log.info("hosts_result = "+hosts_result)
+ main.log.info("_________________________________")
+ hosts_linewise = hosts_result.split("\n")
+ hosts_linewise = hosts_linewise[1:-1]
+ hostCount = 0
+ for line in hosts_linewise:
+ hostid = line.split(",")[0].split("=")[1]
+ hostCount +=1
+ if hostCount ==2:
+ print "Number of hosts = %d and is correctly detected" %hostCount
+ main.log.info("Number of hosts = " + str(hostCount) +" and is correctly detected")
+ hostDiscovery = main.TRUE
+ else:
+ print "Number of hosts = %d and is wrong" %hostCount
+ main.log.info("Number of hosts = " + str(hostCount) +" and is wrong")
+ hostDiscovery = main.FALSE
+ '''
+
+ case22_result = opticalSW_result and packetSW_result
+ utilities.assert_equals(expect=main.TRUE, actual=case22_result,
+ onpass="Packet optical topology discovery successful",
+ onfail="Packet optical topology discovery failed")
+
+ def CASE23(self, main):
+ import time
+ '''
+ Add bidirectional point intents between 2 packet layer(mininet) devices and
+ ping mininet hosts
+ '''
+ main.log.report("This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts")
+ main.case("Topology comparision")
+ main.step("Adding point intents")
+ ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0001/1", "of:0000ffffffff0002/1")
+ if ptp_intent_result == main.TRUE:
+ get_intent_result = main.ONOS3.intents(json_format = False)
+ main.log.info("Point to point intent install successful")
+
+ ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0002/1", "of:0000ffffffff0001/1")
+ if ptp_intent_result == main.TRUE:
+ get_intent_result = main.ONOS3.intents(json_format = False)
+ main.log.info("Point to point intent install successful")
+
+ time.sleep(10)
+ flowHandle = main.ONOS3.flows()
+ main.log.info("flows :" + flowHandle)
+
+ # Sleep for 30 seconds to provide time for the intent state to change
+ time.sleep(30)
+ intentHandle = main.ONOS3.intents(json_format = False)
+ main.log.info("intents :" + intentHandle)
+
+ Ping_Result = main.TRUE
+ count = 1
+ main.log.info("\n\nh1 is Pinging h2")
+ ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+ #ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count<5:
+ count+=1
+ Ping_Result = main.FALSE
+ main.log.info("Ping between h1 and h2 failed. Making attempt number "+str(count) + " in 2 seconds")
+ time.sleep(2)
+ ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+ #ping = main.LincOE2.pinghost()
+ elif ping==main.FALSE:
+ main.log.info("All ping attempts between h1 and h2 have failed")
+ Ping_Result = main.FALSE
+ elif ping==main.TRUE:
+ main.log.info("Ping test between h1 and h2 passed!")
+ Ping_Result = main.TRUE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+
+ if Ping_Result==main.FALSE:
+ main.log.report("Point intents for packet optical have not ben installed correctly. Cleaning up")
+ if Ping_Result==main.TRUE:
+ main.log.report("Point Intents for packet optical have been installed correctly")
+
+ case23_result = Ping_Result
+ utilities.assert_equals(expect=main.TRUE, actual=case23_result,
+ onpass="Point intents addition for packet optical and Pingall Test successful",
+ onfail="Point intents addition for packet optical and Pingall Test NOT successful")
+
+
+
+ def CASE24(self, main):
+ import time
+ import json
+ '''
+ Test Rerouting of Packet Optical by bringing a port down (port 22) of a switch(switchID=1), so that link (between switch1 port22 - switch4-port30) is inactive
+ and do a ping test. If rerouting is successful, ping should pass. also check the flows
+ '''
+ main.log.report("This testcase tests rerouting and pings mininet hosts")
+ main.case("Test rerouting and pings mininet hosts")
+ main.step("Bring a port down and verify the link state")
+ main.LincOE1.port_down(sw_id="1", pt_id="22")
+ links_nonjson = main.ONOS3.links(json_format = False)
+ main.log.info("links = " +links_nonjson)
+
+ links = main.ONOS3.links()
+ main.log.info("links = " +links)
+
+ links_result = json.loads(links)
+ links_state_result = main.FALSE
+ for item in links_result:
+ if item['src']['device'] == "of:0000ffffffffff01" and item['src']['port'] == "22":
+ if item['dst']['device'] == "of:0000ffffffffff04" and item['dst']['port'] == "30":
+ links_state = item['state']
+ if links_state == "INACTIVE":
+ main.log.info("Links state is inactive as expected due to one of the ports being down")
+ main.log.report("Links state is inactive as expected due to one of the ports being down")
+ links_state_result = main.TRUE
+ break
+ else:
+ main.log.info("Links state is not inactive as expected")
+ main.log.report("Links state is not inactive as expected")
+ links_state_result = main.FALSE
+
+ print "links_state_result = ", links_state_result
+ time.sleep(10)
+ flowHandle = main.ONOS3.flows()
+ main.log.info("flows :" + flowHandle)
+
+ main.step("Verify Rerouting by a ping test")
+ Ping_Result = main.TRUE
+ count = 1
+ main.log.info("\n\nh1 is Pinging h2")
+ ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+ #ping = main.LincOE2.pinghost()
+ if ping == main.FALSE and count<5:
+ count+=1
+ Ping_Result = main.FALSE
+ main.log.info("Ping between h1 and h2 failed. Making attempt number "+str(count) + " in 2 seconds")
+ time.sleep(2)
+ ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+ #ping = main.LincOE2.pinghost()
+ elif ping==main.FALSE:
+ main.log.info("All ping attempts between h1 and h2 have failed")
+ Ping_Result = main.FALSE
+ elif ping==main.TRUE:
+ main.log.info("Ping test between h1 and h2 passed!")
+ Ping_Result = main.TRUE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+
+ if Ping_Result==main.TRUE:
+ main.log.report("Ping test successful ")
+ if Ping_Result==main.FALSE:
+ main.log.report("Ping test failed")
+
+ case24_result = Ping_Result and links_state_result
+ utilities.assert_equals(expect=main.TRUE, actual=case24_result,
+ onpass="Packet optical rerouting successful",
+ onfail="Packet optical rerouting failed")
def CASE4(self, main):
import re
@@ -235,26 +519,42 @@
else:
main.log.report("Pingall Test in reactive mode to discover the hosts failed")
- utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall T est successful",onfail="Controller assignment and Pingall Test NOT successful")
+ utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall Test successful",onfail="Controller assignment and Pingall Test NOT successful")
+
+ def CASE10(self):
+ main.log.report("This testcase uninstalls the reactive forwarding app")
+ main.log.report("__________________________________")
+ main.case("Uninstalling reactive forwarding app")
+ #Unistall onos-app-fwd app to disable reactive forwarding
+ appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
+ main.log.info("onos-app-fwd uninstalled")
+
+ #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+ #So sleep for 15s
+ time.sleep(15)
+
+ flows = main.ONOS2.flows()
+ main.log.info(flows)
+
+ case10_result = appUninstall_result
+ utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed")
def CASE6(self):
- main.log.report("This testcase is testing the addition of host intents and then doing pingall")
+ main.log.report("This testcase is testing the addition of host intents and then does pingall")
main.log.report("__________________________________")
- main.case("Uninstalling reactive forwarding app and addhost intents")
+ main.case("Obtaining host id's")
main.step("Get hosts")
- main.ONOS2.handle.sendline("hosts")
- main.ONOS2.handle.expect("onos>")
- hosts = main.ONOS2.handle.before
- main.log.info(hosts)
+ hosts = main.ONOS2.hosts()
+ #main.log.info(hosts)
main.step("Get all devices id")
devices_id_list = main.ONOS2.get_all_devices_id()
- main.log.info(devices_id_list)
+ #main.log.info(devices_id_list)
#ONOS displays the hosts in hex format unlike mininet which does in decimal format
#So take care while adding intents
-
+ '''
main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
@@ -266,22 +566,24 @@
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1")
hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
-
-
-
print "_____________________________________________________________________________________"
+ '''
- #Unistall onos-app-fwd app to disable reactive forwarding
- appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
- main.log.info("onos-app-fwd uninstalled")
+ for i in range(8,18):
+ main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+ host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+ host2 = "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+ #NOTE: get host can return None
+ #TODO: handle this
+ host1_id = main.ONOS2.get_host(host1)['id']
+ host2_id = main.ONOS2.get_host(host2)['id']
+ tmp_result = main.ONOS2.add_host_intent(host1_id, host2_id )
- #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
- #So sleep for 15s
- time.sleep(15)
-
+ time.sleep(10)
+ h_intents = main.ONOS2.intents(json_format = False)
+ main.log.info("intents:" +h_intents)
flowHandle = main.ONOS2.flows()
- #print "flowHandle = ", flowHandle
- main.log.info("flow:" +flowHandle)
+ #main.log.info("flow:" +flowHandle)
count = 1
i = 8
@@ -315,7 +617,7 @@
main.log.report("Ping all test after Host intent addition successful")
case6_result = Ping_Result
- utilities.assert_equals(expect=main.TRUE, actual=case4_result,
+ utilities.assert_equals(expect=main.TRUE, actual=case6_result,
onpass="Pingall Test after Host intents addition successful",
onfail="Pingall Test after Host intents addition failed")
@@ -413,6 +715,7 @@
main.log.report("__________________________________")
main.log.report("Killing a link to ensure that link discovery is consistent")
main.case("Killing a link to Ensure that Link Discovery is Working Properly")
+ '''
main.step("Start continuous pings")
main.Mininet2.pingLong(src=main.params['PING']['source1'],
@@ -435,7 +738,7 @@
target=main.params['PING']['target9'],pingTime=500)
main.Mininet2.pingLong(src=main.params['PING']['source10'],
target=main.params['PING']['target10'],pingTime=500)
-
+ '''
main.step("Determine the current number of switches and links")
topology_output = main.ONOS2.topology()
@@ -470,30 +773,9 @@
onpass="Link up discovered properly",
onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
- #Check ping result here..add code for it
- main.step("Start continuous pings")
-
- main.Mininet2.pingLong(src=main.params['PING']['source1'],
- target=main.params['PING']['target1'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source2'],
- target=main.params['PING']['target2'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source3'],
- target=main.params['PING']['target3'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source4'],
- target=main.params['PING']['target4'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source5'],
- target=main.params['PING']['target5'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source6'],
- target=main.params['PING']['target6'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source7'],
- target=main.params['PING']['target7'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source8'],
- target=main.params['PING']['target8'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source9'],
- target=main.params['PING']['target9'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source10'],
- target=main.params['PING']['target10'],pingTime=500)
-
+ #NOTE Check ping result here..add code for it
+
+
main.step("Compare ONOS Topology to MN Topology")
Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
MNTopo = Topo
@@ -532,19 +814,22 @@
'''
Host intents removal
'''
- main.log.report("This testcase removes host intents before adding the point intents")
+ main.log.report("This testcase removes host intents before adding the same intents or point intents")
main.log.report("__________________________________")
main.log.info("Host intents removal")
main.case("Removing host intents")
main.step("Obtain the intent id's")
- intent_result = main.ONOS2.intents()
- #print "intent_result = ",intent_result
+ intent_result = main.ONOS2.intents(json_format = False)
+ main.log.info("intent_result = " +intent_result)
+
intent_linewise = intent_result.split("\n")
- intent_linewise = intent_linewise[1:-1] #ignore the first and last item of the list obtained from split
- #for line in intent_linewise:
- #print "line = ", line
- intentids = []
+ intentList = []
for line in intent_linewise:
+ if line.startswith("id="):
+ intentList.append(line)
+
+ intentids = []
+ for line in intentList:
intentids.append(line.split(",")[0].split("=")[1])
for id in intentids:
print "id = ", id
@@ -553,36 +838,49 @@
for id in intentids:
main.ONOS2.remove_intent(intent_id = id)
- intent_result = main.ONOS2.intents()
- intent_linewise = intent_result.split("\n")
- intent_linewise = intent_linewise[1:-1] #ignore the first and last item of the list obtained from split
-
- intentState = {}
- for id, line in zip(intentids, intent_linewise):
- #print "line after removing intent = ", line
- x = line.split(",")
- state = x[1].split("=")[1]
- intentState[id] = state
-
- case8_result = main.TRUE
- for key,value in intentState.iteritems():
- print "key,value = ", key, value
- if value == "WITHDRAWN":
- case8_result = case8_result and main.TRUE
- else:
- case8_result = case8_result and main.FALSE
+ intent_result = main.ONOS2.intents(json_format = False)
+ main.log.info("intent_result = " +intent_result)
+ case8_result = main.TRUE
if case8_result == main.TRUE:
main.log.report("Intent removal successful")
else:
main.log.report("Intent removal failed")
-
- utilities.assert_equals(expect=main.TRUE, actual=case8_result,
- onpass="Intent removal test successful",
- onfail="Intent removal test failed")
+
+ Ping_Result = main.TRUE
+ if case8_result == main.TRUE:
+ i = 8
+ while i <18 :
+ main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+ ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+ if ping==main.TRUE:
+ i = 19
+ Ping_Result = Ping_Result and main.TRUE
+ elif ping==main.FALSE:
+ i+=1
+ Ping_Result = Ping_Result and main.FALSE
+ else:
+ main.log.info("Unknown error")
+ Ping_Result = main.ERROR
+ #Note: If the ping result failed, that means the intents have been withdrawn correctly.
+ if Ping_Result==main.TRUE:
+ main.log.report("Host intents have not been withdrawn correctly")
+ #main.cleanup()
+ #main.exit()
+ if Ping_Result==main.FALSE:
+ main.log.report("Host intents have been withdrawn correctly")
-
+ case8_result = case8_result and Ping_Result
+
+ if case8_result == main.FALSE:
+ main.log.report("Intent removal successful")
+ else:
+ main.log.report("Intent removal failed")
+
+ utilities.assert_equals(expect=main.FALSE, actual=case8_result,
+ onpass="Intent removal test failed",
+ onfail="Intent removal test passed")
def CASE9(self):
@@ -591,135 +889,135 @@
main.log.info("Adding point intents")
main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)")
main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018", 1, "of:0000000000003008", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009", 1, "of:0000000000006019", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019", 1, "of:0000000000003009", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010", 1, "of:0000000000006020", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020", 1, "of:0000000000003010", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011", 1, "of:0000000000006021", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021", 1, "of:0000000000003011", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012", 1, "of:0000000000006022", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022", 1, "of:0000000000003012", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013", 1, "of:0000000000006023", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023", 1, "of:0000000000003013", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014", 1, "of:0000000000006024", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024", 1, "of:0000000000003014", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015", 1, "of:0000000000006025", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025", 1, "of:0000000000003015", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016", 1, "of:0000000000006026", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026", 1, "of:0000000000003016", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017", 1, "of:0000000000006027", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
- ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027", 1, "of:0000000000003017", 1)
+ ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS2.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
+ #main.log.info(get_intent_result)
print("_______________________________________________________________________________________")
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.topo b/TestON/tests/ProdFunc13/ProdFunc13.topo
index cf6ffac..c592e18 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.topo
+++ b/TestON/tests/ProdFunc13/ProdFunc13.topo
@@ -28,12 +28,22 @@
<COMPONENTS> </COMPONENTS>
</ONOS2>
+ <ONOS3>
+ <host>10.128.10.11</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOS3>
+
+
<Mininet1>
<host>10.128.10.11</host>
<user>admin</user>
<password>onos_test</password>
<type>MininetCliDriver</type>
- <connect_order>4</connect_order>
+ <connect_order>5</connect_order>
<COMPONENTS>
#Specify the Option for mininet
<arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
@@ -48,7 +58,7 @@
<user>admin</user>
<password>onos_test</password>
<type>RemoteMininetDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>6</connect_order>
<COMPONENTS>
#Specify the Option for mininet
<arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
@@ -57,5 +67,37 @@
<controller> remote </controller>
</COMPONENTS>
</Mininet2>
+
+ <LincOE1>
+ <host>10.128.20.30</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>LincOEDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ <arg1> </arg1>
+ </COMPONENTS>
+ </LincOE1>
+
+ <LincOE2>
+ <host>10.128.20.30</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ <arg1> sudo python /home/admin/optical.py </arg1>
+ <arg2> </arg2>
+ </COMPONENTS>
+ </LincOE2>
+
+ <LincOE3>
+ <host>10.128.20.30</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>LincOEDriver</type>
+ <connect_order>9</connect_order>
+ </LincOE3>
+
</COMPONENT>
</TOPOLOGY>
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.params b/TestON/tests/SdnIpTest/SdnIpTest.params
index 9d3627a..bb5826d 100755
--- a/TestON/tests/SdnIpTest/SdnIpTest.params
+++ b/TestON/tests/SdnIpTest/SdnIpTest.params
@@ -1,14 +1,14 @@
<PARAMS>
- <testcases>1</testcases>
+ <testcases>1,2</testcases>
#Environment variables
<ENV>
- <cellName>driver_test</cellName>
+ <cellName>sdnip_single_instance</cellName>
</ENV>
<CTRL>
- <ip1>127.0.0.1</ip1>
+ <ip1>10.128.4.52</ip1>
<port1>6633</port1>
</CTRL>
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.py b/TestON/tests/SdnIpTest/SdnIpTest.py
index dd73766..4f55c02 100755
--- a/TestON/tests/SdnIpTest/SdnIpTest.py
+++ b/TestON/tests/SdnIpTest/SdnIpTest.py
@@ -1,5 +1,6 @@
+# from cupshelpers.config import prefix
-#Testing the basic functionality of SDN-IP
+# Testing the basic functionality of SDN-IP
class SdnIpTest:
def __init__(self):
@@ -10,111 +11,156 @@
'''
Test the SDN-IP functionality
allRoutes_expected: all expected routes for all BGP peers
- routeIntents_expected: all expected MultiPointToSinglePointIntent intents
- bgpIntents_expected: expected PointToPointIntent intents
- allRoutes_actual: all routes from ONOS LCI
- routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
- bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
+ routeIntents_expected: all expected MultiPointToSinglePointIntent intents
+ bgpIntents_expected: expected PointToPointIntent intents
+ allRoutes_actual: all routes from ONOS LCI
+ routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
+ bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
'''
import time
import json
from operator import eq
-
+ # from datetime import datetime
+ from time import localtime, strftime
+
main.case("The test case is to help to setup the TestON environment and test new drivers")
SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
# all expected routes for all BGP peers
allRoutes_expected = []
- main.step("Start to generate routes for BGP peer on host1")
- prefixes = main.Quaggacli.generate_prefixes(1, 3)
- main.log.info(prefixes)
+ main.step("Start to generate routes for all BGP peers")
+ # bgpPeerHosts = []
+ # for i in range(3, 5):
+ # bgpPeerHosts.append("host" + str(i))
+ # main.log.info("BGP Peer Hosts are:" + bgpPeerHosts)
- # TODO: delete the static prefix below after integration with Demo Mininet script
- prefixes = []
- prefixes.append("172.16.30.0/24")
- prefixes.append("1.0.0.0/24")
- prefixes.append("2.0.0.0/24")
- prefixes.append("3.0.0.0/24")
+ # for i in range(3, 5):
+ # QuaggaCliHost = "QuaggaCliHost" + str(i)
+ # prefixes = main.QuaggaCliHost.generate_prefixes(3, 10)
+ # main.log.info(prefixes)
+ # allRoutes_expected.append(prefixes)
+ main.log.info("Generate prefixes for host3")
+ prefixes_host3 = main.QuaggaCliHost3.generate_prefixes(3, 10)
+ main.log.info(prefixes_host3)
+ # generate route with next hop
+ for prefix in prefixes_host3:
+ allRoutes_expected.append(prefix + "/" + "192.168.20.1")
+ routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(prefixes_host3, "192.168.20.1", "00:00:00:00:02:02", SDNIP_JSON_FILE_PATH)
- for prefix in prefixes:
- # generate route with next hop
- allRoutes_expected.append(prefix + "/" + "1.1.1.1")
+ main.log.info("Generate prefixes for host4")
+ prefixes_host4 = main.QuaggaCliHost4.generate_prefixes(4, 10)
+ main.log.info(prefixes_host4)
+ # generate route with next hop
+ for prefix in prefixes_host4:
+ allRoutes_expected.append(prefix + "/" + "192.168.30.1")
+ routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(prefixes_host4, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
- routeIntents_expected = main.Quaggacli.generate_expected_onePeerRouteIntents(prefixes, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
+ routeIntents_expected = routeIntents_expected_host3 + routeIntents_expected_host4
- # start to insert routes into the bgp peer
- main.step("Start Quagga-cli on host1")
- main.Quaggacli.loginQuagga("1.1.1.1")
-
- main.step("Start to configure Quagga on host1")
- main.Quaggacli.enter_config(64513)
-
- main.step("Start to generate and add routes for BGP peer on host1")
- routes = main.Quaggacli.generate_prefixes(8, 3)
- main.Quaggacli.add_routes(routes, 1)
-
- # add generates routes to allRoutes
- for route in routes:
- allRoutes_expected.append(route + "/" + "1.1.1.1")
cell_name = main.params['ENV']['cellName']
ONOS1_ip = main.params['CTRL']['ip1']
+ main.step("Set cell for ONOS-cli environment")
+ main.ONOScli.set_cell(cell_name)
+ verify_result = main.ONOSbench.verify_cell()
+ main.log.report("Removing raft logs")
+ main.ONOSbench.onos_remove_raft_logs()
+ main.log.report("Uninstalling ONOS")
+ main.ONOSbench.onos_uninstall(ONOS1_ip)
+ main.step("Creating ONOS package")
+ package_result = main.ONOSbench.onos_package()
main.step("Starting ONOS service")
# TODO: start ONOS from Mininet Script
# start_result = main.ONOSbench.onos_start("127.0.0.1")
+ main.step("Installing ONOS package")
+ onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
- main.step("Set cell for ONOS-cli environment")
- main.ONOScli.set_cell(cell_name)
-
+ main.step("Checking if ONOS is up yet")
+ time.sleep(60)
+ onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+ if not onos1_isup:
+ main.log.report("ONOS1 didn't start!")
+
main.step("Start ONOS-cli")
# TODO: change the hardcode in start_onos_cli method in ONOS CLI driver
- time.sleep(5)
- main.ONOScli.start_onos_cli(ONOS1_ip)
+
+ main.ONOScli.start_onos_cli(ONOS1_ip)
main.step("Get devices in the network")
list_result = main.ONOScli.devices(json_format=False)
main.log.info(list_result)
+ time.sleep(10)
+ main.log.info("Installing sdn-ip feature")
+ main.ONOScli.feature_install("onos-app-sdnip")
+ time.sleep(10)
+ main.step("Login all BGP peers and add routes into peers")
+ main.log.info("Login Quagga CLI on host3")
+ main.QuaggaCliHost3.loginQuagga("1.168.30.2")
+ main.log.info("Enter configuration model of Quagga CLI on host3")
+ main.QuaggaCliHost3.enter_config(64514)
+ main.log.info("Add routes to Quagga on host3")
+ main.QuaggaCliHost3.add_routes(prefixes_host3, 1)
- #get all routes inside SDN-IP
- get_routes_result = main.ONOScli.routes(json_format=True)
-
+ main.log.info("Login Quagga CLI on host4")
+ main.QuaggaCliHost4.loginQuagga("1.168.30.3")
+ main.log.info("Enter configuration model of Quagga CLI on host4")
+ main.QuaggaCliHost4.enter_config(64516)
+ main.log.info("Add routes to Quagga on host4")
+ main.QuaggaCliHost4.add_routes(prefixes_host4, 1)
+ time.sleep(60)
+
+ # get all routes inside SDN-IP
+ get_routes_result = main.ONOScli.routes(json_format=True)
+
# parse routes from ONOS CLI
- allRoutes_actual = main.Quaggacli.extract_actual_routes(get_routes_result)
-
+ allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+
+ allRoutes_str_expected = str(sorted(allRoutes_expected))
+ allRoutes_str_actual = str(allRoutes_actual).replace('u', "")
main.step("Check routes installed")
main.log.info("Routes expected:")
- main.log.info(sorted(allRoutes_expected))
+ main.log.info(allRoutes_str_expected)
main.log.info("Routes get from ONOS CLI:")
- main.log.info(allRoutes_actual)
- utilities.assert_equals(expect=sorted(allRoutes_expected), actual=allRoutes_actual,
+ main.log.info(allRoutes_str_actual)
+ utilities.assert_equals(expect=allRoutes_str_expected, actual=allRoutes_str_actual,
onpass="***Routes in SDN-IP are correct!***",
onfail="***Routes in SDN-IP are wrong!***")
+ if(eq(allRoutes_str_expected, allRoutes_str_actual)):
+ main.log.report("***Routes in SDN-IP after adding routes are correct!***")
+ else:
+ main.log.report("***Routes in SDN-IP after adding routes are wrong!***")
- time.sleep(2)
+ time.sleep(20)
get_intents_result = main.ONOScli.intents(json_format=True)
main.step("Check MultiPointToSinglePointIntent intents installed")
# route_intents_expected are generated when generating routes
# get rpoute intents from ONOS CLI
- routeIntents_actual = main.Quaggacli.extract_actual_routeIntents(get_intents_result)
+ routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+ routeIntents_str_expected = str(sorted(routeIntents_expected))
+ routeIntents_str_actual = str(routeIntents_actual).replace('u', "")
main.log.info("MultiPointToSinglePoint intents expected:")
- main.log.info(routeIntents_expected)
+ main.log.info(routeIntents_str_expected)
main.log.info("MultiPointToSinglePoint intents get from ONOS CLI:")
- main.log.info(routeIntents_actual)
- utilities.assert_equals(expect=True, actual=eq(routeIntents_expected, routeIntents_actual),
+ main.log.info(routeIntents_str_actual)
+ utilities.assert_equals(expect=True, actual=eq(routeIntents_str_expected, routeIntents_str_actual),
onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***")
+ if(eq(routeIntents_str_expected, routeIntents_str_actual)):
+ main.log.report("***MultiPointToSinglePoint Intents before deleting routes correct!***")
+ else:
+ main.log.report("***MultiPointToSinglePoint Intents before deleting routes wrong!***")
main.step("Check BGP PointToPointIntent intents installed")
# bgp intents expected
- bgpIntents_expected = main.Quaggacli.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
+ bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
# get BGP intents from ONOS CLI
- bgpIntents_actual = main.Quaggacli.extract_actual_bgpIntents(get_intents_result)
+ bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(get_intents_result)
- bgpIntents_str_expected = str(bgpIntents_expected).replace('u',"")
+ bgpIntents_str_expected = str(bgpIntents_expected).replace('u', "")
bgpIntents_str_actual = str(bgpIntents_actual)
main.log.info("PointToPointIntent intents expected:")
main.log.info(bgpIntents_str_expected)
@@ -125,7 +171,293 @@
onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
onfail="***PointToPointIntent Intents in SDN-IP are wrong!***")
- #main.step("Test whether Mininet is started")
- #main.Mininet2.handle.sendline("xterm host1")
- #main.Mininet2.handle.expect("mininet>")
+
+ if (eq(bgpIntents_str_expected, bgpIntents_str_actual)):
+ main.log.report("***PointToPointIntent Intents in SDN-IP are correct!***")
+ else:
+ main.log.report("***PointToPointIntent Intents in SDN-IP are wrong!***")
+
+
+
+ #============================= Ping Test ========================
+ # wait until all MultiPointToSinglePoint
+ time.sleep(20)
+ ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-before-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+ ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
+ main.log.info(ping_test_results)
+
+ # ping test
+
+ #============================= Deleting Routes ==================
+ main.step("Check deleting routes installed")
+ main.QuaggaCliHost3.delete_routes(prefixes_host3, 1)
+ main.QuaggaCliHost4.delete_routes(prefixes_host4, 1)
+
+ # main.log.info("main.ONOScli.get_routes_num() = " )
+ # main.log.info(main.ONOScli.get_routes_num())
+ # utilities.assert_equals(expect = "Total SDN-IP routes = 1", actual= main.ONOScli.get_routes_num(),
+ get_routes_result = main.ONOScli.routes(json_format=True)
+ allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+ main.log.info("allRoutes_actual = ")
+ main.log.info(allRoutes_actual)
+
+ utilities.assert_equals(expect="[]", actual=str(allRoutes_actual),
+ onpass="***Route number in SDN-IP is 0, correct!***",
+ onfail="***Routes number in SDN-IP is not 0, wrong!***")
+
+ if(eq(allRoutes_str_expected, allRoutes_str_actual)):
+ main.log.report("***Routes in SDN-IP after deleting correct!***")
+ else:
+ main.log.report("***Routes in SDN-IP after deleting wrong!***")
+
+ main.step("Check intents after deleting routes")
+ get_intents_result = main.ONOScli.intents(json_format=True)
+ routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+ main.log.info("main.ONOScli.intents()= ")
+ main.log.info(routeIntents_actual)
+ utilities.assert_equals(expect="[]", actual=str(routeIntents_actual),
+ onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
+ onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***")
+
+ if(eq(routeIntents_str_expected, routeIntents_str_actual)):
+ main.log.report("***MultiPointToSinglePoint Intents after deleting routes correct!***")
+ else:
+ main.log.report("***MultiPointToSinglePoint Intents after deleting routes wrong!***")
+
+ time.sleep(20)
+ ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-after-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+ ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
+ main.log.info(ping_test_results)
+ time.sleep(30)
+
+ # main.step("Test whether Mininet is started")
+ # main.Mininet2.handle.sendline("xterm host1")
+ # main.Mininet2.handle.expect("mininet>")
+
+
+ def CASE2(self, main):
+
+ '''
+ Test the SDN-IP functionality
+ allRoutes_expected: all expected routes for all BGP peers
+ routeIntents_expected: all expected MultiPointToSinglePointIntent intents
+ bgpIntents_expected: expected PointToPointIntent intents
+ allRoutes_actual: all routes from ONOS LCI
+ routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
+ bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
+ '''
+ import time
+ import json
+ from operator import eq
+ from time import localtime, strftime
+
+ main.case("The test case is to help to setup the TestON environment and test new drivers")
+ SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
+ # all expected routes for all BGP peers
+ allRoutes_expected = []
+ main.step("Start to generate routes for all BGP peers")
+
+ main.log.info("Generate prefixes for host3")
+ prefixes_host3 = main.QuaggaCliHost3.generate_prefixes(3, 10)
+ main.log.info(prefixes_host3)
+ # generate route with next hop
+ for prefix in prefixes_host3:
+ allRoutes_expected.append(prefix + "/" + "192.168.20.1")
+ routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(prefixes_host3, "192.168.20.1", "00:00:00:00:02:02", SDNIP_JSON_FILE_PATH)
+
+ main.log.info("Generate prefixes for host4")
+ prefixes_host4 = main.QuaggaCliHost4.generate_prefixes(4, 10)
+ main.log.info(prefixes_host4)
+ # generate route with next hop
+ for prefix in prefixes_host4:
+ allRoutes_expected.append(prefix + "/" + "192.168.30.1")
+ routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(prefixes_host4, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
+
+ routeIntents_expected = routeIntents_expected_host3 + routeIntents_expected_host4
+
+ main.log.report("Removing raft logs")
+ main.ONOSbench.onos_remove_raft_logs()
+ main.log.report("Uninstalling ONOS")
+ main.ONOSbench.onos_uninstall(ONOS1_ip)
+
+ cell_name = main.params['ENV']['cellName']
+ ONOS1_ip = main.params['CTRL']['ip1']
+ main.step("Set cell for ONOS-cli environment")
+ main.ONOScli.set_cell(cell_name)
+ verify_result = main.ONOSbench.verify_cell()
+ #main.log.report("Removing raft logs")
+ #main.ONOSbench.onos_remove_raft_logs()
+ #main.log.report("Uninstalling ONOS")
+ #main.ONOSbench.onos_uninstall(ONOS1_ip)
+ main.step("Creating ONOS package")
+ package_result = main.ONOSbench.onos_package()
+
+ main.step("Installing ONOS package")
+ onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
+
+ main.step("Checking if ONOS is up yet")
+ time.sleep(60)
+ onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+ if not onos1_isup:
+ main.log.report("ONOS1 didn't start!")
+
+ main.step("Start ONOS-cli")
+ main.ONOScli.start_onos_cli(ONOS1_ip)
+
+ main.step("Get devices in the network")
+ list_result = main.ONOScli.devices(json_format=False)
+ main.log.info(list_result)
+ time.sleep(10)
+ main.log.info("Installing sdn-ip feature")
+ main.ONOScli.feature_install("onos-app-sdnip")
+ time.sleep(10)
+
+
+ main.step("Check BGP PointToPointIntent intents installed")
+ # bgp intents expected
+ bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
+ # get BGP intents from ONOS CLI
+ get_intents_result = main.ONOScli.intents(json_format=True)
+ bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(get_intents_result)
+
+ bgpIntents_str_expected = str(bgpIntents_expected).replace('u', "")
+ bgpIntents_str_actual = str(bgpIntents_actual)
+ main.log.info("PointToPointIntent intents expected:")
+ main.log.info(bgpIntents_str_expected)
+ main.log.info("PointToPointIntent intents get from ONOS CLI:")
+ main.log.info(bgpIntents_str_actual)
+
+ utilities.assert_equals(expect=True, actual=eq(bgpIntents_str_expected, bgpIntents_str_actual),
+ onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
+ onfail="***PointToPointIntent Intents in SDN-IP are wrong!***")
+
+ if (eq(bgpIntents_str_expected, bgpIntents_str_actual)):
+ main.log.report("***PointToPointIntent Intents in SDN-IP are correct!***")
+ else:
+ main.log.report("***PointToPointIntent Intents in SDN-IP are wrong!***")
+
+
+ allRoutes_str_expected = str(sorted(allRoutes_expected))
+ routeIntents_str_expected = str(sorted(routeIntents_expected))
+ ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ # round_num = 0;
+ # while(True):
+ for round_num in range(1, 6):
+ # round = round + 1;
+ main.log.report("The Round " + str(round_num) + " test starts........................................")
+
+ main.step("Login all BGP peers and add routes into peers")
+ main.log.info("Login Quagga CLI on host3")
+ main.QuaggaCliHost3.loginQuagga("1.168.30.2")
+ main.log.info("Enter configuration model of Quagga CLI on host3")
+ main.QuaggaCliHost3.enter_config(64514)
+ main.log.info("Add routes to Quagga on host3")
+ main.QuaggaCliHost3.add_routes(prefixes_host3, 1)
+
+ main.log.info("Login Quagga CLI on host4")
+ main.QuaggaCliHost4.loginQuagga("1.168.30.3")
+ main.log.info("Enter configuration model of Quagga CLI on host4")
+ main.QuaggaCliHost4.enter_config(64516)
+ main.log.info("Add routes to Quagga on host4")
+ main.QuaggaCliHost4.add_routes(prefixes_host4, 1)
+ time.sleep(60)
+
+ # get all routes inside SDN-IP
+ get_routes_result = main.ONOScli.routes(json_format=True)
+
+ # parse routes from ONOS CLI
+ allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+
+ # allRoutes_str_expected = str(sorted(allRoutes_expected))
+ allRoutes_str_actual = str(allRoutes_actual).replace('u', "")
+ main.step("Check routes installed")
+ main.log.info("Routes expected:")
+ main.log.info(allRoutes_str_expected)
+ main.log.info("Routes get from ONOS CLI:")
+ main.log.info(allRoutes_str_actual)
+ utilities.assert_equals(expect=allRoutes_str_expected, actual=allRoutes_str_actual,
+ onpass="***Routes in SDN-IP are correct!***",
+ onfail="***Routes in SDN-IP are wrong!***")
+ if(eq(allRoutes_str_expected, allRoutes_str_actual)):
+ main.log.report("***Routes in SDN-IP after adding correct!***")
+ else:
+ main.log.report("***Routes in SDN-IP after adding wrong!***")
+
+ time.sleep(20)
+ get_intents_result = main.ONOScli.intents(json_format=True)
+
+
+ main.step("Check MultiPointToSinglePointIntent intents installed")
+ # route_intents_expected are generated when generating routes
+ # get route intents from ONOS CLI
+ routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+ # routeIntents_str_expected = str(sorted(routeIntents_expected))
+ routeIntents_str_actual = str(routeIntents_actual).replace('u', "")
+ main.log.info("MultiPointToSinglePoint intents expected:")
+ main.log.info(routeIntents_str_expected)
+ main.log.info("MultiPointToSinglePoint intents get from ONOS CLI:")
+ main.log.info(routeIntents_str_actual)
+ utilities.assert_equals(expect=True, actual=eq(routeIntents_str_expected, routeIntents_str_actual),
+ onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
+ onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***")
+
+ if(eq(routeIntents_str_expected, routeIntents_str_actual)):
+ main.log.report("***MultiPointToSinglePoint Intents after adding routes correct!***")
+ else:
+ main.log.report("***MultiPointToSinglePoint Intents after adding routes wrong!***")
+
+ #============================= Ping Test ========================
+ # wait until all MultiPointToSinglePoint
+ time.sleep(20)
+ # ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + str(round_num) + "-ping-results-before-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+ ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
+ main.log.info(ping_test_results)
+ # ping test
+
+ #============================= Deleting Routes ==================
+ main.step("Check deleting routes installed")
+ main.log.info("Delete routes to Quagga on host3")
+ main.QuaggaCliHost3.delete_routes(prefixes_host3, 1)
+ main.log.info("Delete routes to Quagga on host4")
+ main.QuaggaCliHost4.delete_routes(prefixes_host4, 1)
+
+ get_routes_result = main.ONOScli.routes(json_format=True)
+ allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+ main.log.info("allRoutes_actual = ")
+ main.log.info(allRoutes_actual)
+
+ utilities.assert_equals(expect="[]", actual=str(allRoutes_actual),
+ onpass="***Route number in SDN-IP is 0, correct!***",
+ onfail="***Routes number in SDN-IP is not 0, wrong!***")
+
+ if(eq(allRoutes_str_expected, allRoutes_str_actual)):
+ main.log.report("***Routes in SDN-IP after deleting correct!***")
+ else:
+ main.log.report("***Routes in SDN-IP after deleting wrong!***")
+
+ main.step("Check intents after deleting routes")
+ get_intents_result = main.ONOScli.intents(json_format=True)
+ routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+ main.log.info("main.ONOScli.intents()= ")
+ main.log.info(routeIntents_actual)
+ utilities.assert_equals(expect="[]", actual=str(routeIntents_actual),
+ onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
+ onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***")
+
+ if(eq(routeIntents_str_expected, routeIntents_str_actual)):
+ main.log.report("***MultiPointToSinglePoint Intents after deleting routes correct!***")
+ else:
+ main.log.report("***MultiPointToSinglePoint Intents after deleting routes wrong!***")
+
+ time.sleep(20)
+ # ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+ ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + str(round_num) + "-ping-results-after-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+ ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
+ main.log.info(ping_test_results)
+ time.sleep(30)
+
+
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.topo b/TestON/tests/SdnIpTest/SdnIpTest.topo
index 1d23878..6df1975 100755
--- a/TestON/tests/SdnIpTest/SdnIpTest.topo
+++ b/TestON/tests/SdnIpTest/SdnIpTest.topo
@@ -3,8 +3,8 @@
<ONOSbench>
<host>127.0.0.1</host>
- <user>sdn</user>
- <password>rocks</password>
+ <user>admin</user>
+ <password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
<COMPONENTS> </COMPONENTS>
@@ -12,15 +12,15 @@
<ONOScli>
<host>127.0.0.1</host>
- <user>sdn</user>
- <password>rocks</password>
+ <user>admin</user>
+ <password>onos_test</password>
<type>OnosCliDriver</type>
<connect_order>2</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOScli>
<ONOS1>
- <host>127.0.0.1</host>
+ <host>10.128.4.52</host>
<user>sdn</user>
<password>rocks</password>
<type>OnosDriver</type>
@@ -28,14 +28,30 @@
<COMPONENTS> </COMPONENTS>
</ONOS1>
- <Quaggacli>
+ <QuaggaCliHost3>
<host>127.0.0.1</host>
- <user>username</user>
- <password>password</password>
+ <user>admin</user>
+ <password>onos_test</password>
<type>QuaggaCliDriver</type>
<connect_order>5</connect_order>
<COMPONENTS> </COMPONENTS>
- </Quaggacli>
+ </QuaggaCliHost3>
+ <QuaggaCliHost4>
+ <host>127.0.0.1</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>QuaggaCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </QuaggaCliHost4>
+ <QuaggaCliHost>
+ <host>127.0.0.1</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>QuaggaCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </QuaggaCliHost>
</COMPONENT>
</TOPOLOGY>
diff --git a/TestON/tests/SingleInstanceHATestRestart/SingleInstanceHATestRestart.params b/TestON/tests/SingleInstanceHATestRestart/SingleInstanceHATestRestart.params
index e1e75f9..68f12a8 100644
--- a/TestON/tests/SingleInstanceHATestRestart/SingleInstanceHATestRestart.params
+++ b/TestON/tests/SingleInstanceHATestRestart/SingleInstanceHATestRestart.params
@@ -1,9 +1,9 @@
<PARAMS>
- <testcases>1,2,8,3,4,5,[6],7,8,4,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+ <testcases>1,2,8,3,4,5,[6],8,3,7,4,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
<ENV>
<cellName>HA</cellName>
</ENV>
- <Git>True</Git>
+ <Git>False</Git>
<CTRL>
<ip1>10.128.30.11</ip1>
@@ -28,7 +28,7 @@
<port7>6633</port7>
</CTRL>
<TESTONUSER>admin</TESTONUSER>
- <TESTONIP>10.128.30.10</TESTONIP>
+ <TESTONIP>10.128.30.9</TESTONIP>
<PING>
<source1>h8</source1>
<source2>h9</source2>
diff --git a/TestON/tests/SingleInstanceHATestRestart/SingleInstanceHATestRestart.py b/TestON/tests/SingleInstanceHATestRestart/SingleInstanceHATestRestart.py
index e6f2fde..a82bbd5 100644
--- a/TestON/tests/SingleInstanceHATestRestart/SingleInstanceHATestRestart.py
+++ b/TestON/tests/SingleInstanceHATestRestart/SingleInstanceHATestRestart.py
@@ -112,6 +112,8 @@
"clean install")
main.ONOSbench.get_version(report=True)
+ cell_result = main.ONOSbench.set_cell("SingleHA")
+ verify_result = main.ONOSbench.verify_cell()
main.step("Creating ONOS package")
package_result = main.ONOSbench.onos_package()
@@ -123,15 +125,17 @@
main.step("Checking if ONOS is up yet")
#TODO: Refactor
# check bundle:list?
- #this should be enough for ONOS to start
- time.sleep(60)
- onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+ for i in range(2):
+ onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+ if onos1_isup:
+ break
if not onos1_isup:
main.log.report("ONOS1 didn't start!")
+
# TODO: if it becomes an issue, we can retry this step a few times
- cli_result1 = main.ONOScli1.start_onos_cli(ONOS1_ip)
+ cli_result = main.ONOScli1.start_onos_cli(ONOS1_ip)
main.step("Start Packet Capture MN")
main.Mininet2.start_tcpdump(
@@ -142,7 +146,7 @@
case1_result = (clean_install_result and package_result and
cell_result and verify_result and onos1_install_result and
- onos1_isup and cli1_results)
+ onos1_isup and cli_result)
utilities.assert_equals(expect=main.TRUE, actual=case1_result,
onpass="Test startup successful",
@@ -186,8 +190,6 @@
onpass="Switch mastership assigned correctly",
onfail="Switches not assigned correctly to controllers")
- #TODO: If assign roles is working reliably then manually
- # assign mastership to the controller we want
def CASE3(self,main) :
@@ -195,6 +197,7 @@
Assign intents
"""
+ #FIXME: Only call this once when using a persistent datastore!!!!
import time
import json
import re
@@ -204,6 +207,10 @@
main.step("Discovering Hosts( Via pingall for now)")
#FIXME: Once we have a host discovery mechanism, use that instead
+ #install onos-app-fwd
+ main.log.info("Install reactive forwarding app")
+ main.ONOScli1.feature_install("onos-app-fwd")
+
#REACTIVE FWD test
ping_result = main.FALSE
time1 = time.time()
@@ -219,7 +226,7 @@
#TODO: move the host numbers to params
import json
intents_json= json.loads(main.ONOScli1.hosts())
- intent_add_result = main.FALSE
+ intent_add_result = True
for i in range(8,18):
main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
@@ -229,7 +236,10 @@
host1_id = main.ONOScli1.get_host(host1)['id']
host2_id = main.ONOScli1.get_host(host2)['id']
tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
- intent_add_result = intent_add_result and tmp_result
+ intent_add_result = bool(intent_add_result and tmp_result)
+ utilities.assert_equals(expect=True, actual=intent_add_result,
+ onpass="Switch mastership correctly assigned",
+ onfail="Error in (re)assigning switch mastership")
#TODO Check if intents all exist in datastore
#NOTE: Do we need to print this once the test is working?
#main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
@@ -275,6 +285,15 @@
main.step("Get the Mastership of each switch from each controller")
global mastership_state
+ mastership_state = []
+
+ #Assert that each device has a master
+ roles_not_null = main.ONOScli1.roles_not_null()
+ utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+ onpass="Each device has a master",
+ onfail="Some devices don't have a master assigned")
+
+
ONOS1_mastership = main.ONOScli1.roles()
#print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
#TODO: Make this a meaningful check
@@ -285,14 +304,11 @@
else:
mastership_state = ONOS1_mastership
consistent_mastership = main.TRUE
- main.log.report("Switch roles are consistent across all ONOS nodes")
- utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
- onpass="Switch roles are consistent across all ONOS nodes",
- onfail="ONOS nodes have different views of switch roles")
main.step("Get the intents from each controller")
global intent_state
+ intent_state = []
ONOS1_intents = main.ONOScli1.intents( json_format=True )
intent_check = main.FALSE
if "Error" in ONOS1_intents or not ONOS1_intents:
@@ -300,14 +316,11 @@
main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
else:
intent_check = main.TRUE
- main.log.report("Intents are consistent across all ONOS nodes")
- utilities.assert_equals(expect = main.TRUE,actual=intent_check,
- onpass="Intents are consistent across all ONOS nodes",
- onfail="ONOS nodes have different views of intents")
main.step("Get the flows from each controller")
global flow_state
+ flow_state = []
ONOS1_flows = main.ONOScli1.flows( json_format=True )
flow_check = main.FALSE
if "Error" in ONOS1_flows or not ONOS1_flows:
@@ -317,42 +330,16 @@
#TODO: Do a better check, maybe compare flows on switches?
flow_state = ONOS1_flows
flow_check = main.TRUE
- main.log.report("Flow count is consistent across all ONOS nodes")
- utilities.assert_equals(expect = main.TRUE,actual=flow_check,
- onpass="The flow count is consistent across all ONOS nodes",
- onfail="ONOS nodes have different flow counts")
main.step("Get the OF Table entries")
global flows
flows=[]
for i in range(1,29):
- flows.append(main.Mininet2.get_flowTable("s"+str(i),1.0))
+ flows.append(main.Mininet2.get_flowTable(1.3, "s"+str(i)))
#TODO: Compare switch flow tables with ONOS flow tables
- main.step("Start continuous pings")
- main.Mininet2.pingLong(src=main.params['PING']['source1'],
- target=main.params['PING']['target1'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source2'],
- target=main.params['PING']['target2'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source3'],
- target=main.params['PING']['target3'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source4'],
- target=main.params['PING']['target4'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source5'],
- target=main.params['PING']['target5'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source6'],
- target=main.params['PING']['target6'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source7'],
- target=main.params['PING']['target7'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source8'],
- target=main.params['PING']['target8'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source9'],
- target=main.params['PING']['target9'],pingTime=500)
- main.Mininet2.pingLong(src=main.params['PING']['source10'],
- target=main.params['PING']['target10'],pingTime=500)
-
main.step("Create TestONTopology object")
ctrls = []
count = 1
@@ -417,7 +404,7 @@
final_assert = main.TRUE
final_assert = final_assert and topo_result and flow_check \
- and intent_check and consistent_mastership
+ and intent_check and consistent_mastership and roles_not_null
utilities.assert_equals(expect=main.TRUE, actual=final_assert,
onpass="State check successful",
onfail="State check NOT successful")
@@ -436,7 +423,7 @@
main.step("Checking if ONOS is up yet")
count = 0
- while count < 10
+ while count < 10:
onos1_isup = main.ONOSbench.isup(ONOS1_ip)
if onos1_isup == main.TRUE:
elapsed = time.time() - start
@@ -446,11 +433,12 @@
cli_result = main.ONOScli1.start_onos_cli(ONOS1_ip)
- case_results = main.TRUE and onosi1_isup and cli_result
+ case_results = main.TRUE and onos1_isup and cli_result
utilities.assert_equals(expect=main.TRUE, actual=case_results,
onpass="ONOS restart successful",
onfail="ONOS restart NOT successful")
- main.log.info("ONOS took %s seconds to restart" % str(elapsed) )
+ main.log.info("ESTIMATE: ONOS took %s seconds to restart" % str(elapsed) )
+ time.sleep(5)
def CASE7(self,main) :
'''
@@ -460,6 +448,14 @@
import json
main.case("Running ONOS Constant State Tests")
+ #Assert that each device has a master
+ roles_not_null = main.ONOScli1.roles_not_null()
+ utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+ onpass="Each device has a master",
+ onfail="Some devices don't have a master assigned")
+
+
+
main.step("Check if switch roles are consistent across all nodes")
ONOS1_mastership = main.ONOScli1.roles()
#FIXME: Refactor this whole case for single instance
@@ -508,13 +504,14 @@
main.log.report("Error in getting ONOS intents")
main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
else:
- intent_state = ONOS1_intents
intent_check = main.TRUE
main.log.report("Intents are consistent across all ONOS nodes")
utilities.assert_equals(expect = main.TRUE,actual=intent_check,
onpass="Intents are consistent across all ONOS nodes",
onfail="ONOS nodes have different views of intents")
+ #NOTE: Hazelcast has no durability, so intents are lost
+ '''
main.step("Compare current intents with intents before the failure")
if intent_state == ONOS1_intents:
same_intents = main.TRUE
@@ -526,6 +523,7 @@
onpass="Intents are consistent with before failure",
onfail="The Intents changed during failure")
intent_check = intent_check and same_intents
+ '''
@@ -534,42 +532,20 @@
flows2=[]
for i in range(28):
main.log.info("Checking flow table on s" + str(i+1))
- tmp_flows = main.Mininet2.get_flowTable("s"+str(i+1),1.0)
+ tmp_flows = main.Mininet2.get_flowTable(1.3, "s"+str(i+1))
flows2.append(tmp_flows)
- Flow_Tables = Flow_Tables and main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+ temp_result = main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+ Flow_Tables = Flow_Tables and temp_result
if Flow_Tables == main.FALSE:
main.log.info("Differences in flow table for switch: "+str(i+1))
- break
if Flow_Tables == main.TRUE:
main.log.report("No changes were found in the flow tables")
utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
onpass="No changes were found in the flow tables",
onfail="Changes were found in the flow tables")
- main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
- #FIXME: This check is always failing. Investigate cause
- #NOTE: this may be something to do with file permsissions
- # or slight change in format
- main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP'])
- Loss_In_Pings = main.FALSE
- #NOTE: checkForLoss returns main.FALSE with 0% packet loss
- for i in range(8,18):
- main.log.info("Checking for a loss in pings along flow from s" + str(i))
- Loss_In_Pings = Loss_In_Pings or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
- if Loss_In_Pings == main.TRUE:
- main.log.info("Loss in ping detected")
- elif Loss_In_Pings == main.ERROR:
- main.log.info("There are multiple mininet process running")
- elif Loss_In_Pings == main.FALSE:
- main.log.info("No Loss in the pings")
- main.log.report("No loss of dataplane connectivity")
- utilities.assert_equals(expect=main.FALSE,actual=Loss_In_Pings,
- onpass="No Loss of connectivity",
- onfail="Loss of dataplane connectivity detected")
-
-
#TODO:add topology to this or leave as a seperate case?
- result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings)
+ result = mastership_check and intent_check and Flow_Tables and roles_not_null
result = int(result)
if result == main.TRUE:
main.log.report("Constant State Tests Passed")
@@ -606,62 +582,62 @@
ports_results = main.TRUE
links_results = main.TRUE
topo_result = main.FALSE
- start_time = time.time()
elapsed = 0
count = 0
- while topo_result == main.FALSE and elapsed < 120:
+ main.step("Collecting topology information from ONOS")
+ start_time = time.time()
+ while topo_result == main.FALSE and elapsed < 60:
count = count + 1
- try:
- main.step("Collecting topology information from ONOS")
- devices = []
- devices.append( main.ONOScli1.devices() )
- '''
- hosts = []
- hosts.append( main.ONOScli1.hosts() )
- '''
- ports = []
- ports.append( main.ONOScli1.ports() )
- links = []
- links.append( main.ONOScli1.links() )
- for controller in range(1): #TODO parameterize the number of controllers
- if devices[controller] or not "Error" in devices[controller]:
- current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
- else:
- current_devices_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
- onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
- onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+ if count > 1:
+ MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+ cli_start = time.time()
+ devices = []
+ devices.append( main.ONOScli1.devices() )
+ '''
+ hosts = []
+ hosts.append( main.ONOScli1.hosts() )
+ '''
+ ports = []
+ ports.append( main.ONOScli1.ports() )
+ links = []
+ links.append( main.ONOScli1.links() )
+ elapsed = time.time() - start_time
+ print "CLI time: " + str(time.time() - cli_start)
- if ports[controller] or not "Error" in ports[controller]:
- current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
- else:
- current_ports_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
- onpass="ONOS"+str(int(controller+1))+" ports view is correct",
- onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+ for controller in range(1): #TODO parameterize the number of controllers
+ if devices[controller] or not "Error" in devices[controller]:
+ current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+ else:
+ current_devices_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+ onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+ onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
- if links[controller] or not "Error" in links[controller]:
- current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
- else:
- current_links_result = main.FALSE
- utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
- onpass="ONOS"+str(int(controller+1))+" links view is correct",
- onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
- except:
- main.log.error("something went wrong in topo comparison")
- main.log.warn( repr( devices ) )
- main.log.warn( repr( ports ) )
- main.log.warn( repr( links ) )
+ if ports[controller] or not "Error" in ports[controller]:
+ current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+ else:
+ current_ports_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+ onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+ onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+ if links[controller] or not "Error" in links[controller]:
+ current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+ else:
+ current_links_result = main.FALSE
+ utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+ onpass="ONOS"+str(int(controller+1))+" links view is correct",
+ onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
devices_results = devices_results and current_devices_result
ports_results = ports_results and current_ports_result
links_results = links_results and current_links_result
- elapsed = time.time() - start_time
- time_threshold = elapsed < 1
- topo_result = devices_results and ports_results and links_results and time_threshold
- #TODO make sure this step is non-blocking. IE add a timeout
- main.log.report("Very crass estimate for topology discovery/convergence: " +\
+ topo_result = devices_results and ports_results and links_results
+
+ topo_result = topo_result and int(count <= 2)
+ main.log.report("Very crass estimate for topology discovery/convergence(note it takes about 1 seconds to read the topology from each ONOS instance): " +\
str(elapsed) + " seconds, " + str(count) +" tries" )
+ if elapsed > 60:
+ main.log.report("Giving up on topology convergence")
utilities.assert_equals(expect=main.TRUE, actual=topo_result,
onpass="Topology Check Test successful",
onfail="Topology Check Test NOT successful")
@@ -729,13 +705,18 @@
#TODO: Make this switch parameterizable
main.step("Kill s28 ")
main.log.report("Deleting s28")
- #FIXME: use new dynamic topo functions
main.Mininet1.del_switch("s28")
main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
time.sleep(switch_sleep)
+ device = main.ONOScli1.get_device(dpid="0028")
#Peek at the deleted switch
- main.log.warn(main.ONOScli1.get_device(dpid="0028"))
- #TODO do some sort of check here
+ main.log.warn( str(device) )
+ result = main.FALSE
+ if device and device['available'] == False:
+ result = main.TRUE
+ utilities.assert_equals(expect=main.TRUE,actual=result,
+ onpass="Kill switch succesful",
+ onfail="Failed to kill switch?")
def CASE12 (self, main) :
'''
@@ -743,7 +724,6 @@
'''
#NOTE: You should probably run a topology check after this
import time
- #FIXME: use new dynamic topo functions
description = "Adding a switch to ensure it is discovered correctly"
main.log.report(description)
main.case(description)
@@ -759,9 +739,15 @@
ip1=ONOS1_ip,port1=ONOS1_port)
main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
time.sleep(switch_sleep)
- #Peek at the added switch
- main.log.warn(main.ONOScli1.get_device(dpid="0028"))
- #TODO do some sort of check here
+ device = main.ONOScli1.get_device(dpid="0028")
+ #Peek at the deleted switch
+ main.log.warn( str(device) )
+ result = main.FALSE
+ if device and device['available'] == True:
+ result = main.TRUE
+ utilities.assert_equals(expect=main.TRUE,actual=result,
+ onpass="add switch succesful",
+ onfail="Failed to add switch?")
def CASE13 (self, main) :
'''
@@ -775,8 +761,13 @@
main.step("Killing tcpdumps")
main.Mininet2.stop_tcpdump()
+ main.step("Checking ONOS Logs for errors")
+ print "Checking logs for errors on ONOS1:"
+ print main.ONOSbench.check_logs(ONOS1_ip)
main.step("Copying MN pcap and ONOS log files to test station")
testname = main.TEST
+ teststation_user = main.params['TESTONUSER']
+ teststation_IP = main.params['TESTONIP']
#NOTE: MN Pcap file is being saved to ~/packet_captures
# scp this file as MN and TestON aren't necessarily the same vm
#FIXME: scp
@@ -788,8 +779,11 @@
#NOTE: must end in /
dst_dir = "~/packet_captures/"
for f in log_files:
- main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS1-"+f )
+ main.ONOSbench.handle.expect("\$")
+ print main.ONOSbench.handle.before
#std*.log's
#NOTE: must end in /
@@ -798,7 +792,8 @@
#NOTE: must end in /
dst_dir = "~/packet_captures/"
for f in log_files:
- main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\
+ main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+ teststation_user +"@"+teststation_IP+":"+\
dst_dir + str(testname) + "-ONOS1-"+f )
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.params b/TestON/tests/TopoConvNext/TopoConvNext.params
index 96cb9ad..198befb 100644
--- a/TestON/tests/TopoConvNext/TopoConvNext.params
+++ b/TestON/tests/TopoConvNext/TopoConvNext.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,2,3,2,3,2,3,4,2,3,2,3,2,4,2,3,2,3,2</testcases>
+ <testcases>1,2,3,2,3,2,3,2,4,2,3,2,3,2,3,2</testcases>
<ENV>
<cellName>topo_conv_test</cellName>
@@ -42,10 +42,11 @@
<onosLogFile>/opt/onos/log/karaf*</onosLogFile>
#Number of times to iterate each case
- <numIter>5</numIter>
- <numSwitch1>200</numSwitch1>
+ <numIter>3</numIter>
+ <numSwitch1>500</numSwitch1>
<numSwitch2>400</numSwitch2>
- <numSwitch3>500</numSwitch3>
+ <numSwitch3>200</numSwitch3>
+ <numSwitch4>300</numSwitch4>
#Number of iterations to ignore initially
<iterIgnore>1</iterIgnore>
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.py b/TestON/tests/TopoConvNext/TopoConvNext.py
index 52a951c..68d7b5d 100644
--- a/TestON/tests/TopoConvNext/TopoConvNext.py
+++ b/TestON/tests/TopoConvNext/TopoConvNext.py
@@ -185,6 +185,8 @@
num_sw = main.params['TEST']['numSwitch2']
elif topo_iteration == 3:
num_sw = main.params['TEST']['numSwitch3']
+ elif topo_iteration == 4:
+ num_sw = main.params['TEST']['numSwitch4']
#***********
#Timestamp 'keys' for json metrics output.
@@ -323,7 +325,7 @@
#NOTE:
# Delay before checking devices to
# help prevent timing out from CLI
- # due to multiple command drop
+ # due to multiple command issuing
time.sleep(20)
loop = True
@@ -338,6 +340,9 @@
device_json1 = json.loads(device_str1)
json_len = len(device_json1)
+ #NOTE: May want to check the rest of
+ # the ONOS instances for device down as well
+
for device1 in device_json1:
temp_len = temp_len + 1
if device1['available'] == True:
@@ -361,73 +366,10 @@
loop = False
break
-
- #if cluster_count == 1:
- # device_str1 = main.ONOS1cli.devices(
- # node_ip=ONOS_ip_list[1])
- # device_json1 = json.loads(device_str1)
- # for device1 in device_json1:
- # if device1['available'] == False:
- # device_count += 1
- # else:
- # device_count = 0
- #if cluster_count == 2:
- # device_str2 = main.ONOS2cli.devices(
- # node_ip=ONOS_ip_list[2])
- # device_json2 = json.loads(device_str2)
- # for device2 in device_json2:
- # if device2['available'] == False:
- # device_count += 1
- # else:
- # device_count = 0
- #if cluster_count == 3:
- # device_str3 = main.ONOS3cli.devices(
- # node_ip=ONOS_ip_list[3])
- # device_json3 = json.loads(device_str3)
- # for device3 in device_json3:
- # if device3['available'] == False:
- # device_count += 1
- # else:
- # device_count = 0
- #if cluster_count == 4:
- # device_str4 = main.ONOS4cli.devices(
- # node_ip=ONOS_ip_list[4])
- # device_json4 = json.loads(device_str4)
- # for device4 in device_json4:
- # if device4['available'] == False:
- # device_count += 1
- # else:
- # device_count = 0
- #if cluster_count == 5:
- # device_str5 = main.ONOS5cli.devices(
- # node_ip=ONOS_ip_list[5])
- # device_json5 = json.loads(device_str5)
- # for device5 in device_json5:
- # if device5['available'] == False:
- # device_count += 1
- # else:
- # device_count = 0
- #if cluster_count == 7:
- # device_str7 = main.ONOS7cli.devices(
- # node_ip=ONOS_ip_list[7])
- # device_json7 = json.loads(device_str7)
- # for device7 in device_json7:
- # if device7['available'] == False:
- # device_count += 1
- # else:
- # device_count = 0
-
- #If device count is greater than the
- #number of switches discovered by all nodes
- #then remove iptables and measure t0 system time
-
loop_count += 1
time.sleep(1)
- if device_count < int(num_sw):
- main.log.info("Devices down did not ")
-
main.log.info("System time t0: "+str(t0_system))
counter_loop = 0
@@ -590,7 +532,7 @@
else:
main.log.info("Switch discovery latency "+
"exceeded the threshold.")
- main.log.info(graph_lat_1)
+ main.log.info(str(graph_lat_1)+" ms")
#Break while loop
break
if cluster_count == 2:
@@ -635,7 +577,7 @@
else:
main.log.info("Switch discovery latency "+
"exceeded the threshold.")
- main.log.info(max_graph_lat)
+ main.log.info(str(max_graph_lat)+" ms")
break
if cluster_count == 3:
if onos1_dev and onos2_dev and onos3_dev:
@@ -693,7 +635,7 @@
else:
main.log.info("Switch discovery latency "+
"exceeded the threshold.")
- main.log.info(max_graph_lat)
+ main.log.info(str(max_graph_lat)+" ms")
break
if cluster_count == 4:
@@ -756,7 +698,7 @@
else:
main.log.info("Switch discovery latency "+
"exceeded the threshold.")
- main.log.info(max_graph_lat)
+ main.log.info(str(max_graph_lat)+" ms")
break
if cluster_count == 5:
@@ -835,7 +777,7 @@
else:
main.log.info("Switch discovery latency "+
"exceeded the threshold.")
- main.log.info(max_graph_lat)
+ main.log.info(str(max_graph_lat)+" ms")
break
if cluster_count == 6:
@@ -918,7 +860,7 @@
else:
main.log.info("Switch discovery latency "+
"exceeded the threshold.")
- main.log.info(max_graph_lat)
+ main.log.info(str(max_graph_lat)+" ms")
break
if cluster_count == 7:
@@ -1018,7 +960,7 @@
else:
main.log.info("Switch discovery latency "+
"exceeded the threshold.")
- main.log.info(max_graph_lat)
+ main.log.info(str(max_graph_lat)+" ms")
break
@@ -1153,7 +1095,9 @@
sw_lat_avg = sum(sw_discovery_lat_list) / \
len(sw_discovery_lat_list)
sw_lat_dev = numpy.std(sw_discovery_lat_list)
- else:
+ else:
+ sw_lat_avg = 0
+ sw_lat_dev = 0
assertion = main.FALSE
main.log.report("Switch connection attempt time avg "+
@@ -1329,3 +1273,6 @@
utilities.assert_equals(expect=main.TRUE, actual=assertion,
onpass="Topology size increased successfully",
onfail="Topology size was not increased")
+
+
+
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.params b/TestON/tests/TopoPerfNext/TopoPerfNext.params
index 42512e8..851522c 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.params
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.params
@@ -57,7 +57,9 @@
<linkUpThreshold>0,10000</linkUpThreshold>
<linkDownThreshold>0,10000</linkDownThreshold>
<swDisc100Threshold>0,10000</swDisc100Threshold>
- </TEST>
+
+ <tabletFile>tablets_3node.json</tabletFile>
+ </TEST>
<JSON>
<deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
index 49089bf..65bc7a9 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.py
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -47,10 +47,10 @@
main.case("Setting up test environment")
main.log.info("Copying topology event accumulator config"+\
- " to ONOS /ppackage/etc")
+ " to ONOS /package/etc")
main.ONOSbench.handle.sendline("cp ~/"+\
topo_cfg_file+\
- "~/ONOS/tools/package/etc/"+\
+ " ~/ONOS/tools/package/etc/"+\
topo_cfg_name)
main.ONOSbench.handle.expect("\$")
@@ -64,7 +64,7 @@
main.step("Creating cell file")
cell_file_result = main.ONOSbench.create_cell_file(
- BENCH_ip, cell_name, MN1_ip, "onos-core",
+ BENCH_ip, cell_name, MN1_ip, "onos-core,onos-app-metrics",
ONOS1_ip, ONOS2_ip, ONOS3_ip)
main.step("Applying cell file to environment")
@@ -75,7 +75,8 @@
# copy cat log functionality
main.step("Removing raft/copy-cat logs from ONOS nodes")
main.ONOSbench.onos_remove_raft_logs()
-
+ time.sleep(30)
+
main.step("Git checkout and pull "+checkout_branch)
if git_pull == 'on':
checkout_result = \
@@ -114,11 +115,6 @@
cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
- main.step("Enable metrics feature")
- main.ONOS1cli.feature_install("onos-app-metrics")
- main.ONOS2cli.feature_install("onos-app-metrics")
- main.ONOS3cli.feature_install("onos-app-metrics")
-
utilities.assert_equals(expect=main.TRUE,
actual= cell_file_result and cell_apply_result and\
verify_cell_result and checkout_result and\