blob: ee1cb31df3364088b6ed07e52874fadc69518358 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
calvinosanc1a352a932020-07-21 16:03:46 +02002# Copyright 2020 Canonical Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
garciadeblas7a9e0312023-12-11 22:24:46 +010015
calvinosanc1a352a932020-07-21 16:03:46 +020016*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020017Documentation [BASIC-12] NS Primitives
garciadeblas4cf45d72021-04-08 13:52:22 +020018
calvinosanc1a352a932020-07-21 16:03:46 +020019Library OperatingSystem
20Library String
21Library Collections
22Library Process
aticiga131bf02022-08-25 13:10:14 +030023Library SSHLibrary
calvinosanc1a352a932020-07-21 16:03:46 +020024
garciadeblas7a9e0312023-12-11 22:24:46 +010025Resource ../lib/vnfd_lib.resource
26Resource ../lib/nsd_lib.resource
27Resource ../lib/ns_lib.resource
28Resource ../lib/package_lib.resource
29Resource ../lib/juju_lib.resource
30Resource ../lib/ssh_lib.resource
calvinosanc1a352a932020-07-21 16:03:46 +020031
garciadeblas7a9e0312023-12-11 22:24:46 +010032Test Tags basic_12 cluster_ee_config regression azure
garciadeblas4cf45d72021-04-08 13:52:22 +020033
garciadeblasd225e552020-10-02 16:10:14 +000034Suite Teardown Run Keyword And Ignore Error Suite Cleanup
calvinosanc1a352a932020-07-21 16:03:46 +020035
36
37*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020038# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010039${VNFD_PKG1} nscharm_policy_vnf
40${VNFD_PKG2} nscharm_user_vnf
41${VNFD_NAME1} nscharm-policy-vnf
42${VNFD_NAME2} nscharm-user-vnf
43${NSD_PKG} nscharm_ns
44${NEW_NSD_PKG} new_nscharm_ns
45${NSD_NAME} nscharm-ns
46${NSD_FILE} nscharm_nsd.yaml
almagiab4697d32021-05-25 08:56:17 +020047
48# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010049${NS_NAME} test_nscharm
50${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
51${NS_TIMEOUT} 15min
almagiab4697d32021-05-25 08:56:17 +020052
garciadeblas7a9e0312023-12-11 22:24:46 +010053${OLD_JUJU_PASSWORD} a5611fc6452349cc6e45705d34c501d4
54${PUBLICKEY} ${EMPTY}
55${SUCCESS_RETURN_CODE} 0
aguilarherna4de90962021-04-27 09:44:27 +000056
aticiga131bf02022-08-25 13:10:14 +030057# VDU profile id, execution environment name to check vdu level charm naming structure
garciadeblas7a9e0312023-12-11 22:24:46 +010058${VDU_PROFILE_ID} PolicyVM
59${EE_NAME} vnf-policy
aticiga131bf02022-08-25 13:10:14 +030060
61# # Username and SSH private key for accessing OSM host
garciadeblas7a9e0312023-12-11 22:24:46 +010062${PRIVATEKEY} %{OSM_RSA_FILE}
63${USERNAME} ubuntu
64${PASSWORD} ${EMPTY}
aticiga131bf02022-08-25 13:10:14 +030065
66# Charm name to check ns level charm naming structure
garciadeblas7a9e0312023-12-11 22:24:46 +010067${CHARM_NAME} ns
aticiga131bf02022-08-25 13:10:14 +030068
calvinosanc1a352a932020-07-21 16:03:46 +020069
70*** Test Cases ***
71Change Juju Password
garciadeblasf4ebaa82022-06-23 13:33:26 +020072 [Documentation] NS package needs to be updated with the Juju credentials for your OSM installation
garciadeblas7a9e0312023-12-11 22:24:46 +010073 ${rc} ${stdout}= Run And Return RC And Output cp -r '%{PACKAGES_FOLDER}/${NSD_PKG}' '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}'
74 Log ${rc},${stdout}
75 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
76 ${nsd_yaml}= OperatingSystem.Get File %{PACKAGES_FOLDER}/${NEW_NSD_PKG}/${NSD_FILE}
77 ${changed_nsd_yaml}= Replace String ${nsd_yaml} ${OLD_JUJU_PASSWORD} %{JUJU_PASSWORD}
78 Create File %{PACKAGES_FOLDER}/${NEW_NSD_PKG}/${NSD_FILE} ${changed_nsd_yaml}
aticiga131bf02022-08-25 13:10:14 +030079
calvinosanc1a352a932020-07-21 16:03:46 +020080Upload Vnfds
garciadeblas7a9e0312023-12-11 22:24:46 +010081 [Documentation] Upload VNF packages for the testsuite.
82 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}'
83 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}'
aticiga131bf02022-08-25 13:10:14 +030084
calvinosanc1a352a932020-07-21 16:03:46 +020085Upload Nsd
garciadeblas7a9e0312023-12-11 22:24:46 +010086 [Documentation] Upload NS package for the testsuite.
87 Create NSD %{PACKAGES_FOLDER}/${NEW_NSD_PKG}
aticiga131bf02022-08-25 13:10:14 +030088
calvinosanc1a352a932020-07-21 16:03:46 +020089Instantiate NS
garciadeblas7a9e0312023-12-11 22:24:46 +010090 [Documentation] Instantiate NS for the testsuite.
91 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ns_launch_max_wait_time=${NS_TIMEOUT}
92 Set Suite Variable ${NS_ID} ${id}
93 Set Suite Variable ${MODEL_NAME} ${id}
aticiga131bf02022-08-25 13:10:14 +030094
95Check NS Charm Application Name
garciadeblas7a9e0312023-12-11 22:24:46 +010096 [Documentation] Check that the NS charm has the right length.
97 ${ns_charm_app_name}= Get Application Name NS Level Charm %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${MODEL_NAME} ${CHARM_NAME}
aticiga131bf02022-08-25 13:10:14 +030098 ${length}= Get Length ${ns_charm_app_name}
99 Should Be True ${length} <50
100
aticiga131bf02022-08-25 13:10:14 +0300101Check VDU Charm Application Name
garciadeblas7a9e0312023-12-11 22:24:46 +0100102 [Documentation] Check that the VDU charm has the right length.
103 ${vdu_charm_app_name}= Get Application Name VDU Level Charm %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${MODEL_NAME} ${VDU_PROFILE_ID} ${EE_NAME}
aticiga131bf02022-08-25 13:10:14 +0300104 ${length}= Get Length ${vdu_charm_app_name}
105 Should Be True ${length} <50
calvinosanc1a352a932020-07-21 16:03:46 +0200106
107# TODO: Check Initial Config Primitives Status
108
garciadeblas61bbf922022-06-25 18:12:53 +0200109Delete NS
garciadeblas7a9e0312023-12-11 22:24:46 +0100110 [Documentation] Delete NS instance.
garciadeblas4cf45d72021-04-08 13:52:22 +0200111 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100112 Delete NS ${NS_NAME}
aticiga131bf02022-08-25 13:10:14 +0300113
calvinosanc1a352a932020-07-21 16:03:46 +0200114Delete NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +0100115 [Documentation] Delete NS package from OSM.
garciadeblas4cf45d72021-04-08 13:52:22 +0200116 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100117 Delete NSD ${NSD_NAME}
118 Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}'
aticiga131bf02022-08-25 13:10:14 +0300119
calvinosanc1a352a932020-07-21 16:03:46 +0200120Delete VNF Descriptors
garciadeblas7a9e0312023-12-11 22:24:46 +0100121 [Documentation] Delete VNF package from OSM.
garciadeblas4cf45d72021-04-08 13:52:22 +0200122 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100123 Delete VNFD ${VNFD_NAME1}
124 Delete VNFD ${VNFD_NAME2}
calvinosanc1a352a932020-07-21 16:03:46 +0200125
126
127*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000128Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200129 [Documentation] Test Suit Cleanup: Deleting Descriptor and instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100130 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
131 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
132 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME1}
133 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME2}
134 Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}'
aguilarherna4de90962021-04-27 09:44:27 +0000135
136Delete Temporary Descriptor Folder
garciadeblasf4ebaa82022-06-23 13:33:26 +0200137 [Documentation] Removes the temporary package folder created for the test
aguilarherna4de90962021-04-27 09:44:27 +0000138 [Arguments] ${folder_name}
garciadeblas7a9e0312023-12-11 22:24:46 +0100139 ${rc} ${stdout}= Run And Return RC And Output rm -rf '${folder_name}'
140 Log ${rc},${stdout}