blob: b7d6cc3e7a697a48761064d05590b06d78591084 [file] [log] [blame]
garciaale0e696252020-09-24 18:04:27 +00001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
13*** Variables ***
14${success_return_code} 0
15
16
17*** Keywords ***
garciadeblas43f34482023-02-23 17:37:47 +010018Get Vnf List
19 ${rc} ${stdout}= Run and Return RC and Output osm vnf-list 2>&1
20 Log ${stdout}
21 Should Be Equal As Integers ${rc} ${success_return_code}
22 [Return] ${stdout}
23
24
garciaale0e696252020-09-24 18:04:27 +000025Get VNF VIM ID
26 [Arguments] ${vnf_id}
27
28 Should Not Be Empty ${vnf_id}
garciadeblas9553b6f2023-06-19 12:00:49 +020029 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[]."vim-id"'
garciadeblas321726f2022-12-21 11:43:06 +010030 Log ${stdout}
garciaale0e696252020-09-24 18:04:27 +000031 Should Be Equal As Integers ${rc} ${success_return_code}
garciadeblasf4ebaa82022-06-23 13:33:26 +020032 [Return] ${stdout}
Alexis Romerodd1b09d2022-03-16 06:51:43 +010033
34
35Get VDU list from VNF
36 [Documentation] Return a list of the VDUr ids for a VNF
37
38 [Arguments] ${vnf_id}
39
40 Should Not Be Empty ${vnf_id}
41 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[].id'
garciadeblas321726f2022-12-21 11:43:06 +010042 Log ${stdout}
Alexis Romerodd1b09d2022-03-16 06:51:43 +010043 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
44 @{vdur_ids}= Split String ${stdout}
45 [Return] @{vdur_ids}
46
47
48Get VDU VIM Id
49 [Documentation] Return the VIM VM ID for a VDU
50
51 [Arguments] ${vnf_id} ${vdur_id}
52
53 Should Not Be Empty ${vnf_id}
garciadeblas9553b6f2023-06-19 12:00:49 +020054 ${rc} ${vm_vim_id}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."vim-id"'
garciadeblas321726f2022-12-21 11:43:06 +010055 Log ${vm_vim_id}
Alexis Romerodd1b09d2022-03-16 06:51:43 +010056 Should Be Equal As Integers ${rc} ${success_return_code} msg=${vm_vim_id} values=False
57 [Return] ${vm_vim_id}
58
aguilard845c2ea2022-04-08 09:36:03 +000059
60Get Vnf Vdur IPs
garciadeblasf4ebaa82022-06-23 13:33:26 +020061 [Documentation] Return a list with the IP addresses of the VDU records of a VNF instance.
aguilard845c2ea2022-04-08 09:36:03 +000062
garciadeblasf4ebaa82022-06-23 13:33:26 +020063 [Arguments] ${vnf_id}
aguilard845c2ea2022-04-08 09:36:03 +000064
65 Should Not Be Empty ${vnf_id}
garciadeblas9553b6f2023-06-19 12:00:49 +020066 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[].interfaces[]."ip-address"'
garciadeblasf4ebaa82022-06-23 13:33:26 +020067 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
68 @{ip} = Split String ${stdout}
69 [Return] @{ip}
aguilard845c2ea2022-04-08 09:36:03 +000070
71
72Get Vdu Attribute
garciadeblasf4ebaa82022-06-23 13:33:26 +020073 [Documentation] Return an attribute from VDU records selected by count_index of a VNF instance.
aguilard845c2ea2022-04-08 09:36:03 +000074
garciadeblasf4ebaa82022-06-23 13:33:26 +020075 [Arguments] ${vnf_id} ${attribute} ${count_index}=0
aguilard845c2ea2022-04-08 09:36:03 +000076
77 Should Not Be Empty ${vnf_id}
78 Should Not Be Empty ${attribute}
garciadeblas9553b6f2023-06-19 12:00:49 +020079 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == ${count_index})' | yq -r '."${attribute}"'
garciadeblasf4ebaa82022-06-23 13:33:26 +020080 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
81 [Return] ${stdout}