| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | ## |
| 4 | # Copyright 2019 Tech Mahindra Limited |
| 5 | # |
| 6 | # All Rights Reserved. |
| 7 | # |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | # not use this file except in compliance with the License. You may obtain |
| 10 | # a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 17 | # License for the specific language governing permissions and limitations |
| 18 | # under the License. |
| 19 | ## |
| 20 | |
| 21 | ## Change log: |
| 22 | # 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019 |
| 23 | ## |
| 24 | |
| 25 | *** Settings *** |
| 26 | Library String |
| 27 | |
| 28 | |
| 29 | *** Variables *** |
| 30 | ${success_return_code} 0 |
| garciadeblas | f8ea4a6 | 2021-04-18 23:08:17 +0200 | [diff] [blame] | 31 | ${failure_return_code} 1 |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 32 | ${delete_max_wait_time} 1min |
| 33 | ${delete_pol_time} 15sec |
| 34 | |
| 35 | |
| 36 | *** Keywords *** |
| 37 | Get VNFDs List |
| garciadeblas | f70f536 | 2020-09-29 15:38:47 +0000 | [diff] [blame] | 38 | ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 39 | log ${stdout} |
| 40 | log ${rc} |
| 41 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 42 | |
| 43 | |
| 44 | Create VNFD |
| ramonsalguer | 89edc07 | 2020-07-17 18:08:52 +0000 | [diff] [blame] | 45 | [Documentation] Onboards ("creates") a NF Package into OSM. |
| 46 | ... - Parameters: |
| 47 | ... - vnfd_pkg: Name (and location) of the NF Package |
| 48 | ... - overrides (optional): String with options to override the EPA and/or interface properties of the Package. |
| 49 | ... This is very useful to allow to deploy e.g. non-EPA packages in EPA VIMs (or vice-versa). |
| 50 | ... Valid strings are the same as in the command. E.g.: |
| 51 | ... - `--override-epa`: adds EPA attributes to all VDUs. |
| 52 | ... - `--override-nonepa`: removes all EPA attributes from all VDUs. |
| 53 | ... - `--override-paravirt`: converts all interfaces to `PARAVIRT`. This one can be combined with |
| 54 | ... the others above (e.g. '--override-nonepa --override-paravirt'). |
| 55 | ... - Relevant environment variables: |
| 56 | ... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument. |
| 57 | ... This is often more convenient to enforce the same behaviour for every test run in a given VIM. |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 58 | |
| ramonsalguer | 89edc07 | 2020-07-17 18:08:52 +0000 | [diff] [blame] | 59 | [Arguments] ${vnfd_pkg} ${overrides}=${EMPTY} |
| 60 | |
| 61 | # If env variable "OVERRIDES" exists, it prevails over the value in the argument |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 62 | ${overrides}= Get Environment Variable OVERRIDES default=${overrides} |
| ramonsalguer | 89edc07 | 2020-07-17 18:08:52 +0000 | [diff] [blame] | 63 | |
| 64 | # Proceedes with the onboarding with the appropriate arguments |
| garciadeblas | f70f536 | 2020-09-29 15:38:47 +0000 | [diff] [blame] | 65 | ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 66 | log ${stdout} |
| 67 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 68 | ${lines}= Get Line Count ${stdout} |
| 69 | ${last}= Evaluate ${lines} - 1 |
| 70 | ${id}= Get Line ${stdout} ${last} |
| 71 | [Return] ${id} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 72 | |
| 73 | |
| aticig | 6cd7480 | 2022-05-11 19:31:46 +0300 | [diff] [blame] | 74 | Update VNFD |
| 75 | [Documentation] Onboards ("Updates") a NF Package into OSM. |
| 76 | ... - Parameters: |
| 77 | ... - vnfd_pkg: Name (and location) of the NF Package |
| 78 | ... - vnfd_name: Name of the existing NF Package |
| 79 | |
| 80 | [Arguments] ${vnfd_pkg} ${vnfd_name} |
| 81 | |
| 82 | # Proceedes with the onboarding with the appropriate arguments |
| 83 | ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-update --content ${vnfd_pkg} ${vnfd_name} |
| 84 | log ${stdout} |
| 85 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 86 | ${lines}= Get Line Count ${stdout} |
| 87 | ${last}= Evaluate ${lines} - 1 |
| 88 | ${id}= Get Line ${stdout} ${last} |
| 89 | [Return] ${id} |
| aticig | 6cd7480 | 2022-05-11 19:31:46 +0300 | [diff] [blame] | 90 | |
| 91 | |
| aguilarherna | 9dca3a8 | 2021-03-24 16:59:34 +0100 | [diff] [blame] | 92 | Create VNFD Overriding Fields |
| 93 | [Documentation] Onboards ("creates") a NF Package into OSM. |
| 94 | ... - Parameters: |
| 95 | ... - vnfd_pkg: Name (and location) of the NF Package |
| 96 | ... - override_fields: String with options to override fields in descriptor, format: "key1.key2...=value[;key3...=value;...]" |
| 97 | ... - overrides (optional): String with options to override the EPA and/or interface properties of the Package. |
| 98 | ... This is very useful to allow to deploy e.g. non-EPA packages in EPA VIMs (or vice-versa). |
| 99 | ... Valid strings are the same as in the command. E.g.: |
| 100 | ... - `--override-epa`: adds EPA attributes to all VDUs. |
| 101 | ... - `--override-nonepa`: removes all EPA attributes from all VDUs. |
| 102 | ... - `--override-paravirt`: converts all interfaces to `PARAVIRT`. This one can be combined with |
| 103 | ... the others above (e.g. '--override-nonepa --override-paravirt'). |
| garciadeblas | 499c867 | 2021-03-25 11:51:08 +0100 | [diff] [blame] | 104 | ... - Relevant environment variables: |
| aguilarherna | 9dca3a8 | 2021-03-24 16:59:34 +0100 | [diff] [blame] | 105 | ... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument. |
| 106 | ... This is often more convenient to enforce the same behaviour for every test run in a given VIM. |
| 107 | |
| 108 | [Arguments] ${vnfd_pkg} ${override_fields} ${overrides}=${EMPTY} |
| 109 | |
| 110 | # If env variable "OVERRIDES" exists, it prevails over the value in the argument |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 111 | ${overrides}= Get Environment Variable OVERRIDES default=${overrides} |
| aguilarherna | 9dca3a8 | 2021-03-24 16:59:34 +0100 | [diff] [blame] | 112 | |
| 113 | # Proceedes with the onboarding with the appropriate arguments |
| 114 | ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg} --override '${override_fields}' |
| 115 | log ${stdout} |
| 116 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 117 | ${lines}= Get Line Count ${stdout} |
| 118 | ${last}= Evaluate ${lines} - 1 |
| 119 | ${id}= Get Line ${stdout} ${last} |
| 120 | [Return] ${id} |
| aguilarherna | 9dca3a8 | 2021-03-24 16:59:34 +0100 | [diff] [blame] | 121 | |
| 122 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 123 | Delete VNFD |
| 124 | [Arguments] ${vnfd_id} |
| 125 | |
| garciadeblas | f70f536 | 2020-09-29 15:38:47 +0000 | [diff] [blame] | 126 | ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-delete ${vnfd_id} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 127 | log ${stdout} |
| 128 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 129 | WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} |
| 130 | |
| 131 | |
| garciadeblas | 499c867 | 2021-03-25 11:51:08 +0100 | [diff] [blame] | 132 | Assert Failure Delete VNFD |
| 133 | [Documentation] Deletes a NF Package that cannot be deleted and asserts the failure |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 134 | [Arguments] ${vnfd_id} |
| 135 | |
| garciadeblas | 499c867 | 2021-03-25 11:51:08 +0100 | [diff] [blame] | 136 | ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-delete ${vnfd_id} |
| 137 | log ${stdout} |
| 138 | Should Be Equal As Integers ${rc} ${failure_return_code} |
| garciadeblas | f8ea4a6 | 2021-04-18 23:08:17 +0200 | [diff] [blame] | 139 | Should Contain ${stdout} 409 msg=Expected Conflict values=False |
| garciadeblas | 499c867 | 2021-03-25 11:51:08 +0100 | [diff] [blame] | 140 | WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} True |
| 141 | |
| 142 | |
| 143 | Check For VNFD |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 144 | [Arguments] ${vnfd_id} ${exists}=False |
| garciadeblas | 499c867 | 2021-03-25 11:51:08 +0100 | [diff] [blame] | 145 | |
| garciadeblas | f70f536 | 2020-09-29 15:38:47 +0000 | [diff] [blame] | 146 | ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list | awk '{print $2}' | grep ${vnfd_id} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 147 | Run Keyword If ${exists} Should Be Equal As Strings ${stdout} ${vnfd_id} |
| 148 | ... ELSE Should Not Be Equal As Strings ${stdout} ${vnfd_id} |
| garciadeblas | 499c867 | 2021-03-25 11:51:08 +0100 | [diff] [blame] | 149 | |