1 # 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
5 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 ${success_return_code} 0
19 ${rc} ${stdout}= Run and Return RC and Output osm vnf-list 2>&1
21 Should Be Equal As Integers ${rc} ${success_return_code}
28 Should Not Be Empty ${vnf_id}
29 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[]."vim-id"'
31 Should Be Equal As Integers ${rc} ${success_return_code}
36 [Documentation] Return a list of the VDUr ids for a VNF
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'
43 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
44 @{vdur_ids}= Split String ${stdout}
49 [Documentation] Return the VIM VM ID for a VDU
51 [Arguments] ${vnf_id} ${vdur_id}
53 Should Not Be Empty ${vnf_id}
54 ${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"'
56 Should Be Equal As Integers ${rc} ${success_return_code} msg=${vm_vim_id} values=False
61 [Documentation] Return a list with the IP addresses of the VDU records of a VNF instance.
65 Should Not Be Empty ${vnf_id}
66 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[].interfaces[]."ip-address"'
67 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
68 @{ip} = Split String ${stdout}
73 [Documentation] Return an attribute from VDU records selected by count_index of a VNF instance.
75 [Arguments] ${vnf_id} ${attribute} ${count_index}=0
77 Should Not Be Empty ${vnf_id}
78 Should Not Be Empty ${attribute}
79 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == ${count_index})' | yq -r '."${attribute}"'
80 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False