Single Instance and Multi Instance related tests
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: