Bartosz Gardziejewski | 03591ab | 2020-09-29 13:50:12 +0200 | [diff] [blame] | 1 | *** Settings *** |
Bartosz Gardziejewski | 64b0fe1 | 2020-10-06 08:12:12 +0200 | [diff] [blame] | 2 | Resource ./resources/vnfsdk_keywords.robot |
Bartosz Gardziejewski | 03591ab | 2020-09-29 13:50:12 +0200 | [diff] [blame] | 3 | |
| 4 | *** Test Cases *** |
Bartosz Gardziejewski | 64b0fe1 | 2020-10-06 08:12:12 +0200 | [diff] [blame] | 5 | |
Bartosz Gardziejewski | 03591ab | 2020-09-29 13:50:12 +0200 | [diff] [blame] | 6 | Perform vnf refrepo healthcheck |
| 7 | [Documentation] Check if vnf refrepo is up and running |
Bartosz Gardziejewski | e872513 | 2020-10-06 14:03:36 +0200 | [diff] [blame] | 8 | |
Bartosz Gardziejewski | 03591ab | 2020-09-29 13:50:12 +0200 | [diff] [blame] | 9 | Create Session refrepo ${base_url} |
| 10 | ${response}= Get Request refrepo /PackageResource/healthcheck |
| 11 | Should Be Equal As Strings ${response.status_code} 200 |
Bartosz Gardziejewski | 64b0fe1 | 2020-10-06 08:12:12 +0200 | [diff] [blame] | 12 | |
| 13 | Validate correct, no security CSAR |
| 14 | [Documentation] Valid CSAR with no security should PASS validation and should return no error |
Bartosz Gardziejewski | e872513 | 2020-10-06 14:03:36 +0200 | [diff] [blame] | 15 | |
| 16 | ${response}= Validate CSAR usign Post request ${csar_valid_no_security} ${execute_no_security_csar_validation} |
Bartosz Gardziejewski | 64b0fe1 | 2020-10-06 08:12:12 +0200 | [diff] [blame] | 17 | # Removing strings that are causing errors during evaluation, |
| 18 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 19 | ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" |
| 20 | ${json_response}= evaluate json.loads('''${response}''') json |
Bartosz Gardziejewski | 81df68b | 2020-12-22 14:39:02 +0100 | [diff] [blame] | 21 | Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} ${OPERATION_STATUS_PASS} |
Bartosz Gardziejewski | 64b0fe1 | 2020-10-06 08:12:12 +0200 | [diff] [blame] | 22 | FOR ${resault} IN @{json_response[0]["results"]["results"]} |
| 23 | Should Be Equal As Strings ${resault["errors"]} [] |
| 24 | Should Be Equal As Strings ${resault["passed"]} True |
Bartosz Gardziejewski | 81df68b | 2020-12-22 14:39:02 +0100 | [diff] [blame] | 25 | run keyword if "${resault["vnfreqName"]}" == "${CERTIFICATION_RULE}" |
| 26 | ... Should Be Equal As Strings ${resault["warnings"]} ${expected_valid_no_security_warnings} |
Bartosz Gardziejewski | 64b0fe1 | 2020-10-06 08:12:12 +0200 | [diff] [blame] | 27 | END |
Bartosz Gardziejewski | e872513 | 2020-10-06 14:03:36 +0200 | [diff] [blame] | 28 | |
| 29 | |
Bartosz Gardziejewski | 81df68b | 2020-12-22 14:39:02 +0100 | [diff] [blame] | 30 | Validate secure CSAR with invalid certificate |
| 31 | [Documentation] Valid CSAR with cms signature in manifest file and certificate in TOSCA, containing individual signatures for multiple artifacts, using common certificate and individual certificate |
| 32 | |
| 33 | ${response}= Validate CSAR usign Post request ${csar_invalid_with_security} ${execute_security_csar_validation} |
| 34 | # Removing strings that are causing errors during evaluation, |
| 35 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 36 | ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" |
| 37 | ${json_response}= evaluate json.loads('''${response}''') json |
| 38 | Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} ${OPERATION_STATUS_FAILED} |
| 39 | ${validated_rules}= Get Length ${json_response[0]["results"]["results"]} |
| 40 | Should Be Equal As Strings ${validated_rules} 14 |
| 41 | FOR ${resault} IN @{json_response[0]["results"]["results"]} |
| 42 | ${validation_errors}= Get Length ${resault["errors"]} |
| 43 | run keyword if "${resault["vnfreqName"]}" == "${CERTIFICATION_RULE}" |
Bartosz Gardziejewski | f24ffce | 2021-01-13 09:28:01 +0100 | [diff] [blame] | 44 | ... Should Be Equal As Strings ${validation_errors} 9 |
Bartosz Gardziejewski | 81df68b | 2020-12-22 14:39:02 +0100 | [diff] [blame] | 45 | run keyword if "${resault["vnfreqName"]}" == "${PM_DICTIONARY_YAML_RULE}" |
| 46 | ... Should Be Equal As Strings ${validation_errors} 1 |
| 47 | run keyword if "${resault["vnfreqName"]}" == "${MANIFEST_FILE_RULE}" |
| 48 | ... Should Be Equal As Strings ${validation_errors} 1 |
| 49 | run keyword if "${resault["vnfreqName"]}" == "${NON_MANO_FILES_RULE}" |
| 50 | ... Should Be Equal As Strings ${validation_errors} 4 |
| 51 | END |
| 52 | |
| 53 | |
| 54 | Validate CSAR using selected rules |
| 55 | [Documentation] Valid CSAR using only selected rules provided in request parameters |
| 56 | |
| 57 | ${response}= Validate CSAR usign Post request ${csar_invalid_with_security} ${execute_security_csar_validation_selected_rules} |
| 58 | # Removing strings that are causing errors during evaluation, |
| 59 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 60 | ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" |
| 61 | ${json_response}= evaluate json.loads('''${response}''') json |
| 62 | Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} ${OPERATION_STATUS_FAILED} |
| 63 | ${validated_rules}= Get Length ${json_response[0]["results"]["results"]} |
| 64 | Should Be Equal As Strings ${validated_rules} 3 |
| 65 | FOR ${resault} IN @{json_response[0]["results"]["results"]} |
| 66 | ${validation_errors}= Get Length ${resault["errors"]} |
| 67 | run keyword if "${resault["vnfreqName"]}" == "${CERTIFICATION_RULE}" |
Bartosz Gardziejewski | f24ffce | 2021-01-13 09:28:01 +0100 | [diff] [blame] | 68 | ... Should Be Equal As Strings ${validation_errors} 9 |
Bartosz Gardziejewski | 81df68b | 2020-12-22 14:39:02 +0100 | [diff] [blame] | 69 | run keyword if "${resault["vnfreqName"]}" == "${PM_DICTIONARY_YAML_RULE}" |
| 70 | ... Should Be Equal As Strings ${validation_errors} 1 |
| 71 | END |
| 72 | |
| 73 | |
| 74 | |
Bartosz Gardziejewski | 3a55c90 | 2020-10-08 13:04:24 +0200 | [diff] [blame] | 75 | Validate CSAR using rule r130206 and use get method to receive outcome |
| 76 | [Documentation] Validate CSAR with invalid PM_Dictionary (r130206) using rule r130206 , then use get method with validation id to receive valdiation outcome |
Bartosz Gardziejewski | e872513 | 2020-10-06 14:03:36 +0200 | [diff] [blame] | 77 | |
Bartosz Gardziejewski | 3a55c90 | 2020-10-08 13:04:24 +0200 | [diff] [blame] | 78 | ${response}= Validate CSAR usign Post request ${csar_invalid_pm_dictionary} ${execute_invalid_pm_dictionary_r130206_validation} |
Bartosz Gardziejewski | e872513 | 2020-10-06 14:03:36 +0200 | [diff] [blame] | 79 | # Removing strings that are causing errors during evaluation, |
| 80 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 81 | ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" |
| 82 | ${json_response}= evaluate json.loads('''${response}''') json |
| 83 | |
| 84 | ${get_response}= Get validation result using GET request ${json_response[0]["executionId"]} |
| 85 | # Removing strings that are causing errors during evaluation, |
| 86 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 87 | ${get_response}= Remove String ${get_response} \\\\ \\u0027 |
| 88 | ${json_get_response}= evaluate json.loads('''${get_response}''') json |
| 89 | Should Be Equal As Strings ${json_get_response[0]["status"]} failed |
| 90 | ${errors_number}= Get Length ${json_get_response[0]["results"]} |
| 91 | Should Be Equal As Strings ${errors_number} 4 |
| 92 | FOR ${error} IN @{json_get_response[0]["results"]} |
| 93 | Should Contain ${error["code"]} R130206 |
| 94 | END |
Bartosz Gardziejewski | 3a55c90 | 2020-10-08 13:04:24 +0200 | [diff] [blame] | 95 | |
| 96 | Validate CSAR using all rule and use get method to receive outcome |
| 97 | [Documentation] Validate CSAR with invalid PM_Dictionary (r130206) using all rules, then use get method with validation id to receive valdiation outcome |
| 98 | |
| 99 | ${response}= Validate CSAR usign Post request ${csar_invalid_pm_dictionary} ${execute_invalid_pm_dictionary_validation} |
| 100 | # Removing strings that are causing errors during evaluation, |
| 101 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 102 | ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" |
| 103 | ${json_response}= evaluate json.loads('''${response}''') json |
| 104 | |
| 105 | ${get_response}= Get validation result using GET request ${json_response[0]["executionId"]} |
| 106 | # Removing strings that are causing errors during evaluation, |
| 107 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 108 | ${get_response}= Remove String ${get_response} \\\\ \\u0027 \\u003c \\u003e \\" |
| 109 | ${json_get_response}= evaluate json.loads('''${get_response}''') json |
| 110 | Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} FAILED |
| 111 | FOR ${resault} IN @{json_response[0]["results"]["results"]} |
| 112 | Should Be Equal As Strings ${resault["warnings"]} [] |
| 113 | Run keyword if "${resault["vnfreqName"]}" == "r130206" |
| 114 | ... Should Be Equal As Strings ${resault["passed"]} False |
| 115 | END |