Add csit runs with vlan provider
[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/OpenStackOperations.robot
13 Resource          ../../../libraries/SetupUtils.robot
14 Resource          ../../../libraries/Utils.robot
15
16 *** Variables ***
17 @{NETWORKS_NAME}    network_1    network_2    network_3
18 @{SUBNETS_NAME}    subnet_1    subnet_2    subnet_3
19 @{NET_1_VM_INSTANCES}    l3_instance_net_1_1    l3_instance_net_1_2    l3_instance_net_1_3
20 @{NET_2_VM_INSTANCES}    l3_instance_net_2_1    l3_instance_net_2_2    l3_instance_net_2_3
21 @{NET_3_VM_INSTANCES}    l3_instance_net_3_1    l3_instance_net_3_2    l3_instance_net_3_3
22 @{SUBNETS_RANGE}    50.0.0.0/24    60.0.0.0/24    70.0.0.0/24
23 ${network1_vlan_id}    1236
24
25 *** Test Cases ***
26 Create VLAN Network (network_1)
27     [Documentation]    Create Network with neutron request.
28     Create Network    @{NETWORKS_NAME}[0]    --provider:network_type=vlan --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} --provider:segmentation_id=${network1_vlan_id}
29
30 Create VXLAN Network (network_2)
31     [Documentation]    Create Network with neutron request.
32     Create Network    @{NETWORKS_NAME}[1]
33
34 Create VXLAN Network (network_3)
35     [Documentation]    Create Network with neutron request.
36     Create Network    @{NETWORKS_NAME}[2]
37
38 Create Subnets For network_1
39     [Documentation]    Create Sub Nets for the Networks with neutron request.
40     Create SubNet    @{NETWORKS_NAME}[0]    @{SUBNETS_NAME}[0]    @{SUBNETS_RANGE}[0]
41
42 Create Subnets For network_2
43     [Documentation]    Create Sub Nets for the Networks with neutron request.
44     Create SubNet    @{NETWORKS_NAME}[1]    @{SUBNETS_NAME}[1]    @{SUBNETS_RANGE}[1]
45
46 Create Subnets For network_3
47     [Documentation]    Create Sub Nets for the Networks with neutron request.
48     Create SubNet    @{NETWORKS_NAME}[2]    @{SUBNETS_NAME}[2]    @{SUBNETS_RANGE}[2]
49
50 Create Vm Instances For network_1
51     [Documentation]    Create Four Vm instances using flavor and image names for a network.
52     Create Vm Instances    network_1    ${NET_1_VM_INSTANCES}    sg=csit
53
54 Create Vm Instances For network_2
55     [Documentation]    Create Four Vm instances using flavor and image names for a network.
56     Create Vm Instances    network_2    ${NET_2_VM_INSTANCES}    sg=csit
57
58 Create Vm Instances For network_3
59     [Documentation]    Create Four Vm instances using flavor and image names for a network.
60     Create Vm Instances    network_3    ${NET_3_VM_INSTANCES}    sg=csit
61
62 Check Vm Instances Have Ip Address
63     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
64     ...    We are polling first and longest on the last VM created assuming that if it's received it's address
65     ...    already the other instances should have theirs already or at least shortly thereafter.
66     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
67     # for dhcp addresses
68     : FOR    ${vm}    IN    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
69     \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
70     : FOR    ${index}    IN RANGE    1    5
71     \    ${NET1_L3_VM_IPS}    ${NET1_DHCP_IP}    Verify VMs Received DHCP Lease    @{NET_1_VM_INSTANCES}
72     \    ${NET2_L3_VM_IPS}    ${NET2_DHCP_IP}    Verify VMs Received DHCP Lease    @{NET_2_VM_INSTANCES}
73     \    ${NET3_L3_VM_IPS}    ${NET3_DHCP_IP}    Verify VMs Received DHCP Lease    @{NET_3_VM_INSTANCES}
74     \    ${VM_IPS}=    Collections.Combine Lists    ${NET1_L3_VM_IPS}    ${NET2_L3_VM_IPS}    ${NET3_L3_VM_IPS}    ${NET1_DHCP_IP}
75     \    ...    ${NET2_DHCP_IP}    ${NET3_DHCP_IP}
76     \    ${status}    ${message}    Run Keyword And Ignore Error    List Should Not Contain Value    ${VM_IPS}    None
77     \    Exit For Loop If    '${status}' == 'PASS'
78     \    BuiltIn.Sleep    5s
79     : FOR    ${vm}    IN    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
80     \    Write Commands Until Prompt    nova console-log ${vm}    30s
81     Set Suite Variable    ${NET1_L3_VM_IPS}
82     Set Suite Variable    ${NET1_DHCP_IP}
83     Set Suite Variable    ${NET2_L3_VM_IPS}
84     Set Suite Variable    ${NET2_DHCP_IP}
85     Set Suite Variable    ${NET3_L3_VM_IPS}
86     Set Suite Variable    ${NET3_DHCP_IP}
87     Should Not Contain    ${NET1_L3_VM_IPS}    None
88     Should Not Contain    ${NET2_L3_VM_IPS}    None
89     Should Not Contain    ${NET1_DHCP_IP}    None
90     Should Not Contain    ${NET2_DHCP_IP}    None
91     Should Not Contain    ${NET3_DHCP_IP}    None
92     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
93     ...    AND    Get Test Teardown Debugs
94
95 Create Routers
96     [Documentation]    Create Router
97     Create Router    router_1
98
99 Add Interfaces To Router
100     [Documentation]    Add Interfaces
101     : FOR    ${interface}    IN    @{SUBNETS_NAME}
102     \    Add Router Interface    router_1    ${interface}
103
104 Ping Vm Instance1 In network_2 From network_1(vxlan to vlan)
105     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
106     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[0]
107
108 Ping Vm Instance2 In network_2 From network_1(vxlan to vlan)
109     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
110     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[1]
111
112 Ping Vm Instance3 In network_2 From network_1(vxlan to vlan)
113     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
114     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[2]
115
116 Ping Vm Instance1 In network_1 From network_2(vlan to vxlan)
117     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
118     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[0]
119
120 Ping Vm Instance2 In network_1 From network_2(vlan to vxlan)
121     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
122     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[1]
123
124 Ping Vm Instance3 In network_1 From network_2(vlan to vxlan)
125     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
126     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[2]
127
128 Ping Vm Instance1 In network_3 From network_2(vxlan to vxlan)
129     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
130     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[0]
131
132 Ping Vm Instance2 In network_3 From network_2(vxlan to vxlan)
133     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
134     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[1]
135
136 Ping Vm Instance3 In network_3 From network_2(vxlan to vxlan)
137     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
138     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[2]
139
140 Connectivity Tests From Vm Instance1 In network_1
141     [Documentation]    Login to the VM instance and test operations
142     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
143     Log    ${dst_list}
144     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[0]    ${dst_list}
145
146 Connectivity Tests From Vm Instance2 In network_1
147     [Documentation]    Login to the vm instance and test operations
148     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
149     Log    ${dst_list}
150     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[1]    ${dst_list}
151
152 Connectivity Tests From Vm Instance3 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}[2]    ${dst_list}
157
158 Connectivity Tests From Vm Instance1 In network_2
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_2    @{NET2_L3_VM_IPS}[0]    ${dst_list}
163
164 Connectivity Tests From Vm Instance2 In network_2
165     [Documentation]    Logging to the vm instance using generated key pair.
166     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
167     Log    ${dst_list}
168     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[1]    ${dst_list}
169
170 Connectivity Tests From Vm Instance3 In network_2
171     [Documentation]    Logging to the vm instance using generated key pair.
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}[2]    ${dst_list}
175
176 Delete Vm Instances In network_1
177     [Documentation]    Delete Vm instances using instance names in network_1.
178     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
179     \    Delete Vm Instance    ${VmElement}
180
181 Delete Vm Instances In network_2
182     [Documentation]    Delete Vm instances using instance names in network_2.
183     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
184     \    Delete Vm Instance    ${VmElement}
185
186 Delete Vm Instances In network_3
187     [Documentation]    Delete Vm instances using instance names in network_3.
188     : FOR    ${VmElement}    IN    @{NET_3_VM_INSTANCES}
189     \    Delete Vm Instance    ${VmElement}
190     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
191     ...    AND    Get Test Teardown Debugs
192
193 Delete Router Interfaces
194     [Documentation]    Remove Interface to the subnets.
195     : FOR    ${interface}    IN    @{SUBNETS_NAME}
196     \    Remove Interface    router_1    ${interface}
197
198 Delete Routers
199     [Documentation]    Delete Router and Interface to the subnets.
200     Delete Router    router_1
201
202 Delete Sub Networks In network_1
203     [Documentation]    Delete Sub Nets for the Networks with neutron request.
204     Delete SubNet    subnet_1
205
206 Delete Sub Networks In network_2
207     [Documentation]    Delete Sub Nets for the Networks with neutron request.
208     Delete SubNet    subnet_2
209
210 Delete Sub Networks In network_3
211     [Documentation]    Delete Sub Nets for the Networks with neutron request.
212     Delete SubNet    subnet_3
213
214 Delete Networks
215     [Documentation]    Delete Networks with neutron request.
216     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
217     \    Delete Network    ${NetworkElement}