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 [Arguments] ${project_name}
21 Should Not Be Empty ${project_name}
22 ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name}
24 Should Be Equal As Integers ${rc} ${success_return_code}
28 Create Project With Quotas
29 [Arguments] ${project_name} ${project_quotas}
31 Should Not Be Empty ${project_name}
32 Should Not Be Empty ${project_quotas}
33 ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name} --quotas ${project_quotas}
35 Should Be Equal As Integers ${rc} ${success_return_code}
40 [Arguments] ${project_name} ${quotas_name}
42 Should Not Be Empty ${project_name}
43 Should Not Be Empty ${quotas_name}
44 ${rc} ${stdout}= Run and Return RC and Output osm project-show ${project_name} | grep '${quotas_name}' | awk -F ',|: ' '{print $2}' | awk '{print $1}'
46 Should Be Equal As Integers ${rc} ${success_return_code}
51 [Arguments] ${project_name} ${project_quotas}
53 Should Not Be Empty ${project_name}
54 Should Not Be Empty ${project_quotas}
55 ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --quotas ${project_quotas}
57 Should Be Equal As Integers ${rc} ${success_return_code}
61 [Arguments] ${project_name} ${new_name}
63 Should Not Be Empty ${project_name}
64 Should Not Be Empty ${new_name}
65 ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --name ${new_name}
67 Should Be Equal As Integers ${rc} ${success_return_code}
70 Check If User Is Assigned To Project
71 [Arguments] ${user_name} ${project_name}
73 Should Not Be Empty ${user_name}
74 Should Not Be Empty ${project_name}
75 ${rc} ${stdout}= Run And Return RC And Output osm user-show ${user_name} | grep "project_name" | grep "${project_name}"
77 Should Be Equal As Integers ${rc} ${success_return_code}
80 Create VNFD In Project
81 [Documentation] Onboards a VNFD package into an OSM project.
82 ... Extra parameters (such as 'override') are given to this function in name=value format. These parameters will be appended to the 'osm vnfpkg-create' command with the next syntax: --param_name=param_value
84 [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} @{optional_parameters}
86 Should Not Be Empty ${project_name}
87 Should Not Be Empty ${vnfd_pkg}
88 Should Not Be Empty ${project_user}
89 Should Not Be Empty ${user_password}
91 ${osm_pkg_create_command}= Set Variable osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-create ${vnfd_pkg}
92 FOR ${param} IN @{optional_parameters}
93 ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
94 ${osm_pkg_create_command}= Catenate ${osm_pkg_create_command} --${param_name}=${param_value}
97 ${rc} ${stdout}= Run and Return RC and Output ${osm_pkg_create_command}
99 Should Be Equal As Integers ${rc} ${success_return_code}
103 Delete VNFD In Project
104 [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password}
106 Should Not Be Empty ${project_name}
107 Should Not Be Empty ${vnfd_pkg}
108 Should Not Be Empty ${project_user}
109 Should Not Be Empty ${user_password}
110 ${rc} ${stdout}= Run and Return RC and Output osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-delete ${vnfd_pkg}
112 Should Be Equal As Integers ${rc} ${success_return_code}
115 Remove User From Project
116 [Arguments] ${user_name} ${project_name}
118 Should Not Be Empty ${user_name}
119 Should Not Be Empty ${project_name}
120 ${rc} ${stdout}= Run And Return RC And Output osm user-update ${user_name} --remove-project ${project_name}
122 Should Be Equal As Integers ${rc} ${success_return_code}
126 [Arguments] ${project_name}
128 ${rc} ${stdout}= Run and Return RC and Output osm project-delete ${project_name}
130 Should Be Equal As Integers ${rc} ${success_return_code}