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 OFT Create Vteps using Auto Tunnels @{TOOLS_SYSTEM_ALL_IPS}
32 OFT Verify Vteps Created ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
34 Delete and Verify OFT TEPs
35 [Documentation] Delete TEPs set to use OF based Tunnels and verify.
36 OFT Delete Vteps using Auto Tunnels @{TOOLS_SYSTEM_ALL_IPS}
37 OFT Verify Vteps Deleted ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
38 BuiltIn.Wait Until Keyword Succeeds 60 5 Utils.No Content From URI session ${OPERATIONAL_API}/itm-state:tunnels_state
40 Create and Verify single OFT TEPs
41 [Documentation] Create single TEPs set to use OF based Tunnels and verify.
42 ${tools_ips} = BuiltIn.Create List @{TOOLS_SYSTEM_ALL_IPS}
43 Collections.Remove From List ${tools_ips} -1
44 ${dpn_ids} = BuiltIn.CreateList @{DPN_ID_LIST}
45 Collections.Remove From List ${dpn_ids} -1
46 OFT Create Vteps using Auto Tunnels @{tools_ips}
47 OFT Verify Vteps Created ${dpn_ids} ${tools_ips}
48 OFT Create Vteps using Auto Tunnels @{TOOLS_SYSTEM_ALL_IPS}[-1]
49 OFT Verify Vteps Created ${DPN_ID_LIST} ${TOOLS_SYSTEM_ALL_IPS}
51 Delete and Verify single OFT TEPs
52 [Documentation] Delete single TEPs set to use OF based Tunnels and verify.
53 ${deleted_tools_ip_list} = BuiltIn.Create List @{TOOLS_SYSTEM_ALL_IPS}[0]
54 OFT Delete Vteps using Auto Tunnels @{deleted_tools_ip_list}
55 ${deleted_dpn_id_list} = BuiltIn.CreateList @{DPN_ID_LIST}[0]
56 OFT Verify Vteps Deleted ${deleted_dpn_id_list} ${deleted_tools_ip_list}
59 OFT Create Vteps using Auto Tunnels
60 [Arguments] @{tools_ip_list}
61 [Documentation] Create VTEPs for selected tools systems in ODL using Auto Tunnels.
62 : FOR ${tools_ip} IN @{tools_ip_list}
63 \ Utils.Run Command On Remote System And Log ${tools_ip} ${SET_LOCAL_IP}${tools_ip}
65 OFT Verify Vteps Created
66 [Arguments] ${dpn_id_list} ${tools_ip_list}
67 [Documentation] Verify if OFT VTEPs are created successfully or not for given Tools IPs and DPN-IDs.
68 ${switch_data} = BuiltIn.Create List @{dpn_id_list} @{tools_ip_list}
69 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Get ITM ${DEFAULT_TRANSPORT_ZONE} ${switch_data}
70 ${tep_show_output} = BuiltIn.Wait Until Keyword Succeeds 60 5 KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW}
71 BuiltIn.Should Contain Any ${tep_show_output} ${DEFAULT_TRANSPORT_ZONE} VXLAN @{switch_data}
72 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}
73 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Verify Response Code Of Dpn End Point Config API ${dpn_id_list}
74 ${num_switches} = BuiltIn.Get Length ${dpn_id_list}
75 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Verify Tunnel Status As Up ${num_switches}
76 BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Tunnels Created @{tools_ip_list}
77 ${tools_system_len} = BuiltIn.Get Length ${tools_ip_list}
78 : FOR ${tools_system_index} IN RANGE ${tools_system_len}
79 \ ${tun_ip_list} = BuiltIn.CreateList @{tools_ip_list}
80 \ Collections.Remove From List ${tun_ip_list} ${tools_system_index}
81 \ ${ports_output} = Utils.Run Command On Remote System And Log @{tools_ip_list}[${tools_system_index}] sudo ovs-ofctl -Oopenflow13 dump-ports-desc ${Bridge}
82 \ ${port_numbers} = String.Get Regexp Matches ${ports_output} (\\d+).of.* ${1}
83 \ BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Ingress Flows Created per Switch @{tools_ip_list}[${tools_system_index}] ${tun_ip_list}
85 \ BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Egress Flows Created per Switch @{tools_ip_list}[${tools_system_index}] ${tun_ip_list}
88 OFT OVS Verify Tunnels Created
89 [Arguments] @{tools_ip_list}
90 [Documentation] Verify if tunnels are created in OVS for selected tools systems.
91 : FOR ${tools_ip} IN @{tools_ip_list}
92 \ ${output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-vsctl show
93 \ BuiltIn.Should Contain X Times ${output} local_ip="${tools_ip}", remote_ip=flow ${1}
95 OFT OVS Verify Ingress Flows Created per Switch
96 [Arguments] ${tools_ip} ${tun_src_list} ${port_numbers}
97 [Documentation] Verify if Ingress flow rules are created in OVS for a given switch.
98 ${flows_table0_output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE0}
99 BuiltIn.Should Not Contain ${flows_table0_output} tun_src=${tools_ip},
100 : FOR ${tun_src} IN @{tun_src_list}
101 \ BuiltIn.Should Contain ${flows_table0_output} tun_src=${tun_src},
102 : FOR ${port_number} IN @{port_numbers}
103 \ BuiltIn.Should Contain ${flows_table0_output} in_port=${port_number}
105 OFT OVS Verify Egress Flows Created per Switch
106 [Arguments] ${tools_ip} ${tun_dst_list} ${port_numbers}
107 [Documentation] Verify if Egress flow rules are created in OVS for a given switch.
108 ${flows_table95_output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE95}
109 : FOR ${tun_dst} IN @{tun_dst_list}
110 \ ${tun_dst_hex} = BuiltIn.Evaluate hex(struct.unpack('!I',socket.inet_aton('${tun_dst}'))[0]) modules=socket,struct
111 \ BuiltIn.Should Contain ${flows_table95_output} load:${tun_dst_hex}->NXM_NX_TUN_IPV4_DST[]
112 : FOR ${port_number} IN @{port_numbers}
113 \ BuiltIn.Should Contain ${flows_table95_output} output:${port_number}
115 OFT Delete Vteps using Auto Tunnels
116 [Arguments] @{tools_ip_list}
117 [Documentation] Delete VTEPs for selected tools systems in ODL using Auto Tunnel.
118 : FOR ${tools_ip} IN @{tools_ip_list}
119 \ Utils.Run Command On Remote System And Log ${tools_ip} ${REMOVE_LOCAL_IP}
121 OFT Verify Vteps Deleted
122 [Arguments] ${dpn_id_list} ${tools_ip_list}
123 [Documentation] Verify if OFT Vteps are created successfully or not for given Tools IPs and DPN-IDs.
124 ${deleted_tep_len} = BuiltIn.Get Length ${dpn_id_list}
125 ${existing_tep_len} = BuiltIn.Evaluate ${NUM_TOOLS_SYSTEM}-${deleted_tep_len}
126 BuiltIn.Run Keyword If ${existing_tep_len} > 0 BuiltIn.Wait Until Keyword Succeeds 60 5 Genius.Verify Tunnel Status As Up ${existing_tep_len}
127 ${tep_show_output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW}
128 ${tep_show_state_output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE}
129 : FOR ${tools_system_index} IN RANGE ${deleted_tep_len}
130 \ ${tep_show_state_output_1} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW_STATE}
131 \ BuiltIn.Should Not Contain ${tep_show_output} @{tools_ip_list}[${tools_system_index}]
132 \ BuiltIn.Should Not Contain ${tep_show_state_output} @{tools_ip_list}[${tools_system_index}]
133 \ 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}]/
134 \ ${dst_dpn_id_list} = BuiltIn.Create List @{DPN_ID_LIST}
135 \ Collections.Remove From List ${dst_dpn_id_list} ${tools_system_index}
136 \ 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}
137 \ ${ovs_vsctl_output} = BuiltIn.Wait Until Keyword Succeeds 40 10 Utils.Run Command On Remote System And Log @{tools_ip_list}[${tools_system_index}]
138 \ ... sudo ovs-vsctl show
139 \ BuiltIn.Should Not Contain ${ovs_vsctl_output} remote_ip=flow
140 \ BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Ingress Flows Deleted per Switch @{tools_ip_list}[${tools_system_index}]
141 \ BuiltIn.Wait Until Keyword Succeeds 40 10 OFT OVS Verify Egress Flows Deleted per Switch @{tools_ip_list}[${tools_system_index}]
143 OFT Verify Vteps Deleted at Dpn Teps State per Interface
144 [Arguments] ${src_dpn_id} ${dst_dpn_id_list}
145 [Documentation] Verify if vteps are deleted for all src-dst intf pair at dpn-teps-state in ODL for a given src intf.
146 : FOR ${dst_dpn_id} IN @{dst_dpn_id_list}
147 \ ${status} = BuiltIn.Run Keyword And Return Status Genius.Get Tunnel ${src_dpn_id} ${dst_dpn_id} odl-interface:tunnel-type-vxlan
149 \ BuiltIn.Should Be True ${status} == ${False}
151 OFT OVS Verify Ingress Flows Deleted per Switch
152 [Arguments] ${tools_ip}
153 [Documentation] Verify if Ingress flow rules are deleted in OVS for a given switch.
154 ${flows_table0_output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE0}
155 BuiltIn.Should Not Contain ${flows_table0_output} tun_src=
157 OFT OVS Verify Egress Flows Deleted per Switch
158 [Arguments] ${tools_ip}
159 [Documentation] Verify if Egress flow rules are deleted in OVS for a given switch.
160 ${flows_table95_output} = Utils.Run Command On Remote System And Log ${tools_ip} sudo ovs-ofctl -OOpenFlow13 dump-flows ${Bridge} ${FLOWS_FILTER_TABLE95}
161 BuiltIn.Should Not Contain ${flows_table95_output} output:
163 OF Tunnels Start Suite
164 [Documentation] Start suite for OF Tunnels.
165 ClusterManagement.ClusterManagement_Setup
166 ClusterManagement.Stop_Members_From_List_Or_All
167 : FOR ${controller_index} IN RANGE ${NUM_ODL_SYSTEM}
168 \ 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}
169 \ 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}
170 ClusterManagement.Start_Members_From_List_Or_All
173 OF Tunnels Stop Suite
174 [Documentation] Stop suite for OF Tunnels.
175 : FOR ${controller_index} IN RANGE ${NUM_ODL_SYSTEM}
176 \ 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}
177 \ 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}
178 ClusterManagement.Stop_Members_From_List_Or_All
179 ClusterManagement.Start_Members_From_List_Or_All
180 Genius Suite Teardown