blob: b5634630645f7924ec48caed2981822c73e6da7f [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
2# Copyright ETSI Contributors and Others.
3#
4# All Rights Reserved.
5#
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
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
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
16# under the License.
17
18
19*** Settings ***
20Documentation Library providing keywords for building, validating and uploading tar.gz NS and VNF package files with OSM client.
21Library String
22Library OperatingSystem
23
24
25*** Variables ***
26${SUCCESS_RETURN_CODE} 0
27
28
29*** Keywords ***
30Upload Package
31 [Documentation] Onboards ("creates") a NF Package into OSM.
32 ... - Parameters:
33 ... - pkg: Name (and location) of the NF Package
34 [Arguments] ${pkg}
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} .
37 Log ${rc},${stdout}
38 ${rc} ${stdout}= Run And Return Rc And Output osm upload-package ${pkg}.tar.gz
39 Log ${rc},${stdout}
40 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
41 RETURN ${stdout}
42
43Delete Package
44 [Documentation] Delete a tar.gz package passed as argument from the filesystem.
45 [Arguments] ${pkg}
46 # Proceeds with the onboarding with the appropriate arguments
47 ${rc} ${stdout}= Run And Return Rc And Output rm ${pkg}.tar.gz
48 Log ${rc},${stdout}
49
50Package Build
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
58 RETURN ${package}
59
60Package Validate
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
67 RETURN ${package}