59e75b8e67e2fcfb35f3e1ff19fcd6a7329db0bf
[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 Library           SSHLibrary
5 Library           OperatingSystem
6 Library           RequestsLibrary
7 Resource          ../../../libraries/Utils.robot
8 Resource          ../../../libraries/OpenStackOperations.robot
9 Resource          ../../../libraries/DevstackUtils.robot
10
11 *** Variables ***
12 @{NETWORKS_NAME}    network_1    network_2
13 @{SUBNETS_NAME}    subnet_1    subnet_2
14 @{NET_1_VM_INSTANCES}    MyFirstInstance_1
15 @{NET_2_VM_INSTANCES}    MyFirstInstance_2
16 @{NET_1_VM_IPS}    50.0.0.3
17 @{NET_2_VM_IPS}    60.0.0.3
18 @{GATEWAY_IPS}    50.0.0.1    60.0.0.1
19 @{DHCP_IPS}    50.0.0.2    60.0.0.2
20
21 *** Test Cases ***
22 Create Networks
23     [Documentation]    Create Network with neutron request.
24     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
25     \    Create Network    ${NetworkElement}    devstack_path=/opt/stack/devstack
26
27 Create Subnets For network_1
28     [Documentation]    Create Sub Nets for the Networks with neutron request.
29     Create SubNet    network_1    subnet_1    50.0.0.0/24
30
31 Create Subnets For network_2
32     [Documentation]    Create Sub Nets for the Networks with neutron request.
33     Create SubNet    network_2    subnet_2    60.0.0.0/24
34
35 Create Vm Instances For network_1
36     [Documentation]    Create Four Vm instances using flavor and image names for a network.
37     ${net_id}=    Get Net Id    network_1
38     Create Vm Instances    ${net_id}    ${NET_1_VM_INSTANCES}
39     [Teardown]    Show Debugs      ${NET_1_VM_INSTANCES}
40
41 Create Vm Instances For network_2
42     [Documentation]    Create Four Vm instances using flavor and image names for a network.
43     ${net_id}=    Get Net Id    network_2
44     Create Vm Instances    ${net_id}    ${NET_2_VM_INSTANCES}
45     [Teardown]    Show Debugs      ${NET_2_VM_INSTANCES}
46
47 Create Routers
48     [Documentation]    Create Router
49     Create Router    router_1
50
51 Add Interfaces To Router
52     [Documentation]    Add Interfaces
53     : FOR     ${interface}    IN     @{SUBNETS_NAME}
54     \    Add Router Interface     router_1     ${interface}
55
56 Ping Vm Instance In network_2 From network_1
57     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
58     ${net_id}=    Get Net Id    network_1
59     ${output}    Ping Vm From DHCP Namespace    ${net_id}    60.0.0.3
60     Should Contain    ${output}    64 bytes
61
62 Ping Vm Instance In network_1 From network_2
63     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
64     ${net_id}=    Get Net Id    network_2
65     ${output}    Ping Vm From DHCP Namespace    ${net_id}    50.0.0.3
66     Should Contain    ${output}    64 bytes
67
68 Login to Vm Instances In network_1 Using Ssh
69     [Documentation]    Logging to the vm instance using generated key pair.
70     ${net_id}=    Get Net Id    network_1
71     Ssh Vm Instance    ${net_id}    50.0.0.3
72
73 Ping Vm Instance From Instance In network_1
74     [Documentation]    Check reachability of vm instances by pinging.
75     ${output}=    Ping From Instance    60.0.0.3
76     Should Contain    ${output}    64 bytes
77
78 Ping Dhcp Server In network_2 From Instance In network_1
79     [Documentation]    ping the dhcp server from instance.
80     ${output}=    Ping From Instance    60.0.0.2
81     Should Contain    ${output}    64 bytes
82     Close Vm Instance
83
84 Login to Vm Instances In network_2 Using Ssh
85     [Documentation]    Logging to the vm instance using generated key pair.
86     ${net_id}=    Get Net Id    network_2
87     Ssh Vm Instance    ${net_id}    60.0.0.3
88
89 Ping Vm Instance From Instance In network_2
90     [Documentation]    Check reachability of vm instances by pinging.
91     ${output}=    Ping From Instance    50.0.0.3
92     Should Contain    ${output}    64 bytes
93
94 Ping Dhcp Server In network_1 From Instance In network_2
95     [Documentation]    ping the dhcp server from instance.
96     ${output}=    Ping From Instance    50.0.0.2
97     Should Contain    ${output}    64 bytes
98     Close Vm Instance
99
100 Delete Vm Instances In network_1
101     [Documentation]    Delete Vm instances using instance names in network_1.
102     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
103     \    Delete Vm Instance    ${VmElement}
104
105 Delete Vm Instances In network_2
106     [Documentation]    Delete Vm instances using instance names in network_2.
107     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
108     \    Delete Vm Instance    ${VmElement}
109
110 Delete Router Interfaces
111     [Documentation]    Remove Interface to the subnets.
112     : FOR     ${interface}    IN     @{SUBNETS_NAME}
113     \     Remove Interface     router_1     ${interface}
114
115 Delete Routers
116     [Documentation]    Delete Router and Interface to the subnets.
117     Delete Router    router_1
118
119 Delete Sub Networks In network_1
120     [Documentation]    Delete Sub Nets for the Networks with neutron request.
121     Delete SubNet    subnet_1
122
123 Delete Sub Networks In network_2
124     [Documentation]    Delete Sub Nets for the Networks with neutron request.
125     Delete SubNet    subnet_2
126
127 Delete Networks
128     [Documentation]    Delete Networks with neutron request.
129     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
130     \    Delete Network    ${NetworkElement}