blob: 6b94d3a40c6268b0c94bc1d481190e457dd9df07 [file] [log] [blame]
calvinosanc1a352a932020-07-21 16:03:46 +02001# Copyright 2020 Canonical Ltd.
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*** Settings ***
garciadeblas4cf45d72021-04-08 13:52:22 +020015Documentation [BASIC-12] NS Primitives
16
calvinosanc1a352a932020-07-21 16:03:46 +020017Library OperatingSystem
18Library String
19Library Collections
20Library Process
21
22Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
23Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
24Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
25Resource %{ROBOT_DEVOPS_FOLDER}/lib/packages_lib.robot
26
27Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_12-ns_primitives_data.py
28
garciadeblas4cf45d72021-04-08 13:52:22 +020029Force Tags basic_12 cluster_ee_config daily regression
30
garciadeblasd225e552020-10-02 16:10:14 +000031Suite Teardown Run Keyword And Ignore Error Suite Cleanup
calvinosanc1a352a932020-07-21 16:03:46 +020032
33
34*** Variables ***
35${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
36${publickey} ${EMPTY}
aguilarherna4de90962021-04-27 09:44:27 +000037${success_return_code} 0
38
calvinosanc1a352a932020-07-21 16:03:46 +020039
40*** Test Cases ***
41Change Juju Password
calvinosanc1a352a932020-07-21 16:03:46 +020042 [Documentation] NS package needs to be updated with the Juju credentials for your OSM installation
43
aguilarherna4de90962021-04-27 09:44:27 +000044 ${rc} ${stdout}= Run and Return RC and Output cp -r '%{PACKAGES_FOLDER}/${nsd_pkg}' '%{PACKAGES_FOLDER}/${new_nsd_pkg}'
45 Should Be Equal As Integers ${rc} ${success_return_code}
46 ${nsd_yaml}= Get File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file}
calvinosanc1a352a932020-07-21 16:03:46 +020047 ${changed_nsd_yaml}= Replace String ${nsd_yaml} ${old_juju_password} %{JUJU_PASSWORD}
aguilarherna4de90962021-04-27 09:44:27 +000048 Create File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} ${changed_nsd_yaml}
calvinosanc1a352a932020-07-21 16:03:46 +020049
calvinosanc1a352a932020-07-21 16:03:46 +020050Upload Vnfds
51
garciadeblas55a5ec22020-10-07 15:33:05 +000052 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}'
53 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}'
calvinosanc1a352a932020-07-21 16:03:46 +020054
55Upload Nsd
56
aguilarherna4de90962021-04-27 09:44:27 +000057 Create NSD %{PACKAGES_FOLDER}/${new_nsd_pkg}/
calvinosanc1a352a932020-07-21 16:03:46 +020058
59Instantiate NS
60
calvinosanc1a352a932020-07-21 16:03:46 +020061 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ns_launch_max_wait_time=40min
62 Set Suite Variable ${ns_id} ${id}
63
64# TODO: Check Initial Config Primitives Status
65
66Delete NS
garciadeblas4cf45d72021-04-08 13:52:22 +020067 [Tags] cleanup
calvinosanc1a352a932020-07-21 16:03:46 +020068
69 Delete NS ${ns_name}
70
71Delete NS Descriptor
garciadeblas4cf45d72021-04-08 13:52:22 +020072 [Tags] cleanup
calvinosanc1a352a932020-07-21 16:03:46 +020073
74 Delete NSD ${nsd_name}
aguilarherna4de90962021-04-27 09:44:27 +000075 Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}'
calvinosanc1a352a932020-07-21 16:03:46 +020076
77Delete VNF Descriptors
garciadeblas4cf45d72021-04-08 13:52:22 +020078 [Tags] cleanup
calvinosanc1a352a932020-07-21 16:03:46 +020079
80 Delete VNFD ${vnfd_name1}
81 Delete VNFD ${vnfd_name2}
82
83
84*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +000085Suite Cleanup
calvinosanc1a352a932020-07-21 16:03:46 +020086 [Documentation] Test Suit Cleanup: Deleting Descriptor and instance
87
garciadeblasd225e552020-10-02 16:10:14 +000088 Run Keyword If Any Tests Failed Delete NS ${ns_name}
89 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
90 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name1}
91 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name2}
aguilarherna4de90962021-04-27 09:44:27 +000092 Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}'
93
94
95Delete Temporary Descriptor Folder
96 [Documentation] Removes the temporary package folder created for the test
97 [Arguments] ${folder_name}
98
99 ${rc} ${stdout}= Run and Return RC and Output rm -rf '${folder_name}'
100 log ${stdout}
101
102