2 Documentation Test suite for SFC Service Function ACL, Operates functions from Restconf APIs.
3 Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
5 Test Setup Remove All Elements If Exist ${SERVICE_FUNCTION_ACL_URI}
6 Test Teardown Remove All Elements At URI ${SERVICE_FUNCTION_ACL_URI}
9 Library OperatingSystem
10 Library RequestsLibrary
11 Resource ../../../variables/sfc/Variables.robot
12 Resource ../../../libraries/Utils.robot
15 ${SERVICE_FUNCTION_ACL_URI} /restconf/config/ietf-access-control-list:access-lists/
16 ${SERVICE_FUNCTION_ACL_FILE} ${CURDIR}/../../../variables/sfc/master/service-function-acl.json
20 [Documentation] Add Service Function ACL from JSON file
21 Add Elements To URI From File ${SERVICE_FUNCTION_ACL_URI} ${SERVICE_FUNCTION_ACL_FILE}
22 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_ACL_FILE}
23 ${jsonbody} To Json ${body}
24 ${functions} Get From Dictionary ${jsonbody} access-lists
25 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACL_URI}
26 ${result} To JSON ${resp.content}
27 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
28 ${function} Get From Dictionary ${result} access-lists
29 Lists Should be Equal ${function} ${functions}
32 [Documentation] Delete all ACL
33 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_ACL_FILE}
34 Add Elements To URI From File ${SERVICE_FUNCTION_ACL_URI} ${SERVICE_FUNCTION_ACL_FILE}
35 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACL_URI}
36 Should Be Equal As Strings ${resp.status_code} 200
37 Remove All Elements At URI ${SERVICE_FUNCTION_ACL_URI}
38 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACL_URI}
39 Should Be Equal As Strings ${resp.status_code} 404
43 [Documentation] Get one ACL
44 Add Elements To URI From File ${SERVICE_FUNCTION_ACL_URI} ${SERVICE_FUNCTION_ACL_FILE}
45 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACL_URI}acl/ietf-access-control-list:ipv4-acl/ACL1
46 Should Be Equal As Strings ${resp.status_code} 200
48 Get A Non-existing ACL
49 [Documentation] Get A Non-existing ACL
50 Add Elements To URI From File ${SERVICE_FUNCTION_ACL_URI} ${SERVICE_FUNCTION_ACL_FILE}
51 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACL_URI}acl/unexisting-acl
52 Should Be Equal As Strings ${resp.status_code} 404
55 [Documentation] Delete an ACL
56 Add Elements To URI From File ${SERVICE_FUNCTION_ACL_URI} ${SERVICE_FUNCTION_ACL_FILE}
57 Remove All Elements At URI ${SERVICE_FUNCTION_ACL_URI}acl/ietf-access-control-list:ipv4-acl/ACL1
58 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACL_URI}
59 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
60 Should Not Contain ${resp.content} ACL1