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 Variables ../../../variables/Variables.py
11 Resource ../../../libraries/Utils.robot
12 Resource ../../../libraries/TemplatedRequests.robot
15 Add Service Function Paths
16 [Documentation] Add Service Function Paths from JSON file
17 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
18 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
19 ${jsonbody} To Json ${body}
20 ${paths} Get From Dictionary ${jsonbody} service-function-paths
21 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
22 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
23 ${result} To JSON ${resp.content}
24 ${path} Get From Dictionary ${result} service-function-paths
25 Lists Should be Equal ${path} ${paths}
27 Delete All Service Function Paths
28 [Documentation] Delete all Service Function Paths
29 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
30 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
31 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
32 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
33 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
34 Should Be Equal As Strings ${resp.status_code} 404
36 Get one Service Function Path
37 [Documentation] Get one Service Function Path
38 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
39 ${elements}= Create List SFC1-100 "service-chain-name":"SFC1"
40 Check For Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100 ${elements}
42 Get A Non-existing Service Function Path
43 [Documentation] Get A Non-existing Service Function Path
44 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
45 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/non-existing-sfp
46 Should Be Equal As Strings ${resp.status_code} 404
48 Delete A Service Function Path
49 [Documentation] Delete A Service Function Path
50 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
51 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100
52 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
53 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100
54 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100
55 Should Be Equal As Strings ${resp.status_code} 404
56 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
57 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
58 Should Not Contain ${resp.content} SFC1-100
60 Delete A Non-existing Empty Service Function Path
61 [Documentation] Delete A Non existing Service Function Path
62 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
63 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
64 ${jsonbody} To Json ${body}
65 ${paths} Get From Dictionary ${jsonbody} service-function-paths
66 ${resp} RequestsLibrary.Delete Request session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/non-existing-sfp
67 Should Be Equal As Strings ${resp.status_code} 404
68 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
69 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
70 ${result} To JSON ${resp.content}
71 ${path} Get From Dictionary ${result} service-function-paths
72 Lists Should be Equal ${path} ${paths}
74 Put one Service Function
75 [Documentation] Put one Service Function
76 Add Elements To URI From File ${SERVICE_FUNCTION_PATH400_URI} ${SERVICE_FUNCTION_PATH400_FILE}
77 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATH400_URI}
78 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
79 Should Contain ${resp.content} SFC1-400
80 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
81 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
82 Should Contain ${resp.content} SFC1-400
86 [Documentation] Initialize session and ODL version specific variables
87 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
89 Run Keyword If '${ODL_STREAM}' == 'stable-lithium' Set Suite Variable ${VERSION_DIR} lithium
90 ... ELSE Set Suite Variable ${VERSION_DIR} master
91 Set Suite Variable ${SERVICE_FUNCTION_PATHS_URI} /restconf/config/service-function-path:service-function-paths/
92 Set Suite Variable ${SERVICE_FUNCTION_PATHS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-paths.json
93 Set Suite Variable ${SERVICE_FUNCTION_PATH400_URI} /restconf/config/service-function-path:service-function-paths/service-function-path/SFC1-400
94 Set Suite Variable ${SERVICE_FUNCTION_PATH400_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/sfp_sfc1_path400.json