optimizing connectivity suite test case execution
[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 Tests
5 Suite Teardown    Close All Connections
6 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
7 Test Teardown     Get OvsDebugInfo
8 Library           SSHLibrary
9 Library           OperatingSystem
10 Library           RequestsLibrary
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../libraries/OpenStackOperations.robot
13 Resource          ../../../libraries/SetupUtils.robot
14 Resource          ../../../libraries/DevstackUtils.robot
15
16 *** Variables ***
17 @{NETWORKS_NAME}    network_1    network_2
18 @{SUBNETS_NAME}    subnet_1    subnet_2
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_1_VM_IPS}    50.0.0.3    50.0.0.4    50.0.0.5
22 @{NET_2_VM_IPS}    60.0.0.3    60.0.0.4    60.0.0.5
23 @{GATEWAY_IPS}    50.0.0.1    60.0.0.1
24 @{DHCP_IPS}       50.0.0.2    60.0.0.2
25 @{SUBNETS_RANGE}    50.0.0.0/24    60.0.0.0/24
26
27 *** Test Cases ***
28 Create Networks
29     [Documentation]    Create Network with neutron request.
30     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
31     \    Create Network    ${NetworkElement}
32
33 Create Subnets For network_1
34     [Documentation]    Create Sub Nets for the Networks with neutron request.
35     Create SubNet    network_1    subnet_1    @{SUBNETS_RANGE}[0]
36
37 Create Subnets For network_2
38     [Documentation]    Create Sub Nets for the Networks with neutron request.
39     Create SubNet    network_2    subnet_2    @{SUBNETS_RANGE}[1]
40
41 Create Vm Instances For network_1
42     [Documentation]    Create Four Vm instances using flavor and image names for a network.
43     Create Vm Instances    network_1    ${NET_1_VM_INSTANCES}    sg=csit
44
45 Create Vm Instances For network_2
46     [Documentation]    Create Four Vm instances using flavor and image names for a network.
47     Create Vm Instances    network_2    ${NET_2_VM_INSTANCES}    sg=csit
48
49 Check Vm Instances Have Ip Address
50     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
51     ...    We are polling first and longest on the last VM created assuming that if it's received it's address
52     ...    already the other instances should have theirs already or at least shortly thereafter.
53     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
54     # for dhcp addresses
55     : FOR    ${vm}    IN    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
56     \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
57     Wait Until Keyword Succeeds    180s    10s    Verify VMs Received DHCP Lease    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
58     [Teardown]    Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
59     ...    AND    Show Debugs    ${NET_2_VM_INSTANCES}
60     ...    AND    Get OvsDebugInfo
61
62 Create Routers
63     [Documentation]    Create Router
64     Create Router    router_1
65
66 Add Interfaces To Router
67     [Documentation]    Add Interfaces
68     : FOR    ${interface}    IN    @{SUBNETS_NAME}
69     \    Add Router Interface    router_1    ${interface}
70
71 Ping Vm Instance1 In network_2 From network_1
72     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
73     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[0]
74
75 Ping Vm Instance2 In network_2 From network_1
76     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
77     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[1]
78
79 Ping Vm Instance3 In network_2 From network_1
80     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
81     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[2]
82
83 Ping Vm Instance1 In network_1 From network_2
84     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
85     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[0]
86
87 Ping Vm Instance2 In network_1 From network_2
88     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
89     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[1]
90
91 Ping Vm Instance3 In network_1 From network_2
92     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
93     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[2]
94
95 Connectivity Tests From Vm Instance1 In network_1
96     [Documentation]    Logging to the vm instance using generated key pair.
97     ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
98     Log    ${dst_ip_list}
99     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
100     Log    ${other_dst_ip_list}
101     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
102
103 Connectivity Tests From Vm Instance2 In network_1
104     [Documentation]    Logging to the vm instance using generated key pair.
105     ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
106     Log    ${dst_ip_list}
107     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
108     Log    ${other_dst_ip_list}
109     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
110
111 Connectivity Tests From Vm Instance3 In network_1
112     [Documentation]    Logging to the vm instance using generated key pair.
113     ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
114     Log    ${dst_ip_list}
115     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
116     Log    ${other_dst_ip_list}
117     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
118
119 Connectivity Tests From Vm Instance1 In network_2
120     [Documentation]    Logging to the vm instance using generated key pair.
121     ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
122     Log    ${dst_ip_list}
123     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
124     Log    ${other_dst_ip_list}
125     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
126
127 Connectivity Tests From Vm Instance2 In network_2
128     [Documentation]    Logging to the vm instance using generated key pair.
129     ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[2]
130     Log    ${dst_ip_list}
131     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
132     Log    ${other_dst_ip_list}
133     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
134
135 Connectivity Tests From Vm Instance3 In network_2
136     [Documentation]    Logging to the vm instance using generated key pair.
137     ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]
138     Log    ${dst_ip_list}
139     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
140     Log    ${other_dst_ip_list}
141     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
142
143 Delete Vm Instances In network_1
144     [Documentation]    Delete Vm instances using instance names in network_1.
145     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
146     \    Delete Vm Instance    ${VmElement}
147
148 Delete Vm Instances In network_2
149     [Documentation]    Delete Vm instances using instance names in network_2.
150     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
151     \    Delete Vm Instance    ${VmElement}
152     [Teardown]    Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
153     ...    AND    Show Debugs    ${NET_2_VM_INSTANCES}
154     ...    AND    Get OvsDebugInfo
155
156 Delete Router Interfaces
157     [Documentation]    Remove Interface to the subnets.
158     : FOR    ${interface}    IN    @{SUBNETS_NAME}
159     \    Remove Interface    router_1    ${interface}
160
161 Delete Routers
162     [Documentation]    Delete Router and Interface to the subnets.
163     Delete Router    router_1
164
165 Delete Sub Networks In network_1
166     [Documentation]    Delete Sub Nets for the Networks with neutron request.
167     Delete SubNet    subnet_1
168
169 Delete Sub Networks In network_2
170     [Documentation]    Delete Sub Nets for the Networks with neutron request.
171     Delete SubNet    subnet_2
172
173 Delete Networks
174     [Documentation]    Delete Networks with neutron request.
175     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
176     \    Delete Network    ${NetworkElement}