Merge pull request #15 from OPENNETWORKINGLAB/cli_device_role
Add function for onos cli command 'Device-role'
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index a31e946..c7261c5 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -237,7 +237,7 @@
elif i==2:
main.log.info(self.name + ": Git Pull - pulling repository now")
self.handle.expect("ONOS\$", 120)
- return main.TRUE
+ return i # So that only when git pull is done, we do mvn clean compile
elif i==3:
main.log.info(self.name + ": Git Pull - Already up to date")
return main.TRUE
diff --git a/TestON/tests/FuncNext/FuncNext.py b/TestON/tests/FuncNext/FuncNext.py
index 36e0376..c0b96d2 100755
--- a/TestON/tests/FuncNext/FuncNext.py
+++ b/TestON/tests/FuncNext/FuncNext.py
@@ -38,9 +38,10 @@
print "git_pull_result = ", git_pull_result
version_result = main.ONOSbench.get_version()
- main.step("Using mvn clean & install")
- #clean_install_result = main.ONOSbench.clean_install()
- #clean_install_result = main.TRUE
+ if git_pull_result == 2:
+ main.step("Using mvn clean & install")
+ clean_install_result = main.ONOSbench.clean_install()
+ #clean_install_result = main.TRUE
main.step("Applying cell variable to environment")
cell_result1 = main.ONOSbench.set_cell(cell_name)
@@ -250,7 +251,7 @@
print "_____________________________________________________________________________________"
-
+ '''
main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
if ptp_intent_result == main.TRUE:
@@ -382,7 +383,8 @@
main.log.info(get_intent_result)
print("_______________________________________________________________________________________")
-
+ '''
+
#Unistall onos-app-fwd app to disable reactive forwarding
appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
main.log.info("onos-app-fwd uninstalled")
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
index a55b21b..e3940f8 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.py
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -618,6 +618,15 @@
" exceeded the threshold: "+
str(pt_down_graph_to_ofp_avg))
+ if pt_down_device_to_ofp_avg > 0 and \
+ pt_down_device_to_ofp_avg < 1000:
+ port_down_device_to_ofp_list.append(
+ pt_down_device_to_ofp_avg)
+ else:
+ main.log.info("Average port down device-to-ofp result" +
+ " exceeded the threshold: "+
+ str(pt_down_device_to_ofp_avg))
+
#TODO: Remove these logs. For test purposes only
main.log.info("Delta1 down graph: "+str(pt_down_graph_to_ofp_1))
main.log.info("Delta2 down graph: "+str(pt_down_graph_to_ofp_2))
@@ -701,7 +710,35 @@
int(timestamp_begin_pt_up)
pt_up_device_to_ofp_3 = int(device_timestamp_3) -\
int(timestamp_begin_pt_up)
-
+
+ pt_up_graph_to_ofp_avg = \
+ (float(pt_up_graph_to_ofp_1) +
+ float(pt_up_graph_to_ofp_2) +
+ float(pt_up_graph_to_ofp_3)) / 3
+
+ pt_up_device_to_ofp_avg = \
+ (float(pt_up_device_to_ofp_1) +
+ float(pt_up_device_to_ofp_2) +
+ float(pt_up_device_to_ofp_3)) / 3
+
+ if pt_up_graph_to_ofp_avg > 0 and \
+ pt_up_graph_to_ofp_avg < 1000:
+ port_up_graph_to_ofp_list.append(
+ pt_up_graph_to_ofp_avg)
+ else:
+ main.log.info("Average port up graph-to-ofp result"+
+ " exceeded the threshold: "+
+ str(pt_up_graph_to_ofp_avg))
+
+ if pt_up_device_to_ofp_avg > 0 and \
+ pt_up_device_to_ofp_avg < 1000:
+ port_up_device_to_ofp_list.append(
+ pt_up_device_to_ofp_avg)
+ else:
+ main.log.info("Average port up graph-to-ofp result"+
+ " exceeded the threshold: "+
+ str(pt_up_device_to_ofp_avg))
+
#TODO: Remove these logs. For test purposes only
main.log.info("Delta1 up graph: "+str(pt_up_graph_to_ofp_1))
main.log.info("Delta2 up graph: "+str(pt_up_graph_to_ofp_2))
@@ -714,16 +751,87 @@
main.log.info("Delta3 down device: "+
str(pt_up_device_to_ofp_3))
+ #END ITERATION FOR LOOP
+
+ port_down_graph_to_ofp_min = min(port_down_graph_to_ofp_list)
+ port_down_graph_to_ofp_max = max(port_down_graph_to_ofp_list)
+ port_down_graph_to_ofp_avg = \
+ (sum(port_down_graph_to_ofp_list) /
+ len(port_down_graph_to_ofp_list))
+
+ main.log.report("Port up graph-to-ofp Min: ")
+ main.log.report("Port up graph-to-ofp Max: ")
+ main.log.report("Port up graph-to-ofp Avg: ")
+ def CASE4(self, main):
+ '''
+ Link down event using loss rate 100%
+ '''
+ import time
+ import subprocess
+ import os
+ import requests
+ import json
+
+ ONOS1_ip = main.params['CTRL']['ip1']
+ ONOS2_ip = main.params['CTRL']['ip2']
+ ONOS3_ip = main.params['CTRL']['ip3']
+ ONOS_user = main.params['CTRL']['user']
+
+ default_sw_port = main.params['CTRL']['port1']
+
+ #Number of iterations of case
+ num_iter = main.params['TEST']['numIter']
+
+ #Timestamp 'keys' for json metrics output.
+ #These are subject to change, hence moved into params
+ deviceTimestamp = main.params['JSON']['deviceTimestamp']
+ linkTimestamp = main.params['JSON']['linkTimestamp']
+
+ assertion = main.TRUE
+ #Link event timestamp to system time list
+ link_down_link_to_system_list = []
+ link_up_link_to_system_list = []
+ #Graph event timestamp to system time list
+ link_down_graph_to_system_list = []
+ link_up_graph_to_system_list = []
+
+ main.log.report("Add / remove link latency between "+
+ "two switches")
+
+ main.step("Assign all switches")
+ main.Mininet1.assign_sw_controller(sw="1",
+ ip1=ONOS1_ip, port1=default_sw_port)
+ main.Mininet1.assign_sw_controller(sw="2",
+ ip1=ONOS1_ip, port1=default_sw_port)
+
+ main.step("Verifying switch assignment")
+ result_s1 = main.Mininet1.get_sw_controller(sw="s1")
+ result_s2 = main.Mininet1.get_sw_controller(sw="s2")
+
+ if result_s1 == main.TRUE and result_s2 == main.TRUE:
+ main.log.report("Switches s1, s2 assigned successfully")
+ else:
+ main.log.error("Error assigning switches s1 and s2")
+ assertion = main.FALSE
+
+ #Allow time for events to finish before taking measurements
+ time.sleep(10)
+
+ #Start iteration of link event test
+ for i in range(0, int(num_iter)):
+ main.step("Getting initial system time as t0")
-
-
-
-
-
-
-
-
+ timestamp_link_down_t0 = time.time() * 1000
+ #Link down is simulated by 100% loss rate using traffic
+ #control command
+ main.Mininet1.handle.sendline(
+ "sh tc qdisc add dev s1-eth1 root netem loss 100%")
+
+ #TODO: Iterate through topology count to detect
+ # link down discovery. Take timestamp and
+ # gather list for num_iter
+