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