Add Security Rule to allow SSH and fix CSIT
[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       Devstack Suite Setup Tests
4 Suite Teardown    Close All Connections
5 Test Setup        Log Testcase Start To Controller Karaf
6 Library           SSHLibrary
7 Library           OperatingSystem
8 Library           RequestsLibrary
9 Resource          ../../../libraries/Utils.robot
10 Resource          ../../../libraries/OpenStackOperations.robot
11 Resource          ../../../libraries/DevstackUtils.robot
12
13 *** Variables ***
14 @{NETWORKS_NAME}    network_1    network_2
15 @{SUBNETS_NAME}    subnet_1    subnet_2
16 @{NET_1_VM_INSTANCES}    l3_instance_net_1_1    l3_instance_net_1_2    l3_instance_net_1_3
17 @{NET_2_VM_INSTANCES}    l3_instance_net_2_1    l3_instance_net_2_2    l3_instance_net_2_3
18 @{NET_1_VM_IPS}    50.0.0.3    50.0.0.4    50.0.0.5
19 @{NET_2_VM_IPS}    60.0.0.3    60.0.0.4    60.0.0.5
20 @{GATEWAY_IPS}    50.0.0.1    60.0.0.1
21 @{DHCP_IPS}       50.0.0.2    60.0.0.2
22 @{SUBNETS_RANGE}    50.0.0.0/24    60.0.0.0/24
23
24 *** Test Cases ***
25 Create Networks
26     [Documentation]    Create Network with neutron request.
27     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
28     \    Create Network    ${NetworkElement}
29
30 Create Subnets For network_1
31     [Documentation]    Create Sub Nets for the Networks with neutron request.
32     Create SubNet    network_1    subnet_1    @{SUBNETS_RANGE}[0]
33
34 Create Subnets For network_2
35     [Documentation]    Create Sub Nets for the Networks with neutron request.
36     Create SubNet    network_2    subnet_2    @{SUBNETS_RANGE}[1]
37
38 Create Vm Instances For network_1
39     [Documentation]    Create Four Vm instances using flavor and image names for a network.
40     Create Vm Instances    network_1    ${NET_1_VM_INSTANCES}    sg=csit
41     [Teardown]    Show Debugs    ${NET_1_VM_INSTANCES}
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     [Teardown]    Show Debugs    ${NET_2_VM_INSTANCES}
47
48 Create Routers
49     [Documentation]    Create Router
50     Create Router    router_1
51
52 Add Interfaces To Router
53     [Documentation]    Add Interfaces
54     : FOR    ${interface}    IN    @{SUBNETS_NAME}
55     \    Add Router Interface    router_1    ${interface}
56
57 Ping Vm Instance1 In network_2 From network_1
58     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
59     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[0]
60
61 Ping Vm Instance2 In network_2 From network_1
62     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
63     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[1]
64
65 Ping Vm Instance3 In network_2 From network_1
66     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
67     Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[2]
68
69 Ping Vm Instance1 In network_1 From network_2
70     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
71     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[0]
72
73 Ping Vm Instance2 In network_1 From network_2
74     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
75     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[1]
76
77 Ping Vm Instance3 In network_1 From network_2
78     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
79     Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[2]
80
81 Connectivity Tests From Vm Instance1 In network_1
82     [Documentation]    Logging to the vm instance using generated key pair.
83     ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
84     Log    ${dst_ip_list}
85     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
86     Log    ${other_dst_ip_list}
87     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
88
89 Connectivity Tests From Vm Instance2 In network_1
90     [Documentation]    Logging to the vm instance using generated key pair.
91     ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
92     Log    ${dst_ip_list}
93     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
94     Log    ${other_dst_ip_list}
95     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
96
97 Connectivity Tests From Vm Instance3 In network_1
98     [Documentation]    Logging to the vm instance using generated key pair.
99     ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
100     Log    ${dst_ip_list}
101     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
102     Log    ${other_dst_ip_list}
103     Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
104
105 Connectivity Tests From Vm Instance1 In network_2
106     [Documentation]    Logging to the vm instance using generated key pair.
107     ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
108     Log    ${dst_ip_list}
109     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
110     Log    ${other_dst_ip_list}
111     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
112
113 Connectivity Tests From Vm Instance2 In network_2
114     [Documentation]    Logging to the vm instance using generated key pair.
115     ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[2]
116     Log    ${dst_ip_list}
117     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
118     Log    ${other_dst_ip_list}
119     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
120
121 Connectivity Tests From Vm Instance3 In network_2
122     [Documentation]    Logging to the vm instance using generated key pair.
123     ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]
124     Log    ${dst_ip_list}
125     ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
126     Log    ${other_dst_ip_list}
127     Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
128
129 Delete Vm Instances In network_1
130     [Documentation]    Delete Vm instances using instance names in network_1.
131     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
132     \    Delete Vm Instance    ${VmElement}
133
134 Delete Vm Instances In network_2
135     [Documentation]    Delete Vm instances using instance names in network_2.
136     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
137     \    Delete Vm Instance    ${VmElement}
138
139 Delete Router Interfaces
140     [Documentation]    Remove Interface to the subnets.
141     : FOR    ${interface}    IN    @{SUBNETS_NAME}
142     \    Remove Interface    router_1    ${interface}
143
144 Delete Routers
145     [Documentation]    Delete Router and Interface to the subnets.
146     Delete Router    router_1
147
148 Delete Sub Networks In network_1
149     [Documentation]    Delete Sub Nets for the Networks with neutron request.
150     Delete SubNet    subnet_1
151
152 Delete Sub Networks In network_2
153     [Documentation]    Delete Sub Nets for the Networks with neutron request.
154     Delete SubNet    subnet_2
155
156 Delete Networks
157     [Documentation]    Delete Networks with neutron request.
158     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
159     \    Delete Network    ${NetworkElement}