Merge branch 'ONOS-Next' of https://github.com/OPENNETWORKINGLAB/ONLabTest into ONOS-Next
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/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 92ec312..17c25a0 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -298,10 +298,11 @@
'''
if self.handle:
try:
- cmd = host+" ifconfig "+intf+" "+newIP+" "+newNetMask
+ 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:
@@ -320,13 +321,52 @@
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):
'''
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 2391d3a..a6cf341 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1043,6 +1043,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
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 71b397f..418554d 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1202,7 +1202,7 @@
cmd = "./onos-topo-cfg " +instance_name +" " +json_file
print "cmd = ", cmd
self.handle.sendline(cmd)
- self.handle.expect("$")
+ self.handle.expect("\$")
self.handle.sendline("cd ~")
self.handle.expect("\$")
return main.TRUE
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index e0f793b..8314941 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -25,14 +25,17 @@
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("\$")
+ #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")
@@ -47,14 +50,17 @@
+ 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)
+ #self.handle.expect("bgpd#", timeout=5)
+ self.handle.expect("bgpd#")
main.log.info("I in quagga on host " + str(ip_address))
return self.handle
@@ -161,7 +167,7 @@
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" and intent['state'] == 'INSTALLED':
egress = str(intent['egress']['device']) + ":" + str(intent['egress']['port'])
@@ -186,7 +192,7 @@
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'])
@@ -310,8 +316,8 @@
+ 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("\$")
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 + " &")
diff --git a/TestON/tests/MultiProd/MultiProd.params b/TestON/tests/MultiProd/MultiProd.params
index 3007fb2..8bf1600 100755
--- a/TestON/tests/MultiProd/MultiProd.params
+++ b/TestON/tests/MultiProd/MultiProd.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,4,10,5,6,7,8,6,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 7545f3e..dda3ad4 100755
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -665,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 = []
@@ -683,34 +682,16 @@
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 :
@@ -949,27 +930,23 @@
if host['id'] == host1_id:
ip1 = host['ips'][0]
ip1 = str(ip1+"/32")
- print "ip1 = ", ip1
device1 = host['location']['device']
device1 = str(device1+"/1")
- print "device1 = ", device1
elif host['id'] == host2_id:
ip2 = str(host['ips'][0])+"/32"
- print "ip2 = ", ip2
device2 = host['location']["device"]
device2 = str(device2+"/1")
- print "device2 = ", device2
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()
+ 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()
+ 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()
@@ -977,7 +954,7 @@
main.log.info("Point intent related to SDN-IP matching on ICMP install successful")
time.sleep(15)
- get_intent_result = main.ONOScli1.intents()
+ 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)
@@ -1049,16 +1026,12 @@
if host['id'] == host1_id:
ip1 = host['ips'][0]
ip1 = str(ip1+"/32")
- print "ip1 = ", ip1
device1 = host['location']['device']
device1 = str(device1+"/1")
- print "device1 = ", device1
elif host['id'] == host2_id:
ip2 = str(host['ips'][0])+"/32"
- print "ip2 = ", ip2
device2 = host['location']["device"]
device2 = str(device2+"/1")
- print "device2 = ", device2
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'])
@@ -1072,7 +1045,7 @@
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()
+ 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")
@@ -1086,4 +1059,105 @@
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")
+ 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 f41abe2..8bf1600 100755
--- a/TestON/tests/MultiProd13/MultiProd13.params
+++ b/TestON/tests/MultiProd13/MultiProd13.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,4,10,31,32</testcases>
+ <testcases>1,4,10,5,6,7,8,6,8,9,31,32,8,33</testcases>
#Environment variables
<ENV>
@@ -24,6 +24,16 @@
<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 40f41b6..1276d33 100755
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -665,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 = []
@@ -683,34 +682,16 @@
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 :
@@ -949,27 +930,23 @@
if host['id'] == host1_id:
ip1 = host['ips'][0]
ip1 = str(ip1+"/32")
- print "ip1 = ", ip1
device1 = host['location']['device']
device1 = str(device1+"/1")
- print "device1 = ", device1
elif host['id'] == host2_id:
ip2 = str(host['ips'][0])+"/32"
- print "ip2 = ", ip2
device2 = host['location']["device"]
device2 = str(device2+"/1")
- print "device2 = ", device2
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()
+ 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()
+ 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()
@@ -977,7 +954,7 @@
main.log.info("Point intent related to SDN-IP matching on ICMP install successful")
time.sleep(15)
- get_intent_result = main.ONOScli1.intents()
+ 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)
@@ -1049,16 +1026,12 @@
if host['id'] == host1_id:
ip1 = host['ips'][0]
ip1 = str(ip1+"/32")
- print "ip1 = ", ip1
device1 = host['location']['device']
device1 = str(device1+"/1")
- print "device1 = ", device1
elif host['id'] == host2_id:
ip2 = str(host['ips'][0])+"/32"
- print "ip2 = ", ip2
device2 = host['location']["device"]
device2 = str(device2+"/1")
- print "device2 = ", device2
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'])
@@ -1072,7 +1045,7 @@
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()
+ 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")
@@ -1086,4 +1059,105 @@
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")
+ 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/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index 7464739..05c420e 100755
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -35,11 +35,8 @@
main.log.report("__________________________________")
main.step("Applying cell variable to environment")
- cell_result1 = main.ONOSbench.set_cell(cell_name)
+ cell_result = 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()
- cell_result = cell_result1 and cell_result2
main.step("Removing raft logs before a clen installation of ONOS")
main.ONOSbench.onos_remove_raft_logs()
@@ -132,18 +129,22 @@
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.step("Disconnecting mininet and restarting ONOS")
+ 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_result1 = main.ONOSbench.set_cell(cell_name)
+ cell_result = 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()
- cell_result = cell_result1 and cell_result2
onos_install_result = main.ONOSbench.onos_install()
if onos_install_result == main.TRUE:
@@ -159,7 +160,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'])
print "mininet_disconnect =", mininet_disconnect
print "onos_install_result =", onos_install_result
print "onos1_isup =", onos1_isup
@@ -286,17 +288,14 @@
if ptp_intent_result == main.TRUE:
get_intent_result = main.ONOS3.intents()
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
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")
- main.log.info(get_intent_result)
time.sleep(10)
flowHandle = main.ONOS3.flows()
- #print "flowHandle = ", flowHandle
main.log.info("flows :" + flowHandle)
# Sleep for 30 seconds to provide time for the intent state to change
@@ -338,7 +337,68 @@
+ 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
@@ -476,11 +536,11 @@
main.case("Obtaining host id's")
main.step("Get hosts")
hosts = main.ONOS2.hosts()
- main.log.info(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
@@ -510,7 +570,7 @@
tmp_result = main.ONOS2.add_host_intent(host1_id, host2_id )
time.sleep(10)
- h_intents = main.ONOS2.intents()
+ h_intents = main.ONOS2.intents(json_format = False)
main.log.info("intents:" +h_intents)
flowHandle = main.ONOS2.flows()
#main.log.info("flow:" +flowHandle)
@@ -749,9 +809,9 @@
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")
intentList = []
for line in intent_linewise:
@@ -768,28 +828,10 @@
for id in intentids:
main.ONOS2.remove_intent(intent_id = id)
- intent_result = main.ONOS2.intents()
- intent_linewise = intent_result.split("\n")
- list_afterRemoval = []
- for line in intent_linewise:
- if line.startswith("id="):
- list_afterRemoval.append(line)
+ intent_result = main.ONOS2.intents(json_format = False)
+ main.log.info("intent_result = " +intent_result)
- 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
-
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:
main.log.report("Intent removal successful")
else:
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.params b/TestON/tests/ProdFunc13/ProdFunc13.params
index a77dd02..2af3237 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.params
+++ b/TestON/tests/ProdFunc13/ProdFunc13.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1,4,10,5,6,7,8,6,8,9,20,21,22,10,23,24</testcases>
+ <testcases>1,4,10,5,6,7,8,9,20,21,22,10,23,24</testcases>
#Environment variables
<ENV>
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index 205bfb8..abb99d2 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -35,11 +35,8 @@
main.log.report("__________________________________")
main.step("Applying cell variable to environment")
- cell_result1 = main.ONOSbench.set_cell(cell_name)
+ cell_result = 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()
- cell_result = cell_result1 and cell_result2
main.step("Removing raft logs before a clen installation of ONOS")
main.ONOSbench.onos_remove_raft_logs()
@@ -132,18 +129,22 @@
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.step("Disconnecting mininet and restarting ONOS")
+ 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_result1 = main.ONOSbench.set_cell(cell_name)
+ cell_result = 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()
- cell_result = cell_result1 and cell_result2
onos_install_result = main.ONOSbench.onos_install()
if onos_install_result == main.TRUE:
@@ -159,7 +160,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'])
print "mininet_disconnect =", mininet_disconnect
print "onos_install_result =", onos_install_result
print "onos1_isup =", onos1_isup
@@ -245,8 +247,9 @@
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()
@@ -267,8 +270,9 @@
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
+ '''
+
+ 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")
@@ -284,15 +288,13 @@
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()
+ get_intent_result = main.ONOS3.intents(json_format = False)
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
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()
+ get_intent_result = main.ONOS3.intents(json_format = False)
main.log.info("Point to point intent install successful")
- main.log.info(get_intent_result)
time.sleep(10)
flowHandle = main.ONOS3.flows()
@@ -300,7 +302,7 @@
# Sleep for 30 seconds to provide time for the intent state to change
time.sleep(30)
- intentHandle = main.ONOS3.intents()
+ intentHandle = main.ONOS3.intents(json_format = False)
main.log.info("intents :" + intentHandle)
Ping_Result = main.TRUE
@@ -339,32 +341,45 @@
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_result = main.ONOS3.links()
+ 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') == "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
+ 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
- main.case("Verify Rerouting by a ping test")
+ 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
+ count = 1
main.log.info("\n\nh1 is Pinging h2")
ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
#ping = main.LincOE2.pinghost()
@@ -385,9 +400,9 @@
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 successful ")
+ if Ping_Result==main.FALSE:
main.log.report("Ping test failed")
case24_result = Ping_Result and links_state_result
@@ -531,11 +546,11 @@
main.case("Obtaining host id's")
main.step("Get hosts")
hosts = main.ONOS2.hosts()
- main.log.info(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
@@ -565,7 +580,7 @@
tmp_result = main.ONOS2.add_host_intent(host1_id, host2_id )
time.sleep(10)
- h_intents = main.ONOS2.intents()
+ h_intents = main.ONOS2.intents(json_format = False)
main.log.info("intents:" +h_intents)
flowHandle = main.ONOS2.flows()
#main.log.info("flow:" +flowHandle)
@@ -804,9 +819,9 @@
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")
intentList = []
for line in intent_linewise:
@@ -823,28 +838,10 @@
for id in intentids:
main.ONOS2.remove_intent(intent_id = id)
- intent_result = main.ONOS2.intents()
- intent_linewise = intent_result.split("\n")
- list_afterRemoval = []
- for line in intent_linewise:
- if line.startswith("id="):
- list_afterRemoval.append(line)
+ intent_result = main.ONOS2.intents(json_format = False)
+ main.log.info("intent_result = " +intent_result)
- 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
-
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:
main.log.report("Intent removal successful")
else:
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.params b/TestON/tests/SdnIpTest/SdnIpTest.params
index e9121a9..bb5826d 100755
--- a/TestON/tests/SdnIpTest/SdnIpTest.params
+++ b/TestON/tests/SdnIpTest/SdnIpTest.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>1</testcases>
+ <testcases>1,2</testcases>
#Environment variables
<ENV>
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.py b/TestON/tests/SdnIpTest/SdnIpTest.py
index 6580c20..4f55c02 100755
--- a/TestON/tests/SdnIpTest/SdnIpTest.py
+++ b/TestON/tests/SdnIpTest/SdnIpTest.py
@@ -1,4 +1,4 @@
-#from cupshelpers.config import prefix
+# from cupshelpers.config import prefix
# Testing the basic functionality of SDN-IP
@@ -11,11 +11,11 @@
'''
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
@@ -57,20 +57,6 @@
routeIntents_expected = routeIntents_expected_host3 + routeIntents_expected_host4
- 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)
cell_name = main.params['ENV']['cellName']
ONOS1_ip = main.params['CTRL']['ip1']
@@ -86,10 +72,10 @@
main.step("Starting ONOS service")
# TODO: start ONOS from Mininet Script
- #start_result = main.ONOSbench.onos_start("127.0.0.1")
+ # 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("Checking if ONOS is up yet")
time.sleep(60)
onos1_isup = main.ONOSbench.isup(ONOS1_ip)
@@ -107,7 +93,22 @@
time.sleep(10)
main.log.info("Installing sdn-ip feature")
main.ONOScli.feature_install("onos-app-sdnip")
- time.sleep(30)
+ 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)
+
+ 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)
@@ -125,6 +126,10 @@
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(20)
get_intents_result = main.ONOScli.intents(json_format=True)
@@ -144,6 +149,10 @@
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
@@ -162,11 +171,19 @@
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!***")
+
+
+
#============================= Ping Test ========================
# wait until all MultiPointToSinglePoint
time.sleep(20)
ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
- ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-results-before-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+ 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)
@@ -189,6 +206,11 @@
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)
@@ -198,10 +220,14 @@
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/CASE1-ping-results-after-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+ 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)
@@ -210,3 +236,228 @@
# 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)
+
+
+