2 Documentation Test suite for OpenFlow punt path protection for subnet route, SNAT, ARP and GARP
3 Suite Setup Suite Setup
4 Suite Teardown OpenStackOperations.OpenStack Suite Teardown
5 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Test Teardown OpenStackOperations.Get Test Teardown Debugs
7 Resource ../../../libraries/ClusterManagement.robot
8 Resource ../../../libraries/OpenStackOperations.robot
9 Resource ../../../libraries/OvsManager.robot
10 Resource ../../../libraries/OVSDB.robot
11 Resource ../../../libraries/Utils.robot
12 Resource ../../../libraries/VpnOperations.robot
13 Resource ../../../variables/Variables.robot
14 Resource ../../../variables/netvirt/Variables.robot
17 @{NETWORKS} of_punt_net_1 of_punt_net_2 of_punt_net_3
18 ${EXT_NETWORKS} of_punt_ext_net_1
19 @{PORT_LIST} of_punt_net1_port_1 of_punt_net1_port_2 of_punt_net2_port_1 of_punt_net2_port_2 of_punt_net3_port_1 of_punt_net3_port_2
20 @{EXTRA_PORTS} of_punt_net_1_port_3 of_punt_net_2_port_3
21 @{EXTRA_VMS} of_punt_net_1_vm_3 of_punt_net_2_vm_3
22 @{EXTRA_NW_IP} 11.1.1.100 22.1.1.100 12.1.1.12 13.1.1.13
23 @{VM_LIST} of_punt_net1_vm_1 of_punt_net1_vm_2 of_punt_net2_vm_1 of_punt_net2_vm_2 of_punt_net3_vm_1 of_punt_net3_vm_2
24 @{SUBNETS} of_punt_sub_1 of_punt_sub_2 of_punt_sub_3
25 ${EXT_SUBNETS} of_punt_ext_sub_1
26 @{SUBNETS_CIDR} 11.1.1.0/24 22.1.1.0/24 33.1.1.0/24
27 ${EXT_SUBNETS_CIDR} 55.1.1.0/24
28 ${EXT_SUBNETS_FIXED_IP} 55.1.1.100
29 @{VPN_ID} 4ae8cd92-48ca-49b5-94e1-b2921a261111 4ae8cd92-48ca-49b5-94e1-b2921a262222
30 @{VPN_NAME} of_punt_vpn_1 of_punt_vpn_2
31 @{ROUTERS} of_punt_router_1 of_punt_router_2
32 @{ROUTERS_ID} @{EMPTY}
34 ${SECURITY_GROUP} of_punt_sg
35 @{DCGW_RD_IRT_ERT} 11:1 22:1
36 @{L3VPN_RD_IRT_ERT} ["@{DCGW_RD_IRT_ERT}[0]"] ["@{DCGW_RD_IRT_ERT}[1]"]
37 @{FILES_PATH} ${KARAF_HOME}/etc/opendaylight/datastore/initial/config/netvirt-vpnmanager-config.xml ${KARAF_HOME}/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml ${KARAF_HOME}/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml
38 ${SNAT_ORIGINAL_TIMEOUT} 5
39 ${L3_ORIGINAL_TIMEOUT} 10
40 ${ARP_ORIGINAL_TIMEOUT} 5
41 @{ORIGINAL_TIMEOUTS} ${L3_ORIGINAL_TIMEOUT} ${SNAT_ORIGINAL_TIMEOUT} ${ARP_ORIGINAL_TIMEOUT}
42 @{OF_PUNT_TABLES} ${L3_PUNT_TABLE} ${SNAT_PUNT_TABLE} ${ARP_PUNT_TABLE} ${ARP_LEARN_TABLE}
43 @{VALID_TIMEOUTS} 20 30 100 1000 10000
51 Verify default punt timeout values and flows
52 [Documentation] Verify default time out for subnet route, SNAT and ARP in respective defualt openflow tables
53 ${snat_napt_switch_ip} = Get NAPT Switch IP From DPID @{ROUTERS}[1]
54 : FOR ${index} IN RANGE 0 3
55 \ BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} @{OF_PUNT_TABLES}[${index}]
56 \ ... True ${EMPTY} learn(table=@{OF_PUNT_TABLES}[${index}],hard_timeout=@{ORIGINAL_TIMEOUTS}[${index}]
58 Set punt timeout to zero and verify flows
59 [Documentation] Verify default flows in OVS for subnet route, SNAT and ARP after the changing the default punt timeout value to zero.
60 ... Default subnet route, SNAT and ARP should get deleted after changing default timeout value to zero
61 : FOR ${index} IN RANGE 0 3
62 \ Change Hard Timeout Value In XML File @{FILES_PATH}[${index}] @{ORIGINAL_TIMEOUTS}[${index}] ${0}
63 \ Verify Punt Values In XML File @{FILES_PATH}[${index}] ${0}
64 ClusterManagement.Stop_Members_From_List_Or_All
65 ClusterManagement.Start_Members_From_List_Or_All
66 ${snat_napt_switch_ip} = Get NAPT Switch IP From DPID @{ROUTERS}[1]
67 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Check OVS OpenFlow Connections ${OS_CMP1_IP} 2
68 : FOR ${index} IN RANGE 0 3
69 \ OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} @{OF_PUNT_TABLES}[${index}] False ${EMPTY} learn(table=@{OF_PUNT_TABLES}[${index}],hard_timeout=@{ORIGINAL_TIMEOUTS}[${index}]
71 Set punt timeout to combination of valid ranges and verfiy flows
72 [Documentation] Verify the default flow in OVS for subnet route, SNAT and ARP after the changing the default value to different set of values.
73 ... Default subnet route, SNAT and ARP flows should get changed after changing default timeout value to different set of values
74 Set Original TimeOut In Xml ${0}
75 : FOR ${index} IN RANGE 0 3
76 \ Change Hard Timeout Value In XML File @{FILES_PATH}[${index}] @{ORIGINAL_TIMEOUTS}[${index}] @{VALID_TIMEOUTS}[0]
77 \ Verify Punt Values In XML File @{FILES_PATH}[${index}] @{VALID_TIMEOUTS}[0]
78 ${count} = BuiltIn.Get length ${VALID_TIMEOUTS}
79 : FOR ${index} IN RANGE 1 ${count}
80 \ Change Hard Timeout Value In XML File @{FILES_PATH}[0] @{VALID_TIMEOUTS}[${index - 1}] @{VALID_TIMEOUTS}[${index}]
81 \ Verify Punt Values In XML File @{FILES_PATH}[0] @{VALID_TIMEOUTS}[${index}]
82 \ Change Hard Timeout Value In XML File @{FILES_PATH}[1] @{VALID_TIMEOUTS}[${index - 1}] @{VALID_TIMEOUTS}[${index}]
83 \ Verify Punt Values In XML File @{FILES_PATH}[1] @{VALID_TIMEOUTS}[${index}]
84 \ Change Hard Timeout Value In XML File @{FILES_PATH}[2] @{VALID_TIMEOUTS}[${index - 1}] @{VALID_TIMEOUTS}[${index}]
85 \ Verify Punt Values In XML File @{FILES_PATH}[2] @{VALID_TIMEOUTS}[${index}]
86 \ ClusterManagement.Stop_Members_From_List_Or_All
87 \ ClusterManagement.Start_Members_From_List_Or_All
88 \ BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Check OVS OpenFlow Connections ${OS_CMP1_IP} 2
89 \ ${snat_napt_switch_ip} = Get NAPT Switch IP From DPID @{ROUTERS}[1]
90 \ BuiltIn.Wait Until Keyword Succeeds 120s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_COMPUTE_1_IP} ${L3_PUNT_TABLE}
91 \ ... True ${EMPTY} learn(table=${L3_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[${index}]
92 \ BuiltIn.Wait Until Keyword Succeeds 120s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_COMPUTE_1_IP} ${ARP_PUNT_TABLE}
93 \ ... True ${EMPTY} learn(table=${ARP_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[${index}]
94 \ BuiltIn.Wait Until Keyword Succeeds 180s 5s OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} ${SNAT_PUNT_TABLE}
95 \ ... True ${EMPTY} learn(table=${SNAT_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[${index}]
96 Set Original TimeOut In Xml @{VALID_TIMEOUTS}[4]
98 Verify learnt flow for subnet route flow table
99 [Documentation] Get default subnet table packet count before sending traffic to unkwon destination.
100 ... Send subnet route traffic using Ping with packet count 5.
101 ... Punt the first packet to controller and add new rule to stop pipeline processing.
102 ... Check packet count before and after traffic for both(defualt and learnt tables).
103 : FOR ${index} IN RANGE 0 3
104 \ Change Hard Timeout Value In XML File @{FILES_PATH}[${index}] @{ORIGINAL_TIMEOUTS}[${index}] @{VALID_TIMEOUTS}[0]
105 \ Verify Punt Values In XML File @{FILES_PATH}[${index}] @{VALID_TIMEOUTS}[0]
106 ClusterManagement.Stop_Members_From_List_Or_All
107 ClusterManagement.Start_Members_From_List_Or_All
108 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Check OVS OpenFlow Connections ${OS_CMP1_IP} 2
109 ${count_before_traffic} = OvsManager.Get Packet Count From Table ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} table=${L3_PUNT_TABLE}, |grep "ip actions=CONTROLLER:65535,learn(table=${L3_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
110 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{VM_IPS}[0] sudo ping -c 5 @{EXTRA_NW_IP}[1]
111 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${L3_PUNT_TABLE} True ${EMPTY} nw_dst=@{EXTRA_NW_IP}[1] actions=drop
112 ${learnt_packet_count} OvsManager.Get Packet Count From Table ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} table=${L3_PUNT_TABLE}, |grep "nw_dst=@{EXTRA_NW_IP}[1] actions=drop"
113 BuiltIn.Should be true ${learnt_packet_count} > 1
114 ${count_after_traffic} OvsManager.Get Packet Count From Table ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} table=${L3_PUNT_TABLE}, |grep "ip actions=CONTROLLER:65535,learn(table=${L3_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
115 ${count_before_traffic} = BuiltIn.Evaluate ${count_before_traffic} + 1
116 BuiltIn.Should be true ${count_after_traffic} == ${count_before_traffic}
118 Verify learnt flow for UDP in SNAT flow table
119 [Documentation] Get default SNAT table packet count before sending traffic to unkwon destination.
120 ... Send UDP traffic using traceroute with packet count 4.
121 ... Punt the first packet to controller and add new rule to stop pipeline processing.
122 ... Check packet count before and after traffic for both(defualt and learnt tables).
123 ${compute_ip} Get NAPT Switch IP From DPID @{ROUTERS}[1]
124 OVSDB.Verify Dump Flows For Specific Table ${compute_ip} ${SNAT_PUNT_TABLE} @{VALID_TIMEOUTS}[0]
125 ${count_before_traffic} = OvsManager.Get Packet Count From Table ${compute_ip} ${INTEGRATION_BRIDGE} table=${SNAT_PUNT_TABLE} |grep "table=46.*n_packets=[\0-9+].*udp.*learn(table=46"
126 BuiltIn.Should be true ${count_before_traffic} == 0
127 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[2] @{VM_IPS}[4] traceroute @{EXTRA_NW_IP}[2] -w 1 -q 1 -m 4
128 OVSDB.Verify Dump Flows For Specific Table ${compute_ip} ${SNAT_PUNT_TABLE} True ${EMPTY} tp_dst=${UDP_PORT} actions=drop
129 ${count_after_traffic} = OvsManager.Get Packet Count From Table ${compute_ip} ${INTEGRATION_BRIDGE} table=${SNAT_PUNT_TABLE} |grep "table=46.*n_packets=[\0-9+].*udp.*learn(table=46"
130 ${count_before_traffic} = BuiltIn.Evaluate ${count_before_traffic} + 1
131 BuiltIn.Should be true ${count_after_traffic} == ${count_before_traffic}
132 OVSDB.Verify Dump Flows For Specific Table ${compute_ip} ${SNAT_PUNT_TABLE} True ${EMPTY} actions=set_field:${EXT_SUBNETS_FIXED_IP}->ip_src
133 ${controller_packet_count} = OvsManager.Get Packet Count From Table ${compute_ip} ${INTEGRATION_BRIDGE} table=${SNAT_PUNT_TABLE} |grep "table=46.*n_packets=[\0-9+].*udp.*nw_src=@{VM_IPS}[4].*actions=set_field:${EXT_SUBNETS_FIXED_IP}.*goto_table:47"
134 BuiltIn.Should be true ${controller_packet_count} > 1
136 Verify learnt flow for TCP in SNAT flow table
137 [Documentation] Get default SNAT table packet count before sending traffic to unkwon destination.
138 ... Send TCP traffic using wget.
139 ... Punt the first packet to controller and add new rule to stop pipeline processing.
140 ... Check packet count before and after traffic for both(defualt and learnt tables).
141 ${compute_ip} Get NAPT Switch IP From DPID @{ROUTERS}[1]
142 OVSDB.Verify Dump Flows For Specific Table ${compute_ip} ${SNAT_PUNT_TABLE} @{VALID_TIMEOUTS}[0]
143 ${count_before_traffic} = OvsManager.Get Packet Count From Table ${compute_ip} ${INTEGRATION_BRIDGE} table=${SNAT_PUNT_TABLE} |grep "table=46.*n_packets=[\0-9+].*tcp.*learn(table=46"
144 BuiltIn.Should be true ${count_before_traffic} == 0
145 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[2] @{VM_IPS}[4] wget -qc http://@{EXTRA_NW_IP}[2]/ &
146 OVSDB.Verify Dump Flows For Specific Table ${compute_ip} ${SNAT_PUNT_TABLE} True ${EMPTY} tp_dst=${TCP_PORT} actions=drop
147 ${count_after_traffic} = OvsManager.Get Packet Count From Table ${compute_ip} ${INTEGRATION_BRIDGE} table=${SNAT_PUNT_TABLE} |grep "table=46.*n_packets=[\0-9+].*tcp.*learn(table=46"
148 ${count_before_traffic} = BuiltIn.Evaluate ${count_before_traffic} + 1
149 BuiltIn.Should be true ${count_after_traffic} == ${count_before_traffic}
150 OVSDB.Verify Dump Flows For Specific Table ${compute_ip} ${SNAT_PUNT_TABLE} True ${EMPTY} actions=set_field:${EXT_SUBNETS_FIXED_IP}->ip_src
151 ${controller_packet_count} = OvsManager.Get Packet Count From Table ${compute_ip} ${INTEGRATION_BRIDGE} table=${SNAT_PUNT_TABLE} |grep "table=46.*n_packets=[\0-9+].*tcp.*nw_src=@{VM_IPS}[4].*actions=set_field:${EXT_SUBNETS_FIXED_IP}.*goto_table:47"
152 BuiltIn.Should be true ${controller_packet_count} > 1
154 Verify learnt flow for ARP request in ARP tables
155 [Documentation] Get default ARP table packet count before sending traffic to unkwon destination.
156 ... Send ARP request traffic using arping.
157 ... Punt the first packet to controller and add new rule to stop pipeline processing.
158 ... Check packet count before and after traffic for both(defualt and learnt tables).
159 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP2_IP} ${ARP_PUNT_TABLE} @{VALID_TIMEOUTS}[0]
160 ${count_before_traffic} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "arp actions=CONTROLLER:65535,learn(table=${ARP_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
161 ${count_before_traffic_arp} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ELAN_BASETABLE} |grep "n_packets=[\0-9+].*reg4=${ARP_REG}.0xffff"
162 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[1] @{VM_IPS}[3] sudo arping -c 5 -I eth0 22.1.1.101
163 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP2_IP} ${ARP_PUNT_TABLE} True ${EMPTY} arp_tpa=22.1.1.101,arp_op=1
164 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP2_IP} ${ARP_LEARN_TABLE} True ${EMPTY} arp_spa=22.1.1.101,arp_op=1
165 ${count_after_traffic} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "arp actions=CONTROLLER:65535,learn(table=${ARP_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
166 BuiltIn.Should be true ${count_after_traffic} > ${count_before_traffic}
167 ${learnt_packet_count} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "n_packets=[\0-9+].*arp_tpa=22.1.1.101,arp_op=1.*actions=load:0x1"
168 BuiltIn.Should be true ${learnt_packet_count} > 0
169 ${count_after_traffic_arp} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ELAN_BASETABLE} |grep "n_packets=[\0-9+].*reg4=${ARP_REG}.0xffff"
170 BuiltIn.Should be true ${count_after_traffic_arp} > ${count_before_traffic_arp}
172 Verify learnt flow for ARP reply in ARP tables
173 [Documentation] Get default ARP table packet count before sending traffic to unkwon destination.
174 ... Send ARP reply traffic using arping.
175 ... Punt the first packet to controller and add new rule to stop pipeline processing.
176 ... Check packet count before and after traffic for both(defualt and learnt tables).
177 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP2_IP} ${ARP_PUNT_TABLE} @{VALID_TIMEOUTS}[0]
178 ${count_before_traffic} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "arp actions=CONTROLLER:65535,learn(table=${ARP_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
179 ${count_before_traffic_arp} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ELAN_BASETABLE} |grep "n_packets=[\0-9+].*reg4=${ARP_REG}.0xffff"
180 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{VM_IPS}[1] sudo arping -A -c 5 -I eth0 -s @{VM_IPS}[1] 11.1.1.101
181 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP2_IP} ${ARP_PUNT_TABLE} True ${EMPTY} arp_tpa=11.1.1.101,arp_op=2
182 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP2_IP} ${ARP_LEARN_TABLE} True ${EMPTY} arp_spa=11.1.1.101,arp_op=2
183 ${count_after_traffic} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "arp actions=CONTROLLER:65535,learn(table=${ARP_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
184 BuiltIn.Should be true ${count_after_traffic} > ${count_before_traffic}
185 ${learnt_packet_count} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "n_packets=[\0-9+].*arp_tpa=11.1.1.101,arp_op=2.*actions=load:0x1"
186 BuiltIn.Should be true ${learnt_packet_count} > 0
187 ${count_after_traffic_arp} = OvsManager.Get Packet Count From Table ${OS_CMP2_IP} ${INTEGRATION_BRIDGE} table=${ELAN_BASETABLE} |grep "n_packets=[\0-9+].*reg4=${ARP_REG}.0xffff"
188 BuiltIn.Should be true ${count_after_traffic_arp} > ${count_before_traffic_arp}
190 Verify learnt flow for GARP (Gratuitous ARP) in ARP tables
191 [Documentation] Get default ARP table packet count before sending traffic to unkwon destination.
192 ... Send GARP traffic using arping.
193 ... Punt the first packet to controller and add new rule to stop pipeline processing.
194 ... Check packet count before and after traffic for both(defualt and learnt tables).
195 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_PUNT_TABLE} @{VALID_TIMEOUTS}[0]
196 ${count_before_traffic} = OvsManager.Get Packet Count From Table ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "arp actions=CONTROLLER:65535,learn(table=${ARP_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
197 ${count_before_traffic_arp} = OvsManager.Get Packet Count From Table ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} table=${ELAN_BASETABLE} |grep "n_packets=[\0-9+].*reg4=${GARP_REG}.0xffff"
198 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{VM_IPS}[0] sudo arping -U -c 5 -I eth0 @{VM_IPS}[0] &
199 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_PUNT_TABLE} True ${EMPTY} arp_tpa=@{VM_IPS}[0],arp_op=1
200 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_LEARN_TABLE} True ${EMPTY} arp_spa=@{VM_IPS}[0],arp_op=1
201 ${count_after_traffic} = OvsManager.Get Packet Count From Table ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "arp actions=CONTROLLER:65535,learn(table=${ARP_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]"
202 BuiltIn.Should be true ${count_after_traffic} > ${count_before_traffic}
203 ${learnt_packet_count} = OvsManager.Get Packet Count From Table ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} table=${ARP_PUNT_TABLE} |grep "arp_tpa=@{VM_IPS}[0],arp_op=1"
204 BuiltIn.Should be true ${learnt_packet_count} > 0
205 ${count_after_traffic_arp} = OvsManager.Get Packet Count From Table ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} table=${ELAN_BASETABLE} |grep "n_packets=[\0-9+].*reg4=${GARP_REG}.0xffff"
206 BuiltIn.Should be true ${count_after_traffic_arp} > ${count_before_traffic_arp}
208 Verify resync subnet route, SNAT and ARP route flow tables after disconnect and reconnecting OVS control path
209 [Documentation] Verify learnt subnet route, SNAT and ARP flows.
210 ... Delete OVS manager and controller and verify learnt flows for subnet, SNAT and ARP.
211 ... Set OVS manager and controoler again and verify learnt flows for subnet, SNAT and ARP.
212 ... Verify subnet, SNAT and ARP default flows
213 ${snat_napt_switch_ip} = Get NAPT Switch IP From DPID @{ROUTERS}[1]
214 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Check OVS OpenFlow Connections ${OS_CMP1_IP} 2
215 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{VM_IPS}[0] sudo ping -c 5 @{EXTRA_NW_IP}[1]
216 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${L3_PUNT_TABLE} True ${EMPTY} nw_dst=11.1.1.255 actions=drop
217 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${L3_PUNT_TABLE} True ${EMPTY} nw_dst=@{EXTRA_NW_IP}[1] actions=drop
218 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[2] @{VM_IPS}[4] traceroute @{EXTRA_NW_IP}[2] -w 1 -q 1 -m 4
219 OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} ${SNAT_PUNT_TABLE} True ${EMPTY} tp_dst=${UDP_PORT} actions=drop
220 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[2] @{VM_IPS}[4] wget -qc http://@{EXTRA_NW_IP}[2]/ &
221 OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} ${SNAT_PUNT_TABLE} True ${EMPTY} tp_dst=${TCP_PORT} actions=drop
222 OpenStackOperations.Execute Command on VM Instance @{NETWORKS}[0] @{VM_IPS}[0] sudo arping -c 2 @{VM_IPS}[1]
223 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_PUNT_TABLE} True ${EMPTY} arp_tpa=@{VM_IPS}[1],arp_op=1
224 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_LEARN_TABLE} True ${EMPTY} arp_spa=@{VM_IPS}[1],arp_op=1
225 OVSDB.Delete OVS Manager ${OS_CMP1_IP}
226 OVSDB.Delete OVS Controller ${OS_CMP1_IP}
227 OVSDB.Delete OVS Manager ${snat_napt_switch_ip}
228 OVSDB.Delete OVS Controller ${snat_napt_switch_ip}
229 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${L3_PUNT_TABLE} False ${EMPTY} nw_dst=11.1.1.255 actions=drop
230 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${L3_PUNT_TABLE} False ${EMPTY} nw_dst=@{EXTRA_NW_IP}[1] actions=drop
231 OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} ${SNAT_PUNT_TABLE} False ${EMPTY} nw_dst=11.1.1.255 actions=drop
232 OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} ${SNAT_PUNT_TABLE} False ${EMPTY} tp_dst=${TCP_PORT} actions=drop
233 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_PUNT_TABLE} False ${EMPTY} arp_tpa=@{VM_IPS}[1],arp_op=1
234 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_LEARN_TABLE} False ${EMPTY} arp_spa=@{VM_IPS}[1],arp_op=1
235 OVSDB.Set Controller In OVS Bridge ${OS_CMP1_IP} ${INTEGRATION_BRIDGE} tcp:${ODL_SYSTEM_IP}:6653
236 OVSDB.Set Controller In OVS Bridge ${snat_napt_switch_ip} ${INTEGRATION_BRIDGE} tcp:${ODL_SYSTEM_IP}:6653
237 OVSDB.Add Multiple Managers to OVS ${OS_CMP1_IP}
238 OVSDB.Add Multiple Managers to OVS ${snat_napt_switch_ip}
239 ${snat_napt_switch_ip} = Get NAPT Switch IP From DPID @{ROUTERS}[1]
240 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Check OVS OpenFlow Connections ${OS_CMP1_IP} 2
241 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${L3_PUNT_TABLE} True
242 ... ${EMPTY} nw_dst=11.1.1.255 actions=drop
243 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} ${SNAT_PUNT_TABLE} False
244 ... ${EMPTY} tp_dst=${UDP_PORT} actions=drop
245 BuiltIn.Wait Until Keyword Succeeds 190s 40s OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} ${SNAT_PUNT_TABLE} False
246 ... ${EMPTY} tp_dst=${TCP_PORT} actions=drop
247 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_PUNT_TABLE} False
248 ... ${EMPTY} arp_tpa=@{EXTRA_NW_IP}[1],arp_op=1
249 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_LEARN_TABLE} False
250 ... ${EMPTY} arp_spa=@{EXTRA_NW_IP}[1],arp_op=1
251 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${L3_PUNT_TABLE} True ${EMPTY} learn(table=${L3_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]
252 OVSDB.Verify Dump Flows For Specific Table ${snat_napt_switch_ip} ${SNAT_PUNT_TABLE} True ${EMPTY} learn(table=${SNAT_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]
253 OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${ARP_PUNT_TABLE} True ${EMPTY} learn(table=${ARP_PUNT_TABLE},hard_timeout=@{VALID_TIMEOUTS}[0]
257 [Documentation] Create common setup related to openflow punt path protection
258 VpnOperations.Basic Suite Setup
259 : FOR ${network} IN @{NETWORKS}
260 \ OpenStackOperations.Create Network ${network}
261 OpenStackOperations.Create Network ${EXT_NETWORKS} additional_args=--external --provider-network-type gre
262 ${elements} = BuiltIn.Create List ${EXT_NETWORKS}
263 ${count} = BuiltIn.Get length ${SUBNETS}
264 : FOR ${index} IN RANGE 0 ${count}
265 \ OpenStackOperations.Create SubNet @{NETWORKS}[${index}] @{SUBNETS}[${index}] @{SUBNETS_CIDR}[${index}]
266 OpenStackOperations.Create SubNet ${EXT_NETWORKS} ${EXT_SUBNETS} ${EXT_SUBNETS_CIDR} additional_args=--no-dhcp
267 : FOR ${router} IN @{ROUTERS}
268 \ OpenStackOperations.Create Router ${router}
269 \ ${router_id} = OpenStackOperations.Get Router Id ${router}
270 \ Collections.Append To List ${ROUTERS_ID} ${router_id}
271 BuiltIn.Set Suite Variable @{ROUTERS_ID}
272 : FOR ${index} IN RANGE 0 2
273 \ OpenStackOperations.Add Router Interface @{ROUTERS}[0] @{SUBNETS}[${index}]
274 OpenStackOperations.Add Router Interface @{ROUTERS}[1] @{SUBNETS}[2]
275 OpenStackOperations.Create And Configure Security Group ${SECURITY_GROUP}
276 ${ext_net} = BuiltIn.Create List ${EXT_NETWORKS}
277 ${NETWORKS_ALL} = Collections.Combine Lists ${NETWORKS} ${ext_net}
278 : FOR ${index} IN RANGE 0 3
279 \ OpenStackOperations.Create Port @{NETWORKS_ALL}[${index}] @{PORT_LIST}[${index + ${index}}] sg=${SECURITY_GROUP}
280 \ OpenStackOperations.Create Port @{NETWORKS_ALL}[${index}] @{PORT_LIST}[${index + ${index + 1}}] sg=${SECURITY_GROUP}
281 OpenStackOperations.Create Port @{NETWORKS}[0] @{EXTRA_PORTS}[0] sg=${SECURITY_GROUP} additional_args=--allowed-address ip-address=0.0.0.0 --fixed-ip subnet=@{SUBNETS}[0],ip-address=@{EXTRA_NW_IP}[0]
282 OpenStackOperations.Create Port @{NETWORKS}[1] @{EXTRA_PORTS}[1] sg=${SECURITY_GROUP} additional_args=--allowed-address ip-address=0.0.0.0 --fixed-ip subnet=@{SUBNETS}[1],ip-address=@{EXTRA_NW_IP}[1]
283 : FOR ${index} IN RANGE 0 3
284 \ OpenStackOperations.Create Vm Instance With Port On Compute Node @{PORT_LIST}[${index + ${index}}] @{VM_LIST}[${index + ${index}}] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP}
285 \ OpenStackOperations.Create Vm Instance With Port On Compute Node @{PORT_LIST}[${index + ${index + 1}}] @{VM_LIST}[${index + ${index + 1}}] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP}
286 @{VM_IPS} ${dhcp_ip} = OpenStackOperations.Get VM IPs @{VM_LIST}
287 BuiltIn.Set Suite Variable ${VM_IPS}
288 OpenStackOperations.Show Debugs @{VM_LIST}
289 BuiltIn.Should Not Contain ${VM_IPS} None
290 BuiltIn.Should Not Contain ${dhcp_ip} None
291 : FOR ${index} IN RANGE 0 2
292 \ VpnOperations.VPN Create L3VPN name=@{VPN_NAME}[${index}] vpnid=@{VPN_ID}[${index}] rd=@{L3VPN_RD_IRT_ERT}[${index}] exportrt=@{L3VPN_RD_IRT_ERT}[${index}] importrt=@{L3VPN_RD_IRT_ERT}[${index}]
293 VpnOperations.Associate VPN to Router routerid=@{ROUTERS_ID}[0] vpnid=@{VPN_ID}[0]
294 ${network_id} = OpenStackOperations.Get Net Id ${EXT_NETWORKS}
295 VpnOperations.Associate L3VPN To Network networkid=${network_id} vpnid=@{VPN_ID}[1]
296 OpenStackOperations.Add Router Gateway @{ROUTERS}[1] ${EXT_NETWORKS} additional_args=--fixed-ip subnet=${EXT_SUBNETS},ip-address=${EXT_SUBNETS_FIXED_IP} --enable-snat
297 Create Dictionary For DPN ID And Compute IP Mapping For All DPNS
298 OpenStackOperations.Get Suite Debugs
300 Set Original TimeOut In Xml
301 [Arguments] ${hard_timeout}
302 [Documentation] Set default timeout in XML for all the punt files
303 : FOR ${index} IN RANGE 0 3
304 \ Change Hard Timeout Value In XML File @{FILES_PATH}[${index}] ${hard_timeout} @{ORIGINAL_TIMEOUTS}[${index}]
305 \ Verify Punt Values In XML File @{FILES_PATH}[${index}] @{ORIGINAL_TIMEOUTS}[${index}]
306 ClusterManagement.Stop_Members_From_List_Or_All
307 ClusterManagement.Start_Members_From_List_Or_All
308 BuiltIn.Wait Until Keyword Succeeds 120s 20s OVSDB.Check OVS OpenFlow Connections ${OS_CMP1_IP} 2
310 Verify Punt Values In XML File
311 [Arguments] ${file_path} ${value}
312 [Documentation] Verify the default value for SNAT, ARP in ELAN, Subnet Routing in the xml file in ODL Controller
313 ${output} = Utils.Run Command On Remote System And Log ${ODL_SYSTEM_IP} cat ${file_path} | grep punt-timeout
314 @{matches} = BuiltIn.Should Match Regexp ${output} punt.timeout.*?([0-9]+)
315 BuiltIn.Should be true @{matches}[1] == ${value}
317 Change Hard Timeout Value In XML File
318 [Arguments] ${file_path} ${value_1} ${value_2}
319 [Documentation] Change the default value in xml in the ODL controller for subnet route, SNAT and ARP
320 Utils.Run Command On Remote System And Log ${ODL_SYSTEM_IP} sed -i -e 's/punt-timeout\>${value_1}/punt-timeout\>${value_2}/' ${file_path}
322 Create Dictionary For DPN ID And Compute IP Mapping For All DPNS
323 [Documentation] Creating dictionary for DPN ID and compute IP mapping
324 : FOR ${ip} IN @{OS_ALL_IPS}
325 \ ${dpnid} OVSDB.Get DPID ${ip}
326 \ Collections.Append To List ${DPN_IDS} ${dpnid}
327 ${DPN_TO_COMPUTE_IP} = BuiltIn.Create Dictionary
328 ${count} = BuiltIn.Get length ${OS_ALL_IPS}
329 : FOR ${index} IN RANGE 0 ${count}
330 \ Collections.Set To Dictionary ${DPN_TO_COMPUTE_IP} @{DPN_IDS}[${index}] @{OS_ALL_IPS}[${index}]
331 : FOR ${dp_id} IN @{DPN_IDS}
332 \ Collections.Dictionary Should Contain Key ${DPN_TO_COMPUTE_IP} ${dp_id}
333 BuiltIn.Set Suite Variable ${DPN_TO_COMPUTE_IP}
335 Get SNAT NAPT Switch DPID
336 [Arguments] ${router_name}
337 [Documentation] Returns the SNAT NAPT switch dpnid from odl rest call.
338 ${router_id} = OpenStackOperations.Get Router Id ${router_name}
339 ${resp} RequestsLibrary.Get Request session ${CONFIG_API}/odl-nat:napt-switches/router-to-napt-switch/${router_id}
341 @{matches} = BuiltIn.Should Match Regexp ${resp.content} switch.id.*?([0-9]+)
342 ${dpnid} = BuiltIn.Convert To Integer @{matches}[1]
345 Get NAPT Switch IP From DPID
346 [Arguments] ${router_name}
347 [Documentation] Return SNAT NAPT switch ip for the given router name
348 ${dpnid} = BuiltIn.Wait Until Keyword Succeeds 60s 15s Get SNAT NAPT Switch DPID ${router_name}
349 ${compute_ip} = Collections.Get From Dictionary ${DPN_TO_COMPUTE_IP} ${dpnid}
350 [Return] ${compute_ip}