blob: a9d3804b280f1b84a445917ec2062ac5d79ce93a [file] [log] [blame]
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +02001# -*- coding: utf-8 -*-
2
3##
garciadeblasfad22462022-06-25 18:19:04 +02004# Copyright ETSI Contributors and Others.
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +02005#
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 Fleischmanna07c2b32020-07-31 15:17:26 +020021*** Settings ***
22Library String
garciadeblasfad22462022-06-25 18:19:04 +020023Library OperatingSystem
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020024
25
26*** Variables ***
27${success_return_code} 0
28${delete_max_wait_time} 1min
29${delete_pol_time} 15sec
30
31
32*** Keywords ***
33Upload 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
garciadeblas321726f2022-12-21 11:43:06 +010043 Log ${stdout}
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020044 Should Be Equal As Integers ${rc} ${success_return_code}
garciadeblasf4ebaa82022-06-23 13:33:26 +020045 [Return] ${stdout}
Dominik Fleischmanna07c2b32020-07-31 15:17:26 +020046
47
48Delete 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
garciadeblasfad22462022-06-25 18:19:04 +020053
54
55Package 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
69Package 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