adding model dump in new netvirt specific robot library
[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_L3_VM_IPS}    ${NET1_DHCP_IP}    Wait Until Keyword Succeeds    180s    10s    Verify VMs Received DHCP Lease    @{NET_1_VM_INSTANCES}
56     ${NET2_L3_VM_IPS}    ${NET2_DHCP_IP}    Wait Until Keyword Succeeds    180s    10s    Verify VMs Received DHCP Lease    @{NET_2_VM_INSTANCES}
57     Set Suite Variable    ${NET1_L3_VM_IPS}
58     Set Suite Variable    ${NET1_DHCP_IP}
59     Set Suite Variable    ${NET2_L3_VM_IPS}
60     Set Suite Variable    ${NET2_DHCP_IP}
61     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
62     ...    AND    Get OvsDebugInfo
63     ...    AND    Get Model Dump    ${ODL_SYSTEM_IP}
64
65 Create Routers
66     [Documentation]    Create Router
67     Create Router    router_1
68
69 Add Interfaces To Router
70     [Documentation]    Add Interfaces
71     : FOR    ${interface}    IN    @{SUBNETS_NAME}
72     \    Add Router Interface    router_1    ${interface}
73
74 Ping Vm Instance1 In network_2 From network_1
75     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
76     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[0]
77
78 Ping Vm Instance2 In network_2 From network_1
79     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
80     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[1]
81
82 Ping Vm Instance3 In network_2 From network_1
83     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
84     Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[2]
85
86 Ping Vm Instance1 In network_1 From network_2
87     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
88     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[0]
89
90 Ping Vm Instance2 In network_1 From network_2
91     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
92     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[1]
93
94 Ping Vm Instance3 In network_1 From network_2
95     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
96     Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[2]
97
98 Connectivity Tests From Vm Instance1 In network_1
99     [Documentation]    Login to the VM instance and test operations
100     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
101     Log    ${dst_list}
102     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[0]    ${dst_list}
103
104 Connectivity Tests From Vm Instance2 In network_1
105     [Documentation]    Login to the vm instance and test operations
106     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
107     Log    ${dst_list}
108     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[1]    ${dst_list}
109
110 Connectivity Tests From Vm Instance3 In network_1
111     [Documentation]    Login to the vm instance and test operations
112     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
113     Log    ${dst_list}
114     Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[2]    ${dst_list}
115
116 Connectivity Tests From Vm Instance1 In network_2
117     [Documentation]    Login to the vm instance and test operations
118     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
119     Log    ${dst_list}
120     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[0]    ${dst_list}
121
122 Connectivity Tests From Vm Instance2 In network_2
123     [Documentation]    Logging to the vm instance using generated key pair.
124     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
125     Log    ${dst_list}
126     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[1]    ${dst_list}
127
128 Connectivity Tests From Vm Instance3 In network_2
129     [Documentation]    Logging to the vm instance using generated key pair.
130     ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
131     Log    ${dst_list}
132     Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[2]    ${dst_list}
133
134 Delete Vm Instances In network_1
135     [Documentation]    Delete Vm instances using instance names in network_1.
136     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
137     \    Delete Vm Instance    ${VmElement}
138
139 Delete Vm Instances In network_2
140     [Documentation]    Delete Vm instances using instance names in network_2.
141     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
142     \    Delete Vm Instance    ${VmElement}
143     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
144     ...    AND    Get OvsDebugInfo
145     ...    AND    Get Model Dump    ${ODL_SYSTEM_IP}
146
147 Delete Router Interfaces
148     [Documentation]    Remove Interface to the subnets.
149     : FOR    ${interface}    IN    @{SUBNETS_NAME}
150     \    Remove Interface    router_1    ${interface}
151
152 Delete Routers
153     [Documentation]    Delete Router and Interface to the subnets.
154     Delete Router    router_1
155
156 Delete Sub Networks In network_1
157     [Documentation]    Delete Sub Nets for the Networks with neutron request.
158     Delete SubNet    subnet_1
159
160 Delete Sub Networks In network_2
161     [Documentation]    Delete Sub Nets for the Networks with neutron request.
162     Delete SubNet    subnet_2
163
164 Delete Networks
165     [Documentation]    Delete Networks with neutron request.
166     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
167     \    Delete Network    ${NetworkElement}