blob: fc844365b8a5439cda3fa19575e22f02b0087438 [file] [log] [blame]
Felipe Vicensf96bb452020-06-22 08:12:30 +02001# -*- 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 ***
26Library String
27
28
29*** Variables ***
30${success_return_code} 0
31${delete_max_wait_time} 1min
32${delete_pol_time} 15sec
33
34
35*** Keywords ***
36Get VNFDs List
garciadeblasf70f5362020-09-29 15:38:47 +000037 ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list
Felipe Vicensf96bb452020-06-22 08:12:30 +020038 log ${stdout}
39 log ${rc}
40 Should Be Equal As Integers ${rc} ${success_return_code}
41
42
43Create VNFD
ramonsalguer89edc072020-07-17 18:08:52 +000044 [Documentation] Onboards ("creates") a NF Package into OSM.
45 ... - Parameters:
46 ... - vnfd_pkg: Name (and location) of the NF Package
47 ... - overrides (optional): String with options to override the EPA and/or interface properties of the Package.
48 ... This is very useful to allow to deploy e.g. non-EPA packages in EPA VIMs (or vice-versa).
49 ... Valid strings are the same as in the command. E.g.:
50 ... - `--override-epa`: adds EPA attributes to all VDUs.
51 ... - `--override-nonepa`: removes all EPA attributes from all VDUs.
52 ... - `--override-paravirt`: converts all interfaces to `PARAVIRT`. This one can be combined with
53 ... the others above (e.g. '--override-nonepa --override-paravirt').
54 ... - Relevant environment variables:
55 ... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument.
56 ... This is often more convenient to enforce the same behaviour for every test run in a given VIM.
Felipe Vicensf96bb452020-06-22 08:12:30 +020057
ramonsalguer89edc072020-07-17 18:08:52 +000058 [Arguments] ${vnfd_pkg} ${overrides}=${EMPTY}
59
60 # If env variable "OVERRIDES" exists, it prevails over the value in the argument
61 ${overrides}= Get Environment Variable OVERRIDES default=${overrides}
62
63 # Proceedes with the onboarding with the appropriate arguments
garciadeblasf70f5362020-09-29 15:38:47 +000064 ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg}
Felipe Vicensf96bb452020-06-22 08:12:30 +020065 log ${stdout}
66 Should Be Equal As Integers ${rc} ${success_return_code}
67 ${lines}= Get Line Count ${stdout}
68 ${last}= Evaluate ${lines} - 1
69 ${id}= Get Line ${stdout} ${last}
70 [Return] ${id}
71
72
aguilarherna9dca3a82021-03-24 16:59:34 +010073Create VNFD Overriding Fields
74 [Documentation] Onboards ("creates") a NF Package into OSM.
75 ... - Parameters:
76 ... - vnfd_pkg: Name (and location) of the NF Package
77 ... - override_fields: String with options to override fields in descriptor, format: "key1.key2...=value[;key3...=value;...]"
78 ... - overrides (optional): String with options to override the EPA and/or interface properties of the Package.
79 ... This is very useful to allow to deploy e.g. non-EPA packages in EPA VIMs (or vice-versa).
80 ... Valid strings are the same as in the command. E.g.:
81 ... - `--override-epa`: adds EPA attributes to all VDUs.
82 ... - `--override-nonepa`: removes all EPA attributes from all VDUs.
83 ... - `--override-paravirt`: converts all interfaces to `PARAVIRT`. This one can be combined with
84 ... the others above (e.g. '--override-nonepa --override-paravirt').
85 ... - Relevant environment variables:
86 ... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument.
87 ... This is often more convenient to enforce the same behaviour for every test run in a given VIM.
88
89 [Arguments] ${vnfd_pkg} ${override_fields} ${overrides}=${EMPTY}
90
91 # If env variable "OVERRIDES" exists, it prevails over the value in the argument
92 ${overrides}= Get Environment Variable OVERRIDES default=${overrides}
93
94 # Proceedes with the onboarding with the appropriate arguments
95 ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg} --override '${override_fields}'
96 log ${stdout}
97 Should Be Equal As Integers ${rc} ${success_return_code}
98 ${lines}= Get Line Count ${stdout}
99 ${last}= Evaluate ${lines} - 1
100 ${id}= Get Line ${stdout} ${last}
101 [Return] ${id}
102
103
Felipe Vicensf96bb452020-06-22 08:12:30 +0200104Delete VNFD
105 [Arguments] ${vnfd_id}
106
garciadeblasf70f5362020-09-29 15:38:47 +0000107 ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-delete ${vnfd_id}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200108 log ${stdout}
109 Should Be Equal As Integers ${rc} ${success_return_code}
110 WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id}
111
112
113Check For VNFD
114 [Arguments] ${vnfd_id}
115
garciadeblasf70f5362020-09-29 15:38:47 +0000116 ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list | awk '{print $2}' | grep ${vnfd_id}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200117 Should Not Be Equal As Strings ${stdout} ${vnfd_id}