2 Documentation This test suite is to verify working of OF based Tunnels
5 Library OperatingSystem
6 Library RequestsLibrary
9 Resource ../../libraries/ClusterManagement.robot
10 Resource ../../libraries/DataModels.robot
11 Resource ../../libraries/Genius.robot
12 Resource ../../libraries/KarafKeywords.robot
13 Resource ../../libraries/ODLTools.robot
14 Resource ../../libraries/OVSDB.robot
15 Resource ../../libraries/Utils.robot
16 Resource ../../libraries/VpnOperations.robot
17 Resource ../../variables/Variables.robot
18 Variables ../../variables/genius/Modules.py
19 Resource ../../variables/netvirt/Variables.robot
21 Suite Setup OF Tunnels Start Suite
22 Suite Teardown OF Tunnels Stop Suite
23 Test Setup Genius Test Setup
24 Test Teardown Genius Test Teardown ${data_models}
28 ${FLOWS_FILTER_TABLE0} | grep table=0
29 ${FLOWS_FILTER_TABLE95} | grep table=95
33 Create and Verify OFT TEPs
34 [Documentation] Create TEPs set to use OF based Tunnels and verify.
35 CompareStream.Run_Keyword_If_Less_Than_Sodium
36 ... BuiltIn.Pass Execution
37 ... Test case valid only for versions Sodium and above
38 OFT Create Vteps using Auto Tunnels @{TOOLS_SYSTEM_ALL_IPS}
39 OFT Verify Vteps Created ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
41 Delete and Verify OFT TEPs
42 [Documentation] Delete TEPs set to use OF based Tunnels and verify.
43 CompareStream.Run_Keyword_If_Less_Than_Sodium
44 ... BuiltIn.Pass Execution
45 ... Test case valid only for versions Sodium and above
46 OFT Delete Vteps using Auto Tunnels @{TOOLS_SYSTEM_ALL_IPS}
47 OFT Verify Vteps Deleted ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
48 BuiltIn.Wait Until Keyword Succeeds
51 ... Utils.No Content From URI
53 ... ${OPERATIONAL_API}/itm-state:tunnels_state
55 Create and Verify single OFT TEPs
56 [Documentation] Create single TEPs set to use OF based Tunnels and verify.
57 CompareStream.Run_Keyword_If_Less_Than_Sodium
58 ... BuiltIn.Pass Execution
59 ... Test case valid only for versions Sodium and above
60 ${tools_ips} = BuiltIn.Create List @{TOOLS_SYSTEM_ALL_IPS}
61 Collections.Remove From List ${tools_ips} -1
62 ${dpn_ids} = BuiltIn.CreateList @{DPN_ID_LIST}
63 Collections.Remove From List ${dpn_ids} -1
64 OFT Create Vteps using Auto Tunnels @{tools_ips}
65 OFT Verify Vteps Created ${dpn_ids} ${tools_ips}
66 OFT Create Vteps using Auto Tunnels ${TOOLS_SYSTEM_ALL_IPS}[-1]
67 OFT Verify Vteps Created ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
69 Delete and Verify single OFT TEPs
70 [Documentation] Delete single TEPs set to use OF based Tunnels and verify.
71 CompareStream.Run_Keyword_If_Less_Than_Sodium
72 ... BuiltIn.Pass Execution
73 ... Test case valid only for versions Sodium and above
74 ${deleted_tools_ip_list} = BuiltIn.Set Variable ${TOOLS_SYSTEM_ALL_IPS}[0]
75 OFT Delete Vteps using Auto Tunnels ${deleted_tools_ip_list}
76 ${deleted_tools_ip_list} = BuiltIn.CreateList ${TOOLS_SYSTEM_ALL_IPS}[0]
77 ${deleted_dpn_id_list} = BuiltIn.CreateList ${DPN_ID_LIST}[0]
78 OFT Verify Vteps Deleted ${deleted_dpn_id_list} ${deleted_tools_ip_list}
82 OFT Create Vteps using Auto Tunnels
83 [Documentation] Create VTEPs for selected tools systems in ODL using Auto Tunnels.
84 [Arguments] @{tools_ip_list}
85 FOR ${tools_ip} IN @{tools_ip_list}
86 Utils.Run Command On Remote System And Log ${tools_ip} ${SET_LOCAL_IP}${tools_ip}
89 OFT Verify Vteps Created
90 [Documentation] Verify if OFT VTEPs are created successfully or not for given Tools IPs and DPN-IDs.
91 [Arguments] ${dpn_id_list} ${tools_ip_list}
92 ${switch_data} = BuiltIn.Create List @{dpn_id_list} @{tools_ip_list}
93 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Get ITM ${DEFAULT_TRANSPORT_ZONE} ${switch_data}
94 ${tep_show_output} = BuiltIn.Wait Until Keyword Succeeds
97 ... KarafKeywords.Issue Command On Karaf Console
99 BuiltIn.Should Contain Any ${tep_show_output} ${DEFAULT_TRANSPORT_ZONE} VXLAN @{switch_data}
100 BuiltIn.Wait Until Keyword Succeeds
103 ... Genius.Update Dpn id List And Get Tunnels
104 ... odl-interface:tunnel-type-vxlan
107 BuiltIn.Wait Until Keyword Succeeds
110 ... Genius.Verify Response Code Of Dpn End Point Config API
112 ${num_switches} = BuiltIn.Get Length ${dpn_id_list}
113 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Verify Tunnel Status As Up ${num_switches}
114 BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Tunnels Created @{tools_ip_list}
115 ${tools_system_len} = BuiltIn.Get Length ${tools_ip_list}
116 FOR ${tools_system_index} IN RANGE ${tools_system_len}
117 ${tun_ip_list} = BuiltIn.CreateList @{tools_ip_list}
118 Collections.Remove From List ${tun_ip_list} ${tools_system_index}
119 ${ports_output} = Utils.Run Command On Remote System And Log
120 ... ${tools_ip_list}[${tools_system_index}]
121 ... sudo ovs-ofctl -Oopenflow13 dump-ports-desc ${Bridge}
122 ${port_numbers} = String.Get Regexp Matches ${ports_output} (\\d+).of.* ${1}
123 BuiltIn.Wait Until Keyword Succeeds
126 ... OFT OVS Verify Ingress Flows Created per Switch
127 ... ${tools_ip_list}[${tools_system_index}]
130 BuiltIn.Wait Until Keyword Succeeds
133 ... OFT OVS Verify Egress Flows Created per Switch
134 ... ${tools_ip_list}[${tools_system_index}]
137 BuiltIn.Wait Until Keyword Succeeds
140 ... OFT OVS Verify Ingress Flows Created per Switch
141 ... ${tools_ip_list}[${tools_system_index}]
146 OFT OVS Verify Tunnels Created
147 [Documentation] Verify if tunnels are created in OVS for selected tools systems.
148 [Arguments] @{tools_ip_list}
149 FOR ${tools_ip} IN @{tools_ip_list}
150 ${output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-vsctl show
151 BuiltIn.Should Contain X Times ${output} local_ip="${tools_ip}", remote_ip=flow ${1}
154 OFT OVS Verify Ingress Flows Created per Switch
155 [Documentation] Verify if Ingress flow rules are created in OVS for a given switch.
156 [Arguments] ${tools_ip} ${tun_src_list} ${port_numbers}
157 ${flows_table0_output} = Utils.Run Command On Remote System And Log
159 ... sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE0}
160 BuiltIn.Should Not Contain ${flows_table0_output} tun_src=${tools_ip},
161 FOR ${tun_src} IN @{tun_src_list}
162 BuiltIn.Should Contain ${flows_table0_output} tun_src=${tun_src},
164 FOR ${port_number} IN @{port_numbers}
165 BuiltIn.Should Contain ${flows_table0_output} in_port=${port_number}
168 OFT OVS Verify Egress Flows Created per Switch
169 [Documentation] Verify if Egress flow rules are created in OVS for a given switch.
170 [Arguments] ${tools_ip} ${tun_dst_list} ${port_numbers}
171 ${flows_table95_output} = Utils.Run Command On Remote System And Log
173 ... sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE95}
174 FOR ${tun_dst} IN @{tun_dst_list}
175 ${tun_dst_hex} = BuiltIn.Evaluate
176 ... hex(struct.unpack('!I',socket.inet_aton('${tun_dst}'))[0])
177 ... modules=socket,struct
178 BuiltIn.Should Contain ${flows_table95_output} load:${tun_dst_hex}->NXM_NX_TUN_IPV4_DST[]
180 FOR ${port_number} IN @{port_numbers}
181 BuiltIn.Should Contain ${flows_table95_output} output:${port_number}
184 OFT Delete Vteps using Auto Tunnels
185 [Documentation] Delete VTEPs for selected tools systems in ODL using Auto Tunnel.
186 [Arguments] @{tools_ip_list}
187 FOR ${tools_ip} IN @{tools_ip_list}
188 Utils.Run Command On Remote System And Log ${tools_ip} ${REMOVE_LOCAL_IP}
191 OFT Verify Vteps Deleted
192 [Documentation] Verify if OFT Vteps are created successfully or not for given Tools IPs and DPN-IDs.
193 [Arguments] ${dpn_id_list} ${tools_ip_list}
194 ${deleted_tep_len} = BuiltIn.Get Length ${dpn_id_list}
195 ${existing_tep_len} = BuiltIn.Evaluate ${NUM_TOOLS_SYSTEM}-${deleted_tep_len}
196 IF ${existing_tep_len} > 0
197 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Verify Tunnel Status As Up ${existing_tep_len}
199 ${tep_show_output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW}
200 ${tep_show_state_output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE}
201 FOR ${tools_system_index} IN RANGE ${deleted_tep_len}
202 ${tep_show_state_output_1} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE}
203 BuiltIn.Log ${tools_ip_list}[${tools_system_index}]
204 BuiltIn.Should Not Contain ${tep_show_output} ${tools_ip_list}[${tools_system_index}]
205 BuiltIn.Should Not Contain ${tep_show_state_output} ${tools_ip_list}[${tools_system_index}]
206 BuiltIn.Wait Until Keyword Succeeds
209 ... Utils.No Content From URI
211 ... ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${dpn_id_list}[${tools_system_index}]/
212 ${dst_dpn_id_list} = BuiltIn.Create List @{DPN_ID_LIST}
213 Collections.Remove From List ${dst_dpn_id_list} ${tools_system_index}
214 BuiltIn.Wait Until Keyword Succeeds
217 ... OFT Verify Vteps Deleted at Dpn Teps State per Interface
218 ... ${dpn_id_list}[${tools_system_index}]
219 ... ${dst_dpn_id_list}
220 ${ovs_vsctl_output} = BuiltIn.Wait Until Keyword Succeeds
223 ... Utils.Run Command On Remote System And Log
224 ... ${tools_ip_list}[${tools_system_index}]
225 ... sudo ovs-vsctl show
226 BuiltIn.Should Not Contain ${ovs_vsctl_output} remote_ip=flow
227 BuiltIn.Wait Until Keyword Succeeds
230 ... OFT OVS Verify Ingress Flows Deleted per Switch
231 ... ${tools_ip_list}[${tools_system_index}]
232 BuiltIn.Wait Until Keyword Succeeds
235 ... OFT OVS Verify Egress Flows Deleted per Switch
236 ... ${tools_ip_list}[${tools_system_index}]
239 OFT Verify Vteps Deleted at Dpn Teps State per Interface
240 [Documentation] Verify if vteps are deleted for all src-dst intf pair at dpn-teps-state in ODL for a given src intf.
241 [Arguments] ${src_dpn_id} ${dst_dpn_id_list}
242 FOR ${dst_dpn_id} IN @{dst_dpn_id_list}
243 ${status} = BuiltIn.Run Keyword And Return Status
244 ... Genius.Get Tunnel
247 ... odl-interface:tunnel-type-vxlan
249 BuiltIn.Should Be True ${status} == ${False}
252 OFT OVS Verify Ingress Flows Deleted per Switch
253 [Documentation] Verify if Ingress flow rules are deleted in OVS for a given switch.
254 [Arguments] ${tools_ip}
255 ${flows_table0_output} = Utils.Run Command On Remote System And Log
257 ... sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE0}
258 BuiltIn.Should Not Contain ${flows_table0_output} tun_src=
260 OFT OVS Verify Egress Flows Deleted per Switch
261 [Documentation] Verify if Egress flow rules are deleted in OVS for a given switch.
262 [Arguments] ${tools_ip}
263 ${flows_table95_output} = Utils.Run Command On Remote System And Log
265 ... sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE95}
266 BuiltIn.Should Not Contain ${flows_table95_output} output:
268 OF Tunnels Start Suite
269 [Documentation] Start suite for OF Tunnels.
270 ClusterManagement.ClusterManagement_Setup
271 ClusterManagement.Stop_Members_From_List_Or_All
272 FOR ${controller_index} IN RANGE ${NUM_ODL_SYSTEM}
273 Run Command On Remote System And Log
274 ... ${ODL_SYSTEM_${controller_index+1}_IP}
275 ... sed -i -- 's/<itm-direct-tunnels>false/<itm-direct-tunnels>true/g' ${GENIUS_IFM_CONFIG_FLAG}
276 Run Command On Remote System And Log
277 ... ${ODL_SYSTEM_${controller_index+1}_IP}
278 ... sed -i -- 's/<use-of-tunnels>false/<use-of-tunnels>true/g' ${GENIUS_ITM_CONFIG_FLAG}
280 ClusterManagement.Start_Members_From_List_Or_All
283 OF Tunnels Stop Suite
284 [Documentation] Stop suite for OF Tunnels.
285 FOR ${controller_index} IN RANGE ${NUM_ODL_SYSTEM}
286 Run Command On Remote System And Log
287 ... ${ODL_SYSTEM_${controller_index+1}_IP}
288 ... sed -i -- 's/<itm-direct-tunnels>true/<itm-direct-tunnels>false/g' ${GENIUS_IFM_CONFIG_FLAG}
289 Run Command On Remote System And Log
290 ... ${ODL_SYSTEM_${controller_index+1}_IP}
291 ... sed -i -- 's/<itm-of-tunnels>true/<itm-of-tunnels>false/g' ${GENIUS_IFM_CONFIG_FLAG}
293 ClusterManagement.Stop_Members_From_List_Or_All
294 ClusterManagement.Start_Members_From_List_Or_All
295 Genius Suite Teardown