2 Documentation Test suite for SFC Function Schedule Algorithm Types, Operates types from Restconf APIs.
4 Suite Teardown Delete All Sessions
5 Test Setup Remove All Elements If Exist ${SERVICE_SCHED_TYPES_URI}
8 Library OperatingSystem
9 Library RequestsLibrary
10 Variables ../../../variables/Variables.py
11 Resource ../../../libraries/Utils.robot
12 Resource ../../../libraries/TemplatedRequests.robot
15 Add Service Function Schedule Algorithm Types
16 [Documentation] Add Service Function Schedule Algorithm Types from JSON file
17 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
18 ${body} OperatingSystem.Get File ${SERVICE_SCHED_TYPES_FILE}
19 ${jsonbody} To Json ${body}
20 ${types} Get From Dictionary ${jsonbody} service-function-scheduler-types
21 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}
22 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
23 ${result} To JSON ${resp.content}
24 ${type} Get From Dictionary ${result} service-function-scheduler-types
25 Lists Should be Equal ${type} ${types}
27 Delete All Service Function Schedule Algorithm Types
28 [Documentation] Delete Service Function Schedule Algorithm Types
29 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
30 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}
31 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
32 Remove All Elements At URI ${SERVICE_SCHED_TYPES_URI}
33 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}
34 Should Be Equal As Strings ${resp.status_code} 404
36 Get Ramdom Schedule Algorithm Type
37 [Documentation] Get Ramdom Schedule Algorithm Type
38 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
39 ${elements}= Create List random "enabled":false service-function-scheduler-type:random
40 Check For Elements At URI ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:random ${elements}
41 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:random
43 Get A Non-existing Service Function Schedule Algorithm Type
44 [Documentation] Get A Non-existing Service Function Schedule Algorithm Type
45 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
46 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:user-defined
47 Should Be Equal As Strings ${resp.status_code} 404
49 Delete Ramdom Schedule Algorithm Type
50 [Documentation] Delete Ramdom Schedule Algorithm Type
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 Add Elements To URI From File ${SERVICE_SCHED_TYPES_URI} ${SERVICE_SCHED_TYPES_FILE}
59 ${body} OperatingSystem.Get File ${SERVICE_SCHED_TYPES_FILE}
60 ${jsonbody} To Json ${body}
61 ${types} Get From Dictionary ${jsonbody} service-function-scheduler-types
62 ${resp} RequestsLibrary.Delete Request session ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:user-defined
63 Should Be Equal As Strings ${resp.status_code} 404
64 ${resp} RequestsLibrary.Get Request session ${SERVICE_SCHED_TYPES_URI}
65 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
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 Add Elements To URI From File ${SERVICE_WSP_SCHED_TYPE_URI} ${SERVICE_WSP_SCHED_TYPE_FILE}
73 ${elements}= Create List weighted-shortest-path service-function-scheduler-type:weighted-shortest-path
74 Check For Elements At URI ${SERVICE_WSP_SCHED_TYPE_URI} ${elements}
75 Check For Elements At URI ${SERVICE_SCHED_TYPES_URI} ${elements}
79 [Documentation] Initialize session and ODL version specific variables
80 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
82 Set Suite Variable ${VERSION_DIR} master
83 Set Suite Variable ${SERVICE_SCHED_TYPES_URI} /restconf/config/service-function-scheduler-type:service-function-scheduler-types/
84 Set Suite Variable ${SERVICE_SCHED_TYPES_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-schedule-types.json
85 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
86 Set Suite Variable ${SERVICE_WSP_SCHED_TYPE_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-wsp-schedule-type.json