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