Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / basic_27-update_helm_ee_in_running_vnf_instance.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-27] Update Helm EE in Running VNF Instance.
17
18 Library   OperatingSystem
19 Library   SSHLibrary
20
21 Resource   ../lib/vnfd_lib.resource
22 Resource   ../lib/nsd_lib.resource
23 Resource   ../lib/ns_lib.resource
24 Resource   ../lib/ns_operation_lib.resource
25 Resource   ../lib/ssh_lib.resource
26
27 Test Tags   basic_27   cluster_ee_config   daily   regression
28
29 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
30
31
32 *** Variables ***
33 # NS and VNF descriptor package folder and ids
34 ${VNFD_PKG}   simple_ee_vnf
35 ${UPDATED_VNFD_PKG}   updated_simple_ee_vnf
36 ${VNFD_NAME}   simple_ee-vnf
37 ${NSD_PKG}   simple_ee_ns
38 ${NSD_NAME}   simple_ee-ns
39
40 # NS instance name and configuration
41 ${NS_NAME}   basic_27_helm_ee_update_test
42 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
43
44 # SSH keys and username to be used
45 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
46 ${PRIVATEKEY}   %{HOME}/.ssh/id_rsa
47 ${USERNAME}   ubuntu
48 ${PASSWORD}   ${EMPTY}
49
50 ${ACTION_NAME}   touch
51 ${NEW_ACTION_NAME}   mkdir
52 ${VNF_MEMBER_INDEX}   simple
53 ${DAY_1_FILE_NAME}   /home/ubuntu/first-touch
54 ${DAY_2_FILE_NAME}   /home/ubuntu/mytouch1
55 ${DAY_2_FOLDER_NAME}   /home/ubuntu/myfolder1
56 ${NS_TIMEOUT}   15min
57
58 # NS update operation configuration
59 ${UPDATE_TYPE}   CHANGE_VNFPKG
60 ${NS_UPDATE_TIMEOUT}   500
61
62
63 *** Test Cases ***
64 Create VNF Descriptor
65     [Documentation]   Upload VNF package for the testsuite.
66     ${id}=   Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
67     Set Suite Variable   ${VNFD_ID}   ${id}
68
69 Create NS Descriptor
70     [Documentation]   Upload NS package for the testsuite.
71     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
72
73 Instantiate Network Service
74     [Documentation]   Instantiate NS for the testsuite.
75     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}   ${NS_TIMEOUT}
76     Set Suite Variable   ${NS_ID}   ${id}
77
78 Set NS Update Config
79     [Documentation]   Prepare NS update config dictionary to update the NS.
80     Variable Should Exist   ${NS_ID}   msg=NS is not available
81     ${id}=   Get Vnf Id   ${NS_ID}   ${VNF_MEMBER_INDEX}
82     Log   ${id}
83     Set Suite Variable   ${VNF_ID}   ${id}
84     Set Suite Variable   ${NS_UPDATE_CONFIG}   '{changeVnfPackageData: [{vnfInstanceId: "${VNF_ID}", vnfdId: "${VNFD_ID}"}]}'
85
86 Get Management Ip Address
87     [Documentation]   Get VNF mgmt IP address from the NS.
88     ${ip_addr}=   Get Vnf Management Ip Address   ${NS_ID}   ${VNF_MEMBER_INDEX}
89     Log   ${ip_addr}
90     Set Suite Variable   ${VNF_IP_ADDR}   ${ip_addr}
91
92 Test SSH Access
93     [Documentation]   Test SSH access to the VNF mgmt IP address.
94     Variable Should Exist   ${VNF_IP_ADDR}   msg=IP address of the management VNF '${VNF_MEMBER_INDEX}' is not available
95     Sleep   30s   Waiting ssh daemon to be up
96     Test SSH Connection   ${VNF_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}
97
98 Check Remote Files Created Via Day 1 Operation
99     [Documentation]   The VNF has a Day 1 operation that creates a file named ${day_1_file_name}.
100     ...               This test checks whether that files have been created or not.
101     Check If Remote File Exists   ${VNF_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   ${DAY_1_FILE_NAME}
102
103 Execute Day 2 Operation
104     [Documentation]   Performs one Day 2 operation on the VNF that creates a new file.
105     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
106     ${ns_op_id_1}=   Execute NS Action   ${NS_NAME}   ${ACTION_NAME}   ${VNF_MEMBER_INDEX}   file-path=${DAY_2_FILE_NAME}
107     Log   ${ns_op_id_1}
108
109 Check Remote File Created Via Day 2 Operation
110     [Documentation]   Check whether the file created in the previous test via Day 2 operations exist or not.
111     Check If Remote File Exists   ${VNF_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   ${DAY_2_FILE_NAME}
112
113 Update VNFD Package
114     [Documentation]   Updates the VNFD by using new VNFD package which includes the EE
115     ...               which has new day2 operation.
116     Update VNFD   '%{PACKAGES_FOLDER}/${UPDATED_VNFD_PKG}'   ${VNFD_NAME}
117
118 Update Running VNF Instance
119     [Documentation]   Updates the running VNF instance by using new VNFD package.
120     ...               As the VNFD has an updated Helm EE, this operation will trigger the upgrade of existing Helm EE
121     ...               for the specific VNF.
122     Update Network Service   ${NS_ID}   ${UPDATE_TYPE}   ${NS_UPDATE_CONFIG}   ${NS_UPDATE_TIMEOUT}
123
124 Execute Day 2 Operation on Upgraded Helm EE
125     [Documentation]   Performs one Day 2 operation on the updated VNF that creates a new folder.
126     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
127     ${ns_op_id_2}=   Execute NS Action   ${NS_NAME}   ${NEW_ACTION_NAME}   ${VNF_MEMBER_INDEX}   foldername=${DAY_2_FOLDER_NAME}
128     Log   ${ns_op_id_2}
129
130 Check Remote Folder Created Via Day 2 Operation
131     [Documentation]   Check whether the folder created in the previous test via Day 2 operations exist or not.
132     Check If Remote Folder Exists   ${VNF_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   ${DAY_2_FOLDER_NAME}
133
134 Delete NS Instance
135     [Documentation]   Delete NS instance.
136     [Tags]   cleanup
137     Delete NS   ${NS_NAME}
138
139 Delete NS Descriptor
140     [Documentation]   Delete NS package from OSM.
141     [Tags]   cleanup
142     Delete NSD   ${NSD_NAME}
143
144 Delete VNF Descriptor
145     [Documentation]   Delete VNF package from OSM.
146     [Tags]   cleanup
147     Delete VNFD   ${VNFD_NAME}
148
149
150 *** Keywords ***
151 Suite Cleanup
152     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
153     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
154     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
155     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}