2 Documentation Test suite for SFC Service Functions, Operates functions from Restconf APIs.
3 Suite Setup Run Keywords Init Suite ClusterManagement Setup
4 Suite Teardown Delete All Sessions
7 Library OperatingSystem
8 Library RequestsLibrary
9 Resource ../../../variables/Variables.robot
10 Resource ../../../libraries/Utils.robot
11 Resource ../../../libraries/TemplatedRequests.robot
12 Resource ../../../libraries/BackupRestoreKeywords.robot
15 Basic Environment Setup Tests
16 [Documentation] Prepare Basic Test Environment
17 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
18 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
19 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
20 Add Elements To URI From File ${SERVICE_CHAINS_URI} ${SERVICE_CHAINS_FILE}
21 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
23 Create and Get Rendered Service Path
24 [Documentation] Create and Get Rendered Service Path Through RESTConf APIs
25 Post Elements To URI As JSON ${OPERATIONS_CREATE_RSP_URI} ${CREATE_RSP1_INPUT}
26 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}
27 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
28 ${elements}= Create List SFC1-100-Path-1 "parent-service-function-path":"SFC1-100" "hop-number":0 "service-index":255 "hop-number":1
29 ... "service-index":254 "hop-number":2 "service-index":253
30 ConditionalBackupRestoreCheck
31 Check For Elements At URI ${OPERATIONAL_RSPS_URI} ${elements}
32 Post Elements To URI As JSON ${OPERATIONS_DELETE_RSP_URI} ${DELETE_RSP1_INPUT}
34 Create Get Rendered Service Path Failure
35 [Documentation] Create and Get Rendered Service Path Through RESTConf APIs
36 Post Elements To URI As JSON ${OPERATIONS_CREATE_RSP_URI} ${CREATE_RSP1_INPUT}
37 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}
38 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
39 ${elements}= Create List SFC1-100-Path-1 "parent-service-function-path":"SFC1-100" "hop-number":0 "service-index":255 "hop-number":1
40 ... "service-index":254 "hop-number":2 "service-index":253
41 ConditionalBackupRestoreCheck
42 Check For Elements At URI ${OPERATIONAL_RSPS_URI} ${elements}
43 Post Elements To URI As JSON ${OPERATIONS_DELETE_RSP_URI} ${DELETE_RSP1_INPUT}
45 Clean Datastore After Tests
46 [Documentation] Clean All Items In Datastore After Tests
47 Remove All Elements If Exist ${SERVICE_FUNCTIONS_URI}
48 Remove All Elements If Exist ${SERVICE_FORWARDERS_URI}
49 Remove All Elements If Exist ${SERVICE_NODES_URI}
50 Remove All Elements If Exist ${SERVICE_CHAINS_URI}
51 Remove All Elements If Exist ${SERVICE_FUNCTION_PATHS_URI}
54 Post Elements To URI As JSON
55 [Arguments] ${uri} ${data}
56 ${resp} RequestsLibrary.Post Request session ${uri} data=${data} headers=${headers}
57 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
59 Get JSON Elements From URI
61 ${resp} RequestsLibrary.Get Request session ${uri}
62 ${value} To Json ${resp.content}
66 [Documentation] Create session and initialize ODL version specific variables
67 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
69 Set Suite Variable ${VERSION_DIR} master
70 Set Suite Variable ${SERVICE_FUNCTIONS_URI} /restconf/config/service-function:service-functions/
71 Set Suite Variable ${SERVICE_FUNCTIONS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-functions.json
72 Set Suite Variable ${SERVICE_FORWARDERS_URI} /restconf/config/service-function-forwarder:service-function-forwarders/
73 Set Suite Variable ${SERVICE_FORWARDERS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-forwarders.json
74 Set Suite Variable ${SERVICE_NODES_URI} /restconf/config/service-node:service-nodes/
75 Set Suite Variable ${SERVICE_NODES_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-nodes.json
76 Set Suite Variable ${SERVICE_CHAINS_URI} /restconf/config/service-function-chain:service-function-chains/
77 Set Suite Variable ${SERVICE_CHAINS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-chains.json
78 Set Suite Variable ${SERVICE_FUNCTION_PATHS_URI} /restconf/config/service-function-path:service-function-paths/
79 Set Suite Variable ${SERVICE_FUNCTION_PATHS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-paths.json
80 Set Suite Variable ${SERVICE_SCHED_TYPES_URI} /restconf/config/service-function-scheduler-type:service-function-scheduler-types/
81 Set Suite Variable ${SERVICE_SCHED_TYPE_URI_BASE} ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:
82 Set Suite Variable ${SERVICE_RANDOM_SCHED_TYPE_URI} ${SERVICE_SCHED_TYPE_URI_BASE}random
83 Set Suite Variable ${SERVICE_RANDOM_SCHED_TYPE_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-random-schedule-type.json
84 Set Suite Variable ${SERVICE_ROUNDROBIN_SCHED_TYPE_URI} ${SERVICE_SCHED_TYPE_URI_BASE}round-robin
85 Set Suite Variable ${SERVICE_ROUNDROBIN_SCHED_TYPE_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-roundrobin-schedule-type.json
86 Set Suite Variable ${SERVICE_LOADBALANCE_SCHED_TYPE_URI} ${SERVICE_SCHED_TYPE_URI_BASE}load-balance
87 Set Suite Variable ${SERVICE_LOADBALANCE_SCHED_TYPE_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-loadbalance-schedule-type.json
88 Set Suite Variable ${SERVICE_SHORTESTPATH_SCHED_TYPE_URI} ${SERVICE_SCHED_TYPE_URI_BASE}shortest-path
89 Set Suite Variable ${SERVICE_SHORTESTPATH_SCHED_TYPE_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-shortestpath-schedule-type.json
90 Set Suite Variable ${RENDERED_SERVICE_PATHS_URI} /restconf/config/rendered-service-path:rendered-service-paths/
91 Set Suite Variable ${OPERATIONAL_RSPS_URI} /restconf/operational/rendered-service-path:rendered-service-paths/
92 Set Suite Variable ${OPERATIONS_CREATE_RSP_URI} /restconf/operations/rendered-service-path:create-rendered-path/
93 Set Suite Variable ${OPERATIONS_DELETE_RSP_URI} /restconf/operations/rendered-service-path:delete-rendered-path
94 Set Suite Variable ${CREATE_RSP1_INPUT} {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-1"}}
95 Set Suite Variable ${CREATE_RSP2_INPUT} {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-2"}}
96 Set Suite Variable ${CREATE_RSP3_INPUT} {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-3"}}
97 Set Suite Variable ${CREATE_RSP4_INPUT} {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-4"}}
98 Set Suite Variable ${CREATE_RSP5_INPUT} {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-5"}}
99 Set Suite Variable ${CREATE_RSP6_INPUT} {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-6"}}
100 Set Suite Variable ${CREATE_RSP_FAILURE_INPUT} {"input":{"parent-service-function-path":"SFC1-empty","name":"SFC1-empty-Path-1"}}
101 Set Suite Variable ${DELETE_RSP1_INPUT} {"input":{"name":"SFC1-100-Path-1"}}
102 Set Suite Variable ${DELETE_RSP2_INPUT} {"input":{"name":"SFC1-100-Path-2"}}
103 Set Suite Variable ${DELETE_RSP3_INPUT} {"input":{"name":"SFC1-100-Path-3"}}
104 Set Suite Variable ${DELETE_RSP4_INPUT} {"input":{"name":"SFC1-100-Path-4"}}
105 Set Suite Variable ${DELETE_RSP5_INPUT} {"input":{"name":"SFC1-100-Path-5"}}
106 Set Suite Variable ${DELETE_RSP6_INPUT} {"input":{"name":"SFC1-100-Path-6"}}