2 Documentation Test suite for SFC Service Functions using Logical SFF functionality, Operates functions 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_FUNCTIONS_URI}
15 Test Teardown Remove All Elements If Exist ${SERVICE_FUNCTIONS_URI}
20 ${SERVICE_FUNCTIONS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-functions-logicalsff.json
21 ${SF_DPI_URI} ${SERVICE_FUNCTION_URI}/dpi-1/
22 ${SF_DPI_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/sf_dpi.json
27 [Documentation] Add Service Functions from JSON file. Logical SFF
28 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
29 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
30 ${jsonbody} To Json ${body}
31 ${functions} Get From Dictionary ${jsonbody} service-functions
32 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
33 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
34 ${result} To JSON ${resp.content}
35 ${function} Get From Dictionary ${result} service-functions
36 Lists Should be Equal ${function} ${functions}
38 Delete All Service Functions
39 [Documentation] Delete all Service Functions. Logical SFF
40 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
41 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
42 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
43 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
44 Remove All Elements At URI ${SERVICE_FUNCTIONS_URI}
45 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
46 Should Be Equal As Strings ${resp.status_code} 404
48 Get one Service Function
49 [Documentation] Get one Service Function. Logical SFF
50 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
51 ${elements} Create List firewall-1 firewall
52 Check For Elements At URI ${SERVICE_FUNCTION_URI}/firewall-1 ${elements}
54 Get A Non-existing Service Function
55 [Documentation] Get A Non-existing Service Function. Logical SFF
56 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
57 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_URI}/non-existing-sf
58 Should Be Equal As Strings ${resp.status_code} 404
60 Delete A Service Function
61 [Documentation] Delete A Service Function. Logical SFF
62 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
63 Remove All Elements At URI ${SERVICE_FUNCTION_URI}/dpi-1
64 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
65 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
66 Should Not Contain ${resp.text} dpi-1
68 Delete A Non-existing Empty Service Function
69 [Documentation] Delete A Non existing Service Function. Logical SFF
70 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
71 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
72 ${jsonbody} To Json ${body}
73 ${functions} Get From Dictionary ${jsonbody} service-functions
74 ${resp} RequestsLibrary.Delete Request session ${SERVICE_FUNCTION_URI}/non-existing-sf
75 Should Be Equal As Strings ${resp.status_code} 404
76 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
77 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
78 ${result} To JSON ${resp.content}
79 ${function} Get From Dictionary ${result} service-functions
80 Lists Should be Equal ${function} ${functions}
82 Put one Service Function
83 [Documentation] Put one Service Function. Logical SFF
85 Add Elements To URI From File ${SF_DPI_URI} ${SF_DPI_FILE}
86 ${elements} Create List dpi-1 dpi
87 Check For Elements At URI ${SF_DPI_URI} ${elements}
88 Check For Elements At URI ${SERVICE_FUNCTIONS_URI} ${elements}
93 [Documentation] Initialize session and ODL version specific variables .Logical SFF
94 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}