Add suite setup keywords
[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       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 Ping Vm Instance1 In net_1
29     [Documentation]    Check reachability of vm instances by pinging to them.
30     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
31
32 Ping Vm Instance2 In net_1
33     [Documentation]    Check reachability of vm instances by pinging to them.
34     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[1]
35
36 Ping Vm Instance3 In net_1
37     [Documentation]    Check reachability of vm instances by pinging to them.
38     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[2]
39
40 Ping Vm Instance1 In net_2
41     [Documentation]    Check reachability of vm instances by pinging to them.
42     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]
43
44 Ping Vm Instance2 In net_2
45     [Documentation]    Check reachability of vm instances by pinging to them.
46     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[1]
47
48 Ping Vm Instance3 In net_2
49     [Documentation]    Check reachability of vm instances by pinging to them.
50     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]
51
52 Connectivity Tests From Vm Instance1 In net_1
53     [Documentation]    Login to the vm instance and test some operations
54     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ${NET_1_VM_IPS}
55
56 Connectivity Tests From Vm Instance2 In net_1
57     [Documentation]    Login to the vm instance and test operations
58     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[1]    ${NET_1_VM_IPS}
59
60 Connectivity Tests From Vm Instance3 In net_1
61     [Documentation]    Login to the vm instance and test operations
62     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[2]    ${NET_1_VM_IPS}
63
64 Connectivity Tests From Vm Instance1 In net_2
65     [Documentation]    Login to the vm instance and test operations
66     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]    ${NET_2_VM_IPS}
67
68 Connectivity Tests From Vm Instance2 In net_2
69     [Documentation]    Logging to the vm instance using generated key pair.
70     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[1]    ${NET_2_VM_IPS}
71
72 Connectivity Tests From Vm Instance3 In net_2
73     [Documentation]    Login to the vm instance using generated key pair.
74     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]    ${NET_2_VM_IPS}
75
76 Delete A Vm Instance
77     [Documentation]    Delete Vm instances using instance names. Also remove the VM from the
78     ...    list so that later cleanup will not try to delete it.
79     OpenStackOperations.Delete Vm Instance    @{NET_1_VMS}[0]
80     Remove From List    ${NET_1_VMS}    0
81
82 No Ping For Deleted Vm
83     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
84     OpenStackOperations.Ping From DHCP Should Not Succeed    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
85
86 *** Keywords ***
87 Suite Setup
88     OpenStackOperations.OpenStack Suite Setup
89     OpenStackOperations.Create Network    @{NETWORKS}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_1_VLAN_ID}
90     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
91     OpenStackOperations.Create Network    @{NETWORKS}[1]
92     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
93     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
94     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
95     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
96     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
97     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
98     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
99     OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
100     @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
101     @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
102     BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
103     BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
104     BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
105     BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
106     BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
107     BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
108     OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
109     OpenStackOperations.Get Suite Debugs