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
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 Documentation [BASIC-25] Update Charms in Running VNF Instance.
18 Library OperatingSystem
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
27 Test Tags basic_25 cluster_ee_config regression
29 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
33 # NS and VNF descriptor package folder and ids
34 ${VNFD_PKG} charm-packages/ha_proxy_charm_vnf
35 ${UPDATED_VNFD_PKG} charm-packages/updated_vnfds/ha_proxy_charm_vnf
36 ${VNFD_NAME} ha_proxy_charm-vnf
37 ${NSD_PKG} charm-packages/ha_proxy_charm_ns
38 ${NSD_NAME} ha_proxy_charm-ns
40 # NS instance name and configuration
41 ${NS_NAME} basic_25_charm_update_test
42 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
44 # SSH keys and username to be used
45 ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
46 ${PRIVATEKEY} %{HOME}/.ssh/id_rsa
51 ${NEW_ACTION_NAME} mkdir
52 ${VNF_MEMBER_INDEX} vnf1
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
58 # NS update operation configuration
59 ${UPDATE_TYPE} CHANGE_VNFPKG
60 ${NS_UPDATE_TIMEOUT} 500
64 Create Charm 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}
69 Create Charm NS Descriptor
70 [Documentation] Upload NS package for the testsuite.
71 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
73 Instantiate Charm Network Service
74 [Documentation] Instantiates the NS for the test suite.
75 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT}
76 Set Suite Variable ${NS_ID} ${id}
79 [Documentation] Prepare data for NS Update
80 Variable Should Exist ${NS_ID} msg=NS is not available
81 ${id}= Get Vnf Id ${NS_ID} ${VNF_MEMBER_INDEX}
83 Set Suite Variable ${VNF_ID} ${id}
84 Set Suite Variable ${NS_UPDATE_CONFIG} '{changeVnfPackageData: [{vnfInstanceId: "${VNF_ID}", vnfdId: "${VNFD_ID}"}]}'
86 Get Management Ip Address
87 [Documentation] Get the mgmt IP address of the VNF.
88 ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX}
90 Set Suite Variable ${VNF_IP_ADDR} ${ip_addr}
93 [Documentation] Check that the VNF is accessible via SSH in its 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}
98 Check Remote Files Created Via Day 1 Operation
99 [Documentation] The Charm 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}
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} filename=${DAY_2_FILE_NAME}
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}
114 [Documentation] Updates the VNFD by using new VNFD package which includes the Charm
115 ... which has new day2 operation.
116 Update VNFD '%{PACKAGES_FOLDER}/${UPDATED_VNFD_PKG}' ${VNFD_NAME}
118 Update Running VNF Instance
119 [Documentation] Updates the running VNF instance by using new VNFD package.
120 ... As the VNFD has an updated charm, this operation will trigger the upgrade of existing charm
121 ... for the specific VNF.
122 Update Network Service ${NS_ID} ${UPDATE_TYPE} ${NS_UPDATE_CONFIG} ${NS_UPDATE_TIMEOUT}
124 Execute Day 2 Operation on Upgraded Charm
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}
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}
135 [Documentation] Delete NS instance.
140 [Documentation] Delete NS package from OSM.
142 Delete NSD ${NSD_NAME}
144 Delete VNF Descriptor
145 [Documentation] Delete VNF package from OSM.
147 Delete VNFD ${VNFD_NAME}
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}