828ea0a1f735dce29f0dadcf2127427487dd5fee
[osm/devops.git] / robot-systest / lib / vnfd_lib.robot
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
25 *** Variables ***
26 ${success_return_code}   0
27 ${delete_max_wait_time}   1min
28 ${delete_pol_time}   15sec
29
30
31 *** Keywords ***
32 Get VNFDs List
33     ${rc}   ${stdout}=   Run and Return RC and Output   osm vnfd-list
34     log   ${stdout}
35     log   ${rc}
36     Should Be Equal As Integers   ${rc}   ${success_return_code}
37
38
39 Create VNFD
40     [Arguments]   ${vnfd_pkg}
41
42     ${rc}   ${stdout}=   Run and Return RC and Output   osm vnfd-create ${vnfd_pkg}
43     log   ${stdout}
44     Should Be Equal As Integers   ${rc}   ${success_return_code}
45     [Return]  ${stdout}
46
47
48 Delete VNFD
49     [Arguments]   ${vnfd_id}
50
51     ${rc}   ${stdout}=   Run and Return RC and Output   osm vnfd-delete ${vnfd_id}
52     log   ${stdout}
53     Should Be Equal As Integers   ${rc}   ${success_return_code}
54     WAIT UNTIL KEYWORD SUCCEEDS   ${delete_max_wait_time}   ${delete_pol_time}   Check For VNFD   ${vnfd_id}
55
56
57 Check For VNFD
58     [Arguments]   ${vnfd_id}
59
60     ${rc}   ${stdout}=   Run and Return RC and Output   osm vnfd-list | awk '{print $2}' | grep ${vnfd_id}
61     Should Not Be Equal As Strings   ${stdout}   ${vnfd_id}