| Dominik Fleischmann | a07c2b3 | 2020-07-31 15:17:26 +0200 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | ## |
| garciadeblas | fad2246 | 2022-06-25 18:19:04 +0200 | [diff] [blame] | 4 | # Copyright ETSI Contributors and Others. |
| Dominik Fleischmann | a07c2b3 | 2020-07-31 15:17:26 +0200 | [diff] [blame] | 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 | |
| Dominik Fleischmann | a07c2b3 | 2020-07-31 15:17:26 +0200 | [diff] [blame] | 21 | *** Settings *** |
| 22 | Library String |
| garciadeblas | fad2246 | 2022-06-25 18:19:04 +0200 | [diff] [blame] | 23 | Library OperatingSystem |
| Dominik Fleischmann | a07c2b3 | 2020-07-31 15:17:26 +0200 | [diff] [blame] | 24 | |
| 25 | |
| 26 | *** Variables *** |
| 27 | ${success_return_code} 0 |
| 28 | ${delete_max_wait_time} 1min |
| 29 | ${delete_pol_time} 15sec |
| 30 | |
| 31 | |
| 32 | *** Keywords *** |
| 33 | Upload Package |
| 34 | [Documentation] Onboards ("creates") a NF Package into OSM. |
| 35 | ... - Parameters: |
| 36 | ... - pkg: Name (and location) of the NF Package |
| 37 | |
| 38 | [Arguments] ${pkg} |
| 39 | |
| 40 | # Proceedes with the onboarding with the appropriate arguments |
| 41 | ${rc} ${stdout}= Run and Return RC and Output tar -czf ${pkg}.tar.gz -C ${pkg} . |
| 42 | ${rc} ${stdout}= Run and Return RC and Output osm upload-package ${pkg}.tar.gz |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 43 | Log ${stdout} |
| Dominik Fleischmann | a07c2b3 | 2020-07-31 15:17:26 +0200 | [diff] [blame] | 44 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 45 | [Return] ${stdout} |
| Dominik Fleischmann | a07c2b3 | 2020-07-31 15:17:26 +0200 | [diff] [blame] | 46 | |
| 47 | |
| 48 | Delete Package |
| 49 | [Arguments] ${pkg} |
| 50 | |
| 51 | # Proceedes with the onboarding with the appropriate arguments |
| 52 | ${rc} ${stdout}= Run and Return RC and Output rm ${pkg}.tar.gz |
| garciadeblas | fad2246 | 2022-06-25 18:19:04 +0200 | [diff] [blame] | 53 | |
| 54 | |
| 55 | Package Build |
| 56 | [Documentation] Build the package NS, VNF given the package_folder |
| 57 | |
| 58 | [Arguments] ${pkg_folder} ${skip_charm_build}=${EMPTY} |
| 59 | |
| 60 | ${skip_charm} Set Variable If '${skip_charm_build}'!='${EMPTY}' --skip-charm-build \ |
| 61 | ${rc} ${stdout}= Run and Return RC and Output osm package-build ${pkg_folder} ${skip_charm} |
| 62 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 63 | Should Contain ${stdout} Package created |
| 64 | ${package}= Get Line ${stdout} -1 |
| 65 | |
| 66 | [Return] ${package} |
| 67 | |
| 68 | |
| 69 | Package Validate |
| 70 | [Documentation] Validate descriptors given a base directory |
| 71 | |
| 72 | [Arguments] ${pkg_folder} |
| 73 | ${rc} ${stdout}= Run and Return RC and Output osm package-validate ${pkg_folder} | awk -F\| '$2 !~ /-/ && $4 ~ /OK|ERROR/ {print $4}' |
| 74 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 75 | Should Contain ${stdout} 'OK' |
| 76 | ${package}= Get Line ${stdout} -1 |
| 77 | |
| 78 | [Return] ${package} |
| 79 | |