Moving robot-systests deprecated to tests
[osm/tests.git] / robot-systest / deprecated / testsuite / cli / TS013__Feature_1415_RBAC_Visibility_Of_Packages_And_Instances.robot
1 ##
2 # Copyright 2019 Tech Mahindra Limited
3 #
4 # All Rights Reserved.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
9 #
10 #         http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
16 # under the License.
17 ##
18
19 ## Change log:
20 # 1. Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 18-Dec-2019
21 ##
22
23 *** Settings ***
24 Documentation    Test RBAC for platform - Visibility of packages and instances test
25 Library     OperatingSystem
26 Library     String
27 Library     Collections
28 Resource    ../../lib/cli/rbac_lib.robot
29 Resource    ../../lib/cli/vnfd_lib.robot
30 Resource    ../../lib/cli/nsd_lib.robot
31 Resource    ../../lib/cli/ns_lib.robot
32 Resource    ../../lib/cli/vim_account_lib.robot
33 Library     ../../lib/custom_lib.py
34
35 Suite Setup    Prerequisite For Test
36 Suite Teardown  Run Keyword And Ignore Error    Test Cleanup
37
38
39 *** Variables ***
40 ${success_return_code}    0
41
42 @{vim}
43 @{vnfd_ids}
44 ${nsd_id}
45 @{nsd_ids}
46 @{ns_ids}
47 ${vnfdPckg}    hackfest_basic_vnf.tar.gz
48 ${nsdPckg}    hackfest_basic_ns.tar.gz
49 ${vnfdftpPath}    https://osm-download.etsi.org/ftp/osm-5.0-five/6th-hackfest/packages/hackfest_basic_vnf.tar.gz
50 ${nsdftpPath}    https://osm-download.etsi.org/ftp/osm-5.0-five/6th-hackfest/packages/hackfest_basic_ns.tar.gz
51
52 # Test data for Users Operations test
53 ${user_id}    ${EMPTY}
54
55 # Test data for Project Operations test
56 ${project_id}    ${EMPTY}
57
58
59 *** Test Cases ***
60 Create VIM Account For New User
61     [Documentation]  Test to create VIM account for newly created user
62     [Tags]  rabc    rabc_vim    comprehensive    nbi
63
64     Wait Until Keyword Succeeds    2x    30sec    VIM Setup To Launch Network Services
65
66
67 Create VNF Descriptor For New User
68     [Documentation]  Test to create vnfd for new user
69     [Tags]  rabc    rabc_vnfd    comprehensive    nbi
70
71     ${rc}   ${stdout}=      Run and Return RC and Output    wget -P '${CURDIR}${/}../../resource/cli/rbac/' ${vnfdftpPath}
72     ${vnfd_id}=    Create VNFD    '${CURDIR}${/}../../resource/cli/rbac${/}${vnfdPckg}'
73     Append To List     ${vnfd_ids}       ${vnfd_id}
74
75
76 Create NS Descriptor For New User
77     [Documentation]  Test to create nsd for new user
78     [Tags]  rabc    rabc_nsd    comprehensive    nbi
79
80     ${rc}   ${stdout}=      Run and Return RC and Output    wget -P '${CURDIR}${/}../../resource/cli/rbac/' ${nsdftpPath}
81     ${nsd_id}=    Create VNFD    '${CURDIR}${/}../../resource/cli/rbac${/}${nsdPckg}'
82     Append To List     ${nsd_ids}       ${nsd_id}
83
84
85 Instanciate Network Service For New User
86     [Documentation]  Launch network services for new user
87     [Tags]   rabc    rabc_ns    comprehensive    nbi
88
89     :FOR    ${vim_name}    IN    @{vim}
90     \    Launch Network Services and Return    ${vim_name}
91
92
93 Delete NS Instance Test
94     [Tags]    rabc    rabc_ns    comprehensive    nbi
95
96     :FOR    ${ns}  IN   @{ns_ids}
97     \   Delete NS   ${ns}
98
99
100 Delete NS Descriptor Test
101     [Tags]   rabc    rabc_nsd    comprehensive    nbi
102
103     :FOR    ${nsd}  IN   @{nsd_ids}
104     \   Delete NSD      ${nsd}
105
106
107 Delete VNF Descriptor Test
108     [Tags]   rabc    rabc_vnfd    comprehensive    nbi
109
110     :FOR    ${vnfd_id}  IN   @{vnfd_ids}
111     \   Delete VNFD     ${vnfd_id}
112
113
114 *** Keywords ***
115 Prerequisite For Test
116     ${user-name}=     Generate Random String    8    [NUMBERS]
117     ${user-name}=     Catenate  SEPARATOR=  user_  ${user-name}
118     set global variable  ${user-name}
119     ${user-password}=     Generate Random String    8    [NUMBERS]
120     set global variable  ${user-password}
121     ${user_id}=    Create User    ${user-name}    ${user-password}
122
123     ${project-name}=     Generate Random String    8    [NUMBERS]
124     ${project-name}=     Catenate  SEPARATOR=  project_  ${project-name}
125     set global variable  ${project-name}
126     ${project_id}=    Create Project    ${project-name}
127
128     &{update_field1}=    Create Dictionary    --add-project-role=admin,project_user
129     &{update_field2}=    Create Dictionary    --add-project-role=${project-name},account_manager
130     @{update_user}=    Create List    ${update_field1}    ${update_field2}
131     Update User And Verify Info    ${user-name}    @{update_user}
132     Login With User And Perform Operation    ${user-name}    ${user-password}    ${project-name}
133
134
135 Test Cleanup
136     [Documentation]  Test Suit Cleanup: Deliting Descriptor, instance and vim
137
138 #    :FOR    ${vim_id}  IN   @{vim}
139 #    \   Delete Vim Account    ${vim_id}
140
141     Logout and Login With Admin
142
143     Delete User    ${user-name}
144     Delete Project    ${project-name}