2 # 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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 Documentation [BASIC-12] NS Primitives
19 Library OperatingSystem
25 Resource ../lib/vnfd_lib.resource
26 Resource ../lib/nsd_lib.resource
27 Resource ../lib/ns_lib.resource
28 Resource ../lib/package_lib.resource
29 Resource ../lib/juju_lib.resource
30 Resource ../lib/ssh_lib.resource
32 Test Tags basic_12 cluster_ee_config regression azure
34 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
38 # NS and VNF descriptor package folder and ids
39 ${VNFD_PKG1} nscharm_policy_vnf
40 ${VNFD_PKG2} nscharm_user_vnf
41 ${VNFD_NAME1} nscharm-policy-vnf
42 ${VNFD_NAME2} nscharm-user-vnf
44 ${NEW_NSD_PKG} new_nscharm_ns
45 ${NSD_NAME} nscharm-ns
46 ${NSD_FILE} nscharm_nsd.yaml
48 # NS instance name and configuration
49 ${NS_NAME} test_nscharm
50 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
53 ${OLD_JUJU_PASSWORD} a5611fc6452349cc6e45705d34c501d4
55 ${SUCCESS_RETURN_CODE} 0
57 # VDU profile id, execution environment name to check vdu level charm naming structure
58 ${VDU_PROFILE_ID} PolicyVM
61 # # Username and SSH private key for accessing OSM host
62 ${PRIVATEKEY} %{OSM_RSA_FILE}
66 # Charm name to check ns level charm naming structure
72 [Documentation] NS package needs to be updated with the Juju credentials for your OSM installation
73 ${rc} ${stdout}= Run And Return RC And Output cp -r '%{PACKAGES_FOLDER}/${NSD_PKG}' '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}'
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}
81 [Documentation] Upload VNF packages for the testsuite.
82 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}'
83 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}'
86 [Documentation] Upload NS package for the testsuite.
87 Create NSD %{PACKAGES_FOLDER}/${NEW_NSD_PKG}
90 [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}
95 Check NS Charm Application Name
96 [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}
98 ${length}= Get Length ${ns_charm_app_name}
99 Should Be True ${length} <50
101 Check VDU Charm Application Name
102 [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}
104 ${length}= Get Length ${vdu_charm_app_name}
105 Should Be True ${length} <50
107 # TODO: Check Initial Config Primitives Status
110 [Documentation] Delete NS instance.
115 [Documentation] Delete NS package from OSM.
117 Delete NSD ${NSD_NAME}
118 Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}'
120 Delete VNF Descriptors
121 [Documentation] Delete VNF package from OSM.
123 Delete VNFD ${VNFD_NAME1}
124 Delete VNFD ${VNFD_NAME2}
129 [Documentation] Test Suit Cleanup: Deleting Descriptor and instance
130 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}'
136 Delete Temporary Descriptor Folder
137 [Documentation] Removes the temporary package folder created for the test
138 [Arguments] ${folder_name}
139 ${rc} ${stdout}= Run And Return RC And Output rm -rf '${folder_name}'