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
18 Create Project With Quotas
19 [Arguments] ${project_name} ${project_quotas}
21 Should Not Be Empty ${project_name}
22 Should Not Be Empty ${project_quotas}
23 ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name} --quotas ${project_quotas}
25 Should Be Equal As Integers ${rc} ${success_return_code}
30 [Arguments] ${project_name} ${quotas_name}
32 Should Not Be Empty ${project_name}
33 Should Not Be Empty ${quotas_name}
34 ${rc} ${stdout}= Run and Return RC and Output osm project-show ${project_name} | grep '${quotas_name}' | awk -F ',|: ' '{print $2}' | awk '{print $1}'
36 Should Be Equal As Integers ${rc} ${success_return_code}
41 [Arguments] ${project_name} ${project_quotas}
43 Should Not Be Empty ${project_name}
44 Should Not Be Empty ${project_quotas}
45 ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --quotas ${project_quotas}
47 Should Be Equal As Integers ${rc} ${success_return_code}
51 [Arguments] ${project_name} ${new_name}
53 Should Not Be Empty ${project_name}
54 Should Not Be Empty ${new_name}
55 ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --name ${new_name}
57 Should Be Equal As Integers ${rc} ${success_return_code}
60 Check If User Is Assigned To Project
61 [Arguments] ${user_name} ${project_name}
63 Should Not Be Empty ${user_name}
64 Should Not Be Empty ${project_name}
65 ${rc} ${stdout}= Run And Return RC And Output osm user-show ${user_name} | grep "project_name" | grep "${project_name}"
67 Should Be Equal As Integers ${rc} ${success_return_code}
70 Create VNFD In Project
71 [Documentation] Onboards a VNFD package into an OSM project.
72 ... 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
74 [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} @{optional_parameters}
76 Should Not Be Empty ${project_name}
77 Should Not Be Empty ${vnfd_pkg}
78 Should Not Be Empty ${project_user}
79 Should Not Be Empty ${user_password}
81 ${osm_pkg_create_command}= Set Variable osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-create ${vnfd_pkg}
82 FOR ${param} IN @{optional_parameters}
83 ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters
84 ${osm_pkg_create_command}= Catenate ${osm_pkg_create_command} --${param_name}=${param_value}
87 ${rc} ${stdout}= Run and Return RC and Output ${osm_pkg_create_command}
89 Should Be Equal As Integers ${rc} ${success_return_code}
93 Delete VNFD In Project
94 [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password}
96 Should Not Be Empty ${project_name}
97 Should Not Be Empty ${vnfd_pkg}
98 Should Not Be Empty ${project_user}
99 Should Not Be Empty ${user_password}
100 ${rc} ${stdout}= Run and Return RC and Output osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-delete ${vnfd_pkg}
102 Should Be Equal As Integers ${rc} ${success_return_code}
105 Remove User From Project
106 [Arguments] ${user_name} ${project_name}
108 Should Not Be Empty ${user_name}
109 Should Not Be Empty ${project_name}
110 ${rc} ${stdout}= Run And Return RC And Output osm user-update ${user_name} --remove-project ${project_name}
112 Should Be Equal As Integers ${rc} ${success_return_code}
116 [Arguments] ${project_name}
118 ${rc} ${stdout}= Run and Return RC and Output osm project-delete ${project_name}
120 Should Be Equal As Integers ${rc} ${success_return_code}