8111e0b07704a09d8eda7015fed882bc9dff3b32
[integration/test.git] / csit / suites / openstack / connectivity / l2.robot
1 *** Settings ***
2 Documentation     Test suite to verify packet flows between vm instances.
3 Suite Setup       OpenStackOperations.OpenStack 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          ../../../libraries/KarafKeywords.robot
16 Resource          ../../../variables/netvirt/Variables.robot
17
18 *** Variables ***
19 ${SECURITY_GROUP}    l2_sg
20 @{NETWORKS}       l2_net_1    l2_net_2
21 @{SUBNETS}        l2_sub_1    l2_sub_2
22 @{NET_1_VMS}      l2_net_1_vm_1    l2_net_1_vm_2    l2_net_1_vm_3
23 @{NET_2_VMS}      l2_net_2_vm_1    l2_net_2_vm_2    l2_net_2_vm_3
24 @{SUBNET_CIDRS}    21.0.0.0/24    22.0.0.0/24
25 ${NET_1_VLAN_ID}    1121
26
27 *** Test Cases ***
28 Create VLAN Network net_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     ${feature_check_status} =    OpenStackOperations.Is Feature Installed    ${legacy_feature_list}
33     BuiltIn.Run Keyword If    '${feature_check_status}' == 'True'    OpenStackOperations.Create Network    @{NETWORKS}[0]
34     ...    ELSE    OpenStackOperations.Create Network    @{NETWORKS}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_1_VLAN_ID}
35
36 Create Subnet For net_1
37     [Documentation]    Create Sub Nets for the Networks with neutron request.
38     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
39
40 Create VXLAN Network net_2
41     [Documentation]    Create Network with neutron request.
42     OpenStackOperations.Create Network    @{NETWORKS}[1]
43
44 Create Subnet For net_2
45     [Documentation]    Create Sub Nets for the Networks with neutron request.
46     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
47
48 Add Ssh Allow All Rule
49     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
50     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
51
52 Create Vm Instances For net_1
53     [Documentation]    Create VM instances using flavor and image names for a network.
54     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
55     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
56     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
57
58 Create Vm Instances For net_2
59     [Documentation]    Create VM instances using flavor and image names for a network.
60     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
61     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
62     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
63
64 Check Vm Instances Have Ip Address
65     @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
66     @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
67     BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
68     BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
69     BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
70     BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
71     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
72     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
73     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
74     ...    AND    OpenStackOperations.Get Test Teardown Debugs
75
76 Ping Vm Instance1 In net_1
77     [Documentation]    Check reachability of vm instances by pinging to them.
78     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
79
80 Ping Vm Instance2 In net_1
81     [Documentation]    Check reachability of vm instances by pinging to them.
82     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[1]
83
84 Ping Vm Instance3 In net_1
85     [Documentation]    Check reachability of vm instances by pinging to them.
86     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[2]
87
88 Ping Vm Instance1 In net_2
89     [Documentation]    Check reachability of vm instances by pinging to them.
90     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]
91
92 Ping Vm Instance2 In net_2
93     [Documentation]    Check reachability of vm instances by pinging to them.
94     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[1]
95
96 Ping Vm Instance3 In net_2
97     [Documentation]    Check reachability of vm instances by pinging to them.
98     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]
99
100 Connectivity Tests From Vm Instance1 In net_1
101     [Documentation]    Login to the vm instance and test some operations
102     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ${NET_1_VM_IPS}
103
104 Connectivity Tests From Vm Instance2 In net_1
105     [Documentation]    Login to the vm instance and test operations
106     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[1]    ${NET_1_VM_IPS}
107
108 Connectivity Tests From Vm Instance3 In net_1
109     [Documentation]    Login to the vm instance and test operations
110     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[2]    ${NET_1_VM_IPS}
111
112 Connectivity Tests From Vm Instance1 In net_2
113     [Documentation]    Login to the vm instance and test operations
114     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]    ${NET_2_VM_IPS}
115
116 Connectivity Tests From Vm Instance2 In net_2
117     [Documentation]    Logging to the vm instance using generated key pair.
118     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[1]    ${NET_2_VM_IPS}
119
120 Connectivity Tests From Vm Instance3 In net_2
121     [Documentation]    Login to the vm instance using generated key pair.
122     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]    ${NET_2_VM_IPS}
123
124 Delete A Vm Instance
125     [Documentation]    Delete Vm instances using instance names. Also remove the VM from the
126     ...    list so that later cleanup will not try to delete it.
127     OpenStackOperations.Delete Vm Instance    @{NET_1_VMS}[0]
128     Remove From List    ${NET_1_VMS}    0
129
130 No Ping For Deleted Vm
131     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
132     OpenStackOperations.Ping From DHCP Should Not Succeed    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
133
134 Delete Vm Instances In net_1
135     [Documentation]    Delete Vm instances using instance names in net_1.
136     : FOR    ${vm}    IN    @{NET_1_VMS}
137     \    OpenStackOperations.Delete Vm Instance    ${vm}
138
139 Delete Vm Instances In net_2
140     [Documentation]    Delete Vm instances using instance names in net_2.
141     : FOR    ${vm}    IN    @{NET_2_VMS}
142     \    OpenStackOperations.Delete Vm Instance    ${vm}
143
144 Delete Sub Network In net_1
145     [Documentation]    Delete Sub Net for the Networks with neutron request.
146     OpenStackOperations.Delete SubNet    @{SUBNETS}[0]
147
148 Delete Sub Network In net_2
149     [Documentation]    Delete Sub Net for the Networks with neutron request.
150     OpenStackOperations.Delete SubNet    @{SUBNETS}[1]
151
152 Delete Networks
153     [Documentation]    Delete Networks with neutron request.
154     : FOR    ${networks}    IN    @{NETWORKS}
155     \    OpenStackOperations.Delete Network    ${networks}
156
157 Delete Security Group
158     [Documentation]    Delete security group with neutron request
159     OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
160
161 Verify Flows Cleanup
162     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
163     ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    odl-vtn-manager-neutron
164     BuiltIn.Run Keyword If    '${feature_check_status}' != 'True'    DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes