afb69d2dd109be1597acf74ee00472765db4df31
[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
104 Delete Vm Instances In net_2
105     [Documentation]    Delete Vm instances using instance names in net_2.
106     [Tags]    NON_GATE
107     : FOR    ${vm}    IN    @{NET_2_VMS}
108     \    OpenStackOperations.Delete Vm Instance    ${vm}
109
110 Delete Vm Instances In net_3
111     [Documentation]    Delete Vm instances using instance names in net_3.
112     [Tags]    NON_GATE
113     : FOR    ${vm}    IN    @{NET_3_VMS}
114     \    OpenStackOperations.Delete Vm Instance    ${vm}
115
116 Create Vm Instances For net_4
117     [Documentation]    Create VM instances using flavor and image names for a network.
118     [Tags]    NON_GATE
119     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[3]    @{NET_4_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
120
121 Create Vm Instances For net_5
122     [Documentation]    Create VM instances using flavor and image names for a network.
123     [Tags]    NON_GATE
124     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[4]    @{NET_5_VMS}[0]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
125
126 Create Router2
127     [Documentation]    Create Router
128     [Tags]    NON_GATE
129     OpenStackOperations.Create Router    @{ROUTER}[1]
130
131 Add net_4 Interfaces To Router2
132     [Documentation]    Add Interfaces
133     [Tags]    NON_GATE
134     OpenStackOperations.Add Router Interface    @{ROUTER}[1]    @{SUBNETS_2}[0]
135
136 Check Vm Instances on net_4 and net_5 Have Ip Address
137     [Tags]    NON_GATE
138     @{NET_4_L3_VM_IPS}    ${NET_4_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_4_VMS}
139     @{NET_5_L3_VM_IPS}    ${NET_5_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_5_VMS}
140     BuiltIn.Set Suite Variable    @{NET_4_L3_VM_IPS}
141     BuiltIn.Set Suite Variable    @{NET_5_L3_VM_IPS}
142     BuiltIn.Should Not Contain    ${NET_4_L3_VM_IPS}    None
143     BuiltIn.Should Not Contain    ${NET_5_L3_VM_IPS}    None
144     BuiltIn.Should Not Contain    ${NET_4_L3_DHCP_IP}    None
145     BuiltIn.Should Not Contain    ${NET_5_L3_DHCP_IP}    None
146     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_4_VMS}    @{NET_5_VMS}
147     ...    AND    OpenStackOperations.Get Test Teardown Debugs
148
149 Add net_5 Interfaces To Router2
150     [Documentation]    Add Interfaces
151     [Tags]    NON_GATE
152     OpenStackOperations.Add Router Interface    @{ROUTER}[1]    @{SUBNETS_2}[1]
153
154 Ping Vm Instance5 In net_5 From net_4 (vlan to vlan)
155     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
156     [Tags]    NON_GATE
157     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[3]    @{NET_5_L3_VM_IPS}[0]
158
159 Ping Vm Instance5 In net_4 From net_5 (vlan to vlan)
160     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
161     [Tags]    NON_GATE
162     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[4]    @{NET_4_L3_VM_IPS}[0]
163
164 Connectivity Tests From Vm Instance4 In net_5
165     [Documentation]    Check reachability of vm instance on a different network with one vlan vm in source and destination.
166     [Tags]    NON_GATE
167     ${dst_list} =    BuiltIn.Create List    @{NET_4_L3_VM_IPS}
168     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[4]    @{NET_5_L3_VM_IPS}[0]    ${dst_list}
169
170 *** Keywords ***
171 Suite Setup
172     OpenStackOperations.OpenStack Suite Setup
173     OpenStackOperations.Create Network    @{NETWORKS}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment @{NET_VLAN_ID}[0]
174     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS_1}[0]    @{SUBNET_CIDRS}[0]
175     OpenStackOperations.Create Network    @{NETWORKS}[1]
176     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS_1}[1]    @{SUBNET_CIDRS}[1]
177     OpenStackOperations.Create Network    @{NETWORKS}[2]
178     OpenStackOperations.Create SubNet    @{NETWORKS}[2]    @{SUBNETS_1}[2]    @{SUBNET_CIDRS}[2]
179     OpenStackOperations.Create Network    @{NETWORKS}[3]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment @{NET_VLAN_ID}[1]
180     OpenStackOperations.Create SubNet    @{NETWORKS}[3]    @{SUBNETS_2}[0]    @{SUBNET_CIDRS}[3]
181     OpenStackOperations.Create Network    @{NETWORKS}[4]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment @{NET_VLAN_ID}[2]
182     OpenStackOperations.Create SubNet    @{NETWORKS}[4]    @{SUBNETS_2}[1]    @{SUBNET_CIDRS}[4]
183     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
184     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
185     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
186     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
187     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
188     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
189     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
190     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
191     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
192     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[2]    @{NET_3_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
193     @{NET_1_L3_VM_IPS}    ${NET_1_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
194     @{NET_2_L3_VM_IPS}    ${NET_2_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
195     @{NET_3_L3_VM_IPS}    ${NET_3_L3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_3_VMS}
196     BuiltIn.Set Suite Variable    @{NET_1_L3_VM_IPS}
197     BuiltIn.Set Suite Variable    @{NET_2_L3_VM_IPS}
198     BuiltIn.Set Suite Variable    @{NET_3_L3_VM_IPS}
199     BuiltIn.Should Not Contain    ${NET_1_L3_VM_IPS}    None
200     BuiltIn.Should Not Contain    ${NET_2_L3_VM_IPS}    None
201     BuiltIn.Should Not Contain    ${NET_3_L3_VM_IPS}    None
202     BuiltIn.Should Not Contain    ${NET_1_L3_DHCP_IP}    None
203     BuiltIn.Should Not Contain    ${NET_2_L3_DHCP_IP}    None
204     BuiltIn.Should Not Contain    ${NET_3_L3_DHCP_IP}    None
205     OpenStackOperations.Create Router    @{ROUTER}[0]
206     : FOR    ${interface}    IN    @{SUBNETS_1}
207     \    OpenStackOperations.Add Router Interface    @{ROUTER}[0]    ${interface}
208     OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}    @{NET_3_VMS}
209     OpenStackOperations.Get Suite Debugs