2 Documentation Test suite for SFC Function Schedule Algorithm Types, Operates types 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 Schedule Algorithm Types
14 [Documentation] Add Service Function Schedule Algorithm Types from JSON file
15 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
16 ${body} OperatingSystem.Get File ${SERVICE_SCHED_TYPES_FILE}
17 ${jsonbody} To Json ${body}
18 ${types} Get From Dictionary ${jsonbody} service-function-scheduler-types
19 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}
20 Should Be Equal As Strings ${resp.status_code} 200
21 ${result} To JSON ${resp.content}
22 ${type} Get From Dictionary ${result} service-function-scheduler-types
23 Lists Should be Equal ${type} ${types}
25 Delete All Service Function Schedule Algorithm Types
26 [Documentation] Delete Service Function Schedule Algorithm Types
27 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}
28 Should Be Equal As Strings ${resp.status_code} 200
29 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}
30 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}
31 Should Be Equal As Strings ${resp.status_code} 404
33 Get Ramdom Schedule Algorithm Type
34 [Documentation] Get Ramdom Schedule Algorithm Type
35 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}
36 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
37 ${elements}= Create List random "enabled":false service-function-scheduler-type:random
38 Check For Elements At URI ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:random ${elements}
39 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:random
41 Get A Non-existing Service Function Schedule Algorithm Type
42 [Documentation] Get A Non-existing Service Function Schedule Algorithm Type
43 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}
44 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
45 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:user-defined
46 Should Be Equal As Strings ${resp.status_code} 404
48 Delete Ramdom Schedule Algorithm Type
49 [Documentation] Delete Ramdom Schedule Algorithm Type
50 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}
51 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
52 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:random
53 ${elements}= Create List random service-function-scheduler-type:random
54 Check For Elements Not At URI ${SERVICE_SCHED_TYPES_URI} ${elements}
56 Delete A Non-existing Service Function Schedule Algorithm Type
57 [Documentation] Delete A Non existing Service Function Schedule Algorithm Type
58 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}
59 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
60 ${body} OperatingSystem.Get File ${SERVICE_SCHED_TYPES_FILE}
61 ${jsonbody} To Json ${body}
62 ${types} Get From Dictionary ${jsonbody} service-function-scheduler-types
63 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:user-defined
64 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}
65 Should Be Equal As Strings ${resp.status_code} 200
66 ${result} To JSON ${resp.content}
67 ${type} Get From Dictionary ${result} service-function-scheduler-types
68 Lists Should be Equal ${type} ${types}
70 Put one Service Function Schedule Algorithm Type
71 [Documentation] Put one Service Function Schedule Algorithm Type
72 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}
73 Add Elements To URI From File ${SERVICE_WSP_SCHED_TYPE_URI} ${SERVICE_WSP_SCHED_TYPE_FILE}
74 ${elements}= Create List weighted-shortest-path service-function-scheduler-type:weighted-shortest-path
75 Check For Elements At URI ${SERVICE_WSP_SCHED_TYPE_URI} ${elements}
76 Check For Elements At URI ${SERVICE_SCHED_TYPES_URI} ${elements}
78 Clean Datastore After Tests
79 [Documentation] Delete All Service Function Schedule Algorithm Types From Datastore After Tests
80 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}
84 [Documentation] Initialize session and ODL version specific variables
85 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
87 Run Keyword If '${ODL_STREAM}' == 'stable-lithium' Set Suite Variable ${VERSION_DIR} lithium
88 ... ELSE Set Suite Variable ${VERSION_DIR} master
89 Set Suite Variable ${SERVICE_SCHED_TYPES_URI} /restconf/config/service-function-scheduler-type:service-function-scheduler-types/
90 Set Suite Variable ${SERVICE_SCHED_TYPES_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-schedule-types.json
91 Set Suite Variable ${SERVICE_WSP_SCHED_TYPE_URI} /restconf/config/service-function-scheduler-type:service-function-scheduler-types/service-function-scheduler-type/service-function-scheduler-type:weighted-shortest-path
92 Set Suite Variable ${SERVICE_WSP_SCHED_TYPE_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-wsp-schedule-type.json