blob: 35366e258aa13d82c0a938961287d9cb856000f2 [file] [log] [blame]
garciaaleda7fdb42020-07-17 17:24:54 -04001# 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
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
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.
12
13*** Variables ***
14${success_return_code} 0
15
16
17*** Keywords ***
garciaaledce1fa82020-07-22 22:14:08 +000018Create Project
19 [Arguments] ${project_name}
20
21 Should Not Be Empty ${project_name}
22 ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name}
23 Log ${stdout}
24 Should Be Equal As Integers ${rc} ${success_return_code}
garciadeblasf4ebaa82022-06-23 13:33:26 +020025 [Return] ${stdout}
garciaaledce1fa82020-07-22 22:14:08 +000026
27
garciaaleda7fdb42020-07-17 17:24:54 -040028Create Project With Quotas
29 [Arguments] ${project_name} ${project_quotas}
30
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}
34 Log ${stdout}
35 Should Be Equal As Integers ${rc} ${success_return_code}
garciadeblasf4ebaa82022-06-23 13:33:26 +020036 [Return] ${stdout}
garciaaleda7fdb42020-07-17 17:24:54 -040037
38
39Get Project Quotas
40 [Arguments] ${project_name} ${quotas_name}
41
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}'
45 Log ${stdout}
46 Should Be Equal As Integers ${rc} ${success_return_code}
garciadeblasf4ebaa82022-06-23 13:33:26 +020047 [Return] ${stdout}
garciaaleda7fdb42020-07-17 17:24:54 -040048
49
50Update Project Quotas
51 [Arguments] ${project_name} ${project_quotas}
52
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}
56 Log ${stdout}
57 Should Be Equal As Integers ${rc} ${success_return_code}
58
59
60Update Project Name
61 [Arguments] ${project_name} ${new_name}
62
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}
garciadeblas321726f2022-12-21 11:43:06 +010066 Log ${stdout}
garciaaleda7fdb42020-07-17 17:24:54 -040067 Should Be Equal As Integers ${rc} ${success_return_code}
68
69
70Check If User Is Assigned To Project
garciadeblasf4ebaa82022-06-23 13:33:26 +020071 [Arguments] ${user_name} ${project_name}
garciaaleda7fdb42020-07-17 17:24:54 -040072
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}"
76 Log ${stdout}
77 Should Be Equal As Integers ${rc} ${success_return_code}
78
79
80Create VNFD In Project
garciadeblasf4ebaa82022-06-23 13:33:26 +020081 [Documentation] Onboards a VNFD package into an OSM project.
garciaaleda7fdb42020-07-17 17:24:54 -040082 ... 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
83
84 [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} @{optional_parameters}
85
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}
90
garciadeblasf4ebaa82022-06-23 13:33:26 +020091 ${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}
garciaaleda7fdb42020-07-17 17:24:54 -040095 END
96
97 ${rc} ${stdout}= Run and Return RC and Output ${osm_pkg_create_command}
98 Log ${stdout}
99 Should Be Equal As Integers ${rc} ${success_return_code}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200100 [Return] ${stdout}
garciaaleda7fdb42020-07-17 17:24:54 -0400101
102
103Delete VNFD In Project
104 [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password}
105
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}
111 Log ${stdout}
112 Should Be Equal As Integers ${rc} ${success_return_code}
113
114
115Remove User From Project
garciadeblasf4ebaa82022-06-23 13:33:26 +0200116 [Arguments] ${user_name} ${project_name}
garciaaleda7fdb42020-07-17 17:24:54 -0400117
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}
121 Log ${stdout}
122 Should Be Equal As Integers ${rc} ${success_return_code}
123
124
125Delete Project
garciadeblasf4ebaa82022-06-23 13:33:26 +0200126 [Arguments] ${project_name}
garciaaleda7fdb42020-07-17 17:24:54 -0400127
128 ${rc} ${stdout}= Run and Return RC and Output osm project-delete ${project_name}
129 Log ${stdout}
130 Should Be Equal As Integers ${rc} ${success_return_code}