2 Documentation Test suite for SFC Service Function Forwarders, Operates SFFs from Restconf APIs.
6 Library OperatingSystem
7 Library RequestsLibrary
8 Resource ../../../variables/sfc/Variables.robot
9 Resource ../../../libraries/Utils.robot
10 Resource ../../../libraries/TemplatedRequests.robot
12 Suite Setup Init Suite
13 Suite Teardown Delete All Sessions
14 Test Setup Remove All Elements If Exist ${SERVICE_FORWARDERS_URI}
18 Put Service Function Forwarders
19 [Documentation] Add Service Function Forwarders from JSON file
20 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
21 ${body} OperatingSystem.Get File ${SERVICE_FORWARDERS_FILE}
22 ${jsonbody} To Json ${body}
23 ${forwarders} Get From Dictionary ${jsonbody} service-function-forwarders
24 ${resp} RequestsLibrary.Get Request session ${SERVICE_FORWARDERS_URI}
25 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
26 ${result} To JSON ${resp.content}
27 ${forwarder} Get From Dictionary ${result} service-function-forwarders
28 Lists Should be Equal ${forwarder} ${forwarders}
30 Delete All Service Function Forwarders
31 [Documentation] Delete all Service Function Forwarders
32 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
33 ${resp} RequestsLibrary.Get Request session ${SERVICE_FORWARDERS_URI}
34 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
35 Remove All Elements At URI ${SERVICE_FORWARDERS_URI}
36 ${resp} RequestsLibrary.Get Request session ${SERVICE_FORWARDERS_URI}
37 Should Be Equal As Strings ${resp.status_code} 404
39 Get one Service Function Forwarder
40 [Documentation] Get one Service Function Forwarder
41 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
42 ${elements} Create List SFF-bootstrap service-locator:vxlan-gpe SF1
43 Check For Elements At URI ${SFF_BOOTSTRAP_URI} ${elements}
45 Get A Non-existing Service Function Forwarder
46 [Documentation] Get A Non-existing Service Function Forwarder
47 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
48 ${resp} RequestsLibrary.Get Request session ${SERVICE_FORWARDER_URI}/non-existing-sff
49 Should Be Equal As Strings ${resp.status_code} 404
51 Delete A Service Function Forwarder
52 [Documentation] Delete A Service Function Forwarder
53 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
54 ${resp} RequestsLibrary.Get Request session ${SFF_BOOTSTRAP_URI}
55 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
56 Remove All Elements At URI ${SFF_BOOTSTRAP_URI}
57 ${resp} RequestsLibrary.Get Request session ${SFF_BOOTSTRAP_URI}
58 Should Be Equal As Strings ${resp.status_code} 404
59 ${resp} RequestsLibrary.Get Request session ${SERVICE_FORWARDERS_URI}
60 Should Be Equal As Strings ${resp.status_code} 200
61 Should Not Contain ${resp.text} SF1
63 Delete A Non-existing Service Function Forwarder
64 [Documentation] Delete A Non existing Service Function
65 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
66 ${body} OperatingSystem.Get File ${SERVICE_FORWARDERS_FILE}
67 ${jsonbody} To Json ${body}
68 ${forwarders} Get From Dictionary ${jsonbody} service-function-forwarders
69 ${resp} RequestsLibrary.Delete Request session ${SERVICE_FORWARDER_URI}/non-existing-sff
70 Should Be Equal As Strings ${resp.status_code} 404
71 ${resp} RequestsLibrary.Get Request session ${SERVICE_FORWARDERS_URI}
72 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
73 ${result} To JSON ${resp.content}
74 ${forwarder} Get From Dictionary ${result} service-function-forwarders
75 Lists Should be Equal ${forwarder} ${forwarders}
77 Put one Service Function Forwarder
78 [Documentation] Put one Service Function Forwarder
79 Add Elements To URI From File ${SFF_OVS100_URI} ${SFF_OVS100_FILE}
80 ${resp} RequestsLibrary.Get Request session ${SFF_OVS100_URI}
81 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
82 ${elements} Create List ovs-100 SF7
83 Check For Elements At URI ${SFF_OVS100_URI} ${elements}
84 Check For Elements At URI ${SERVICE_FORWARDERS_URI} ${elements}
86 Get Service Function Forwarder DPL
87 [Documentation] Get Service Function Data Plane Locator
88 Add Elements To URI From File ${SFF_OVS100_URI} ${SFF_OVS100_FILE}
89 ${elements} Create List eth0 service-locator:vxlan-gpe
90 Check For Elements At URI ${SFF_OVS100_URI}/sff-data-plane-locator/eth0 ${elements}
92 Put Service Function Forwarder DPL
93 [Documentation] Put Service Function Forwarder Data Plane Locator
94 Add Elements To URI From File ${SFF_OVS100_URI} ${SFF_OVS100_FILE}
95 Add Elements To URI From File ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101 ${SFF_DPL101_FILE}
96 ${elements} Create List dpl-101 6101
97 Check For Elements At URI ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101 ${elements}
98 Check For Elements At URI ${SFF_OVS100_URI} ${elements}
100 Put DPL to a Non-existing Service Function Forwarder
101 [Documentation] Put Service Function DPL to a Non-existing Service Function
102 Add Elements To URI From File ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101 ${SFF_DPL101_FILE}
103 ${resp} RequestsLibrary.Get Request session ${SERVICE_FORWARDERS_URI}
104 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
105 Should Contain ${resp.text} ovs-100
106 ${elements} Create List dpl-101 6101
107 Check For Elements At URI ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101 ${elements}
108 Check For Elements At URI ${SFF_OVS100_URI} ${elements}
110 Delete Service Function Forwarder DPL
111 [Documentation] Delete Service Function Forwarder Data Plane Locator
112 Add Elements To URI From File ${SFF_OVS100_URI} ${SFF_OVS100_FILE}
113 Remove All Elements At URI ${SFF_OVS100_URI}/sff-data-plane-locator/eth0
114 ${resp} RequestsLibrary.Get Request session ${SFF_OVS100_URI}
115 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
116 Should Not Contain ${resp.text} "name":"eth0"
118 Get Service Function Forwarder DPL's Locator
119 [Documentation] Get Service Function Data Plane Locator
120 Add Elements To URI From File ${SFF_OVS100_URI} ${SFF_OVS100_FILE}
121 ${elements} Create List 6000 service-locator:vxlan-gpe
122 Check For Elements At URI ${SFF_OVS100_URI}/sff-data-plane-locator/eth0/data-plane-locator/ ${elements}
124 Put Service Function Forwarder DPL's Locator
125 [Documentation] Put Service Function Forwarder Data Plane Locator
126 Add Elements To URI From File ${SFF_OVS100_URI} ${SFF_OVS100_FILE}
127 Add Elements To URI From File ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101 ${SFF_DPL101_FILE}
128 Add Elements To URI From File
129 ... ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101/data-plane-locator/
130 ... ${SFF_DPL_LOCATOR_FILE}
131 ${elements} Create List 5000 service-locator:vxlan-gpe
132 Check For Elements At URI ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101/data-plane-locator ${elements}
133 ${elements} Create List dpl-101 5000 service-locator:vxlan-gpe
134 Check For Elements At URI ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101 ${elements}
135 Check For Elements At URI ${SFF_OVS100_URI} ${elements}
137 Delete Service Function Forwarder DPL's Locator
138 [Documentation] Delete Service Function Forwarder Data Plane Locator
140 Add Elements To URI From File ${SFF_OVS100_URI} ${SFF_OVS100_FILE}
141 Add Elements To URI From File ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101 ${SFF_DPL101_FILE}
142 Add Elements To URI From File
143 ... ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101/data-plane-locator
144 ... ${SFF_DPL_LOCATOR_FILE}
145 Remove All Elements At URI ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101/data-plane-locator
146 ${resp} RequestsLibrary.Get Request session ${SFF_OVS100_URI}/sff-data-plane-locator/dpl-101
147 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
148 Should Contain ${resp.text} dpl-101
149 Should Not Contain ${resp.text} 6101
150 Should Not Contain ${resp.text} service-locator:vxlan-gpe
151 ${resp} RequestsLibrary.Get Request session ${SFF_OVS100_URI}
152 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
153 Should Contain ${resp.text} dpl-101
154 Should Not Contain ${resp.text} 6101
156 Get Service Function Dictionary From SFF
157 [Documentation] Get Service Function Dictionary From SFF
158 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
159 ${elements} Create List service-function-dictionary SF1 SF1-DPL eth0
160 Check For Elements At URI ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI} ${elements}
162 Delete Service Function Dictionary From SFF
163 [Documentation] Delete Service Function Dictionary From SFF
164 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
165 ${resp} RequestsLibrary.Get Request session ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}
166 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
167 Remove All Elements At URI ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}
168 ${resp} RequestsLibrary.Get Request session ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}
169 Should Be Equal As Strings ${resp.status_code} 404
170 ${resp} RequestsLibrary.Get Request session ${SFF_BOOTSTRAP_URI}
171 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
172 Should Contain ${resp.text} service-function-dictionary
173 Should Not Contain ${resp.text} SF1
175 Put Service Function Dictionary to SFF
176 [Documentation] Put Service Function Dictionary to SFF
177 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
178 Add Elements To URI From File ${SFF_BOOTSTRAP_URI}/service-function-dictionary/SF100 ${SFF_SFD_SF100_FILE}
179 ${elements} Create List SF100 SF2-DPL eth0
180 Check For Elements At URI ${SFF_BOOTSTRAP_URI}/service-function-dictionary/SF100 ${elements}
181 ${elements} create list service-function-dictionary SF100 SF2-DPL eth0
182 Check For Elements At URI ${SFF_BOOTSTRAP_URI} ${elements}
184 Get Service Function Dictionary's DPL From SFF
185 [Documentation] Get Service Function Dictionary From SFF
186 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
187 ${elements} create list sff-sf-data-plane-locator SF1-DPL eth0
188 Check For Elements At URI ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}/sff-sf-data-plane-locator/ ${elements}
190 Delete Service Function Dictionary's DPL From SFF
191 [Documentation] Delete Service Function Dictionary From SFF
192 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
193 ${resp} RequestsLibrary.Get Request
195 ... ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}/sff-sf-data-plane-locator
196 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
197 Remove All Elements At URI ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}/sff-sf-data-plane-locator
198 ${resp} RequestsLibrary.Get Request
200 ... ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}/sff-sf-data-plane-locator
201 Should Be Equal As Strings ${resp.status_code} 404
203 Put DPL of Service Function Dictionary to SFF
204 [Documentation] Put DPL of Service Function Dictionary to SFF
205 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
206 Add Elements To URI From File
207 ... ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}/sff-sf-data-plane-locator
208 ... ${SFF_SFD_LOCATOR_FILE}
209 ${elements} create list sff-sf-data-plane-locator SF2-DPL eth0
210 Check For Elements At URI ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI}/sff-sf-data-plane-locator ${elements}
211 Check For Elements At URI ${SFF_BOOTSTRAP_URI}/${SF_DICT_SF1_URI} ${elements}
213 Get Connected SFF Dictionary From SFF
214 [Documentation] Get Connected SFF Dictionary Dictionary From SFF
215 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
216 ${elements} create list connected-sff-dictionary br-int-ovs-2 sff-sff-data-plane-locator
217 Check For Elements At URI ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/br-int-ovs-2 ${elements}
218 ${resp} RequestsLibrary.Get Request
220 ... ${SERVICE_FORWARDER_URI}/br-int-ovs-2/connected-sff-dictionary/SFF-bootstrap
221 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
222 Should Contain ${resp.text} SFF-bootstrap
224 Delete Connected SFF Dictionary From SFF
225 [Documentation] Delete Connected SFF Dictionary From SFF
226 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
227 ${resp} RequestsLibrary.Get Request session ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/br-int-ovs-2
228 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
229 Remove All Elements At URI ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/br-int-ovs-2
230 ${resp} RequestsLibrary.Get Request session ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/br-int-ovs-2
231 Should Be Equal As Strings ${resp.status_code} 404
232 ${resp} RequestsLibrary.Get Request session ${SFF_BOOTSTRAP_URI}
233 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
234 Should Not Contain ${resp.text} br-int-ovs-2
236 Put Connected SFF Dictionary to SFF
237 [Documentation] Put Connected SFF Dictionary to SFF
238 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
239 Add Elements To URI From File ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/SFF100 ${SFF_CSD_SFF100_FILE}
240 ${elements} create list SFF100 service-function-forwarder:open
241 Check For Elements At URI ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/SFF100 ${elements}
242 Check For Elements At URI ${SFF_BOOTSTRAP_URI} ${elements}
244 Get Connected SFF Dictionary's DPL From SFF
245 [Documentation] Get Connected SFF Dictionary's DPL From SFF
246 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
247 ${elements} create list sff-sff-data-plane-locator 5000 192.168.1.2
248 Check For Elements At URI
249 ... ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/br-int-ovs-2/sff-sff-data-plane-locator
252 Put DPL of Connected SFF Dictionary to SFF
253 [Documentation] Put DPL of Connected SFF Dictionary to SFF
254 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
255 Add Elements To URI From File
256 ... ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/br-int-ovs-2/sff-sff-data-plane-locator
257 ... ${SFF_CSD_LOCATOR_FILE}
258 ${elements} create list sff-sff-data-plane-locator 6000 10.1.1.1
259 Check For Elements At URI
260 ... ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/br-int-ovs-2/sff-sff-data-plane-locator
262 Check For Elements At URI ${SFF_BOOTSTRAP_URI}/connected-sff-dictionary/br-int-ovs-2 ${elements}
267 [Documentation] Initialize session and ODL version specific variables
268 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
270 Set Suite Variable ${VERSION_DIR} master
271 Set Suite Variable ${TEST_DIR} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}
272 Set Suite Variable ${SERVICE_FORWARDERS_FILE} ${TEST_DIR}/service-function-forwarders.json
273 Set Suite Variable ${SFF_OVS100_URI} ${SERVICE_FORWARDER_URI}/ovs-100
274 Set Suite Variable ${SFF_BOOTSTRAP_URI} ${SERVICE_FORWARDER_URI}/SFF-bootstrap
275 Set Suite Variable ${SF_DICT_SF1_URI} service-function-dictionary/SF1
276 Set Suite Variable ${SFF_OVS100_FILE} ${TEST_DIR}/sff_ovs_100.json
277 Set Suite Variable ${SFF_DPL101_FILE} ${TEST_DIR}/sff_dpl_101.json
278 Set Suite Variable ${SFF_DPL_LOCATOR_FILE} ${TEST_DIR}/sff_dpl_locator.json
279 Set Suite Variable ${SFF_SFD_SF100_FILE} ${TEST_DIR}/sff_sfd_sf100.json
280 Set Suite Variable ${SFF_SFD_LOCATOR_FILE} ${TEST_DIR}/sff_sfd_locator.json
281 Set Suite Variable ${SFF_CSD_SFF100_FILE} ${TEST_DIR}/sff_csd_sff100.json
282 Set Suite Variable ${SFF_CSD_LOCATOR_FILE} ${TEST_DIR}/sff_csd_locator.json