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