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 |
| 21 | Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} PASS |
| 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 |
| 25 | END |
Bartosz Gardziejewski | e872513 | 2020-10-06 14:03:36 +0200 | [diff] [blame] | 26 | |
| 27 | |
Bartosz Gardziejewski | 3a55c90 | 2020-10-08 13:04:24 +0200 | [diff] [blame] | 28 | Validate CSAR using rule r130206 and use get method to receive outcome |
| 29 | [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] | 30 | |
Bartosz Gardziejewski | 3a55c90 | 2020-10-08 13:04:24 +0200 | [diff] [blame] | 31 | ${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] | 32 | # Removing strings that are causing errors during evaluation, |
| 33 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 34 | ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" |
| 35 | ${json_response}= evaluate json.loads('''${response}''') json |
| 36 | |
| 37 | ${get_response}= Get validation result using GET request ${json_response[0]["executionId"]} |
| 38 | # Removing strings that are causing errors during evaluation, |
| 39 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 40 | ${get_response}= Remove String ${get_response} \\\\ \\u0027 |
| 41 | ${json_get_response}= evaluate json.loads('''${get_response}''') json |
| 42 | Should Be Equal As Strings ${json_get_response[0]["status"]} failed |
| 43 | ${errors_number}= Get Length ${json_get_response[0]["results"]} |
| 44 | Should Be Equal As Strings ${errors_number} 4 |
| 45 | FOR ${error} IN @{json_get_response[0]["results"]} |
| 46 | Should Contain ${error["code"]} R130206 |
| 47 | END |
Bartosz Gardziejewski | 3a55c90 | 2020-10-08 13:04:24 +0200 | [diff] [blame] | 48 | |
| 49 | Validate CSAR using all rule and use get method to receive outcome |
| 50 | [Documentation] Validate CSAR with invalid PM_Dictionary (r130206) using all rules, then use get method with validation id to receive valdiation outcome |
| 51 | |
| 52 | ${response}= Validate CSAR usign Post request ${csar_invalid_pm_dictionary} ${execute_invalid_pm_dictionary_validation} |
| 53 | # Removing strings that are causing errors during evaluation, |
| 54 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 55 | ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\" |
| 56 | ${json_response}= evaluate json.loads('''${response}''') json |
| 57 | |
| 58 | ${get_response}= Get validation result using GET request ${json_response[0]["executionId"]} |
| 59 | # Removing strings that are causing errors during evaluation, |
| 60 | # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes |
| 61 | ${get_response}= Remove String ${get_response} \\\\ \\u0027 \\u003c \\u003e \\" |
| 62 | ${json_get_response}= evaluate json.loads('''${get_response}''') json |
| 63 | Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} FAILED |
| 64 | FOR ${resault} IN @{json_response[0]["results"]["results"]} |
| 65 | Should Be Equal As Strings ${resault["warnings"]} [] |
| 66 | Run keyword if "${resault["vnfreqName"]}" == "r130206" |
| 67 | ... Should Be Equal As Strings ${resault["passed"]} False |
| 68 | END |