| garciaale | 0e69625 | 2020-09-24 18:04:27 +0000 | [diff] [blame] | 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 |
| 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 *** |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 18 | Get 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 | |
| garciaale | 0e69625 | 2020-09-24 18:04:27 +0000 | [diff] [blame] | 25 | Get VNF VIM ID |
| 26 | [Arguments] ${vnf_id} |
| 27 | |
| 28 | Should Not Be Empty ${vnf_id} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame^] | 29 | ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[]."vim-id"' |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 30 | Log ${stdout} |
| garciaale | 0e69625 | 2020-09-24 18:04:27 +0000 | [diff] [blame] | 31 | Should Be Equal As Integers ${rc} ${success_return_code} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 32 | [Return] ${stdout} |
| Alexis Romero | dd1b09d | 2022-03-16 06:51:43 +0100 | [diff] [blame] | 33 | |
| 34 | |
| 35 | Get 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' |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 42 | Log ${stdout} |
| Alexis Romero | dd1b09d | 2022-03-16 06:51:43 +0100 | [diff] [blame] | 43 | 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 | |
| 48 | Get 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} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame^] | 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"' |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 55 | Log ${vm_vim_id} |
| Alexis Romero | dd1b09d | 2022-03-16 06:51:43 +0100 | [diff] [blame] | 56 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${vm_vim_id} values=False |
| 57 | [Return] ${vm_vim_id} |
| 58 | |
| aguilard | 845c2ea | 2022-04-08 09:36:03 +0000 | [diff] [blame] | 59 | |
| 60 | Get Vnf Vdur IPs |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 61 | [Documentation] Return a list with the IP addresses of the VDU records of a VNF instance. |
| aguilard | 845c2ea | 2022-04-08 09:36:03 +0000 | [diff] [blame] | 62 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 63 | [Arguments] ${vnf_id} |
| aguilard | 845c2ea | 2022-04-08 09:36:03 +0000 | [diff] [blame] | 64 | |
| 65 | Should Not Be Empty ${vnf_id} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame^] | 66 | ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[].interfaces[]."ip-address"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 67 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 68 | @{ip} = Split String ${stdout} |
| 69 | [Return] @{ip} |
| aguilard | 845c2ea | 2022-04-08 09:36:03 +0000 | [diff] [blame] | 70 | |
| 71 | |
| 72 | Get Vdu Attribute |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 73 | [Documentation] Return an attribute from VDU records selected by count_index of a VNF instance. |
| aguilard | 845c2ea | 2022-04-08 09:36:03 +0000 | [diff] [blame] | 74 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 75 | [Arguments] ${vnf_id} ${attribute} ${count_index}=0 |
| aguilard | 845c2ea | 2022-04-08 09:36:03 +0000 | [diff] [blame] | 76 | |
| 77 | Should Not Be Empty ${vnf_id} |
| 78 | Should Not Be Empty ${attribute} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame^] | 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}"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 80 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 81 | [Return] ${stdout} |