2 Documentation Test suite for SFC Service Functions, Operates functions from Restconf APIs.
6 Library OperatingSystem
7 Library RequestsLibrary
8 Resource ../../../variables/sfc/Variables.robot
9 Resource ../../../libraries/Utils.robot
10 Resource ../../../libraries/TemplatedRequests.robot
12 Suite Setup Init Suite
13 Suite Teardown Delete All Sessions
14 Test Setup Remove All Elements If Exist ${SERVICE_FUNCTIONS_URI}
19 [Documentation] Add Service Functions from JSON file
20 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
21 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
22 ${jsonbody} To Json ${body}
23 ${functions} Get From Dictionary ${jsonbody} service-functions
24 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
25 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
26 ${result} To JSON ${resp.content}
27 ${function} Get From Dictionary ${result} service-functions
28 Lists Should be Equal ${function} ${functions}
30 Delete All Service Functions
31 [Documentation] Delete all Service Functions
32 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
33 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
34 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
35 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
36 Remove All Elements At URI ${SERVICE_FUNCTIONS_URI}
37 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
38 Should Be Equal As Strings ${resp.status_code} 404
40 Get one Service Function
41 [Documentation] Get one Service Function
42 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
43 ${elements} Create List dpi-102-1 dpi
44 Check For Elements At URI ${SERVICE_FUNCTION_URI}/dpi-102-1 ${elements}
46 Get A Non-existing Service Function
47 [Documentation] Get A Non-existing Service Function
48 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
49 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_URI}/non-existing-sf
50 Should Be Equal As Strings ${resp.status_code} 404
52 Delete A Service Function
53 [Documentation] Delete A Service Function
54 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
55 Remove All Elements At URI ${SERVICE_FUNCTION_URI}/dpi-102-1
56 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
57 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
58 Should Not Contain ${resp.text} dpi-102-1
60 Delete A Non-existing Empty Service Function
61 [Documentation] Delete A Non existing Service Function
62 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
63 ${body} OperatingSystem.Get File ${SERVICE_FUNCTIONS_FILE}
64 ${jsonbody} To Json ${body}
65 ${functions} Get From Dictionary ${jsonbody} service-functions
66 ${resp} RequestsLibrary.Delete Request session ${SERVICE_FUNCTION_URI}/non-existing-sf
67 Should Be Equal As Strings ${resp.status_code} 404
68 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
69 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
70 ${result} To JSON ${resp.content}
71 ${function} Get From Dictionary ${result} service-functions
72 Lists Should be Equal ${function} ${functions}
74 Put one Service Function
75 [Documentation] Put one Service Function
76 Add Elements To URI From File ${SF_DPI102100_URI} ${SF_DPI102100_FILE}
77 ${elements} Create List dpi-102-100 dpi
78 Check For Elements At URI ${SF_DPI102100_URI} ${elements}
79 Check For Elements At URI ${SERVICE_FUNCTIONS_URI} ${elements}
81 Get Service Function DPL
82 [Documentation] Get Service Function Data Plane Locator
83 Add Elements To URI From File ${SF_DPI102100_URI} ${SF_DPI102100_FILE}
84 ${elements} Create List 100 10100
85 Check For Elements At URI ${SF_DPI102100_URI}/sf-data-plane-locator/dpl-100 ${elements}
87 Put Service Function DPL
88 [Documentation] Put Service Function Data Plane Locator
89 Add Elements To URI From File ${SF_DPI102100_URI} ${SF_DPI102100_FILE}
90 Add Elements To URI From File ${SF_DPI102100_URI}/sf-data-plane-locator/dpl-101 ${SF_DPL101_FILE}
91 ${elements} Create List dpl-101 10101
92 Check For Elements At URI ${SF_DPI102100_URI}/sf-data-plane-locator/dpl-101 ${elements}
93 Check For Elements At URI ${SF_DPI102100_URI} ${elements}
95 Put Service Function DPL to a Non-existing Service Function
96 [Documentation] Put Service Function DPL to a Non-existing Service Function
98 Add Elements To URI From File ${SF_DPI102100_URI}/sf-data-plane-locator/dpl-101 ${SF_DPL101_FILE}
99 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTIONS_URI}
100 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
101 Should Contain ${resp.text} dpi-102-100
102 ${elements} Create List dpl-101 10101
103 Check For Elements At URI ${SF_DPI102100_URI}/sf-data-plane-locator/dpl-101 ${elements}
104 Check For Elements At URI ${SF_DPI102100_URI} ${elements}
106 Delete Service Function DPL
107 [Documentation] Delete Service Function Data Plane Locator
108 Add Elements To URI From File ${SF_DPI102100_URI} ${SF_DPI102100_FILE}
109 Remove All Elements At URI ${SF_DPI102100_URI}/sf-data-plane-locator/dpl-100
110 ${resp} RequestsLibrary.Get Request session ${SF_DPI102100_URI}
111 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
112 Should Not Contain ${resp.text} dpl-100
117 [Documentation] Initialize session and ODL version specific variables
118 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
120 Set Suite Variable ${VERSION_DIR} master
121 Set Suite Variable ${TEST_DIR} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}
122 Set Suite Variable ${SERVICE_FUNCTIONS_FILE} ${TEST_DIR}/service-functions.json
123 Set Suite Variable ${SF_DPI102100_URI} ${SERVICE_FUNCTION_URI}/dpi-102-100
124 Set Suite Variable ${SF_DPI102100_FILE} ${TEST_DIR}/sf_dpi_102_100.json
125 Set Suite Variable ${SF_DPL101_FILE} ${TEST_DIR}/sf_dpl_101.json