*** Variables ***
# TODO: Make the following list more narrow when streams without Bug 2594 fix (up to beryllium) are no longer used.
+@{ALLOWED_DELETE_STATUS_CODES} ${200} ${201} ${204} ${404} # List of integers, not strings. Used by DELETE if the resource may be not present.
@{ALLOWED_STATUS_CODES} ${200} ${201} ${204} # List of integers, not strings. Used by both PUT and DELETE (if the resource should have been present).
-@{DATA_VALIDATION_ERROR} ${500}
+@{DATA_VALIDATION_ERROR} ${400} # For testing mildly negative scenarios where ODL reports user error.
@{DELETED_STATUS_CODE} ${404} # List of integers, not strings. Used by DELETE if the resource may be not present.
+# TODO: Add option for delete to require 404.
+@{INTERNAL_SERVER_ERROR} ${500} # Only for testing severely negative scenarios where ODL cannot recover.
+@{KEYS_WITH_BITS} op # the default list with keys to be sorted when norm_json libray is used
@{NO_STATUS_CODES}
-@{ALLOWED_DELETE_STATUS_CODES} ${200} ${201} ${204} ${404} # List of integers, not strings. Used by DELETE if the resource may be not present.
@{UNAUTHORIZED_STATUS_CODES} ${401} # List of integers, not strings. Used in Keystone Authentication when the user is not authorized to use the requested resource.
-@{KEYS_WITH_BITS} op # the default list with keys to be sorted when norm_json libray is used
-# TODO: Add option for delete to require 404.
*** Keywords ***
Create_Default_Session
Add Elements To URI From File And Check Validation Error
[Arguments] ${dest_uri} ${data_file} ${headers}=${headers} ${session}=session
+ [Documentation] Shorthand for PUTting data from file and expecting status code 400.
+ BuiltIn.Comment TODO: Does this have any benefits, considering TemplatedRequests can also do this in one line?
${body} OperatingSystem.Get File ${data_file}
${resp} RequestsLibrary.Put Request ${session} ${dest_uri} data=${body} headers=${headers}
Should Contain ${DATA_VALIDATION_ERROR} ${resp.status_code}
+Add Elements To URI From File And Check Server Error
+ [Arguments] ${dest_uri} ${data_file} ${headers}=${headers} ${session}=session
+ [Documentation] Shorthand for PUTting data from file and expecting status code 500.
+ ... Consider opening a Bug against ODL, as in most test cases, 400 is the http code to expect.
+ BuiltIn.Comment TODO: Does this have any benefits, considering TemplatedRequests can also do this in one line?
+ ${body} OperatingSystem.Get File ${data_file}
+ ${resp} RequestsLibrary.Put Request ${session} ${dest_uri} data=${body} headers=${headers}
+ Should Contain ${INTERNAL_SERVER_ERROR} ${resp.status_code}
+
Post Elements To URI From File
[Arguments] ${dest_uri} ${data_file} ${headers}=${headers} ${session}=session
${body} OperatingSystem.Get File ${data_file}
*** Test Cases ***
Add Service Function Path referencing a non-existing SF
[Documentation] Add Service Function Paths from JSON file
- Add Elements To URI From File And Check Validation Error ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
+ Add Elements To URI From File And Check Server Error ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
${jsonbody} To Json ${body}
${paths} Get From Dictionary ${jsonbody} service-function-paths
Add Service Function Path referencing a non-existing SFC
[Documentation] Add Service Function Paths from JSON file
Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
- Add Elements To URI From File And Check Validation Error ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
+ Add Elements To URI From File And Check Server Error ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
${jsonbody} To Json ${body}
${paths} Get From Dictionary ${jsonbody} service-function-paths
[Documentation] Add Service Function Paths from JSON file
Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
Add Elements To URI From File ${SERVICE_CHAINS_URI} ${SERVICE_CHAINS_FILE}
- Add Elements To URI From File And Check Validation Error ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
+ Add Elements To URI From File And Check Server Error ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
${jsonbody} To Json ${body}
${paths} Get From Dictionary ${jsonbody} service-function-paths
[Documentation] Add Service Function Paths from JSON file
Add Elements To URI From File ${SERVICE_FUNCTIONS_URI} ${SERVICE_FUNCTIONS_FILE}
Add Elements To URI From File ${SERVICE_CHAINS_URI} ${SERVICE_CHAINS_FILE}
- Add Elements To URI From File And Check Validation Error ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_WITH_THREE_HOPS_FILE}
+ Add Elements To URI From File And Check Server Error ${SERVICE_FUNCTION_PATHS_URI} ${SERVICE_FUNCTION_PATHS_WITH_THREE_HOPS_FILE}
${body} OperatingSystem.Get File ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE}
${jsonbody} To Json ${body}
${paths} Get From Dictionary ${jsonbody} service-function-paths
Set Suite Variable ${SERVICE_FUNCTION_PATH400_FILE} ${SFC_JSON_TEST_FILES_DIR}/sfp_sfc1_path400.json
Set Suite Variable ${SERVICE_FUNCTION_PATHS_WITH_HOP_FILE} ${SFC_JSON_TEST_FILES_DIR}/service-function-paths-with-one-hop.json
Set Suite Variable ${SERVICE_FUNCTION_PATHS_WITH_THREE_HOPS_FILE} ${SFC_JSON_TEST_FILES_DIR}/service-function-paths-with-three-hops-firewall-napt44-dpi.json
- Set Suite Variable ${SFC_MODEL_VALIDATION_ERROR} ${500}
Set Suite Variable ${SERVICE_FUNCTIONS_FILE} ${SFC_JSON_TEST_FILES_DIR}/service-functions.json
Set Suite Variable ${SERVICE_CHAINS_FILE} ${SFC_JSON_TEST_FILES_DIR}/service-function-chains.json
Set Suite Variable ${SERVICE_CHAINS_FILE_FW_NAPT44_DPI} ${SFC_JSON_TEST_FILES_DIR}/service-function-chain-firewall-napt44-dpi.json