Feature 11001: Robot framework linting for E2E tests
[osm/tests.git] / robot-systest / testsuite / basic_32-volume_with_different_az.robot
1 *** Comments ***
2 #   Licensed under the Apache License, Version 2.0 (the "License");
3 #   you may not use this file except in compliance with the License.
4 #   You may obtain a copy of the License at
5 #
6 #       http://www.apache.org/licenses/LICENSE-2.0
7 #
8 #   Unless required by applicable law or agreed to in writing, software
9 #   distributed under the License is distributed on an "AS IS" BASIS,
10 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 #   See the License for the specific language governing permissions and
12 #   limitations under the License.
13
14
15 *** Settings ***
16 Documentation   [BASIC-32] Basic NS with a volume in different availability zone
17
18 Library   OperatingSystem
19 Library   String
20 Library   Collections
21 Library   Process
22 Library   SSHLibrary
23
24 Resource   ../lib/vim_lib.resource
25 Resource   ../lib/prometheus_lib.resource
26 Resource   ../lib/vnfd_lib.resource
27 Resource   ../lib/nsd_lib.resource
28 Resource   ../lib/ns_lib.resource
29
30 Variables   ../resources/basic_32-volume_with_different_az.py
31
32 Test Tags   basic_32
33
34 Suite Setup   Run Keyword And Ignore Error   Suite Preparation
35
36
37 *** Variables ***
38 # NS and VNF descriptor package folder and ids
39 ${VNFD_PKG}   several_volumes_vnf
40 ${VNFD_NAME}   several_volumes-vnf
41 ${NSD_PKG}   several_volumes_ns
42 ${NSD_NAME}   several_volumes-ns
43
44 # NS instance name and configuration
45 ${NS_NAME}   basic_32
46 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
47
48 # SSH keys and username to be used
49 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
50
51
52 *** Test Cases ***
53 Create VIM Target Basic
54     [Documentation]   Create a VIM Target only with the az parameters.
55     ...               Checks the status of the VIM in Prometheus after it creation.
56
57     Pass Execution If   '${VIM_ACCOUNT_TYPE}' != 'openstack'   Not applicable for ${VIM_ACCOUNT_TYPE} VIM
58     ${rand}=   Generate Random String   6   [NUMBERS]
59     ${VIM_NAME_AZ}=   Catenate   SEPARATOR=_   ${VIM_NAME_PREFIX}   ${rand}
60     Set Suite Variable   ${VIM_NAME_AZ}
61     ${CREATED_VIM_ACCOUNT_ID}=   Create VIM Target   ${VIM_NAME_AZ}   ${VIM_USER}   ${VIM_PASSWORD}   ${VIM_AUTH_URL}   ${VIM_TENANT}   ${VIM_ACCOUNT_TYPE}   config=${VIM_CONFIG}
62     Set Suite Variable   ${CREATED_VIM_ACCOUNT_ID}
63
64 Create VNF Descriptor
65     [Documentation]   Upload VNF package for the testsuite.
66     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
67
68 Create NS Descriptor
69     [Documentation]   Upload NS package for the testsuite.
70     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
71
72 Network Service Instance Test
73     [Documentation]   Instantiate NS for the testsuite.
74     [Tags]   prepare
75     ${id}=   Create Network Service   ${NSD_NAME}   ${VIM_NAME_AZ}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}
76     Set Suite Variable   ${NS_ID}   ${id}
77
78 Delete NS Instance Test
79     [Documentation]   Delete NS instance.
80     [Tags]   cleanup
81     Delete NS   ${NS_NAME}
82
83 Delete NS Descriptor Test
84     [Documentation]   Delete NS package from OSM.
85     [Tags]   cleanup
86     Delete NSD   ${NSD_NAME}
87
88 Delete VNF Descriptor Test
89     [Documentation]   Delete VNF package from OSM.
90     [Tags]   cleanup
91
92     Delete VNFD   ${VNFD_NAME}
93
94 Delete VIM Target By ID
95     [Documentation]   Delete the VIM Target created in previous test-case by its ID.
96     ...               Checks whether the VIM Target was created or not before perform the deletion.
97     [Tags]   cleanup
98
99     ${vim_account_id}=   Get VIM Target ID   ${VIM_NAME_AZ}
100     Should Be Equal As Strings   ${vim_account_id}   ${CREATED_VIM_ACCOUNT_ID}
101     Delete VIM Target   ${vim_account_id}
102
103
104 *** Keywords ***
105 Suite Preparation
106     [Documentation]   Test Suite Preparation: Setting Prometheus Testsuite Variables
107     Set Testsuite Prometheus Variables
108
109 Suite Cleanup
110     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
111     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
112     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
113     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}