Remove SXP beryllium resources
[integration/test.git] / csit / suites / openstack / connectivity / 02_l3_tests.robot
1 *** Settings ***
2 Documentation     Test suite to check connectivity in L3 using routers.
3 Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_Teardown
4 ...               AND    DevstackUtils.Devstack Suite Setup
5 Suite Teardown    Close All Connections
6 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
7 Test Teardown     Get Test Teardown Debugs
8 Library           SSHLibrary
9 Library           OperatingSystem
10 Library           RequestsLibrary
11 Resource          ../../../libraries/DevstackUtils.robot
12 Resource          ../../../libraries/DataModels.robot
13 Resource          ../../../libraries/OpenStackOperations.robot
14 Resource          ../../../libraries/SetupUtils.robot
15 Resource          ../../../libraries/Utils.robot
16 Resource          ../../../variables/netvirt/Variables.robot
17
18 *** Variables ***
19 @{NETWORKS_NAME}    network_1    network_2    network_3
20 @{SUBNETS_NAME}    subnet_1    subnet_2    subnet_3
21 @{NET_1_VM_INSTANCES}    l3_instance_net_1_1    l3_instance_net_1_2    l3_instance_net_1_3
22 @{NET_2_VM_INSTANCES}    l3_instance_net_2_1    l3_instance_net_2_2    l3_instance_net_2_3
23 @{NET_3_VM_INSTANCES}    l3_instance_net_3_1    l3_instance_net_3_2    l3_instance_net_3_3
24 @{SUBNETS_RANGE}    50.0.0.0/24    60.0.0.0/24    70.0.0.0/24
25 ${network1_vlan_id}    1236
26
27 *** Test Cases ***
28 Create VLAN Network (network_1)
29     [Documentation]    Create Network with neutron request.
30     # in the case that the controller under test is using legacy netvirt features, vlan segmentation is not supported,
31     # and we cannot create a vlan network. If those features are installed we will instead stick with vxlan.
32     : FOR    ${feature_name}    IN    @{legacy_feature_list}
33     \    ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    ${feature_name}
34     \    Exit For Loop If    '${feature_check_status}' == 'True'
35     Run Keyword If    '${feature_check_status}' == 'True'    Create Network    @{NETWORKS_NAME}[0]
36     ...    ELSE    Create Network    @{NETWORKS_NAME}[0]    --provider:network_type=vlan --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} --provider:segmentation_id=${network1_vlan_id}
37
38 Create VXLAN Network (network_2)
39     [Documentation]    Create Network with neutron request.
40     Create Network    @{NETWORKS_NAME}[1]
41
42 Create VXLAN Network (network_3)
43     [Documentation]    Create Network with neutron request.
44     Create Network    @{NETWORKS_NAME}[2]
45
46 Create Subnets For network_1
47     [Documentation]    Create Sub Nets for the Networks with neutron request.
48     Create SubNet    @{NETWORKS_NAME}[0]    @{SUBNETS_NAME}[0]    @{SUBNETS_RANGE}[0]
49
50 Create Subnets For network_2
51     [Documentation]    Create Sub Nets for the Networks with neutron request.
52     Create SubNet    @{NETWORKS_NAME}[1]    @{SUBNETS_NAME}[1]    @{SUBNETS_RANGE}[1]
53
54 Create Subnets For network_3
55     [Documentation]    Create Sub Nets for the Networks with neutron request.
56     Create SubNet    @{NETWORKS_NAME}[2]    @{SUBNETS_NAME}[2]    @{SUBNETS_RANGE}[2]
57
58 Create Vm Instances For network_1
59     [Documentation]    Create Four Vm instances using flavor and image names for a network.
60     Create Vm Instances    network_1    ${NET_1_VM_INSTANCES}    sg=csit
61
62 Create Vm Instances For network_2
63     [Documentation]    Create Four Vm instances using flavor and image names for a network.
64     Create Vm Instances    network_2    ${NET_2_VM_INSTANCES}    sg=csit
65
66 Create Vm Instances For network_3
67     [Documentation]    Create Four Vm instances using flavor and image names for a network.
68     Create Vm Instances    network_3    ${NET_3_VM_INSTANCES}    sg=csit
69
70 Check Vm Instances Have Ip Address
71     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
72     ...    We are polling first and longest on the last VM created assuming that if it's received it's address
73     ...    already the other instances should have theirs already or at least shortly thereafter.
74     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
75     # for dhcp addresses
76     : FOR    ${vm}    IN    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
77     \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
78     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    60s    5s    Collect VM IP Addresses
79     ...    true    @{NET_1_VM_INSTANCES}
80     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    60s    5s    Collect VM IP Addresses
81     ...    true    @{NET_2_VM_INSTANCES}
82     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    60s    5s    Collect VM IP Addresses
83     ...    true    @{NET_3_VM_INSTANCES}
84     ${NET3_L3_VM_IPS}    ${NET3_DHCP_IP}    Collect VM IP Addresses    false    @{NET_3_VM_INSTANCES}
85     ${NET2_L3_VM_IPS}    ${NET2_DHCP_IP}    Collect VM IP Addresses    false    @{NET_2_VM_INSTANCES}
86     ${NET1_L3_VM_IPS}    ${NET1_DHCP_IP}    Collect VM IP Addresses    false    @{NET_1_VM_INSTANCES}
87     ${VM_INSTANCES}=    Collections.Combine Lists    ${NET_1_VM_INSTANCES}    ${NET_2_VM_INSTANCES}    ${NET_3_VM_INSTANCES}
88     ${VM_IPS}=    Collections.Combine Lists    ${NET1_L3_VM_IPS}    ${NET2_L3_VM_IPS}    ${NET3_L3_VM_IPS}
89     ${LOOP_COUNT}    Get Length    ${VM_INSTANCES}
90     : FOR    ${index}    IN RANGE    0    ${LOOP_COUNT}
91     \    ${status}    ${message}    Run Keyword And Ignore Error    Should Not Contain    @{VM_IPS}[${index}]    None
92     \    Run Keyword If    '${status}' == 'FAIL'    Write Commands Until Prompt    nova console-log @{VM_INSTANCES}[${index}]    30s
93     Set Suite Variable    ${NET1_L3_VM_IPS}
94     Set Suite Variable    ${NET1_DHCP_IP}
95     Set Suite Variable    ${NET2_L3_VM_IPS}
96     Set Suite Variable    ${NET2_DHCP_IP}
97     Set Suite Variable    ${NET3_L3_VM_IPS}
98     Set Suite Variable    ${NET3_DHCP_IP}
99     Should Not Contain    ${NET1_L3_VM_IPS}    None
100     Should Not Contain    ${NET2_L3_VM_IPS}    None
101     Should Not Contain    ${NET1_DHCP_IP}    None
102     Should Not Contain    ${NET2_DHCP_IP}    None
103     Should Not Contain    ${NET3_DHCP_IP}    None
104     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
105     ...    AND    Get Test Teardown Debugs
106
107 Create Routers
108     [Documentation]    Create Router
109     Create Router    router_1
110
111 Add Interfaces To Router
112     [Documentation]    Add Interfaces
113     : FOR    ${interface}    IN    @{SUBNETS_NAME}
114     \    Add Router Interface    router_1    ${interface}
115
116 Ping Vm Instance1 In network_2 From network_1(vxlan to vlan)
117     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
118     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[0]
119
120 Ping Vm Instance2 In network_2 From network_1(vxlan to vlan)
121     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
122     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[1]
123
124 Ping Vm Instance3 In network_2 From network_1(vxlan to vlan)
125     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
126     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[2]
127
128 Ping Vm Instance1 In network_1 From network_2(vlan to vxlan)
129     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
130     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[0]
131
132 Ping Vm Instance2 In network_1 From network_2(vlan to vxlan)
133     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
134     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[1]
135
136 Ping Vm Instance3 In network_1 From network_2(vlan to vxlan)
137     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
138     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[2]
139
140 Ping Vm Instance1 In network_3 From network_2(vxlan to vxlan)
141     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
142     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[0]
143
144 Ping Vm Instance2 In network_3 From network_2(vxlan to vxlan)
145     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
146     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[1]
147
148 Ping Vm Instance3 In network_3 From network_2(vxlan to vxlan)
149     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
150     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[2]
151
152 Connectivity Tests From Vm Instance1 In network_1
153     [Documentation]    Login to the VM instance and test operations
154     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
155     Log    ${dst_list}
156     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[0]    ${dst_list}
157
158 Connectivity Tests From Vm Instance2 In network_1
159     [Documentation]    Login to the vm instance and test operations
160     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
161     Log    ${dst_list}
162     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[1]    ${dst_list}
163
164 Connectivity Tests From Vm Instance3 In network_1
165     [Documentation]    Login to the vm instance and test operations
166     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
167     Log    ${dst_list}
168     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[2]    ${dst_list}
169
170 Connectivity Tests From Vm Instance1 In network_2
171     [Documentation]    Login to the vm instance and test operations
172     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
173     Log    ${dst_list}
174     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[0]    ${dst_list}
175
176 Connectivity Tests From Vm Instance2 In network_2
177     [Documentation]    Logging to the vm instance using generated key pair.
178     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
179     Log    ${dst_list}
180     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[1]    ${dst_list}
181
182 Connectivity Tests From Vm Instance3 In network_2
183     [Documentation]    Logging to the vm instance using generated key pair.
184     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
185     Log    ${dst_list}
186     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[2]    ${dst_list}
187
188 Delete Vm Instances In network_1
189     [Documentation]    Delete Vm instances using instance names in network_1.
190     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
191     \    Delete Vm Instance    ${VmElement}
192
193 Delete Vm Instances In network_2
194     [Documentation]    Delete Vm instances using instance names in network_2.
195     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
196     \    Delete Vm Instance    ${VmElement}
197
198 Delete Vm Instances In network_3
199     [Documentation]    Delete Vm instances using instance names in network_3.
200     : FOR    ${VmElement}    IN    @{NET_3_VM_INSTANCES}
201     \    Delete Vm Instance    ${VmElement}
202     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
203     ...    AND    Get Test Teardown Debugs
204
205 Delete Router Interfaces
206     [Documentation]    Remove Interface to the subnets.
207     : FOR    ${interface}    IN    @{SUBNETS_NAME}
208     \    Remove Interface    router_1    ${interface}
209
210 Delete Routers
211     [Documentation]    Delete Router and Interface to the subnets.
212     Delete Router    router_1
213
214 Delete Sub Networks In network_1
215     [Documentation]    Delete Sub Nets for the Networks with neutron request.
216     Delete SubNet    subnet_1
217
218 Delete Sub Networks In network_2
219     [Documentation]    Delete Sub Nets for the Networks with neutron request.
220     Delete SubNet    subnet_2
221
222 Delete Sub Networks In network_3
223     [Documentation]    Delete Sub Nets for the Networks with neutron request.
224     Delete SubNet    subnet_3
225
226 Delete Networks
227     [Documentation]    Delete Networks with neutron request.
228     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
229     \    Delete Network    ${NetworkElement}
230
231 Verify Flows Cleanup
232     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
233     Verify Flows Are Cleaned Up On All OpenStack Nodes