Test case for ovsdb netvirt
[integration/test.git] / test / csit / suites / ovsdb / Openstack_Neutron / 010__ovsdb_flow.robot
1 *** Settings ***
2 Documentation     Checking Network created in OVSDB are pushed to OpenDaylight
3 Suite Setup       Create Session    ODLSession    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           SSHLibrary
6 Library           Collections
7 Library           OperatingSystem
8 Library           String
9 Library           DateTime
10 Library           RequestsLibrary
11 Library           ../../../libraries/Common.py
12 Variables         ../../../variables/Variables.py
13 Resource          ../../../libraries/Utils.txt
14
15 *** Variables ***
16 ${ODLREST}        /controller/nb/v2/neutron
17 ${OVSDB_CONFIG_DIR}    ${CURDIR}/../../../variables/ovsdb
18 ${TNT1_ID}        cde2563ead464ffa97963c59e002c0cf
19 ${EXT_NET1_ID}    7da709ff-397f-4778-a0e8-994811272fdb
20 ${EXT_SUBNET1_ID}    00289199-e288-464a-ab2f-837ca67101a7
21 ${TNT1_RTR_ID}    e09818e7-a05a-4963-9927-fc1dc6f1e844
22 ${NEUTRON_PORT_TNT1_RTR_GW}    8ddd29db-f417-4917-979f-b01d4b1c3e0d
23 ${NEUTRON_PORT_TNT1_RTR_NET1}    9cc1af22-108f-40bb-b938-f1da292236bf
24 ${TNT1_NET1_NAME}    net1
25 ${TNT1_NET1_SEGM}    1062
26 ${TNT1_NET1_ID}    12809f83-ccdf-422c-a20a-4ddae0712655
27 ${TNT1_SUBNET1_NAME}    subnet1
28 ${TNT1_SUBNET1_ID}    6c496958-a787-4d8c-9465-f4c4176652e8
29 ${TNT1_NET1_DHCP_PORT_ID}    79adcba5-19e0-489c-9505-cc70f9eba2a1
30 ${TNT1_NET1_DHCP_MAC}    FA:16:3E:8F:70:A9
31 ${TNT1_NET1_DHCP_DEVICE_ID}    dhcp58155ae3-f2e7-51ca-9978-71c513ab02ee-${TNT1_NET1_ID}
32 ${TNT1_NET1_DHCP_OVS_PORT}    tap79adcba5-19
33 ${TNT1_VM1_PORT_ID}    341ceaca-24bf-4017-9b08-c3180e86fd24
34 ${TNT1_VM1_MAC}    FA:16:3E:8E:B8:05
35 ${TNT1_VM1_DEVICE_ID}    20e500c3-41e1-4be0-b854-55c710a1cfb2
36 ${TNT1_NET1_VM1_OVS_PORT}    tap341ceaca-24
37 ${TNT1_VM1_VM_ID}    20e500c3-41e1-4be0-b854-55c710a1cfb2
38 ${FLOAT_IP1_ID}    f013bef4-9468-494d-9417-c9d9e4abb97c
39 ${FLOAT_IP1_PORT_ID}    01671703-695e-4497-8a11-b5da989d2dc3
40 ${FLOAT_IP1_MAC}    FA:16:3E:3F:37:BB
41 ${FLOAT_IP1_DEVICE_ID}    f013bef4-9468-494d-9417-c9d9e4abb97c
42 ${FLOAT_IP1_ADDRESS}    192.168.111.22
43
44 *** Test Cases ***
45 Check External Net for Tenant
46     [Documentation]    Check External Net for Tenant
47     [Tags]    OpenStack Call Flow
48     ${resp}    RequestsLibrary.Get    ODLSession    ${ODLREST}/networks
49     log    http://${CONTROLLER}:${RESTCONFPORT}${ODLREST}
50     Should be Equal As Strings    ${resp.status_code}    200
51
52 Create External Net for Tenant
53     [Documentation]    Create External Net for Tenant
54     [Tags]    OpenStack Call Flow
55     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_ext_net.json
56     ${Data}    Replace String    ${Data}    {netId}    ${EXT_NET1_ID}
57     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
58     log    ${Data}
59     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/networks    data=${Data}    headers=${HEADERS}
60     log    ${resp.status_code}
61     Should be Equal As Strings    ${resp.status_code}    201
62
63 Create External Subnet
64     [Documentation]    Create External Subnet
65     [Tags]    OpenStack Call Flow
66     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_ext_subnet.json
67     ${Data}    Replace String    ${Data}    {netId}    ${EXT_NET1_ID}
68     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
69     ${Data}    Replace String    ${Data}    {subnetId}    ${EXT_SUBNET1_ID}
70     log    ${Data}
71     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/subnets    ${Data}
72     Should be Equal As Strings    ${resp.status_code}    201
73
74 Create Tenant Router
75     [Documentation]    Create Tenant Router
76     [Tags]    OpenStack Call Flow
77     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_router.json
78     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
79     ${Data}    Replace String    ${Data}    {rtrId}    ${TNT1_RTR_ID}
80     log    ${Data}
81     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/routers    ${Data}
82     Should be Equal As Strings    ${resp.status_code}    201
83
84 Set Router Gateway
85     [Documentation]    Set Router Gateway
86     [Tags]    OpenStack Call Flow
87     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port_rtr_gateway.json
88     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
89     ${Data}    Replace String    ${Data}    {rtrId}    ${TNT1_RTR_ID}
90     ${Data}    Replace String    ${Data}    {netId}    ${EXT_NET1_ID}
91     ${Data}    Replace String    ${Data}    {subnetId}    ${EXT_SUBNET1_ID}
92     ${Data}    Replace String    ${Data}    {portId}    ${NEUTRON_PORT_TNT1_RTR_GW}
93     log    ${Data}
94     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/ports    ${Data}
95     Should be Equal As Strings    ${resp.status_code}    201
96
97 Update Router Port Gateway
98     [Documentation]    Update Router Port Gateway
99     [Tags]    OpenStack Call Flow
100     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/update_router_port_gateway.json
101     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
102     ${Data}    Replace String    ${Data}    {netId}    ${EXT_NET1_ID}
103     ${Data}    Replace String    ${Data}    {subnetId}    ${EXT_SUBNET1_ID}
104     ${Data}    Replace String    ${Data}    {portId}    ${NEUTRON_PORT_TNT1_RTR_GW}
105     log    ${Data}
106     ${resp}    RequestsLibrary.Put    ODLSession    ${ODLREST}/routers/${TNT1_RTR_ID}    ${Data}
107     Should be Equal As Strings    ${resp.status_code}    200
108
109 Create Tenant Internal Net
110     [Documentation]    Create Tenant Internal Net
111     [Tags]    OpenStack Call Flow
112     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_tnt_net.json
113     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
114     ${Data}    Replace String    ${Data}    {netId}    ${TNT1_NET1_ID}
115     ${Data}    Replace String    ${Data}    {netName}    ${TNT1_NET1_NAME}
116     ${Data}    Replace String    ${Data}    {netSegm}    ${TNT1_NET1_SEGM}
117     log    ${Data}
118     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/networks    ${Data}
119     Should be Equal As Strings    ${resp.status_code}    201
120
121 Create Tenant Internal Subnet
122     [Documentation]    Create Tenant Internal Subnet
123     [Tags]    OpenStack Call Flow
124     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_tnt_subnet.json
125     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
126     ${Data}    Replace String    ${Data}    {netId}    ${TNT1_NET1_ID}
127     ${Data}    Replace String    ${Data}    {subnetId}    ${TNT1_SUBNET1_ID}
128     ${Data}    Replace String    ${Data}    {subnetName}    ${TNT1_SUBNET1_NAME}
129     log    ${Data}
130     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/subnets    ${Data}
131     Should be Equal As Strings    ${resp.status_code}    201
132
133 Create Port DHCP
134     [Documentation]    Create Port DHCP
135     [Tags]    OpenStack Call Flow
136     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port_dhcp.json
137     ${Data}    Replace String    ${Data}    {BIND_HOST_ID}    ${CONTROLLER}
138     ${Data}    Replace String    ${Data}    {subnetId}    ${TNT1_SUBNET1_ID}
139     ${Data}    Replace String    ${Data}    {dhcpDeviceId}    ${TNT1_NET1_DHCP_DEVICE_ID}
140     ${Data}    Replace String    ${Data}    {netId}    ${TNT1_NET1_ID}
141     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
142     ${Data}    Replace String    ${Data}    {dhcpMac}    ${TNT1_NET1_DHCP_MAC}
143     ${Data}    Replace String    ${Data}    {dhcpId}    ${TNT1_NET1_DHCP_PORT_ID}
144     log    ${Data}
145     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/ports    ${Data}
146     Should be Equal As Strings    ${resp.status_code}    201
147
148 Update Port DHCP
149     [Documentation]    Update Port DHCP
150     [Tags]    OpenStack Call Flow
151     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/update_port_dhcp.json
152     ${Data}    Replace String    ${Data}    {BIND_HOST_ID}    ${CONTROLLER}
153     ${Data}    Replace String    ${Data}    {dhcpDeviceId}    ${TNT1_NET1_DHCP_DEVICE_ID}
154     log    ${Data}
155     ${resp}    RequestsLibrary.Put    ODLSession    ${ODLREST}/ports/${TNT1_NET1_DHCP_PORT_ID}    ${Data}
156     Should be Equal As Strings    ${resp.status_code}    200
157
158 Create Router Interface on Tenant Internal Subnet
159     [Documentation]    Create Router Interface on Tenant Internal Subnet
160     [Tags]    OpenStack Call Flow
161     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port_rtr_interface.json
162     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
163     ${Data}    Replace String    ${Data}    {rtrId}    ${TNT1_RTR_ID}
164     ${Data}    Replace String    ${Data}    {netId}    ${TNT1_NET1_ID}
165     ${Data}    Replace String    ${Data}    {subnetId}    ${TNT1_SUBNET1_ID}
166     ${Data}    Replace String    ${Data}    {portId}    ${NEUTRON_PORT_TNT1_RTR_NET1}
167     log    ${Data}
168     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/ports    ${Data}
169     Should be Equal As Strings    ${resp.status_code}    201
170
171 Update Router Interface on Tenant Internal Subnet
172     [Documentation]    Update Router Interface on Tenant Internal Subnet
173     [Tags]    OpenStack Call Flow
174     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/update_router_interface.json
175     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
176     ${Data}    Replace String    ${Data}    {rtrId}    ${TNT1_RTR_ID}
177     ${Data}    Replace String    ${Data}    {subnetId}    ${TNT1_SUBNET1_ID}
178     ${Data}    Replace String    ${Data}    {portId}    ${NEUTRON_PORT_TNT1_RTR_NET1}
179     log    ${Data}
180     ${resp}    RequestsLibrary.Put    ODLSession    ${ODLREST}/routers/${TNT1_RTR_ID}/add_router_interface    ${Data}
181     Should be Equal As Strings    ${resp.status_code}    200
182
183 Create Port VM
184     [Documentation]    Create Port VM
185     [Tags]    OpenStack Call Flow
186     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port_vm.json
187     ${Data}    Replace String    ${Data}    {BIND_HOST_ID}    ${CONTROLLER}
188     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
189     ${Data}    Replace String    ${Data}    {netId}    ${TNT1_NET1_ID}
190     ${Data}    Replace String    ${Data}    {subnetId}    ${TNT1_SUBNET1_ID}
191     ${Data}    Replace String    ${Data}    {portId}    ${TNT1_VM1_PORT_ID}
192     ${Data}    Replace String    ${Data}    {macAddr}    ${TNT1_VM1_MAC}
193     ${Data}    Replace String    ${Data}    {deviceId}    ${TNT1_VM1_DEVICE_ID}
194     log    ${Data}
195     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/ports    ${Data}
196     Should be Equal As Strings    ${resp.status_code}    201
197
198 Create Port Floating IP
199     [Documentation]    Create Port Floating IP
200     [Tags]    OpenStack Call Flow
201     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port_floating_ip.json
202     ${Data}    Replace String    ${Data}    {netId}    ${EXT_NET1_ID}
203     ${Data}    Replace String    ${Data}    {subnetId}    ${EXT_SUBNET1_ID}
204     ${Data}    Replace String    ${Data}    {portId}    ${FLOAT_IP1_PORT_ID}
205     ${Data}    Replace String    ${Data}    {macAddress}    ${FLOAT_IP1_MAC}
206     ${Data}    Replace String    ${Data}    {deviceId}    ${FLOAT_IP1_DEVICE_ID}
207     log    ${Data}
208     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/ports    ${Data}
209     Should be Equal As Strings    ${resp.status_code}    201
210
211 Create Floating IP
212     [Documentation]    Create Floating IP
213     [Tags]    OpenStack Call Flow
214     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_floating_ip.json
215     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
216     ${Data}    Replace String    ${Data}    {netId}    ${EXT_NET1_ID}
217     ${Data}    Replace String    ${Data}    {floatIpId}    ${FLOAT_IP1_ID}
218     ${Data}    Replace String    ${Data}    {floatIpAddress}    ${FLOAT_IP1_ADDRESS}
219     log    ${Data}
220     ${resp}    RequestsLibrary.Post    ODLSession    ${ODLREST}/floatingips    ${Data}
221     Should be Equal As Strings    ${resp.status_code}    201
222
223 Associate the Floating IP with Tenant VM
224     [Documentation]    Associate the Floating IP with Tenant VM
225     [Tags]    OpenStack Call Flow
226     ${Data}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/associate_floating_ip.json
227     ${Data}    Replace String    ${Data}    {tntId}    ${TNT1_ID}
228     ${Data}    Replace String    ${Data}    {netId}    ${EXT_NET1_ID}
229     ${Data}    Replace String    ${Data}    {rtrId}    ${TNT1_RTR_ID}
230     ${Data}    Replace String    ${Data}    {floatIpId}    ${FLOAT_IP1_ID}
231     ${Data}    Replace String    ${Data}    {floatIpAddress}    ${FLOAT_IP1_ADDRESS}
232     ${Data}    Replace String    ${Data}    {vmPortId}    ${TNT1_VM1_PORT_ID}
233     log    ${Data}
234     ${resp}    RequestsLibrary.Put    ODLSession    ${ODLREST}/floatingips/${FLOAT_IP1_ID}    ${Data}
235     Should be Equal As Strings    ${resp.status_code}    201