Reduce logging in collect ips
[integration/test.git] / csit / suites / openstack / connectivity / 02_l3_tests.robot
1 *** Settings ***
2 Documentation     Test suite to check connectivity in L3 using routers.
3 Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_Teardown
4 ...               AND    DevstackUtils.Devstack Suite Setup
5 Suite Teardown    Close All Connections
6 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
7 Test Teardown     Get Test Teardown Debugs
8 Library           SSHLibrary
9 Library           OperatingSystem
10 Library           RequestsLibrary
11 Resource          ../../../libraries/DevstackUtils.robot
12 Resource          ../../../libraries/DataModels.robot
13 Resource          ../../../libraries/OpenStackOperations.robot
14 Resource          ../../../libraries/SetupUtils.robot
15 Resource          ../../../libraries/Utils.robot
16 Resource          ../../../variables/netvirt/Variables.robot
17
18 *** Variables ***
19 ${SECURITY_GROUP}    sg-connectivity
20 @{NETWORKS_NAME}    network_1    network_2    network_3
21 @{SUBNETS_NAME}    subnet_1    subnet_2    subnet_3
22 @{NET_1_VM_INSTANCES}    l3_net_1_vm_1    l3_net_1_vm_2    l3_net_1_vm_3
23 @{NET_2_VM_INSTANCES}    l3_net_2_vm_1    l3_net_2_vm_2    l3_net_2_vm_3
24 @{NET_3_VM_INSTANCES}    l3_net_3_vm_1    l3_net_3_vm_2    l3_net_3_vm_3
25 @{SUBNETS_RANGE}    50.0.0.0/24    60.0.0.0/24    70.0.0.0/24
26 ${network1_vlan_id}    1236
27
28 *** Test Cases ***
29 Create VLAN Network (network_1)
30     [Documentation]    Create Network with neutron request.
31     # in the case that the controller under test is using legacy netvirt features, vlan segmentation is not supported,
32     # and we cannot create a vlan network. If those features are installed we will instead stick with vxlan.
33     : FOR    ${feature_name}    IN    @{legacy_feature_list}
34     \    ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    ${feature_name}
35     \    Exit For Loop If    '${feature_check_status}' == 'True'
36     Run Keyword If    '${feature_check_status}' == 'True'    Create Network    @{NETWORKS_NAME}[0]
37     ...    ELSE    Create Network    @{NETWORKS_NAME}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${network1_vlan_id}
38
39 Create VXLAN Network (network_2)
40     [Documentation]    Create Network with neutron request.
41     Create Network    @{NETWORKS_NAME}[1]
42
43 Create VXLAN Network (network_3)
44     [Documentation]    Create Network with neutron request.
45     Create Network    @{NETWORKS_NAME}[2]
46
47 Create Subnets For network_1
48     [Documentation]    Create Sub Nets for the Networks with neutron request.
49     Create SubNet    @{NETWORKS_NAME}[0]    @{SUBNETS_NAME}[0]    @{SUBNETS_RANGE}[0]
50
51 Create Subnets For network_2
52     [Documentation]    Create Sub Nets for the Networks with neutron request.
53     Create SubNet    @{NETWORKS_NAME}[1]    @{SUBNETS_NAME}[1]    @{SUBNETS_RANGE}[1]
54
55 Create Subnets For network_3
56     [Documentation]    Create Sub Nets for the Networks with neutron request.
57     Create SubNet    @{NETWORKS_NAME}[2]    @{SUBNETS_NAME}[2]    @{SUBNETS_RANGE}[2]
58
59 Create Vm Instances For network_1
60     [Documentation]    Create Four Vm instances using flavor and image names for a network.
61     Create Vm Instances    network_1    ${NET_1_VM_INSTANCES}    sg=${SECURITY_GROUP}
62
63 Create Vm Instances For network_2
64     [Documentation]    Create Four Vm instances using flavor and image names for a network.
65     Create Vm Instances    network_2    ${NET_2_VM_INSTANCES}    sg=${SECURITY_GROUP}
66
67 Create Vm Instances For network_3
68     [Documentation]    Create Four Vm instances using flavor and image names for a network.
69     Create Vm Instances    network_3    ${NET_3_VM_INSTANCES}    sg=${SECURITY_GROUP}
70
71 Check Vm Instances Have Ip Address
72     @{NET1_L3_VM_IPS}    ${NET1_L3_DHCP_IP} =    Get VM IPs    @{NET_1_VM_INSTANCES}
73     @{NET2_L3_VM_IPS}    ${NET2_L3_DHCP_IP} =    Get VM IPs    @{NET_2_VM_INSTANCES}
74     @{NET3_L3_VM_IPS}    ${NET3_L3_DHCP_IP} =    Get VM IPs    @{NET_3_VM_INSTANCES}
75     Set Suite Variable    ${NET1_L3_VM_IPS}
76     Set Suite Variable    ${NET2_L3_VM_IPS}
77     Set Suite Variable    ${NET3_L3_VM_IPS}
78     Should Not Contain    ${NET1_L3_VM_IPS}    None
79     Should Not Contain    ${NET2_L3_VM_IPS}    None
80     Should Not Contain    ${NET3_L3_VM_IPS}    None
81     Should Not Contain    ${NET1_L3_DHCP_IP}    None
82     Should Not Contain    ${NET2_L3_DHCP_IP}    None
83     Should Not Contain    ${NET3_L3_DHCP_IP}    None
84     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
85     ...    AND    Get Test Teardown Debugs
86
87 Create Routers
88     [Documentation]    Create Router
89     Create Router    router_1
90
91 Add Interfaces To Router
92     [Documentation]    Add Interfaces
93     : FOR    ${interface}    IN    @{SUBNETS_NAME}
94     \    Add Router Interface    router_1    ${interface}
95
96 Ping Vm Instance1 In network_2 From network_1(vxlan to vlan)
97     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
98     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[0]
99
100 Ping Vm Instance2 In network_2 From network_1(vxlan to vlan)
101     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
102     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[1]
103
104 Ping Vm Instance3 In network_2 From network_1(vxlan to vlan)
105     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
106     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[2]
107
108 Ping Vm Instance1 In network_1 From network_2(vlan to vxlan)
109     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
110     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[0]
111
112 Ping Vm Instance2 In network_1 From network_2(vlan to vxlan)
113     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
114     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[1]
115
116 Ping Vm Instance3 In network_1 From network_2(vlan to vxlan)
117     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
118     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[2]
119
120 Ping Vm Instance1 In network_3 From network_2(vxlan to vxlan)
121     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
122     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[0]
123
124 Ping Vm Instance2 In network_3 From network_2(vxlan to vxlan)
125     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
126     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[1]
127
128 Ping Vm Instance3 In network_3 From network_2(vxlan to vxlan)
129     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
130     Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[2]
131
132 Connectivity Tests From Vm Instance1 In network_1
133     [Documentation]    Login to the VM instance and test operations
134     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
135     Log    ${dst_list}
136     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[0]    ${dst_list}
137
138 Connectivity Tests From Vm Instance2 In network_1
139     [Documentation]    Login to the vm instance and test operations
140     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
141     Log    ${dst_list}
142     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[1]    ${dst_list}
143
144 Connectivity Tests From Vm Instance3 In network_1
145     [Documentation]    Login to the vm instance and test operations
146     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
147     Log    ${dst_list}
148     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[2]    ${dst_list}
149
150 Connectivity Tests From Vm Instance1 In network_2
151     [Documentation]    Login to the vm instance and test operations
152     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
153     Log    ${dst_list}
154     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[0]    ${dst_list}
155
156 Connectivity Tests From Vm Instance2 In network_2
157     [Documentation]    Logging to the vm instance using generated key pair.
158     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
159     Log    ${dst_list}
160     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[1]    ${dst_list}
161
162 Connectivity Tests From Vm Instance3 In network_2
163     [Documentation]    Logging to the vm instance using generated key pair.
164     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
165     Log    ${dst_list}
166     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[2]    ${dst_list}
167
168 Delete Vm Instances In network_1
169     [Documentation]    Delete Vm instances using instance names in network_1.
170     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
171     \    Delete Vm Instance    ${VmElement}
172
173 Delete Vm Instances In network_2
174     [Documentation]    Delete Vm instances using instance names in network_2.
175     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
176     \    Delete Vm Instance    ${VmElement}
177
178 Delete Vm Instances In network_3
179     [Documentation]    Delete Vm instances using instance names in network_3.
180     : FOR    ${VmElement}    IN    @{NET_3_VM_INSTANCES}
181     \    Delete Vm Instance    ${VmElement}
182     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
183     ...    AND    Get Test Teardown Debugs
184
185 Delete Router Interfaces
186     [Documentation]    Remove Interface to the subnets.
187     : FOR    ${interface}    IN    @{SUBNETS_NAME}
188     \    Remove Interface    router_1    ${interface}
189
190 Delete Routers
191     [Documentation]    Delete Router and Interface to the subnets.
192     Delete Router    router_1
193
194 Delete Sub Networks In network_1
195     [Documentation]    Delete Sub Nets for the Networks with neutron request.
196     Delete SubNet    subnet_1
197
198 Delete Sub Networks In network_2
199     [Documentation]    Delete Sub Nets for the Networks with neutron request.
200     Delete SubNet    subnet_2
201
202 Delete Sub Networks In network_3
203     [Documentation]    Delete Sub Nets for the Networks with neutron request.
204     Delete SubNet    subnet_3
205
206 Delete Networks
207     [Documentation]    Delete Networks with neutron request.
208     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
209     \    Delete Network    ${NetworkElement}
210
211 Verify Flows Cleanup
212     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
213     Verify Flows Are Cleaned Up On All OpenStack Nodes