Use suite teardown resource cleanup
[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     OpenStackOperations.Create Network    @{NETWORKS}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_1_VLAN_ID}
31
32 Create Subnet For net_1
33     [Documentation]    Create Sub Nets for the Networks with neutron request.
34     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
35
36 Create VXLAN Network net_2
37     [Documentation]    Create Network with neutron request.
38     OpenStackOperations.Create Network    @{NETWORKS}[1]
39
40 Create Subnet For net_2
41     [Documentation]    Create Sub Nets for the Networks with neutron request.
42     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
43
44 Add Ssh Allow All Rule
45     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
46     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
47
48 Create Vm Instances For net_1
49     [Documentation]    Create VM instances using flavor and image names for a network.
50     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
51     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
52     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
53
54 Create Vm Instances For net_2
55     [Documentation]    Create VM instances using flavor and image names for a network.
56     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
57     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
58     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
59
60 Check Vm Instances Have Ip Address
61     @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
62     @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
63     BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
64     BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
65     BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
66     BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
67     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
68     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
69     [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
70     ...    AND    OpenStackOperations.Get Test Teardown Debugs
71
72 Ping Vm Instance1 In net_1
73     [Documentation]    Check reachability of vm instances by pinging to them.
74     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
75
76 Ping Vm Instance2 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}[1]
79
80 Ping Vm Instance3 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}[2]
83
84 Ping Vm Instance1 In net_2
85     [Documentation]    Check reachability of vm instances by pinging to them.
86     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]
87
88 Ping Vm Instance2 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}[1]
91
92 Ping Vm Instance3 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}[2]
95
96 Connectivity Tests From Vm Instance1 In net_1
97     [Documentation]    Login to the vm instance and test some operations
98     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ${NET_1_VM_IPS}
99
100 Connectivity Tests From Vm Instance2 In net_1
101     [Documentation]    Login to the vm instance and test operations
102     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[1]    ${NET_1_VM_IPS}
103
104 Connectivity Tests From Vm Instance3 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}[2]    ${NET_1_VM_IPS}
107
108 Connectivity Tests From Vm Instance1 In net_2
109     [Documentation]    Login to the vm instance and test operations
110     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]    ${NET_2_VM_IPS}
111
112 Connectivity Tests From Vm Instance2 In net_2
113     [Documentation]    Logging to the vm instance using generated key pair.
114     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[1]    ${NET_2_VM_IPS}
115
116 Connectivity Tests From Vm Instance3 In net_2
117     [Documentation]    Login to the vm instance using generated key pair.
118     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]    ${NET_2_VM_IPS}
119
120 Delete A Vm Instance
121     [Documentation]    Delete Vm instances using instance names. Also remove the VM from the
122     ...    list so that later cleanup will not try to delete it.
123     OpenStackOperations.Delete Vm Instance    @{NET_1_VMS}[0]
124     Remove From List    ${NET_1_VMS}    0
125
126 No Ping For Deleted Vm
127     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
128     OpenStackOperations.Ping From DHCP Should Not Succeed    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]