2 Documentation Test suite for SFC Service Function Paths, Operates paths from Restconf APIs.
4 Suite Teardown Delete All Sessions
5 Test Setup Remove All Elements If Exist ${SERVICE_FUNCTION_PATHS_URI}
8 Library OperatingSystem
9 Library RequestsLibrary
10 Resource ../../../variables/sfc/Variables.robot
11 Resource ../../../variables/Variables.robot
12 Resource ../../../libraries/Utils.robot
13 Resource ../../../libraries/TemplatedRequests.robot
16 Add Service Function Paths
17 [Documentation] Add Service Function Paths from JSON file
18 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
19 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
20 ${jsonbody} To Json ${body}
21 ${paths} Get From Dictionary ${jsonbody} service-function-paths
22 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
23 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
24 ${result} To JSON ${resp.content}
25 ${path} Get From Dictionary ${result} service-function-paths
26 Lists Should be Equal ${path} ${paths}
28 Delete All Service Function Paths
29 [Documentation] Delete all Service Function Paths
30 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
31 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
32 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
33 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
34 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
35 Should Be Equal As Strings ${resp.status_code} 404
37 Get one Service Function Path
38 [Documentation] Get one Service Function Path
39 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
40 ${elements}= Create List SFC1-100 "service-chain-name":"SFC1"
41 Check For Elements At URI ${SERVICE_FUNCTION_PATH_URI}/SFC1-100 ${elements}
43 Get A Non-existing Service Function Path
44 [Documentation] Get A Non-existing Service Function Path
45 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
46 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATH_URI}/non-existing-sfp
47 Should Be Equal As Strings ${resp.status_code} 404
49 Delete A Service Function Path
50 [Documentation] Delete A Service Function Path
51 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
52 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATH_URI}/SFC1-100
53 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
54 Remove All Elements At URI ${SERVICE_FUNCTION_PATH_URI}/SFC1-100
55 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATH_URI}/SFC1-100
56 Should Be Equal As Strings ${resp.status_code} 404
57 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
58 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
59 Should Not Contain ${resp.text} SFC1-100
61 Delete A Non-existing Empty Service Function Path
62 [Documentation] Delete A Non existing Service Function Path
63 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
64 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
65 ${jsonbody} To Json ${body}
66 ${paths} Get From Dictionary ${jsonbody} service-function-paths
67 ${resp} RequestsLibrary.Delete Request session ${SERVICE_FUNCTION_PATH_URI}/non-existing-sfp
68 Should Be Equal As Strings ${resp.status_code} 404
69 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
70 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
71 ${result} To JSON ${resp.content}
72 ${path} Get From Dictionary ${result} service-function-paths
73 Lists Should be Equal ${path} ${paths}
75 Put one Service Function
76 [Documentation] Put one Service Function
77 Add Elements To URI From File ${SERVICE_FUNCTION_PATH400_URI} ${SERVICE_FUNCTION_PATH400_FILE}
78 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATH400_URI}
79 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
80 Should Contain ${resp.text} SFC1-400
81 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
82 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
83 Should Contain ${resp.text} SFC1-400
87 [Documentation] Initialize session and ODL version specific variables
88 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
90 Set Suite Variable ${VERSION_DIR} master
91 Set Suite Variable ${TEST_DIR} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}
92 Set Suite Variable ${SERVICE_FUNCTION_PATHS_FILE} ${TEST_DIR}/service-function-paths.json
93 Set Suite Variable ${SERVICE_FUNCTION_PATH400_URI} ${SERVICE_FUNCTION_PATH_URI}/SFC1-400
94 Set Suite Variable ${SERVICE_FUNCTION_PATH400_FILE} ${TEST_DIR}/sfp_sfc1_path400.json