2 Documentation Test suite for SFC Service Function Paths, Operates paths from Restconf APIs.
3 Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
7 Library OperatingSystem
8 Library RequestsLibrary
9 Variables ../../../variables/Variables.py
10 Resource ../../../libraries/Utils.robot
13 ${SERVICE_FUNCTION_PATHS_URI} /restconf/config/service-function-path:service-function-paths/
14 ${SERVICE_FUNCTION_PATHS_FILE} ../../../variables/sfc/service-function-paths.json
15 ${SERVICE_FUNCTION_PATH400_URI} /restconf/config/service-function-path:service-function-paths/service-function-path/SFC1-400
16 ${SERVICE_FUNCTION_PATH400_FILE} ../../../variables/sfc/sfp_sfc1_path400.json
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 session ${SERVICE_FUNCTION_PATHS_URI}
26 Should Be Equal As Strings ${resp.status_code} 200
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 ${resp} RequestsLibrary.Get session ${SERVICE_FUNCTION_PATHS_URI}
34 Should Be Equal As Strings ${resp.status_code} 200
35 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
36 ${resp} RequestsLibrary.Get 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 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
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_PATHS_URI}service-function-path/SFC1-100 ${elements}
46 Get A Non-existing Service Function Path
47 [Documentation] Get A Non-existing Service Function Path
48 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
49 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
50 ${resp} RequestsLibrary.Get session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/non-existing-sfp
51 Should Be Equal As Strings ${resp.status_code} 404
53 Delete A Service Function Path
54 [Documentation] Delete A Service Function Path
55 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
56 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
57 ${resp} RequestsLibrary.Get session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100
58 Should Be Equal As Strings ${resp.status_code} 200
59 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100
60 ${resp} RequestsLibrary.Get session ${SERVICE_FUNCTION_PATHS_URI}service-function-path/SFC1-100
61 Should Be Equal As Strings ${resp.status_code} 404
62 ${resp} RequestsLibrary.Get session ${SERVICE_FUNCTION_PATHS_URI}
63 Should Be Equal As Strings ${resp.status_code} 200
64 Should Not Contain ${resp.content} SFC1-100
66 Delete A Non-existing Empty Service Function Path
67 [Documentation] Delete A Non existing Service Function Path
68 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
69 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
70 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
71 ${jsonbody} To Json ${body}
72 ${paths} Get From Dictionary ${jsonbody} service-function-paths
73 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}service-function-path/non-existing-sfp
74 ${resp} RequestsLibrary.Get session ${SERVICE_FUNCTION_PATHS_URI}
75 Should Be Equal As Strings ${resp.status_code} 200
76 ${result} To JSON ${resp.content}
77 ${path} Get From Dictionary ${result} service-function-paths
78 Lists Should be Equal ${path} ${paths}
80 Put one Service Function
81 [Documentation] Put one Service Function
82 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}
83 Add Elements To URI From File ${SERVICE_FUNCTION_PATH400_URI} ${SERVICE_FUNCTION_PATH400_FILE}
84 ${resp} RequestsLibrary.Get session ${SERVICE_FUNCTION_PATH400_URI}
85 Should Be Equal As Strings ${resp.status_code} 200
86 Should Contain ${resp.content} SFC1-400
87 ${resp} RequestsLibrary.Get session ${SERVICE_FUNCTION_PATHS_URI}
88 Should Be Equal As Strings ${resp.status_code} 200
89 Should Contain ${resp.content} SFC1-400
91 Clean All Service Function Paths After Tests
92 [Documentation] Delete all Service Function Paths From Datastore After Tests
93 Remove All Elements At URI ${SERVICE_FUNCTION_PATHS_URI}