2 # Copyright ETSI Contributors and Others.
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
20 Documentation Library providing keywords for building, validating and uploading tar.gz NS and VNF package files with OSM client.
22 Library OperatingSystem
26 ${SUCCESS_RETURN_CODE} 0
31 [Documentation] Onboards ("creates") a NF Package into OSM.
33 ... - pkg: Name (and location) of the NF Package
35 # Proceeds with the onboarding with the appropriate arguments
36 ${rc} ${stdout}= Run And Return Rc And Output tar -czf ${pkg}.tar.gz -C ${pkg} .
38 ${rc} ${stdout}= Run And Return Rc And Output osm upload-package ${pkg}.tar.gz
40 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
44 [Documentation] Delete a tar.gz package passed as argument from the filesystem.
46 # Proceeds with the onboarding with the appropriate arguments
47 ${rc} ${stdout}= Run And Return Rc And Output rm ${pkg}.tar.gz
51 [Documentation] Build the package NS, VNF given the package_folder
52 [Arguments] ${pkg_folder} ${skip_charm_build}=${EMPTY}
53 ${skip_charm}= Set Variable If "${skip_charm_build}" != "${EMPTY}" "--skip-charm-build" ${EMPTY}
54 ${rc} ${stdout}= Run And Return Rc And Output osm package-build ${pkg_folder} ${skip_charm}
55 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
56 Should Contain ${stdout} Package created
57 ${package}= Get Line ${stdout} -1
61 [Documentation] Validate descriptors given a base directory
62 [Arguments] ${pkg_folder}
63 ${rc} ${stdout}= Run And Return Rc And Output osm package-validate ${pkg_folder} | awk -F\| '$2 !~ /-/ && $4 ~ /OK|ERROR/ {print $4}'
64 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
65 Should Contain ${stdout} 'OK'
66 ${package}= Get Line ${stdout} -1