Moving robot-systests deprecated to tests
[osm/tests.git] / robot-systest / deprecated / lib / cli / osm_package_tools_lib.robot
1 # All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14 ##
15
16 ## Change log:
17 # 1. Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 18-Dec-2019
18 ##
19
20 *** Keywords ***
21 Create OSM NS Package
22     [Arguments]  ${pkg_name}
23     ${ns_pkg}=    Catenate      SEPARATOR=_     ${pkg_name}      ns
24     ${ns_yaml}=   Catenate      SEPARATOR=_     ${pkg_name}      nsd
25     ${ns_yaml}=   Catenate      SEPARATOR=.     ${ns_yaml}      yaml
26     ${nsd_path}=    Join Path    ${ns_pkg}    ${ns_yaml}
27     ${rc}   ${stdout}=      Run and Return RC and Output    osm package-create ns ${pkg_name}
28     Should Be Equal As Integers    ${rc}    ${success_return_code}
29     File Should Exist    ${nsd_path}
30     log  ${stdout}
31
32
33 Create OSM VNF Package
34     [Arguments]  ${pkg_name}
35     ${vnf_pkg}=    Catenate    SEPARATOR=_     ${pkg_name}      vnf
36     ${vnf_yaml}=   Catenate        SEPARATOR=_     ${pkg_name}      vnfd
37     ${vnf_yaml}=   Catenate        SEPARATOR=.     ${vnf_yaml}      yaml
38     ${vnfd_path}=    Join Path    ${vnf_pkg}    ${vnf_yaml}
39     ${rc}   ${stdout}=      Run and Return RC and Output    osm package-create vnf ${pkg_name}
40     Should Be Equal As Integers    ${rc}    ${success_return_code}
41     File Should Exist    ${vnfd_path}
42     log  ${stdout}
43
44
45 Validate OSM NS Package
46     [Arguments]  ${pkg_name}
47     ${ns_pkg}=    Catenate      SEPARATOR=_     ${pkg_name}      ns
48     ${rc}   ${stdout}=      Run and Return RC and Output    osm package-validate ${ns_pkg}
49     Should Be Equal As Integers    ${rc}    ${success_return_code}
50     Verify Package Validation Result    ${ns_pkg}
51     log  ${stdout}
52
53
54 Validate OSM VNF Package
55     [Arguments]  ${pkg_name}
56     ${vnf_pkg}=         Catenate        SEPARATOR=_     ${pkg_name}      vnf
57     ${rc}   ${stdout}=      Run and Return RC and Output    osm package-validate ${vnf_pkg}
58     Should Be Equal As Integers    ${rc}    ${success_return_code}
59     Verify Package Validation Result    ${vnf_pkg}
60     log  ${stdout}
61
62
63 Verify Package Validation Result
64     [Arguments]  ${pkg}
65     ${rc}   ${stdout}=      Run and Return RC and Output    osm package-validate ${pkg} | awk 'NR==6{print $6}'
66     Should Be Equal As Integers    ${rc}    ${success_return_code}
67     Should Not Contain    ${stdout}    ERROR
68     log  ${stdout}
69
70
71 Build OSM VNF Package
72     [Arguments]  ${pkg_name}
73     ${vnf_pkg}=         Catenate        SEPARATOR=_     ${pkg_name}      vnf
74     ${vnf_pkg_tar}=     Catenate        SEPARATOR=.     ${vnf_pkg}      tar    gz
75     ${rc}   ${stdout}=      Run and Return RC and Output    osm package-build ${vnf_pkg}
76     Should Be Equal As Integers    ${rc}    ${success_return_code}
77     File Should Exist    ${vnf_pkg_tar}
78     log  ${stdout}
79
80
81 Build OSM NS Package
82     [Arguments]  ${pkg_name}
83     ${ns_pkg}=    Catenate        SEPARATOR=_     ${pkg_name}      ns
84     ${ns_pkg_tar}=        Catenate        SEPARATOR=.     ${ns_pkg}      tar    gz
85     ${rc}   ${stdout}=      Run and Return RC and Output    osm package-build ${ns_pkg}
86     Should Be Equal As Integers    ${rc}    ${success_return_code}
87     File Should Exist    ${ns_pkg_tar}
88     log  ${stdout}