Modify Clustering Tests in line with the KW changes
[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     Run Keywords    Get OvsDebugInfo
8 ...               AND    Get Model Dump    ${ODL_SYSTEM_IP}
9 Library           SSHLibrary
10 Library           OperatingSystem
11 Library           RequestsLibrary
12 Resource          ../../../libraries/DevstackUtils.robot
13 Resource          ../../../libraries/Netvirt.robot
14 Resource          ../../../libraries/OpenStackOperations.robot
15 Resource          ../../../libraries/SetupUtils.robot
16 Resource          ../../../libraries/Utils.robot
17
18 *** Variables ***
19 @{NETWORKS_NAME}    network_1    network_2
20 @{SUBNETS_NAME}    subnet_1    subnet_2
21 @{NET_1_VM_INSTANCES}    l3_instance_net_1_1    l3_instance_net_1_2    l3_instance_net_1_3
22 @{NET_2_VM_INSTANCES}    l3_instance_net_2_1    l3_instance_net_2_2    l3_instance_net_2_3
23 @{SUBNETS_RANGE}    50.0.0.0/24    60.0.0.0/24
24
25 *** Test Cases ***
26 Create Networks
27     [Documentation]    Create Network with neutron request.
28     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
29     \    Create Network    ${NetworkElement}
30
31 Create Subnets For network_1
32     [Documentation]    Create Sub Nets for the Networks with neutron request.
33     Create SubNet    network_1    subnet_1    @{SUBNETS_RANGE}[0]
34
35 Create Subnets For network_2
36     [Documentation]    Create Sub Nets for the Networks with neutron request.
37     Create SubNet    network_2    subnet_2    @{SUBNETS_RANGE}[1]
38
39 Create Vm Instances For network_1
40     [Documentation]    Create Four Vm instances using flavor and image names for a network.
41     Create Vm Instances    network_1    ${NET_1_VM_INSTANCES}    sg=csit
42
43 Create Vm Instances For network_2
44     [Documentation]    Create Four Vm instances using flavor and image names for a network.
45     Create Vm Instances    network_2    ${NET_2_VM_INSTANCES}    sg=csit
46
47 Check Vm Instances Have Ip Address
48     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
49     ...    We are polling first and longest on the last VM created assuming that if it's received it's address
50     ...    already the other instances should have theirs already or at least shortly thereafter.
51     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
52     # for dhcp addresses
53     : FOR    ${vm}    IN    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
54     \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
55     ${NET1_VM_COUNT}    Get Length    ${NET_1_VM_INSTANCES}
56     ${NET2_VM_COUNT}    Get Length    ${NET_2_VM_INSTANCES}
57     ${LOOP_COUNT}    Evaluate    ${NET1_VM_COUNT}+${NET2_VM_COUNT}
58     : FOR    ${index}    IN RANGE    1    ${LOOP_COUNT}
59     \    ${NET1_L3_VM_IPS}    ${NET1_DHCP_IP}    Verify VMs Received DHCP Lease    @{NET_1_VM_INSTANCES}
60     \    ${NET2_L3_VM_IPS}    ${NET2_DHCP_IP}    Verify VMs Received DHCP Lease    @{NET_2_VM_INSTANCES}
61     \    ${NET1_VM_LIST_LENGTH}=    Get Length    ${NET1_L3_VM_IPS}
62     \    ${NET2_VM_LIST_LENGTH}=    Get Length    ${NET2_L3_VM_IPS}
63     \    Exit For Loop If    ${NET1_VM_LIST_LENGTH}==${NET1_VM_COUNT} and ${NET2_VM_LIST_LENGTH}==${NET2_VM_COUNT}
64     Set Suite Variable    ${NET1_L3_VM_IPS}
65     Set Suite Variable    ${NET1_DHCP_IP}
66     Set Suite Variable    ${NET2_L3_VM_IPS}
67     Set Suite Variable    ${NET2_DHCP_IP}
68     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
69     ...    AND    Get OvsDebugInfo
70     ...    AND    Get Model Dump    ${ODL_SYSTEM_IP}
71
72 Create Routers
73     [Documentation]    Create Router
74     Create Router    router_1
75
76 Add Interfaces To Router
77     [Documentation]    Add Interfaces
78     : FOR    ${interface}    IN    @{SUBNETS_NAME}
79     \    Add Router Interface    router_1    ${interface}
80
81 Ping Vm Instance1 In network_2 From network_1
82     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
83     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[0]
84
85 Ping Vm Instance2 In network_2 From network_1
86     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
87     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[1]
88
89 Ping Vm Instance3 In network_2 From network_1
90     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
91     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[2]
92
93 Ping Vm Instance1 In network_1 From network_2
94     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
95     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[0]
96
97 Ping Vm Instance2 In network_1 From network_2
98     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
99     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[1]
100
101 Ping Vm Instance3 In network_1 From network_2
102     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
103     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[2]
104
105 Connectivity Tests From Vm Instance1 In network_1
106     [Documentation]    Login to the VM instance and test operations
107     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
108     Log    ${dst_list}
109     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[0]    ${dst_list}
110
111 Connectivity Tests From Vm Instance2 In network_1
112     [Documentation]    Login to the vm instance and test operations
113     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
114     Log    ${dst_list}
115     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[1]    ${dst_list}
116
117 Connectivity Tests From Vm Instance3 In network_1
118     [Documentation]    Login to the vm instance and test operations
119     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
120     Log    ${dst_list}
121     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[2]    ${dst_list}
122
123 Connectivity Tests From Vm Instance1 In network_2
124     [Documentation]    Login to the vm instance and test operations
125     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
126     Log    ${dst_list}
127     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[0]    ${dst_list}
128
129 Connectivity Tests From Vm Instance2 In network_2
130     [Documentation]    Logging to the vm instance using generated key pair.
131     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
132     Log    ${dst_list}
133     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[1]    ${dst_list}
134
135 Connectivity Tests From Vm Instance3 In network_2
136     [Documentation]    Logging to the vm instance using generated key pair.
137     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
138     Log    ${dst_list}
139     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[2]    ${dst_list}
140
141 Delete Vm Instances In network_1
142     [Documentation]    Delete Vm instances using instance names in network_1.
143     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
144     \    Delete Vm Instance    ${VmElement}
145
146 Delete Vm Instances In network_2
147     [Documentation]    Delete Vm instances using instance names in network_2.
148     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
149     \    Delete Vm Instance    ${VmElement}
150     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
151     ...    AND    Get OvsDebugInfo
152     ...    AND    Get Model Dump    ${ODL_SYSTEM_IP}
153
154 Delete Router Interfaces
155     [Documentation]    Remove Interface to the subnets.
156     : FOR    ${interface}    IN    @{SUBNETS_NAME}
157     \    Remove Interface    router_1    ${interface}
158
159 Delete Routers
160     [Documentation]    Delete Router and Interface to the subnets.
161     Delete Router    router_1
162
163 Delete Sub Networks In network_1
164     [Documentation]    Delete Sub Nets for the Networks with neutron request.
165     Delete SubNet    subnet_1
166
167 Delete Sub Networks In network_2
168     [Documentation]    Delete Sub Nets for the Networks with neutron request.
169     Delete SubNet    subnet_2
170
171 Delete Networks
172     [Documentation]    Delete Networks with neutron request.
173     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
174     \    Delete Network    ${NetworkElement}