blob: 6d5a557b65940f2bf6ff2d2c588f14cf7ae78c20 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
aguilardb19f27f2021-06-30 12:21:18 +02002# 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
garciadeblas7a9e0312023-12-11 22:24:46 +010014
aguilardb19f27f2021-06-30 12:21:18 +020015*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020016Documentation [BASIC-19] NS with a single VNF and two VDU linked by a VLD with ip-profile.
aguilardb19f27f2021-06-30 12:21:18 +020017
18Library OperatingSystem
19Library String
20Library Collections
21Library SSHLibrary
22
garciadeblas7a9e0312023-12-11 22:24:46 +010023Resource ../lib/vnfd_lib.resource
24Resource ../lib/nsd_lib.resource
25Resource ../lib/ns_lib.resource
26Resource ../lib/ssh_lib.resource
aguilardb19f27f2021-06-30 12:21:18 +020027
garciadeblas7a9e0312023-12-11 22:24:46 +010028Test Tags basic_19 cluster_main daily regression
aguilardb19f27f2021-06-30 12:21:18 +020029
30Suite Teardown Run Keyword And Ignore Error Suite Cleanup
31
32
33*** Variables ***
34# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010035${VNFD_PKG} ipprofile_2vm_vnf
36${VNFD_NAME} ipprofile_2vm-vnf
37${NSD_PKG} ipprofile_2vm_ns
38${NSD_NAME} ipprofile_2vm-ns
aguilardb19f27f2021-06-30 12:21:18 +020039
40# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010041${NS_NAME} basic_19
42${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
aguilardb19f27f2021-06-30 12:21:18 +020043
garciadeblas61bbf922022-06-25 18:12:53 +020044# SSH keys and username to be used
garciadeblas7a9e0312023-12-11 22:24:46 +010045${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
46${USERNAME} ubuntu
aguilardb19f27f2021-06-30 12:21:18 +020047
48# VNFs data
garciadeblas7a9e0312023-12-11 22:24:46 +010049${VNF_MEMBER_INDEX_1} vnf
50${INTERNAL_PREFIX} ^192.168.200.*
aguilardb19f27f2021-06-30 12:21:18 +020051
garciadeblas7a9e0312023-12-11 22:24:46 +010052${SUCCESS_RETURN_CODE} 0
aguilardb19f27f2021-06-30 12:21:18 +020053
54
55*** Test Cases ***
56Create VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010057 [Documentation] Upload VNF package for the testsuite.
58 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
aguilardb19f27f2021-06-30 12:21:18 +020059
60Create NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010061 [Documentation] Upload NS package for the testsuite.
62 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
aguilardb19f27f2021-06-30 12:21:18 +020063
64Instantiate Network Service
garciadeblas7a9e0312023-12-11 22:24:46 +010065 [Documentation] Instantiate NS for the testsuite.
66 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
67 Set Suite Variable ${NS_ID} ${id}
aguilardb19f27f2021-06-30 12:21:18 +020068
69Get Vnf Info
garciadeblas7a9e0312023-12-11 22:24:46 +010070 [Documentation] Get VNF information, specifically the VNF instance id and the mgmt IP address.
71 Variable Should Exist ${NS_ID} msg=Network service instance is not available
72 @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID}
aguilardb19f27f2021-06-30 12:21:18 +020073 Log List ${vnfr_list}
garciadeblas7a9e0312023-12-11 22:24:46 +010074 Set Suite Variable ${VNF_ID} ${vnfr_list}[0]
75 ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1}
76 Set Suite Variable ${VNF_IPMGMT} ${ip}
77 Log ${VNF_IPMGMT}
aguilardb19f27f2021-06-30 12:21:18 +020078
79Check Vnf IPs
garciadeblas7a9e0312023-12-11 22:24:46 +010080 [Documentation] Check whether IP addresses are syntactically valid.
81 Variable Should Exist ${VNF_ID} msg=VNF is not available
82 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"'
83 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
84 Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX}
85 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"'
86 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
87 Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX}
aguilardb19f27f2021-06-30 12:21:18 +020088
89Delete NS Instance
garciadeblas7a9e0312023-12-11 22:24:46 +010090 [Documentation] Delete NS instance.
aguilardb19f27f2021-06-30 12:21:18 +020091 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +010092 Delete NS ${NS_NAME}
aguilardb19f27f2021-06-30 12:21:18 +020093
94Delete NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010095 [Documentation] Delete NS package from OSM.
aguilardb19f27f2021-06-30 12:21:18 +020096 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +010097 Delete NSD ${NSD_NAME}
aguilardb19f27f2021-06-30 12:21:18 +020098
99Delete VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +0100100 [Documentation] Delete VNF package from OSM.
aguilardb19f27f2021-06-30 12:21:18 +0200101 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100102 Delete VNFD ${VNFD_NAME}
aguilardb19f27f2021-06-30 12:21:18 +0200103
104
105*** Keywords ***
106Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200107 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100108 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
109 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
110 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}