blob: ce7127217dc40abe60d9161b83b4c3d1bf0ba754 [file] [log] [blame]
andrewonlab2a6c9342014-10-16 13:40:15 -04001#TopoPerfNext
2#
3#Topology Performance test for ONOS-next
4#
5#andrew@onlab.us
6
7import time
8import sys
9import os
10import re
11
12class TopoPerfNext:
13 def __init__(self):
14 self.default = ''
15
16 def CASE1(self, main):
17 '''
18 ONOS startup sequence
19 '''
20 cell_name = main.params['ENV']['cellName']
21
22 git_pull = main.params['GIT']['autoPull']
23 checkout_branch = main.params['GIT']['checkout']
24
25 ONOS1_ip = main.params['CTRL']['ip1']
andrewonlabba44bcf2014-10-16 16:54:41 -040026 ONOS2_ip = main.params['CTRL']['ip2']
27 ONOS3_ip = main.params['CTRL']['ip3']
andrewonlab2a6c9342014-10-16 13:40:15 -040028 MN1_ip = main.params['MN']['ip1']
29 BENCH_ip = main.params['BENCH']['ip']
30
31 main.case("Setting up test environment")
32
33 main.step("Creating cell file")
34 cell_file_result = main.ONOSbench.create_cell_file(
andrewonlabba44bcf2014-10-16 16:54:41 -040035 BENCH_ip, cell_name, MN1_ip,
36 ONOS1_ip, ONOS2_ip, ONOS3_ip)
andrewonlab2a6c9342014-10-16 13:40:15 -040037
38 main.step("Applying cell file to environment")
39 cell_apply_result = main.ONOSbench.set_cell(cell_name)
40 verify_cell_result = main.ONOSbench.verify_cell()
41
42 main.step("Git checkout and pull "+checkout_branch)
43 if git_pull == 'on':
44 checkout_result = \
45 main.ONOSbench.git_checkout(checkout_branch)
46 pull_result = main.ONOSbench.git_pull()
47 else:
48 checkout_result = main.TRUE
49 pull_result = main.TRUE
50 main.log.info("Skipped git checkout and pull")
51
52 main.step("Using mvn clean & install")
andrewonlabba44bcf2014-10-16 16:54:41 -040053 mvn_result = main.ONOSbench.clean_install()
andrewonlab2a6c9342014-10-16 13:40:15 -040054
55 main.step("Creating ONOS package")
56 package_result = main.ONOSbench.onos_package()
57
58 main.step("Installing ONOS package")
59 install_result = main.ONOSbench.onos_install()
60
61 main.step("Starting ONOS service")
62 start_result = main.ONOSbench.onos_start(ONOS1_ip)
63
64 utilities.assert_equals(expect=main.TRUE,
65 actual= cell_file_result and cell_apply_result and\
66 verify_cell_result and checkout_result and\
67 pull_result and mvn_result and\
68 install_result and start_result,
69 onpass="Cell file created successfully",
70 onfail="Failed to create cell file")
71
andrewonlabba44bcf2014-10-16 16:54:41 -040072 def CASE2(self, main):
73 '''
74 Assign s1 to ONOS1 and measure latency
75 '''
76 import time
77
78 ONOS1_ip = main.params['CTRL']['ip1']
79 ONOS2_ip = main.params['CTRL']['ip2']
80 ONOS3_ip = main.params['CTRL']['ip3']
81 default_sw_port = main.params['CTRL']['port1']
82
83 #Number of iterations of case
84 num_iter = main.params['TEST']['numIter']
85
86 #Directory/file to store tshark results
87 tshark_of_output = "/tmp/tshark_of_topo.txt"
88 tshark_tcp_output = "/tmp/tshark_tcp_topo.txt"
89
90 #String to grep in tshark output
91 tshark_tcp_string = "TCP 74 "+default_sw_port
92 tshark_of_string = "OFP 86 Vendor"
93
94 main.log.report("Latency of adding one switch")
95
96 for i in range(0, int(num_iter)):
97 main.log.info("Starting tshark capture")
98
99 #* TCP [ACK, SYN] is used as t0_a, the
100 # very first "exchange" between ONOS and
101 # the switch for end-to-end measurement
102 #* OFP [Stats Reply] is used for t0_b
103 # the very last OFP message between ONOS
104 # and the switch for ONOS measurement
105 main.ONOS1.tshark_grep(tshark_tcp_string,
106 tshark_tcp_output)
107 main.ONOS1.tshark_grep(tshark_of_string,
108 tshark_of_output)
109
110 #Wait and ensure tshark is started and
111 #capturing
112 time.sleep(10)
113
114 main.log.info("Assigning s1 to controller")
115
116 main.Mininet1.assign_sw_controller(sw="1",
117 ip1=ONOS1_ip, port1=default_sw_port)
118
119 #Wait and ensure switch is assigned
120 #before stopping tshark
121 time.sleep(10)
122
123 main.ONOS1.stop_tshark()
124
125
126
127
128
129
130
131
132
133
134
135
andrewonlab2a6c9342014-10-16 13:40:15 -0400136