Changes to linc-oe driver / addition of linc-oe tests with startup functionality. Minor edits to TopoPerf
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.params b/TestON/tests/TopoPerfNext/TopoPerfNext.params
index d8d8b37..23b470b 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.params
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.params
@@ -12,7 +12,7 @@
</GIT>
<CTRL>
- <user>sdn</user>
+ <user>admin</user>
<ip1>10.128.20.11</ip1>
<port1>6633</port1>
<ip2>10.128.20.12</ip2>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
index 2fe521b..8e36c95 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.py
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -50,7 +50,8 @@
main.log.info("Skipped git checkout and pull")
main.step("Using mvn clean & install")
- mvn_result = main.ONOSbench.clean_install()
+ #mvn_result = main.ONOSbench.clean_install()
+ mvn_result = main.TRUE
main.step("Creating ONOS package")
package_result = main.ONOSbench.onos_package()
@@ -66,8 +67,8 @@
verify_cell_result and checkout_result and\
pull_result and mvn_result and\
install_result and start_result,
- onpass="Cell file created successfully",
- onfail="Failed to create cell file")
+ onpass="ONOS started successfully",
+ onfail="Failed to start ONOS")
def CASE2(self, main):
'''
@@ -127,7 +128,7 @@
#Wait and ensure switch is assigned
#before stopping tshark
- time.sleep(10)
+ time.sleep(20)
main.ONOS1.stop_tshark()
@@ -136,10 +137,12 @@
main.log.info("Copying over tshark files")
#TCP CAPTURE ****
- ssh_tcp_file = subprocess.Popen(['ssh',
- ONOS_user+"@"+ONOS1_ip, 'cat',
- tshark_tcp_output], stdout=subprocess.PIPE)
- temp_text = ssh_tcp_file.stdout.readline()
+ #Copy the tshark output from ONOS machine to
+ #TestON machine in tshark_tcp_output directory>file
+ os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+ tshark_tcp_output+" /tmp/")
+ tcp_file = open(tshark_tcp_output, 'r')
+ temp_text = tcp_file.readline()
temp_text = temp_text.split(" ")
main.log.info("Object read in from TCP capture: "+
@@ -151,16 +154,19 @@
" returned unexpected results")
t0_tcp = 0
assertion = main.FALSE
+
+ tcp_file.close()
#****************
#OF CAPTURE ****
- ssh_of_file = subprocess.Popen(['ssh',
- ONOS_user+"@"+ONOS1_ip, 'cat',
- tshark_of_output], stdout=subprocess.PIPE)
-
+ os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+ tshark_of_output+" /tmp/")
+ of_file = open(tshark_of_output, 'r')
+
+ line_ofp = ""
while True:
- temp_text = ssh_of_file.stdout.readline()
- if line !='':
+ temp_text = of_file.readline()
+ if temp_text !='':
line_ofp = temp_text
else:
break
@@ -176,6 +182,8 @@
" returned unexpected results")
t0_ofp = 0
assertion = main.FALSE
+
+ of_file.close()
#****************
#TODO:
@@ -208,7 +216,153 @@
main.log.info("ONOS2 delta TCP: "+str(delta_tcp_2))
main.log.info("ONOS3 delta TCP: "+str(delta_tcp_3))
+ main.step("Remove switch from controller")
+ main.Mininet1.delete_sw_controller("s1")
+ time.sleep(5)
+ utilities.assert_equals(expect=main.TRUE, actual=assertion,
+ onpass="Switch latency test successful",
+ onfail="Switch latency test failed")
+
+ def CASE3(self, main):
+ '''
+ Bring port up / down and measure latency.
+ Port enable / disable is simulated by ifconfig up / down
+ '''
+ import time
+ import subprocess
+ import os
+ import requests
+ import json
+ ONOS1_ip = main.params['CTRL']['ip1']
+ default_sw_port = main.params['CTRL']['port1']
+ ONOS_user = main.params['CTRL']['user']
+ num_iter = main.params['TEST']['numIter']
+
+ tshark_port_status = "OFP 130 Port Status"
+
+ tshark_port_up = "/tmp/tshark_port_up.txt"
+ tshark_port_down = "/tmp/tshark_port_down.txt"
+
+ main.log.report("Port enable / disable latency")
+
+ main.step("Assign switch to controller")
+ main.Mininet1.assign_sw_controller(sw="1",ip1=ONOS1_ip,
+ port1=default_sw_port)
+
+ main.step("Verify switch is assigned correctly")
+ result_s1 = main.Mininet1.get_sw_controller(sw="s1")
+ if result_s1 == main.FALSE:
+ main.log.info("Switch s1 was not assigned correctly")
+ assertion = main.FALSE
+ else:
+ main.log.info("Switch s1 was assigned correctly")
+
+ for i in range(0, int(num_iter)):
+ main.step("Starting wireshark capture for port status down")
+ main.ONOS1.tshark_grep(tshark_port_status,
+ tshark_port_down)
+
+ time.sleep(10)
+
+ main.step("Disable port (interface s1-eth2)")
+ main.Mininet2.handle.sendline("sudo ifconfig s1-eth2 down")
+ main.Mininet2.handle.expect("\$")
+ time.sleep(20)
+
+ main.ONOS1.tshark_stop()
+ time.sleep(5)
+
+ #Copy tshark output file from ONOS to TestON instance
+ #/tmp directory
+ os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+ tshark_port_down+" /tmp/")
+
+ f_port_down = open(tshark_port_down, 'r')
+ f_line = f_port_down.readline()
+ obj_down = f_line.split(" ")
+ if len(f_line) > 0:
+ timestamp_begin_pt_down = int(float(obj_down[1])*1000)
+ else:
+ main.log.info("Tshark output file returned unexpected"+
+ " results")
+ timestamp_begin_pt_down = 0
+
+ main.step("Obtain t1 by REST call")
+ #TODO: Implement json object parsing here
+
+ timestamp_end_pt_down_1 = 0
+ timestamp_end_pt_down_2 = 0
+ timestamp_end_pt_down_3 = 0
+
+ delta_pt_down_1 = int(timestamp_end_pt_down_1) - \
+ int(timestamp_begin_pt_down)
+ delta_pt_down_2 = int(timestamp_end_pt_down_2) - \
+ int(timestamp_begin_pt_down)
+ delta_pt_down_3 = int(timestamp_end_pt_down_3) - \
+ int(timestamp_begin_pt_down)
+
+ #TODO: Remove these logs. For test purposes only
+ main.log.info("Delta1: "+str(delta_pt_down_1))
+ main.log.info("Delta2: "+str(delta_pt_down_2))
+ main.log.info("Delta3: "+str(delta_pt_down_3))
+
+ #Port up events
+ main.step("Enable port and obtain timestamp")
+ main.step("Starting wireshark capture for port status up")
+ main.ONOS1.tshark_grep("OFP 130 Port Status", tshark_port_up)
+ time.sleep(10)
+
+ main.Mininet2.handle.sendline("sudo ifconfig s1-eth2 up")
+ main.Mininet2.handle.expect("\$")
+ time.sleep(20)
+
+ os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+ tshark_port_up+" /tmp/")
+
+ f_port_up = open(tshark_port_up, 'r')
+ f_line = f_port_down.readline()
+ obj_up = f_line.split(" ")
+ if len(f_line) > 0:
+ timestamp_begin_pt_up = int(float(obj_up[1])*1000)
+ else:
+ main.log.info("Tshark output file returned unexpected"+
+ " results.")
+ timestamp_begin_pt_up = 0
+
+ main.step("Obtain t1 by REST call")
+ #TODO: Implement json object parsing here
+
+ timestamp_end_pt_up_1 = 0
+ timestamp_end_pt_up_2 = 0
+ timestamp_end_pt_up_3 = 0
+
+ delta_pt_up_1 = int(timestamp_end_pt_up_1) - \
+ int(timestamp_begin_pt_up)
+ delta_pt_up_2 = int(timestamp_end_pt_up_2) - \
+ int(timestamp_begin_pt_up)
+ delta_pt_up_3 = int(timestamp_end_pt_up_3) - \
+ int(timestamp_begin_pt_up)
+
+ #TODO: Remove these logs. For test purposes only
+ main.log.info("Delta1: "+str(delta_pt_up_1))
+ main.log.info("Delta2: "+str(delta_pt_up_2))
+ main.log.info("Delta3: "+str(delta_pt_up_3))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.topo b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
index 7d65d18..72fbd07 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.topo
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
@@ -21,8 +21,8 @@
<ONOS1>
<host>10.128.20.11</host>
- <user>sdn</user>
- <password>sdn</password>
+ <user>admin</user>
+ <password>onos_test</password>
<type>OnosDriver</type>
<connect_order>3</connect_order>
<COMPONENTS> </COMPONENTS>
@@ -36,11 +36,20 @@
<connect_order>4</connect_order>
<COMPONENTS>
<arg1> --custom topo-4fan.py </arg1>
- <arg2> --arp --mac</arg2>
- <arg3> --topo mytopo </arg3>
+ <arg2> --arp --mac --topo mytopo</arg2>
+ <arg3> </arg3>
<controller> remote </controller>
</COMPONENTS>
</Mininet1>
+ <Mininet2>
+ <host>10.128.10.90</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </Mininet2>
+
</COMPONENT>
</TOPOLOGY>