optimizing connectivity suite test case execution
[integration/test.git] / csit / suites / openstack / connectivity / 01_l2_tests.robot
1 *** Settings ***
2 Documentation     Test suite to verify packet flows between vm instances.
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/DevstackUtils.robot
14 Resource          ../../../libraries/SetupUtils.robot
15
16 *** Variables ***
17 @{NETWORKS_NAME}    l2_network_1    l2_network_2
18 @{SUBNETS_NAME}    l2_subnet_1    l2_subnet_2
19 @{NET_1_VM_INSTANCES}    MyFirstInstance_1    MySecondInstance_1    MyThirdInstance_1
20 @{NET_2_VM_INSTANCES}    MyFirstInstance_2    MySecondInstance_2    MyThirdInstance_2
21 @{NET_1_VM_IPS}    30.0.0.3    30.0.0.4    30.0.0.5
22 @{NET_2_VM_IPS}    40.0.0.3    40.0.0.4    40.0.0.5
23 @{VM_IPS_NOT_DELETED}    30.0.0.4    30.0.0.5
24 @{GATEWAY_IPS}    30.0.0.1    40.0.0.1
25 @{DHCP_IPS}       30.0.0.2    40.0.0.2
26 @{SUBNETS_RANGE}    30.0.0.0/24    40.0.0.0/24
27
28 *** Test Cases ***
29 Create Networks
30     [Documentation]    Create Network with neutron request.
31     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
32     \    Create Network    ${NetworkElement}
33
34 Create Subnets For l2_network_1
35     [Documentation]    Create Sub Nets for the Networks with neutron request.
36     Create SubNet    l2_network_1    l2_subnet_1    @{SUBNETS_RANGE}[0]
37
38 Create Subnets For l2_network_2
39     [Documentation]    Create Sub Nets for the Networks with neutron request.
40     Create SubNet    l2_network_2    l2_subnet_2    @{SUBNETS_RANGE}[1]
41
42 Add Ssh Allow Rule
43     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
44     Neutron Security Group Create    csit
45     Neutron Security Group Rule Create    csit    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
46     Neutron Security Group Rule Create    csit    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
47     Neutron Security Group Rule Create    csit    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
48     Neutron Security Group Rule Create    csit    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
49     Neutron Security Group Rule Create    csit    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
50     Neutron Security Group Rule Create    csit    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
51
52 Create Vm Instances For l2_network_1
53     [Documentation]    Create Four Vm instances using flavor and image names for a network.
54     Create Vm Instances    l2_network_1    ${NET_1_VM_INSTANCES}    sg=csit
55
56 Create Vm Instances For l2_network_2
57     [Documentation]    Create Four Vm instances using flavor and image names for a network.
58     Create Vm Instances    l2_network_2    ${NET_2_VM_INSTANCES}    sg=csit
59
60 Check Vm Instances Have Ip Address
61     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
62     ...    We are polling first and longest on the last VM created assuming that if it's received it's address
63     ...    already the other instances should have theirs already or at least shortly thereafter.
64     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
65     # for dhcp addresses
66     : FOR    ${vm}    IN    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
67     \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
68     Wait Until Keyword Succeeds    180s    10s    Verify VMs Received DHCP Lease    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
69     [Teardown]    Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
70     ...    AND    Show Debugs    ${NET_2_VM_INSTANCES}
71     ...    AND    Get OvsDebugInfo
72
73 Ping Vm Instance1 In l2_network_1
74     [Documentation]    Check reachability of vm instances by pinging to them.
75     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[0]
76
77 Ping Vm Instance2 In l2_network_1
78     [Documentation]    Check reachability of vm instances by pinging to them.
79     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[1]
80
81 Ping Vm Instance3 In l2_network_1
82     [Documentation]    Check reachability of vm instances by pinging to them.
83     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[2]
84
85 Ping Vm Instance1 In l2_network_2
86     [Documentation]    Check reachability of vm instances by pinging to them.
87     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[0]
88
89 Ping Vm Instance2 In l2_network_2
90     [Documentation]    Check reachability of vm instances by pinging to them.
91     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[1]
92
93 Ping Vm Instance3 In l2_network_2
94     [Documentation]    Check reachability of vm instances by pinging to them.
95     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[2]
96
97 Connectivity Tests From Vm Instance1 In l2_network_1
98     [Documentation]    Logging to the vm instance1
99     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[1]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
100     Log    ${dst_ip_list}
101     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}
102
103 Connectivity Tests From Vm Instance2 In l2_network_1
104     [Documentation]    Logging to the vm instance2
105     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
106     Log    ${dst_ip_list}
107     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}
108
109 Connectivity Tests From Vm Instance3 In l2_network_1
110     [Documentation]    Logging to the vm instance2
111     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]
112     Log    ${dst_ip_list}
113     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}
114
115 Connectivity Tests From Vm Instance1 In l2_network_2
116     [Documentation]    Logging to the vm instance using generated key pair.
117     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[1]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
118     Log    ${dst_ip_list}
119     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}
120
121 Connectivity Tests From Vm Instance2 In l2_network_2
122     [Documentation]    Logging to the vm instance using generated key pair.
123     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
124     Log    ${dst_ip_list}
125     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}
126
127 Connectivity Tests From Vm Instance3 In l2_network_2
128     [Documentation]    Logging to the vm instance using generated key pair.
129     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[1]
130     Log    ${dst_ip_list}
131     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}
132
133 Delete A Vm Instance
134     [Documentation]    Delete Vm instances using instance names.
135     Delete Vm Instance    MyFirstInstance_1
136
137 No Ping For Deleted Vm
138     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
139     ${output}=    Ping From DHCP Should Not Succeed    l2_network_1    @{NET_1_VM_IPS}[0]
140
141 Delete Vm Instances In l2_network_1
142     [Documentation]    Delete Vm instances using instance names in l2_network_1.
143     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
144     \    Delete Vm Instance    ${VmElement}
145
146 Delete Vm Instances In l2_network_2
147     [Documentation]    Delete Vm instances using instance names in l2_network_2.
148     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
149     \    Delete Vm Instance    ${VmElement}
150     [Teardown]    Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
151     ...    AND    Show Debugs    ${NET_2_VM_INSTANCES}
152     ...    AND    Get OvsDebugInfo
153
154 Delete Sub Networks In l2_network_1
155     [Documentation]    Delete Sub Nets for the Networks with neutron request.
156     Delete SubNet    l2_subnet_1
157
158 Delete Sub Networks In l2_network_2
159     [Documentation]    Delete Sub Nets for the Networks with neutron request.
160     Delete SubNet    l2_subnet_2
161
162 Delete Networks
163     [Documentation]    Delete Networks with neutron request.
164     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
165     \    Delete Network    ${NetworkElement}