2 Documentation This test suite is to verify working of OF based Tunnels
3 Suite Setup OF Tunnels Start Suite
4 Suite Teardown OF Tunnels Stop Suite
5 Test Setup Genius Test Setup
6 Test Teardown Genius Test Teardown ${data_models}
8 Library OperatingSystem
9 Library RequestsLibrary
12 Resource ../../libraries/ClusterManagement.robot
13 Resource ../../libraries/DataModels.robot
14 Resource ../../libraries/Genius.robot
15 Resource ../../libraries/KarafKeywords.robot
16 Resource ../../libraries/ODLTools.robot
17 Resource ../../libraries/OVSDB.robot
18 Resource ../../libraries/Utils.robot
19 Resource ../../libraries/VpnOperations.robot
20 Resource ../../variables/Variables.robot
21 Variables ../../variables/genius/Modules.py
22 Resource ../../variables/netvirt/Variables.robot
25 ${FLOWS_FILTER_TABLE0} | grep table=0
26 ${FLOWS_FILTER_TABLE95} | grep table=95
29 Create and Verify OFT TEPs
30 [Documentation] Create TEPs set to use OF based Tunnels and verify.
31 CompareStream.Run_Keyword_If_Less_Than_Sodium BuiltIn.Pass Execution Test case valid only for versions Sodium and above
32 OFT Create Vteps using Auto Tunnels @{TOOLS_SYSTEM_ALL_IPS}
33 OFT Verify Vteps Created ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
35 Delete and Verify OFT TEPs
36 [Documentation] Delete TEPs set to use OF based Tunnels and verify.
37 CompareStream.Run_Keyword_If_Less_Than_Sodium BuiltIn.Pass Execution Test case valid only for versions Sodium and above
38 OFT Delete Vteps using Auto Tunnels @{TOOLS_SYSTEM_ALL_IPS}
39 OFT Verify Vteps Deleted ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
40 BuiltIn.Wait Until Keyword Succeeds 60 5 Utils.No Content From URI session ${OPERATIONAL_API}/itm-state:tunnels_state
42 Create and Verify single OFT TEPs
43 [Documentation] Create single TEPs set to use OF based Tunnels and verify.
44 CompareStream.Run_Keyword_If_Less_Than_Sodium BuiltIn.Pass Execution Test case valid only for versions Sodium and above
45 ${tools_ips} = BuiltIn.Create List @{TOOLS_SYSTEM_ALL_IPS}
46 Collections.Remove From List ${tools_ips} -1
47 ${dpn_ids} = BuiltIn.CreateList @{DPN_ID_LIST}
48 Collections.Remove From List ${dpn_ids} -1
49 OFT Create Vteps using Auto Tunnels @{tools_ips}
50 OFT Verify Vteps Created ${dpn_ids} ${tools_ips}
51 OFT Create Vteps using Auto Tunnels @{TOOLS_SYSTEM_ALL_IPS}[-1]
52 OFT Verify Vteps Created ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
54 Delete and Verify single OFT TEPs
55 [Documentation] Delete single TEPs set to use OF based Tunnels and verify.
56 CompareStream.Run_Keyword_If_Less_Than_Sodium BuiltIn.Pass Execution Test case valid only for versions Sodium and above
57 ${deleted_tools_ip_list} = BuiltIn.Create List @{TOOLS_SYSTEM_ALL_IPS}[0]
58 OFT Delete Vteps using Auto Tunnels @{deleted_tools_ip_list}
59 ${deleted_dpn_id_list} = BuiltIn.CreateList @{DPN_ID_LIST}[0]
60 OFT Verify Vteps Deleted ${deleted_dpn_id_list} ${deleted_tools_ip_list}
63 OFT Create Vteps using Auto Tunnels
64 [Arguments] @{tools_ip_list}
65 [Documentation] Create VTEPs for selected tools systems in ODL using Auto Tunnels.
66 FOR ${tools_ip} IN @{tools_ip_list}
67 Utils.Run Command On Remote System And Log ${tools_ip} ${SET_LOCAL_IP}${tools_ip}
70 OFT Verify Vteps Created
71 [Arguments] ${dpn_id_list} ${tools_ip_list}
72 [Documentation] Verify if OFT VTEPs are created successfully or not for given Tools IPs and DPN-IDs.
73 ${switch_data} = BuiltIn.Create List @{dpn_id_list} @{tools_ip_list}
74 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Get ITM ${DEFAULT_TRANSPORT_ZONE} ${switch_data}
75 ${tep_show_output} = BuiltIn.Wait Until Keyword Succeeds 60 5 KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW}
76 BuiltIn.Should Contain Any ${tep_show_output} ${DEFAULT_TRANSPORT_ZONE} VXLAN @{switch_data}
77 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Update Dpn id List And Get Tunnels odl-interface:tunnel-type-vxlan dpn-teps-state ${dpn_id_list}
78 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Verify Response Code Of Dpn End Point Config API ${dpn_id_list}
79 ${num_switches} = BuiltIn.Get Length ${dpn_id_list}
80 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Verify Tunnel Status As Up ${num_switches}
81 BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Tunnels Created @{tools_ip_list}
82 ${tools_system_len} = BuiltIn.Get Length ${tools_ip_list}
83 FOR ${tools_system_index} IN RANGE ${tools_system_len}
84 ${tun_ip_list} = BuiltIn.CreateList @{tools_ip_list}
85 Collections.Remove From List ${tun_ip_list} ${tools_system_index}
86 ${ports_output} = Utils.Run Command On Remote System And Log @{tools_ip_list}[${tools_system_index}] sudo ovs-ofctl -Oopenflow13 dump-ports-desc ${Bridge}
87 ${port_numbers} = String.Get Regexp Matches ${ports_output} (\\d+).of.* ${1}
88 BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Ingress Flows Created per Switch @{tools_ip_list}[${tools_system_index}] ${tun_ip_list}
90 BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Egress Flows Created per Switch @{tools_ip_list}[${tools_system_index}] ${tun_ip_list}
94 OFT OVS Verify Tunnels Created
95 [Arguments] @{tools_ip_list}
96 [Documentation] Verify if tunnels are created in OVS for selected tools systems.
97 FOR ${tools_ip} IN @{tools_ip_list}
98 ${output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-vsctl show
99 BuiltIn.Should Contain X Times ${output} local_ip="${tools_ip}", remote_ip=flow ${1}
102 OFT OVS Verify Ingress Flows Created per Switch
103 [Arguments] ${tools_ip} ${tun_src_list} ${port_numbers}
104 [Documentation] Verify if Ingress flow rules are created in OVS for a given switch.
105 ${flows_table0_output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE0}
106 BuiltIn.Should Not Contain ${flows_table0_output} tun_src=${tools_ip},
107 FOR ${tun_src} IN @{tun_src_list}
108 BuiltIn.Should Contain ${flows_table0_output} tun_src=${tun_src},
110 FOR ${port_number} IN @{port_numbers}
111 BuiltIn.Should Contain ${flows_table0_output} in_port=${port_number}
114 OFT OVS Verify Egress Flows Created per Switch
115 [Arguments] ${tools_ip} ${tun_dst_list} ${port_numbers}
116 [Documentation] Verify if Egress flow rules are created in OVS for a given switch.
117 ${flows_table95_output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE95}
118 FOR ${tun_dst} IN @{tun_dst_list}
119 ${tun_dst_hex} = BuiltIn.Evaluate hex(struct.unpack('!I',socket.inet_aton('${tun_dst}'))[0]) modules=socket,struct
120 BuiltIn.Should Contain ${flows_table95_output} load:${tun_dst_hex}->NXM_NX_TUN_IPV4_DST[]
122 FOR ${port_number} IN @{port_numbers}
123 BuiltIn.Should Contain ${flows_table95_output} output:${port_number}
126 OFT Delete Vteps using Auto Tunnels
127 [Arguments] @{tools_ip_list}
128 [Documentation] Delete VTEPs for selected tools systems in ODL using Auto Tunnel.
129 FOR ${tools_ip} IN @{tools_ip_list}
130 Utils.Run Command On Remote System And Log ${tools_ip} ${REMOVE_LOCAL_IP}
133 OFT Verify Vteps Deleted
134 [Arguments] ${dpn_id_list} ${tools_ip_list}
135 [Documentation] Verify if OFT Vteps are created successfully or not for given Tools IPs and DPN-IDs.
136 ${deleted_tep_len} = BuiltIn.Get Length ${dpn_id_list}
137 ${existing_tep_len} = BuiltIn.Evaluate ${NUM_TOOLS_SYSTEM}-${deleted_tep_len}
138 BuiltIn.Run Keyword If ${existing_tep_len} > 0 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Verify Tunnel Status As Up ${existing_tep_len}
139 ${tep_show_output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW}
140 ${tep_show_state_output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE}
141 FOR ${tools_system_index} IN RANGE ${deleted_tep_len}
142 ${tep_show_state_output_1} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE}
143 BuiltIn.Should Not Contain ${tep_show_output} @{tools_ip_list}[${tools_system_index}]
144 BuiltIn.Should Not Contain ${tep_show_state_output} @{tools_ip_list}[${tools_system_index}]
145 BuiltIn.Wait Until Keyword Succeeds 60 5 Utils.No Content From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/@{dpn_id_list}[${tools_system_index}]/
146 ${dst_dpn_id_list} = BuiltIn.Create List @{DPN_ID_LIST}
147 Collections.Remove From List ${dst_dpn_id_list} ${tools_system_index}
148 BuiltIn.Wait Until Keyword Succeeds 60 5 OFT Verify Vteps Deleted at Dpn Teps State per Interface @{dpn_id_list}[${tools_system_index}] ${dst_dpn_id_list}
149 ${ovs_vsctl_output} = BuiltIn.Wait Until Keyword Succeeds 40 10 Utils.Run Command On Remote System And Log @{tools_ip_list}[${tools_system_index}]
150 ... sudo ovs-vsctl show
151 BuiltIn.Should Not Contain ${ovs_vsctl_output} remote_ip=flow
152 BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Ingress Flows Deleted per Switch @{tools_ip_list}[${tools_system_index}]
153 BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Egress Flows Deleted per Switch @{tools_ip_list}[${tools_system_index}]
156 OFT Verify Vteps Deleted at Dpn Teps State per Interface
157 [Arguments] ${src_dpn_id} ${dst_dpn_id_list}
158 [Documentation] Verify if vteps are deleted for all src-dst intf pair at dpn-teps-state in ODL for a given src intf.
159 FOR ${dst_dpn_id} IN @{dst_dpn_id_list}
160 ${status} = BuiltIn.Run Keyword And Return Status Genius.Get Tunnel ${src_dpn_id} ${dst_dpn_id} odl-interface:tunnel-type-vxlan
162 BuiltIn.Should Be True ${status} == ${False}
165 OFT OVS Verify Ingress Flows Deleted per Switch
166 [Arguments] ${tools_ip}
167 [Documentation] Verify if Ingress flow rules are deleted in OVS for a given switch.
168 ${flows_table0_output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE0}
169 BuiltIn.Should Not Contain ${flows_table0_output} tun_src=
171 OFT OVS Verify Egress Flows Deleted per Switch
172 [Arguments] ${tools_ip}
173 [Documentation] Verify if Egress flow rules are deleted in OVS for a given switch.
174 ${flows_table95_output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE95}
175 BuiltIn.Should Not Contain ${flows_table95_output} output:
177 OF Tunnels Start Suite
178 [Documentation] Start suite for OF Tunnels.
179 ClusterManagement.ClusterManagement_Setup
180 ClusterManagement.Stop_Members_From_List_Or_All
181 FOR ${controller_index} IN RANGE ${NUM_ODL_SYSTEM}
182 Run Command On Remote System And Log ${ODL_SYSTEM_${controller_index+1}_IP} sed -i -- 's/<itm-direct-tunnels>false/<itm-direct-tunnels>true/g' ${GENIUS_IFM_CONFIG_FLAG}
183 Run Command On Remote System And Log ${ODL_SYSTEM_${controller_index+1}_IP} sed -i -- 's/<use-of-tunnels>false/<use-of-tunnels>true/g' ${GENIUS_ITM_CONFIG_FLAG}
185 ClusterManagement.Start_Members_From_List_Or_All
188 OF Tunnels Stop Suite
189 [Documentation] Stop suite for OF Tunnels.
190 FOR ${controller_index} IN RANGE ${NUM_ODL_SYSTEM}
191 Run Command On Remote System And Log ${ODL_SYSTEM_${controller_index+1}_IP} sed -i -- 's/<itm-direct-tunnels>true/<itm-direct-tunnels>false/g' ${GENIUS_IFM_CONFIG_FLAG}
192 Run Command On Remote System And Log ${ODL_SYSTEM_${controller_index+1}_IP} sed -i -- 's/<use-of-tunnels>true/<use-of-tunnels>false/g' ${GENIUS_ITM_CONFIG_FLAG}
194 ClusterManagement.Stop_Members_From_List_Or_All
195 ClusterManagement.Start_Members_From_List_Or_All
196 Genius Suite Teardown