4ec87077a72b88217fcadb36cc38db251ca1f030
[integration/test.git] / csit / suites / openstack / connectivity / l3.robot
1 *** Settings ***
2 Documentation     Test suite to check connectivity in L3 using routers.
3 Suite Setup       OpenStackOperations.OpenStack 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 Library           SSHLibrary
8 Library           OperatingSystem
9 Library           RequestsLibrary
10 Resource          ../../../libraries/DevstackUtils.robot
11 Resource          ../../../libraries/DataModels.robot
12 Resource          ../../../libraries/OpenStackOperations.robot
13 Resource          ../../../libraries/SetupUtils.robot
14 Resource          ../../../libraries/Utils.robot
15 Resource          ../../../variables/netvirt/Variables.robot
16
17 *** Variables ***
18 ${SECURITY_GROUP}    l3_sg
19 @{NETWORKS}       l3_net_1    l3_net_2    l3_net_3
20 @{SUBNETS}        l3_sub_1    l3_sub_2    l3_sub_3
21 ${ROUTER}         l3_router
22 @{NET_1_VMS}      l3_net_1_vm_1    l3_net_1_vm_2    l3_net_1_vm_3
23 @{NET_2_VMS}      l3_net_2_vm_1    l3_net_2_vm_2    l3_net_2_vm_3
24 @{NET_3_VMS}      l3_net_3_vm_1    l3_net_3_vm_2    l3_net_3_vm_3
25 @{SUBNET_CIDRS}    31.0.0.0/24    32.0.0.0/24    33.0.0.0/24
26 ${NET_1_VLAN_ID}    1131
27
28 *** Test Cases ***
29 Create VLAN Network net_1
30     [Documentation]    Create Network with neutron request.
31     # in the case that the controller under test is using legacy netvirt features, vlan segmentation is not supported,
32     # and we cannot create a vlan network. If those features are installed we will instead stick with vxlan.
33     ${feature_check_status} =    OpenStackOperations.Is Feature Installed    ${legacy_feature_list}
34     Run Keyword If    '${feature_check_status}' == 'True'    OpenStackOperations.Create Network    @{NETWORKS}[0]
35     ...    ELSE    OpenStackOperations.Create Network    @{NETWORKS}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_1_VLAN_ID}
36
37 Create Subnet For net_1
38     [Documentation]    Create Sub Nets for the Networks with neutron request.
39     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
40
41 Create VXLAN Network net_2
42     [Documentation]    Create Network with neutron request.
43     OpenStackOperations.Create Network    @{NETWORKS}[1]
44
45 Create Subnet For net_2
46     [Documentation]    Create Sub Nets for the Networks with neutron request.
47     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
48
49 Create VXLAN Network net_3
50     [Documentation]    Create Network with neutron request.
51     OpenStackOperations.Create Network    @{NETWORKS}[2]
52
53 Create Subnet For net_3
54     [Documentation]    Create Sub Nets for the Networks with neutron request.
55     OpenStackOperations.Create SubNet    @{NETWORKS}[2]    @{SUBNETS}[2]    @{SUBNET_CIDRS}[2]
56
57 Add Ssh Allow All Rule
58     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
59     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
60
61 Create Vm Instances For net_1
62     [Documentation]    Create VM instances using flavor and image names for a network.
63     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HN}    sg=${SECURITY_GROUP}
64     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HN}    sg=${SECURITY_GROUP}
65     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HN}    sg=${SECURITY_GROUP}
66
67 Create Vm Instances For net_2
68     [Documentation]    Create VM instances using flavor and image names for a network.
69     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HN}    sg=${SECURITY_GROUP}
70     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HN}    sg=${SECURITY_GROUP}
71     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HN}    sg=${SECURITY_GROUP}
72
73 Create Vm Instances For net_3
74     [Documentation]    Create VM instances using flavor and image names for a network.
75     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[0]    ${OS_CMP1_HN}    sg=${SECURITY_GROUP}
76     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[1]    ${OS_CMP1_HN}    sg=${SECURITY_GROUP}
77     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[2]    ${OS_CMP2_HN}    sg=${SECURITY_GROUP}
78
79 Check Vm Instances Have Ip Address
80     @{NET_1_L3_VM_IPS}    ${NET_1_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
81     @{NET_2_L3_VM_IPS}    ${NET_2_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
82     @{NET_3_L3_VM_IPS}    ${NET_3_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_3_VMS}
83     BuiltIn.Set Suite Variable    @{NET_1_L3_VM_IPS}
84     BuiltIn.Set Suite Variable    @{NET_2_L3_VM_IPS}
85     BuiltIn.Set Suite Variable    @{NET_3_L3_VM_IPS}
86     BuiltIn.Should Not Contain    ${NET_1_L3_VM_IPS}    None
87     BuiltIn.Should Not Contain    ${NET_2_L3_VM_IPS}    None
88     BuiltIn.Should Not Contain    ${NET_3_L3_VM_IPS}    None
89     BuiltIn.Should Not Contain    ${NET_1_L3_DHCP_IP}    None
90     BuiltIn.Should Not Contain    ${NET_2_L3_DHCP_IP}    None
91     BuiltIn.Should Not Contain    ${NET_3_L3_DHCP_IP}    None
92     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}    @{NET_3_VMS}
93     ...    AND    OpenStackOperations.Get Test Teardown Debugs
94
95 Create Routers
96     [Documentation]    Create Router
97     OpenStackOperations.Create Router    ${ROUTER}
98
99 Add Interfaces To Router
100     [Documentation]    Add Interfaces
101     : FOR    ${interface}    IN    @{SUBNETS}
102     \    OpenStackOperations.Add Router Interface    ${ROUTER}    ${interface}
103
104 Ping Vm Instance1 In net_2 From net_1 (vxlan to vlan)
105     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
106     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[0]
107
108 Ping Vm Instance2 In net_2 From net_1 (vxlan to vlan)
109     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
110     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[1]
111
112 Ping Vm Instance3 In net_2 From net_1 (vxlan to vlan)
113     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
114     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[2]
115
116 Ping Vm Instance1 In net_1 From net_2 (vlan to vxlan)
117     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
118     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[0]
119
120 Ping Vm Instance2 In net_1 From net_2 (vlan to vxlan)
121     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
122     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[1]
123
124 Ping Vm Instance3 In net_1 From net_2 (vlan to vxlan)
125     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
126     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[2]
127
128 Ping Vm Instance1 In net_3 From net_2 (vxlan to vxlan)
129     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
130     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_3_L3_VM_IPS}[0]
131
132 Ping Vm Instance2 In net_3 From net_2 (vxlan to vxlan)
133     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
134     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_3_L3_VM_IPS}[1]
135
136 Ping Vm Instance3 In net_3 From net_2 (vxlan to vxlan)
137     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
138     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_3_L3_VM_IPS}[2]
139
140 Connectivity Tests From Vm Instance1 In net_1
141     [Documentation]    Login to the VM instance and test operations
142     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
143     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[0]    ${dst_list}
144
145 Connectivity Tests From Vm Instance2 In net_1
146     [Documentation]    Login to the vm instance and test operations
147     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
148     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[1]    ${dst_list}
149
150 Connectivity Tests From Vm Instance3 In net_1
151     [Documentation]    Login to the vm instance and test operations
152     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
153     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[2]    ${dst_list}
154
155 Connectivity Tests From Vm Instance1 In net_2
156     [Documentation]    Login to the vm instance and test operations
157     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
158     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[0]    ${dst_list}
159
160 Connectivity Tests From Vm Instance2 In net_2
161     [Documentation]    Logging to the vm instance using generated key pair.
162     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
163     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[1]    ${dst_list}
164
165 Connectivity Tests From Vm Instance3 In net_2
166     [Documentation]    Logging to the vm instance using generated key pair.
167     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
168     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[2]    ${dst_list}
169
170 Delete Vm Instances In net_1
171     [Documentation]    Delete Vm instances using instance names in net_1.
172     : FOR    ${vm}    IN    @{NET_1_VMS}
173     \    OpenStackOperations.Delete Vm Instance    ${vm}
174
175 Delete Vm Instances In net_2
176     [Documentation]    Delete Vm instances using instance names in net_2.
177     : FOR    ${vm}    IN    @{NET_2_VMS}
178     \    OpenStackOperations.Delete Vm Instance    ${vm}
179
180 Delete Vm Instances In net_3
181     [Documentation]    Delete Vm instances using instance names in net_3.
182     : FOR    ${vm}    IN    @{NET_3_VMS}
183     \    OpenStackOperations.Delete Vm Instance    ${vm}
184
185 Delete Router Interfaces
186     [Documentation]    Remove Interface to the subnets.
187     : FOR    ${interface}    IN    @{SUBNETS}
188     \    OpenStackOperations.Remove Interface    ${ROUTER}    ${interface}
189
190 Delete Router
191     [Documentation]    Delete Router and Interface to the subnets.
192     OpenStackOperations.Delete Router    ${ROUTER}
193
194 Delete Sub Network In net_1
195     [Documentation]    Delete Sub Net for the Network with neutron request.
196     OpenStackOperations.Delete SubNet    l3_sub_1
197
198 Delete Sub Network In net_2
199     [Documentation]    Delete Sub Net for the Network with neutron request.
200     OpenStackOperations.Delete SubNet    l3_sub_2
201
202 Delete Sub Network In net_3
203     [Documentation]    Delete Sub Net for the Network with neutron request.
204     OpenStackOperations.Delete SubNet    l3_sub_3
205
206 Delete Networks
207     [Documentation]    Delete Networks with neutron request.
208     : FOR    ${network}    IN    @{NETWORKS}
209     \    OpenStackOperations.Delete Network    ${network}
210
211 Delete Security Group
212     [Documentation]    Delete security group with neutron request
213     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
214
215 Verify Flows Cleanup
216     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
217     DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes