2 Documentation Test suite for SFC Service Functions, Operates functions from Restconf APIs. Logical SFF
4 Suite Teardown Delete All Sessions
5 Test Setup Create All Elements
6 Test Teardown Delete All Elements
9 Library OperatingSystem
10 Library RequestsLibrary
11 Library HttpLibrary.HTTP
12 Resource ../../../libraries/SFC/SfcKeywords.robot
13 Resource ../../../variables/sfc/Variables.robot
14 Resource ../../../libraries/Utils.robot
15 Resource ../../../libraries/TemplatedRequests.robot
19 ${SERVICE_FUNCTIONS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-functions-logicalsff.json
20 ${SERVICE_FORWARDERS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-forwarders-logicallsff.json
21 ${SERVICE_CHAINS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-chains-logicalsff.json
22 ${SERVICE_FUNCTION_PATHS_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-paths-logicalsff.json
23 ${CREATE_RSP1_INPUT} {"input":{"name": "RSP1","parent-service-function-path": "SFP1","symmetric": "true"}}
24 ${CREATE_RSP2_INPUT} {"input":{"name": "RSP2","parent-service-function-path": "SFP2","symmetric": "true"}}
25 ${CREATE_RSP_FAILURE_INPUT} {"input":{"name": "RSP1","parent-service-function-path": "SFP3","symmetric": "true"}}
26 ${DELETE_RSP1_INPUT} {"input":{"name":"RSP1"}}
27 ${DELETE_RSP1_REVERSE_INPUT} {"input":{"name":"RSP1-Reverse"}}
28 ${DELETE_RSP2_INPUT} {"input":{"name":"RSP2"}}
29 @{SF_NAMES} "name":"firewall-1" "name":"dpi-1"
32 Basic Environment Setup Tests
33 [Documentation] Prepare Basic Test Environment. Logical SFF
34 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
35 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
36 Wait Until Keyword Succeeds 60s 2s Check Service Function Types Added ${SF_NAMES}
37 Add Elements To URI From File ${SERVICE_CHAINS_URI} ${SERVICE_CHAINS_FILE}
38 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}
40 Create and Get Rendered Service Path
41 [Documentation] Create and Get Rendered Service Path Through RESTConf APIs. Logical SFF
43 Post Elements To URI ${OPERATIONS_CREATE_RSP_URI} ${CREATE_RSP1_INPUT}
44 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}
45 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
46 ${elements1}= Create List RSP1 "parent-service-function-path":"SFP1" "service-chain-name":"SFC1" "hop-number":0 "service-index":255
47 ... "hop-number":1 "service-index":254 "service-function-forwarder":"sfflogical1" "sfc-encapsulation":"service-locator:nsh"
48 ${elements2}= Create List RSP1-Reverse "parent-service-function-path":"SFP1" "service-chain-name":"SFC1" "hop-number":0 "service-index":255
49 ... "hop-number":1 "service-index":254 "service-function-forwarder":"sfflogical1" "sfc-encapsulation":"service-locator:nsh"
50 ${elements}= Combine Lists ${elements1} ${elements2}
51 Check For Elements At URI ${OPERATIONAL_RSPS_URI} ${elements}
53 Create Get Rendered Service Path Failure
54 [Documentation] Create Rendered Service Path Failure Cases. Logical SFF
55 ${resp} RequestsLibrary.Post Request session ${OPERATIONS_CREATE_RSP_URI} data=${CREATE_RSP_FAILURE_INPUT} headers=${headers}
56 Should Be Equal As Strings ${resp.status_code} 500
58 Get Rendered Service Path By Name
59 [Documentation] Get Rendered Service Path By Name Through RESTConf APIs. Logical SFF
60 Post Elements To URI ${OPERATIONS_CREATE_RSP_URI} ${CREATE_RSP1_INPUT}
61 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1
62 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
63 ${elements}= Create List RSP1 "parent-service-function-path":"SFP1" "hop-number":0 "service-index":255 "hop-number":1
64 ... "service-index":254
65 Check For Elements At URI ${OPERATIONAL_RSPS_URI} ${elements}
67 Get Non Existing Rendered Service Path
68 [Documentation] Get Non Existing Rendered Service Path Through RESTConf APIs. Logical SFF
69 Post Elements To URI ${OPERATIONS_CREATE_RSP_URI} ${CREATE_RSP1_INPUT}
70 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}rendered-service-path/non-existing-rsp
71 Should Be Equal As Strings ${resp.status_code} 404
72 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}
73 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
74 Should Not Contain ${resp.content} non-existing-rsp
76 Delete one Rendered Service Path By Name
77 [Documentation] Delete One Rendered Service Path By Name Through RESTConf APIs. Logical SFF
78 Post Elements To URI ${OPERATIONS_CREATE_RSP_URI} ${CREATE_RSP1_INPUT}
79 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1-Reverse
80 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
81 Should Contain ${resp.content} RSP1-Reverse
82 Post Elements To URI ${OPERATIONS_DELETE_RSP_URI} ${DELETE_RSP1_REVERSE_INPUT}
83 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1-Reverse
84 Should Be Equal As Strings ${resp.status_code} 404
85 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}
86 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
87 Should Not Contain ${resp.content} RSP1-Reverse
89 Delete Non Existing Rendered Service Path By Name
90 [Documentation] Delete One Rendered Service Path By Name Through RESTConf APIs. Logical SFF
91 Post Elements To URI ${OPERATIONS_CREATE_RSP_URI} ${CREATE_RSP1_INPUT}
92 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1
93 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
94 Should Contain ${resp.content} RSP1
95 Post Elements To URI ${OPERATIONS_DELETE_RSP_URI} ${DELETE_RSP2_INPUT}
96 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}
97 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
98 Should Not Contain ${resp.content} {"rendered-service-paths":{}}
100 Get Rendered Service Path Hop
101 [Documentation] Get Rendered Service Path By Name Through RESTConf APIs. Logical SFF
102 Post Elements To URI ${OPERATIONS_CREATE_RSP_URI} ${CREATE_RSP1_INPUT}
103 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1/rendered-service-path-hop/0/
104 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
105 ${elements}= Create List "hop-number":0 "service-index":255 "service-function-name":"dpi-1
106 Check For Elements At URI ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1/rendered-service-path-hop/0/ ${elements}
107 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1/rendered-service-path-hop/1/
108 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
109 ${elements}= Create List "hop-number":1 "service-index":254 "service-function-name":"firewall-1
110 Check For Elements At URI ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1/rendered-service-path-hop/1/ ${elements}
111 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_RSPS_URI}rendered-service-path/RSP1/rendered-service-path-hop/2/
112 Should Be Equal As Strings ${resp.status_code} 404
113 Post Elements To URI ${OPERATIONS_DELETE_RSP_URI} ${DELETE_RSP1_INPUT}
117 [Documentation] Create session and initialize ODL version specific variables
118 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
122 [Documentation] Delete all provisioned elements
123 Remove All Elements If Exist ${RENDERED_SERVICE_PATHS_URI}
124 Remove All Elements If Exist ${SERVICE_FUNCTION_PATHS_URI}
125 Remove All Elements If Exist ${SERVICE_CHAINS_URI}
126 Remove All Elements If Exist ${SERVICE_FORWARDERS_URI}
127 Remove All Elements If Exist ${SERVICE_FUNCTIONS_URI}
128 Wait Until Keyword Succeeds 60s 2s Check Service Function Types Removed ${SF_NAMES}
131 [Documentation] Delete all provisioned elements
132 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
133 Wait Until Keyword Succeeds 60s 2s Check Service Function Types Added ${SF_NAMES}
134 Add Elements To URI From File ${SERVICE_FORWARDERS_URI} ${SERVICE_FORWARDERS_FILE}
135 Add Elements To URI From File ${SERVICE_CHAINS_URI} ${SERVICE_CHAINS_FILE}
136 Add Elements To URI From File ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_FILE}