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