2 Documentation Test suite for SFC Service Function ACL, Operates functions from Restconf APIs.
6 Library OperatingSystem
7 Library RequestsLibrary
8 Resource ../../../variables/sfc/Variables.robot
9 Resource ../../../libraries/Utils.robot
11 Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
12 Suite Teardown Delete All Sessions
13 Test Setup Remove All Elements If Exist ${SERVICE_FUNCTION_ACLS_URI}
14 Test Teardown Remove All Elements At URI ${SERVICE_FUNCTION_ACLS_URI}
18 ${SERVICE_FUNCTION_ACL_FILE} ${CURDIR}/../../../variables/sfc/master/service-function-acl.json
23 [Documentation] Add Service Function ACL from JSON file
24 Add Elements To URI From File ${SERVICE_FUNCTION_ACLS_URI} ${SERVICE_FUNCTION_ACL_FILE}
25 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_ACL_FILE}
26 ${jsonbody} To Json ${body}
27 ${functions} Get From Dictionary ${jsonbody} access-lists
28 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACLS_URI}
29 ${result} To JSON ${resp.content}
30 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
31 ${function} Get From Dictionary ${result} access-lists
32 Lists Should be Equal ${function} ${functions}
35 [Documentation] Delete all ACL
36 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_ACL_FILE}
37 Add Elements To URI From File ${SERVICE_FUNCTION_ACLS_URI} ${SERVICE_FUNCTION_ACL_FILE}
38 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACLS_URI}
39 Should Be Equal As Strings ${resp.status_code} 200
40 Remove All Elements At URI ${SERVICE_FUNCTION_ACLS_URI}
41 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACLS_URI}
42 Should Be Equal As Strings ${resp.status_code} 404
46 [Documentation] Get one ACL
47 Add Elements To URI From File ${SERVICE_FUNCTION_ACLS_URI} ${SERVICE_FUNCTION_ACL_FILE}
48 ${resp} RequestsLibrary.Get Request
50 ... ${SERVICE_FUNCTION_ACLS_URI}/acl/ietf-access-control-list:ipv4-acl/ACL1
51 Should Be Equal As Strings ${resp.status_code} 200
53 Get A Non-existing ACL
54 [Documentation] Get A Non-existing ACL
55 Add Elements To URI From File ${SERVICE_FUNCTION_ACLS_URI} ${SERVICE_FUNCTION_ACL_FILE}
56 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACLS_URI}/acl/unexisting-acl
57 Should Be Equal As Strings ${resp.status_code} 404
60 [Documentation] Delete an ACL
61 Add Elements To URI From File ${SERVICE_FUNCTION_ACLS_URI} ${SERVICE_FUNCTION_ACL_FILE}
62 Remove All Elements At URI ${SERVICE_FUNCTION_ACLS_URI}/acl/ietf-access-control-list:ipv4-acl/ACL1
63 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_ACLS_URI}
64 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
65 Should Not Contain ${resp.text} ACL1