Use vm instance names for Show Debugs
[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       Devstack Suite Setup Tests
4 Suite Teardown    Close All Connections
5 Test Setup        Log Testcase Start To Controller Karaf
6 Test Teardown     Run Keywords    Show Debugs    ${NET_1_VM_INSTANCES}
7 ...               AND    Show Debugs    ${NET_2_VM_INSTANCES}
8 ...               AND    Get OvsDebugInfo
9 Library           SSHLibrary
10 Library           OperatingSystem
11 Library           RequestsLibrary
12 Resource          ../../../libraries/Utils.robot
13 Resource          ../../../libraries/OpenStackOperations.robot
14 Resource          ../../../libraries/DevstackUtils.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 packets for testing
44     Create Security Group      csit    "CSIT SSH Allow"
45     Create Security Rule     ingress      tcp     1     65535     0.0.0.0/0      csit
46     Create Security Rule     egress       tcp     1     65535     0.0.0.0/0      csit
47
48 Create Vm Instances For l2_network_1
49     [Documentation]    Create Four Vm instances using flavor and image names for a network.
50     Create Vm Instances    l2_network_1    ${NET_1_VM_INSTANCES}     sg=csit
51
52 Create Vm Instances For l2_network_2
53     [Documentation]    Create Four Vm instances using flavor and image names for a network.
54     Create Vm Instances    l2_network_2    ${NET_2_VM_INSTANCES}     sg=csit
55
56 Ping Vm Instance1 In l2_network_1
57     [Documentation]    Check reachability of vm instances by pinging to them.
58     Get OvsDebugInfo
59     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[0]
60
61 Ping Vm Instance2 In l2_network_1
62     [Documentation]    Check reachability of vm instances by pinging to them.
63     Get OvsDebugInfo
64     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[1]
65
66 Ping Vm Instance3 In l2_network_1
67     [Documentation]    Check reachability of vm instances by pinging to them.
68     Get OvsDebugInfo
69     Ping Vm From DHCP Namespace    l2_network_1    @{NET_1_VM_IPS}[2]
70
71 Ping Vm Instance1 In l2_network_2
72     [Documentation]    Check reachability of vm instances by pinging to them.
73     Get OvsDebugInfo
74     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[0]
75
76 Ping Vm Instance2 In l2_network_2
77     [Documentation]    Check reachability of vm instances by pinging to them.
78     Get OvsDebugInfo
79     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[1]
80
81 Ping Vm Instance3 In l2_network_2
82     [Documentation]    Check reachability of vm instances by pinging to them.
83     Get OvsDebugInfo
84     Ping Vm From DHCP Namespace    l2_network_2    @{NET_2_VM_IPS}[2]
85
86 Connectivity Tests From Vm Instance1 In l2_network_1
87     [Documentation]    Logging to the vm instance1
88     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[1]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
89     Log    ${dst_ip_list}
90     Get OvsDebugInfo
91     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}
92
93 Connectivity Tests From Vm Instance2 In l2_network_1
94     [Documentation]    Logging to the vm instance2
95     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[2]
96     Log    ${dst_ip_list}
97     Get OvsDebugInfo
98     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}
99
100 Connectivity Tests From Vm Instance3 In l2_network_1
101     [Documentation]    Logging to the vm instance2
102     ${dst_ip_list}=    Create List    @{NET_1_VM_IPS}[0]    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]
103     Log    ${dst_ip_list}
104     Get OvsDebugInfo
105     Test Operations From Vm Instance    l2_network_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}
106
107 Connectivity Tests From Vm Instance1 In l2_network_2
108     [Documentation]    Logging to the vm instance using generated key pair.
109     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[1]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
110     Log    ${dst_ip_list}
111     Get OvsDebugInfo
112     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}
113
114 Connectivity Tests From Vm Instance2 In l2_network_2
115     [Documentation]    Logging to the vm instance using generated key pair.
116     ${dst_ip_list}=    Create List    @{NET_2_VM_IPS}[0]    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[2]
117     Log    ${dst_ip_list}
118     Get OvsDebugInfo
119     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}
120
121 Connectivity Tests From Vm Instance3 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}[1]
124     Log    ${dst_ip_list}
125     Get OvsDebugInfo
126     Test Operations From Vm Instance    l2_network_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}
127
128 Delete A Vm Instance
129     [Documentation]    Delete Vm instances using instance names.
130     Delete Vm Instance    MyFirstInstance_1
131
132 No Ping For Deleted Vm
133     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
134     Get OvsDebugInfo
135     ${output}=    Ping From DHCP Should Not Succeed    l2_network_1    @{NET_1_VM_IPS}[0]
136
137 Delete Vm Instances In l2_network_1
138     [Documentation]    Delete Vm instances using instance names in l2_network_1.
139     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
140     \    Delete Vm Instance    ${VmElement}
141
142 Delete Vm Instances In l2_network_2
143     [Documentation]    Delete Vm instances using instance names in l2_network_2.
144     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
145     \    Delete Vm Instance    ${VmElement}
146
147 Delete Sub Networks In l2_network_1
148     [Documentation]    Delete Sub Nets for the Networks with neutron request.
149     Delete SubNet    l2_subnet_1
150
151 Delete Sub Networks In l2_network_2
152     [Documentation]    Delete Sub Nets for the Networks with neutron request.
153     Delete SubNet    l2_subnet_2
154
155 Delete Networks
156     [Documentation]    Delete Networks with neutron request.
157     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
158     \    Delete Network    ${NetworkElement}