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
13 Add Service Function Paths
14 [Documentation] Add Service Function Paths from JSON file
15 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
16 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
17 ${jsonbody} To Json ${body}
18 ${paths} Get From Dictionary ${jsonbody} service-function-paths
19 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
20 Should Be Equal As Strings ${resp.status_code} 200
21 ${result} To JSON ${resp.content}
22 ${path} Get From Dictionary ${result} service-function-paths
23 Lists Should be Equal ${path} ${paths}
25 Delete All Service Function Paths
26 [Documentation] Delete all Service Function Paths
27 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
28 Should Be Equal As Strings ${resp.status_code} 200
29 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
30 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
31 Should Be Equal As Strings ${resp.status_code} 404
33 Get one Service Function Path
34 [Documentation] Get one Service Function Path
35 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
36 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
37 ${elements}= Create List SFC1-100 "service-chain-name":"SFC1"
38 Check For Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100 ${elements}
40 Get A Non-existing Service Function Path
41 [Documentation] Get A Non-existing Service Function Path
42 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
43 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
44 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/non-existing-sfp
45 Should Be Equal As Strings ${resp.status_code} 404
47 Delete A Service Function Path
48 [Documentation] Delete A Service Function Path
49 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
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 Be Equal As Strings ${resp.status_code} 200
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 Be Equal As Strings ${resp.status_code} 200
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 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
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 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/non-existing-sfp
68 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
69 Should Be Equal As Strings ${resp.status_code} 200
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 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
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 Be Equal As Strings ${resp.status_code} 200
80 Should Contain ${resp.content} SFC1-400
81 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
82 Should Be Equal As Strings ${resp.status_code} 200
83 Should Contain ${resp.content} SFC1-400
85 Clean All Service Function Paths After Tests
86 [Documentation] Delete all Service Function Paths From Datastore After Tests
87 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
91 [Documentation] Initialize session and ODL version specific variables
92 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
94 Run Keyword If '${ODL_STREAM}' == 'stable-lithium' Set Suite Variable ${VERSION_DIR} lithium
95 ... ELSE Set Suite Variable ${VERSION_DIR} master
96 Set Suite Variable ${SERVICE_FUNCTION_PATHS_URI} /restconf/config/service-function-path:service-function-paths/
97 Set Suite Variable ${SERVICE_FUNCTION_PATHS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-paths.json
98 Set Suite Variable ${SERVICE_FUNCTION_PATH400_URI} /restconf/config/service-function-path:service-function-paths/service-function-path/SFC1-400
99 Set Suite Variable ${SERVICE_FUNCTION_PATH400_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/sfp_sfc1_path400.json