2 Documentation Test suite for SFC Service Function Paths, Operates paths from Restconf APIs.
4 Suite Teardown Delete All Sessions
7 Library OperatingSystem
8 Library RequestsLibrary
9 Variables ../../../variables/Variables.py
10 Resource ../../../libraries/Utils.robot
11 Resource ../../../libraries/TemplatedRequests.robot
14 Add Service Function Paths
15 [Documentation] Add Service Function Paths from JSON file
16 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
17 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
18 ${jsonbody} To Json ${body}
19 ${paths} Get From Dictionary ${jsonbody} service-function-paths
20 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
21 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
22 ${result} To JSON ${resp.content}
23 ${path} Get From Dictionary ${result} service-function-paths
24 Lists Should be Equal ${path} ${paths}
26 Delete All Service Function Paths
27 [Documentation] Delete all Service Function Paths
28 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
29 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
30 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
31 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
32 Should Be Equal As Strings ${resp.status_code} 404
34 Get one Service Function Path
35 [Documentation] Get one Service Function Path
36 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
37 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
38 ${elements}= Create List SFC1-100 "service-chain-name":"SFC1"
39 Check For Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100 ${elements}
41 Get A Non-existing Service Function Path
42 [Documentation] Get A Non-existing Service Function Path
43 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
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 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
51 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
52 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100
53 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
54 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100
55 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/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.content} SFC1-100
61 Delete A Non-existing Empty Service Function Path
62 [Documentation] Delete A Non existing Service Function Path
63 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
64 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
65 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
66 ${jsonbody} To Json ${body}
67 ${paths} Get From Dictionary ${jsonbody} service-function-paths
68 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/non-existing-sfp
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 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
78 Add Elements To URI From File ${SERVICE_FUNCTION_PATH400_URI} ${SERVICE_FUNCTION_PATH400_FILE}
79 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATH400_URI}
80 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
81 Should Contain ${resp.content} SFC1-400
82 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
83 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
84 Should Contain ${resp.content} SFC1-400
86 Clean All Service Function Paths After Tests
87 [Documentation] Delete all Service Function Paths From Datastore After Tests
88 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
92 [Documentation] Initialize session and ODL version specific variables
93 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
95 Run Keyword If '${ODL_STREAM}' == 'stable-lithium' Set Suite Variable ${VERSION_DIR} lithium
96 ... ELSE Set Suite Variable ${VERSION_DIR} master
97 Set Suite Variable ${SERVICE_FUNCTION_PATHS_URI} /restconf/config/service-function-path:service-function-paths/
98 Set Suite Variable ${SERVICE_FUNCTION_PATHS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-paths.json
99 Set Suite Variable ${SERVICE_FUNCTION_PATH400_URI} /restconf/config/service-function-path:service-function-paths/service-function-path/SFC1-400
100 Set Suite Variable ${SERVICE_FUNCTION_PATH400_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/sfp_sfc1_path400.json