2 Documentation Test suite for SFC Service Functions using Logical SFF functionality, Operates functions from Restconf APIs.
4 Suite Teardown Delete All Sessions
5 Test Setup Remove All Elements If Exist ${SERVICE_FUNCTIONS_URI}
6 Test Teardown Remove All Elements If Exist ${SERVICE_FUNCTIONS_URI}
9 Library OperatingSystem
10 Library RequestsLibrary
11 Resource ../../../variables/sfc/Variables.robot
12 Resource ../../../libraries/Utils.robot
13 Resource ../../../libraries/TemplatedRequests.robot
17 ${SERVICE_FUNCTIONS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-functions-logicalsff.json
18 ${SF_DPI_URI} ${SERVICE_FUNCTION_URI}/dpi-1/
19 ${SF_DPI_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/sf_dpi.json
23 [Documentation] Add Service Functions from JSON file. Logical SFF
24 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
25 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
26 ${jsonbody} To Json ${body}
27 ${functions} Get From Dictionary ${jsonbody} service-functions
28 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
29 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
30 ${result} To JSON ${resp.content}
31 ${function} Get From Dictionary ${result} service-functions
32 Lists Should be Equal ${function} ${functions}
34 Delete All Service Functions
35 [Documentation] Delete all Service Functions. Logical SFF
36 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
37 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
38 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
39 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
40 Remove All Elements At URI ${SERVICE_FUNCTIONS_URI}
41 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
42 Should Be Equal As Strings ${resp.status_code} 404
44 Get one Service Function
45 [Documentation] Get one Service Function. Logical SFF
46 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
47 ${elements}= Create List firewall-1 firewall
48 Check For Elements At URI ${SERVICE_FUNCTION_URI}/firewall-1 ${elements}
50 Get A Non-existing Service Function
51 [Documentation] Get A Non-existing Service Function. Logical SFF
52 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
53 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_URI}/non-existing-sf
54 Should Be Equal As Strings ${resp.status_code} 404
56 Delete A Service Function
57 [Documentation] Delete A Service Function. Logical SFF
58 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
59 Remove All Elements At URI ${SERVICE_FUNCTION_URI}/dpi-1
60 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
61 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
62 Should Not Contain ${resp.text} dpi-1
64 Delete A Non-existing Empty Service Function
65 [Documentation] Delete A Non existing Service Function. Logical SFF
66 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
67 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
68 ${jsonbody} To Json ${body}
69 ${functions} Get From Dictionary ${jsonbody} service-functions
70 ${resp} RequestsLibrary.Delete Request session ${SERVICE_FUNCTION_URI}/non-existing-sf
71 Should Be Equal As Strings ${resp.status_code} 404
72 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
73 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
74 ${result} To JSON ${resp.content}
75 ${function} Get From Dictionary ${result} service-functions
76 Lists Should be Equal ${function} ${functions}
78 Put one Service Function
79 [Documentation] Put one Service Function. Logical SFF
81 Add Elements To URI From File ${SF_DPI_URI} ${SF_DPI_FILE}
82 ${elements}= Create List dpi-1 dpi
83 Check For Elements At URI ${SF_DPI_URI} ${elements}
84 Check For Elements At URI ${SERVICE_FUNCTIONS_URI} ${elements}
88 [Documentation] Initialize session and ODL version specific variables .Logical SFF
89 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}