2 Documentation Test suite for SFC Service Function Paths validation. This validation is in charge of verifying that the SF types for the SFs defined in newly added SFPs are consistent with SF types defined in the referenced SFC.
6 Library OperatingSystem
7 Library RequestsLibrary
8 Resource ../../../libraries/CompareStream.robot
9 Resource ../../../libraries/TemplatedRequests.robot
10 Resource ../../../libraries/Utils.robot
11 Resource ../../../variables/Variables.robot
12 Resource ../../../variables/sfc/Variables.robot
14 Suite Setup Init Suite
15 Suite Teardown Delete All Sessions
16 Test Setup Remove All Elements If Exist ${SERVICE_FUNCTION_PATHS_URI}
17 Test Teardown Clean_All_URIs
21 Add Service Function Path referencing a non-existing SF
22 [Documentation] Add Service Function Paths from JSON file
23 CompareStream.Run_Keyword_If_Equals_Else
25 ... Add Elements To URI From File And Check Validation Error
26 ... ${SERVICE_FUNCTION_PATHS_URI}
27 ... ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
29 ... Add Elements To URI From File And Check Server Error
30 ... ${SERVICE_FUNCTION_PATHS_URI}
31 ... ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
32 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
33 ${jsonbody} To Json ${body}
34 ${paths} Get From Dictionary ${jsonbody} service-function-paths
35 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
36 Should Be Equal As Strings ${resp.status_code} 404
38 Add Service Function Path referencing a non-existing SFC
39 [Documentation] Add Service Function Paths from JSON file
40 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
41 CompareStream.Run_Keyword_If_Equals_Else
43 ... Add Elements To URI From File And Check Validation Error
44 ... ${SERVICE_FUNCTION_PATHS_URI}
45 ... ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
47 ... Add Elements To URI From File And Check Server Error
48 ... ${SERVICE_FUNCTION_PATHS_URI}
49 ... ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
50 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
51 ${jsonbody} To Json ${body}
52 ${paths} Get From Dictionary ${jsonbody} service-function-paths
53 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
54 Should Be Equal As Strings ${resp.status_code} 404
55 Remove All Elements At URI ${SERVICE_FUNCTIONS_URI}
57 Add Service Function Path where SFC types size and hop sizes differ
58 [Documentation] Add Service Function Paths from JSON file
59 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
60 Add Elements To URI From File ${SERVICE_CHAINS_URI} ${SERVICE_CHAINS_FILE}
61 CompareStream.Run_Keyword_If_At_Least_Else
63 ... Add Elements To URI From File And Check Validation Error
64 ... ${SERVICE_FUNCTION_PATHS_URI}
65 ... ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
67 ... Add Elements To URI From File And Check Server Error
68 ... ${SERVICE_FUNCTION_PATHS_URI}
69 ... ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
70 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
71 ${jsonbody} To Json ${body}
72 ${paths} Get From Dictionary ${jsonbody} service-function-paths
73 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
74 Should Be Equal As Strings ${resp.status_code} 404
75 Remove All Elements At URI ${SERVICE_CHAINS_URI}
76 Remove All Elements At URI ${SERVICE_FUNCTIONS_URI}
78 Add Service Function Path where SFC types size and types for SFs in hops differ
79 [Documentation] Add Service Function Paths from JSON file
80 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
81 Add Elements To URI From File ${SERVICE_CHAINS_URI} ${SERVICE_CHAINS_FILE}
82 CompareStream.Run_Keyword_If_At_Least_Else
84 ... Add Elements To URI From File And Check Validation Error
85 ... ${SERVICE_FUNCTION_PATHS_URI}
86 ... ${SERVICE_FUNCTION_PATHS_WITH_THREE_HOPS_FILE}
88 ... Add Elements To URI From File And Check Server Error
89 ... ${SERVICE_FUNCTION_PATHS_URI}
90 ... ${SERVICE_FUNCTION_PATHS_WITH_THREE_HOPS_FILE}
91 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
92 ${jsonbody} To Json ${body}
93 ${paths} Get From Dictionary ${jsonbody} service-function-paths
94 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
95 Should Be Equal As Strings ${resp.status_code} 404
96 Remove All Elements At URI ${SERVICE_FUNCTIONS_URI}
97 Remove All Elements At URI ${SERVICE_CHAINS_URI}
99 Add Service Function Path where SFC types size and types for SFs in hops match
100 [Documentation] Add Service Function Paths from JSON file
101 Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
102 Add Elements To URI From File ${SERVICE_CHAINS_URI} ${SERVICE_CHAINS_FILE_FW_NAPT44_DPI}
103 Add Elements To URI From File And Verify
104 ... ${SERVICE_FUNCTION_PATHS_URI}
105 ... ${SERVICE_FUNCTION_PATHS_WITH_THREE_HOPS_FILE}
106 ${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_FILE}
107 ${jsonbody} To Json ${body}
108 ${paths} Get From Dictionary ${jsonbody} service-function-paths
109 ${resp} RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATHS_URI}
110 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
111 ${result} To JSON ${resp.content}
112 ${path} Get From Dictionary ${result} service-function-paths
113 Lists Should be Equal ${path} ${paths}
118 [Documentation] Initialize session and ODL version specific variables
119 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
121 Set Suite Variable ${VERSION_DIR} master
122 Set Suite Variable ${SFC_JSON_TEST_FILES_DIR} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}
123 Set Suite Variable ${SERVICE_FUNCTION_PATHS_FILE} ${SFC_JSON_TEST_FILES_DIR}/service-function-paths.json
125 ... ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
126 ... ${SFC_JSON_TEST_FILES_DIR}/service-function-paths-with-one-hop.json
128 ... ${SERVICE_FUNCTION_PATHS_WITH_THREE_HOPS_FILE}
129 ... ${SFC_JSON_TEST_FILES_DIR}/service-function-paths-with-three-hops-firewall-napt44-dpi.json
130 Set Suite Variable ${SERVICE_FUNCTIONS_FILE} ${SFC_JSON_TEST_FILES_DIR}/service-functions.json
131 Set Suite Variable ${SERVICE_CHAINS_FILE} ${SFC_JSON_TEST_FILES_DIR}/service-function-chains.json
133 ... ${SERVICE_CHAINS_FILE_FW_NAPT44_DPI}
134 ... ${SFC_JSON_TEST_FILES_DIR}/service-function-chain-firewall-napt44-dpi.json
137 [Documentation] Deletes all the elements which might have been created during SFP validation tests
138 Utils.Remove All Elements If Exist ${SERVICE_FUNCTIONS_URI}
139 Utils.Remove All Elements If Exist ${SERVICE_CHAINS_URI}
140 Utils.Remove All Elements If Exist ${SERVICE_FUNCTION_PATHS_URI}