Upgrade RF syntax for v3.2 compatibility
[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       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    l3_net_4    l3_net_5
20 @{SUBNETS_1}      l3_sub_1    l3_sub_2    l3_sub_3
21 @{SUBNETS_2}      l3_sub_4    l3_sub_5
22 @{ROUTER}         l3_router1    l3_router2
23 @{NET_1_VMS}      l3_net_1_vm_1    l3_net_1_vm_2    l3_net_1_vm_3
24 @{NET_2_VMS}      l3_net_2_vm_1    l3_net_2_vm_2    l3_net_2_vm_3
25 @{NET_3_VMS}      l3_net_3_vm_1    l3_net_3_vm_2    l3_net_3_vm_3
26 @{NET_4_VMS}      l3_net_4_vm_1
27 @{NET_5_VMS}      l3_net_5_vm_1
28 @{SUBNET_CIDRS}    31.0.0.0/24    32.0.0.0/24    33.0.0.0/24    34.0.0.0/24    35.0.0.0/24
29 @{NET_VLAN_ID}    1131    1132    1133
30
31 *** Test Cases ***
32 Ping Vm Instance1 In net_2 From net_1 (vxlan to vlan)
33     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
34     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[0]
35
36 Ping Vm Instance2 In net_2 From net_1 (vxlan to vlan)
37     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
38     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[1]
39
40 Ping Vm Instance3 In net_2 From net_1 (vxlan to vlan)
41     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
42     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_2_L3_VM_IPS}[2]
43
44 Ping Vm Instance1 In net_1 From net_2 (vlan to vxlan)
45     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
46     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[0]
47
48 Ping Vm Instance2 In net_1 From net_2 (vlan to vxlan)
49     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
50     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[1]
51
52 Ping Vm Instance3 In net_1 From net_2 (vlan to vxlan)
53     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
54     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_1_L3_VM_IPS}[2]
55
56 Ping Vm Instance1 In net_3 From net_2 (vxlan to vxlan)
57     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
58     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_3_L3_VM_IPS}[0]
59
60 Ping Vm Instance2 In net_3 From net_2 (vxlan to vxlan)
61     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
62     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_3_L3_VM_IPS}[1]
63
64 Ping Vm Instance3 In net_3 From net_2 (vxlan to vxlan)
65     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
66     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_3_L3_VM_IPS}[2]
67
68 Connectivity Tests From Vm Instance1 In net_1
69     [Documentation]    Login to the VM instance and test operations
70     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
71     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[0]    ${dst_list}
72
73 Connectivity Tests From Vm Instance2 In net_1
74     [Documentation]    Login to the vm instance and test operations
75     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
76     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[1]    ${dst_list}
77
78 Connectivity Tests From Vm Instance3 In net_1
79     [Documentation]    Login to the vm instance and test operations
80     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
81     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_L3_VM_IPS}[2]    ${dst_list}
82
83 Connectivity Tests From Vm Instance1 In net_2
84     [Documentation]    Login to the vm instance and test operations
85     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
86     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[0]    ${dst_list}
87
88 Connectivity Tests From Vm Instance2 In net_2
89     [Documentation]    Logging to the vm instance using generated key pair.
90     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
91     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[1]    ${dst_list}
92
93 Connectivity Tests From Vm Instance3 In net_2
94     [Documentation]    Logging to the vm instance using generated key pair.
95     ${dst_list} =    BuiltIn.Create List    @{NET_1_L3_VM_IPS}    @{NET_2_L3_VM_IPS}
96     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_L3_VM_IPS}[2]    ${dst_list}
97
98 Delete Vm Instances In net_1
99     [Documentation]    Delete Vm instances using instance names in net_1.
100     [Tags]    NON_GATE
101     FOR    ${vm}    IN    @{NET_1_VMS}
102         OpenStackOperations.Delete Vm Instance    ${vm}
103     END
104
105 Delete Vm Instances In net_2
106     [Documentation]    Delete Vm instances using instance names in net_2.
107     [Tags]    NON_GATE
108     FOR    ${vm}    IN    @{NET_2_VMS}
109         OpenStackOperations.Delete Vm Instance    ${vm}
110     END
111
112 Delete Vm Instances In net_3
113     [Documentation]    Delete Vm instances using instance names in net_3.
114     [Tags]    NON_GATE
115     FOR    ${vm}    IN    @{NET_3_VMS}
116         OpenStackOperations.Delete Vm Instance    ${vm}
117     END
118
119 Create Vm Instances For net_4
120     [Documentation]    Create VM instances using flavor and image names for a network.
121     [Tags]    NON_GATE
122     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[3]    @{NET_4_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
123
124 Create Vm Instances For net_5
125     [Documentation]    Create VM instances using flavor and image names for a network.
126     [Tags]    NON_GATE
127     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[4]    @{NET_5_VMS}[0]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
128
129 Create Router2
130     [Documentation]    Create Router
131     [Tags]    NON_GATE
132     OpenStackOperations.Create Router    @{ROUTER}[1]
133
134 Add net_4 Interfaces To Router2
135     [Documentation]    Add Interfaces
136     [Tags]    NON_GATE
137     OpenStackOperations.Add Router Interface    @{ROUTER}[1]    @{SUBNETS_2}[0]
138
139 Check Vm Instances on net_4 and net_5 Have Ip Address
140     [Tags]    NON_GATE
141     @{NET_4_L3_VM_IPS}    ${NET_4_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_4_VMS}
142     @{NET_5_L3_VM_IPS}    ${NET_5_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_5_VMS}
143     BuiltIn.Set Suite Variable    @{NET_4_L3_VM_IPS}
144     BuiltIn.Set Suite Variable    @{NET_5_L3_VM_IPS}
145     BuiltIn.Should Not Contain    ${NET_4_L3_VM_IPS}    None
146     BuiltIn.Should Not Contain    ${NET_5_L3_VM_IPS}    None
147     BuiltIn.Should Not Contain    ${NET_4_L3_DHCP_IP}    None
148     BuiltIn.Should Not Contain    ${NET_5_L3_DHCP_IP}    None
149     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_4_VMS}    @{NET_5_VMS}
150     ...    AND    OpenStackOperations.Get Test Teardown Debugs
151
152 Add net_5 Interfaces To Router2
153     [Documentation]    Add Interfaces
154     [Tags]    NON_GATE
155     OpenStackOperations.Add Router Interface    @{ROUTER}[1]    @{SUBNETS_2}[1]
156
157 Ping Vm Instance5 In net_5 From net_4 (vlan to vlan)
158     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
159     [Tags]    NON_GATE
160     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[3]    @{NET_5_L3_VM_IPS}[0]
161
162 Ping Vm Instance5 In net_4 From net_5 (vlan to vlan)
163     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
164     [Tags]    NON_GATE
165     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[4]    @{NET_4_L3_VM_IPS}[0]
166
167 Connectivity Tests From Vm Instance4 In net_5
168     [Documentation]    Check reachability of vm instance on a different network with one vlan vm in source and destination.
169     [Tags]    NON_GATE
170     ${dst_list} =    BuiltIn.Create List    @{NET_4_L3_VM_IPS}
171     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[4]    @{NET_5_L3_VM_IPS}[0]    ${dst_list}
172
173 *** Keywords ***
174 Suite Setup
175     OpenStackOperations.OpenStack Suite Setup
176     OpenStackOperations.Create Network    @{NETWORKS}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment @{NET_VLAN_ID}[0]
177     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS_1}[0]    @{SUBNET_CIDRS}[0]
178     OpenStackOperations.Create Network    @{NETWORKS}[1]
179     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS_1}[1]    @{SUBNET_CIDRS}[1]
180     OpenStackOperations.Create Network    @{NETWORKS}[2]
181     OpenStackOperations.Create SubNet    @{NETWORKS}[2]    @{SUBNETS_1}[2]    @{SUBNET_CIDRS}[2]
182     OpenStackOperations.Create Network    @{NETWORKS}[3]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment @{NET_VLAN_ID}[1]
183     OpenStackOperations.Create SubNet    @{NETWORKS}[3]    @{SUBNETS_2}[0]    @{SUBNET_CIDRS}[3]
184     OpenStackOperations.Create Network    @{NETWORKS}[4]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment @{NET_VLAN_ID}[2]
185     OpenStackOperations.Create SubNet    @{NETWORKS}[4]    @{SUBNETS_2}[1]    @{SUBNET_CIDRS}[4]
186     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
187     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
188     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
189     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
190     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
191     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
192     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
193     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
194     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
195     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
196     @{NET_1_L3_VM_IPS}    ${NET_1_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
197     @{NET_2_L3_VM_IPS}    ${NET_2_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
198     @{NET_3_L3_VM_IPS}    ${NET_3_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_3_VMS}
199     BuiltIn.Set Suite Variable    @{NET_1_L3_VM_IPS}
200     BuiltIn.Set Suite Variable    @{NET_2_L3_VM_IPS}
201     BuiltIn.Set Suite Variable    @{NET_3_L3_VM_IPS}
202     BuiltIn.Should Not Contain    ${NET_1_L3_VM_IPS}    None
203     BuiltIn.Should Not Contain    ${NET_2_L3_VM_IPS}    None
204     BuiltIn.Should Not Contain    ${NET_3_L3_VM_IPS}    None
205     BuiltIn.Should Not Contain    ${NET_1_L3_DHCP_IP}    None
206     BuiltIn.Should Not Contain    ${NET_2_L3_DHCP_IP}    None
207     BuiltIn.Should Not Contain    ${NET_3_L3_DHCP_IP}    None
208     OpenStackOperations.Create Router    @{ROUTER}[0]
209     FOR    ${interface}    IN    @{SUBNETS_1}
210         OpenStackOperations.Add Router Interface    @{ROUTER}[0]    ${interface}
211     END
212     OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}    @{NET_3_VMS}
213     OpenStackOperations.Get Suite Debugs