WIP: Topology performance; Added: tshark functions in onosdriver
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 5532b8a..d74b6d6 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -384,7 +384,8 @@
main.cleanup()
main.exit()
- def create_cell_file(self, bench_ip, file_name, mn_ip_addrs, *onos_ip_addrs):
+ def create_cell_file(self, bench_ip, file_name, mn_ip_addrs,
+ extra_feature_string="onos-core-trivial", *onos_ip_addrs):
'''
Creates a cell file based on arguments
Required:
@@ -413,10 +414,9 @@
#That you may wish to use by default on startup.
#Note that you may not want certain features listed
#on here.
- feature_string = "export ONOS_FEATURES=webconsole,onos-api,"+\
- "onos-core-trivial,onos-cli,onos-openflow,"+\
- "onos-app-fwd,onos-app-mobility,onos-app-tvue,"+\
- "onos-app-proxyarp"
+ core_feature_string = "export ONOS_FEATURES=webconsole,onos-api,"+\
+ "onos-cli,onos-openflow,onos-app-mobility,onos-app-tvue,"+\
+ "onos-app-proxyarp,"+extra_feature_string
mn_string = "export OCN="
onos_string = "export OC"
temp_count = 1
@@ -977,3 +977,47 @@
main.log.info(self.name+" ::::::")
main.cleanup()
main.exit()
+
+ def tshark_grep(self, grep, directory, interface='eth0'):
+ '''
+ Required:
+ * grep string
+ * directory to store results
+ Optional:
+ * interface - default: eth0
+ Description:
+ Uses tshark command to grep specific group of packets
+ and stores the results to specified directory.
+ The timestamp is hardcoded to be in epoch
+ '''
+ self.handle.sendline("")
+ self.handle.expect("\$")
+ self.handle.sendline("\r")
+ self.handle.sendline("tshark -i "+str(interface)+
+ " -t e | grep \""+str(grep)+"\" > "+directory+" &")
+ self.handle.sendline("\r")
+ self.handle.expect("Capturing on")
+ self.handle.sendline("\r")
+ self.handle.expect("\$")
+
+ def tshark_stop(self):
+ '''
+ Removes wireshark files from /tmp and kills all tshark processes
+ '''
+ self.execute(cmd="rm /tmp/wireshark*")
+ self.handle.sendline("")
+ self.handle.sendline("sudo kill -9 `ps -ef | grep \"tshark -i\" |"+
+ " grep -v grep | awk '{print $2}'`")
+ self.handle.sendline("")
+ main.log.info("Tshark stopped")
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.params b/TestON/tests/TopoPerfNext/TopoPerfNext.params
index 2635df6..25ae644 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.params
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1</testcases>
+ <testcases>1,2</testcases>
<ENV>
<cellName>topo_perf_test</cellName>
@@ -14,6 +14,10 @@
<CTRL>
<ip1>10.128.20.11</ip1>
<port1>6633</port1>
+ <ip2>10.128.20.12</ip2>
+ <port2>6633</port2>
+ <ip3>10.128.20.13</ip3>
+ <port3>6633</port3>
</CTRL>
<MN>
@@ -24,4 +28,10 @@
<BENCH>
<ip>10.128.20.10</ip>
</BENCH>
+
+ <TEST>
+ #Number of times to iterate each case
+ <numIter>10</numIter>
+
+ </TEST>
</PARAMS>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
index 170a43b..ce71272 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.py
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -23,6 +23,8 @@
checkout_branch = main.params['GIT']['checkout']
ONOS1_ip = main.params['CTRL']['ip1']
+ ONOS2_ip = main.params['CTRL']['ip2']
+ ONOS3_ip = main.params['CTRL']['ip3']
MN1_ip = main.params['MN']['ip1']
BENCH_ip = main.params['BENCH']['ip']
@@ -30,7 +32,8 @@
main.step("Creating cell file")
cell_file_result = main.ONOSbench.create_cell_file(
- BENCH_ip, cell_name, MN1_ip, ONOS1_ip)
+ BENCH_ip, cell_name, MN1_ip,
+ ONOS1_ip, ONOS2_ip, ONOS3_ip)
main.step("Applying cell file to environment")
cell_apply_result = main.ONOSbench.set_cell(cell_name)
@@ -47,11 +50,7 @@
main.log.info("Skipped git checkout and pull")
main.step("Using mvn clean & install")
- if git_pull == 'on':
- mvn_result = main.ONOSbench.clean_install()
- else:
- mvn_result = main.TRUE
- main.log.info("Skipped mvn clean compile")
+ mvn_result = main.ONOSbench.clean_install()
main.step("Creating ONOS package")
package_result = main.ONOSbench.onos_package()
@@ -70,4 +69,68 @@
onpass="Cell file created successfully",
onfail="Failed to create cell file")
+ def CASE2(self, main):
+ '''
+ Assign s1 to ONOS1 and measure latency
+ '''
+ import time
+
+ ONOS1_ip = main.params['CTRL']['ip1']
+ ONOS2_ip = main.params['CTRL']['ip2']
+ ONOS3_ip = main.params['CTRL']['ip3']
+ default_sw_port = main.params['CTRL']['port1']
+
+ #Number of iterations of case
+ num_iter = main.params['TEST']['numIter']
+
+ #Directory/file to store tshark results
+ tshark_of_output = "/tmp/tshark_of_topo.txt"
+ tshark_tcp_output = "/tmp/tshark_tcp_topo.txt"
+
+ #String to grep in tshark output
+ tshark_tcp_string = "TCP 74 "+default_sw_port
+ tshark_of_string = "OFP 86 Vendor"
+
+ main.log.report("Latency of adding one switch")
+
+ for i in range(0, int(num_iter)):
+ main.log.info("Starting tshark capture")
+
+ #* TCP [ACK, SYN] is used as t0_a, the
+ # very first "exchange" between ONOS and
+ # the switch for end-to-end measurement
+ #* OFP [Stats Reply] is used for t0_b
+ # the very last OFP message between ONOS
+ # and the switch for ONOS measurement
+ main.ONOS1.tshark_grep(tshark_tcp_string,
+ tshark_tcp_output)
+ main.ONOS1.tshark_grep(tshark_of_string,
+ tshark_of_output)
+
+ #Wait and ensure tshark is started and
+ #capturing
+ time.sleep(10)
+
+ main.log.info("Assigning s1 to controller")
+
+ main.Mininet1.assign_sw_controller(sw="1",
+ ip1=ONOS1_ip, port1=default_sw_port)
+
+ #Wait and ensure switch is assigned
+ #before stopping tshark
+ time.sleep(10)
+
+ main.ONOS1.stop_tshark()
+
+
+
+
+
+
+
+
+
+
+
+