| romeromonser | 4edf733 | 2020-04-02 15:54:38 +0200 | [diff] [blame] | 1 | # -*- 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 | |
| limon | d624cda | 2020-06-01 16:28:40 +0200 | [diff] [blame] | 25 | *** Settings *** |
| 26 | Library String |
| 27 | |
| 28 | |
| romeromonser | 4edf733 | 2020-04-02 15:54:38 +0200 | [diff] [blame] | 29 | *** Variables *** |
| 30 | ${success_return_code} 0 |
| 31 | ${delete_max_wait_time} 1min |
| 32 | ${delete_pol_time} 15sec |
| 33 | |
| 34 | |
| 35 | *** Keywords *** |
| 36 | Get VNFDs List |
| 37 | ${rc} ${stdout}= Run and Return RC and Output osm vnfd-list |
| 38 | log ${stdout} |
| 39 | log ${rc} |
| 40 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 41 | |
| 42 | |
| 43 | Create VNFD |
| 44 | [Arguments] ${vnfd_pkg} |
| 45 | |
| 46 | ${rc} ${stdout}= Run and Return RC and Output osm vnfd-create ${vnfd_pkg} |
| 47 | log ${stdout} |
| 48 | Should Be Equal As Integers ${rc} ${success_return_code} |
| limon | d624cda | 2020-06-01 16:28:40 +0200 | [diff] [blame] | 49 | ${lines}= Get Line Count ${stdout} |
| 50 | ${last}= Evaluate ${lines} - 1 |
| 51 | ${id}= Get Line ${stdout} ${last} |
| 52 | [Return] ${id} |
| romeromonser | 4edf733 | 2020-04-02 15:54:38 +0200 | [diff] [blame] | 53 | |
| 54 | |
| 55 | Delete VNFD |
| 56 | [Arguments] ${vnfd_id} |
| 57 | |
| 58 | ${rc} ${stdout}= Run and Return RC and Output osm vnfd-delete ${vnfd_id} |
| 59 | log ${stdout} |
| 60 | Should Be Equal As Integers ${rc} ${success_return_code} |
| 61 | WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} |
| 62 | |
| 63 | |
| 64 | Check For VNFD |
| 65 | [Arguments] ${vnfd_id} |
| 66 | |
| 67 | ${rc} ${stdout}= Run and Return RC and Output osm vnfd-list | awk '{print $2}' | grep ${vnfd_id} |
| 68 | Should Not Be Equal As Strings ${stdout} ${vnfd_id} |