blob: 41be581ecc9f5f0ae2f9020352a47fd8642277ce [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
aguilardf848c142021-06-28 15:47:54 +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
aguilardf848c142021-06-28 15:47:54 +020015*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020016Documentation [BASIC-18] NS with a VLD with a virtual link profile.
aguilardf848c142021-06-28 15:47:54 +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
aguilardf848c142021-06-28 15:47:54 +020027
garciadeblas7a9e0312023-12-11 22:24:46 +010028Test Tags basic_18 cluster_main daily regression
aguilardf848c142021-06-28 15:47:54 +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} ubuntu_4ifaces_vnf
36${VNFD_NAME} ubuntu_4ifaces-vnf
37${NSD_PKG} ubuntu_4ifaces_ns
38${NSD_NAME} ubuntu_4ifaces-ns
aguilardf848c142021-06-28 15:47:54 +020039
40# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010041${NS_NAME} basic_18
42${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
aguilardf848c142021-06-28 15:47:54 +020043
44# SSH keys and username to be used
garciadeblas7a9e0312023-12-11 22:24:46 +010045${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
46${PRIVATEKEY} %{HOME}/.ssh/id_rsa
47${USERNAME} ubuntu
aguilardf848c142021-06-28 15:47:54 +020048
49# VNFs data
garciadeblas7a9e0312023-12-11 22:24:46 +010050${VNF_MEMBER_INDEX_1} vnf1
51${VNF_MEMBER_INDEX_2} vnf2
52${IFACE1_NAME} eth1
53${IFACE2_NAME} eth2
54${IFACE3_NAME} eth3
55${DATANET1_PREFIX} ^192.168.10.*
56${DATANET2_PREFIX} ^192.168.20.*
57${DATANET3_PREFIX} ^192.168.30.*
aguilardf848c142021-06-28 15:47:54 +020058
garciadeblas7a9e0312023-12-11 22:24:46 +010059${SUCCESS_RETURN_CODE} 0
aguilardf848c142021-06-28 15:47:54 +020060
61
62*** Test Cases ***
63Create VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010064 [Documentation] Upload VNF package for the testsuite.
65 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
aguilardf848c142021-06-28 15:47:54 +020066
67Create NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010068 [Documentation] Upload NS package for the testsuite.
69 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
aguilardf848c142021-06-28 15:47:54 +020070
71Instantiate Network Service
garciadeblas7a9e0312023-12-11 22:24:46 +010072 [Documentation] Instantiate NS for the testsuite.
73 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
74 Set Suite Variable ${NS_ID} ${id}
aguilardf848c142021-06-28 15:47:54 +020075
76Get Vnfs Info
garciadeblas7a9e0312023-12-11 22:24:46 +010077 [Documentation] Get information from the two VNF of the Ns, specifically the VNF instance id and the mgmt IP address.
78 Variable Should Exist ${NS_ID} msg=Network service instance is not available
79 @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID}
aguilardf848c142021-06-28 15:47:54 +020080 Log List ${vnfr_list}
garciadeblas7a9e0312023-12-11 22:24:46 +010081 Set Suite Variable ${VNF_ID1} ${vnfr_list}[0]
82 Set Suite Variable ${VNF_ID2} ${vnfr_list}[1]
83 ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1}
84 Set Suite Variable ${VNF1_IPMGMT} ${ip}
85 Log ${VNF1_IPMGMT}
86 ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2}
87 Set Suite Variable ${VNF2_IPMGMT} ${ip}
88 Log ${VNF2_IPMGMT}
aguilardf848c142021-06-28 15:47:54 +020089
90Check Vnf1 IPs
garciadeblas7a9e0312023-12-11 22:24:46 +010091 [Documentation] Check whether IP addresses of the first VNF in the VNF record meet the expected CIDR.
92 Variable Should Exist ${VNF_ID1} msg=VNF1 is not available
93 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE1_NAME}")' | yq -r '."ip-address"'
94 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
95 Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX}
96 Set Suite Variable ${VNF1_IP1} ${stdout}
97 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE2_NAME}")' | yq -r '."ip-address"'
98 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
99 Should Match Regexp ${stdout} ${DATANET2_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET2_PREFIX}
100 Set Suite Variable ${VNF1_IP2} ${stdout}
101 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE3_NAME}")' | yq -r '."ip-address"'
102 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
103 Should Match Regexp ${stdout} ${DATANET3_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET3_PREFIX}
104 Set Suite Variable ${VNF1_IP3} ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200105
106Check Vnf2 IPs
garciadeblas7a9e0312023-12-11 22:24:46 +0100107 [Documentation] Check whether IP addresses of the second VNF in the VNF record meet the expected CIDR.
108 Variable Should Exist ${VNF_ID1} msg=VNF2 is not available
109 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE1_NAME}")' | yq -r '."ip-address"'
110 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
111 Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX}
112 Set Suite Variable ${VNF2_IP1} ${stdout}
113 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE2_NAME}")' | yq -r '."ip-address"'
114 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
115 Should Match Regexp ${stdout} ${DATANET2_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET2_PREFIX}
116 Set Suite Variable ${VNF2_IP2} ${stdout}
117 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE3_NAME}")' | yq -r '."ip-address"'
118 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
119 Should Match Regexp ${stdout} ${DATANET3_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET3_PREFIX}
120 Set Suite Variable ${VNF2_IP3} ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200121
aguilardc5468a12022-06-10 12:58:09 +0200122Verify Vnf1 Interfaces
garciadeblas7a9e0312023-12-11 22:24:46 +0100123 [Documentation] Check whether IP addresses of the first VNF configured inside the VM meet the expected CIDR.
124 Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available
125 Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available
aguilardc5468a12022-06-10 12:58:09 +0200126 Sleep 10 seconds Wait for SSH daemon to be up
garciadeblas7a9e0312023-12-11 22:24:46 +0100127 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip --brief addr show up | grep -v "^lo" | awk '{print $3}'
garciadeblas321726f2022-12-21 11:43:06 +0100128 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +0100129 @{ip}= Split String ${stdout}
130 Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX}
131 Should Match Regexp ${ip}[2] ${DATANET2_PREFIX} msg=${ip}[2] doesn't match subnet's regexp ${DATANET2_PREFIX}
132 Should Match Regexp ${ip}[3] ${DATANET3_PREFIX} msg=${ip}[3] doesn't match subnet's regexp ${DATANET3_PREFIX}
aguilardc5468a12022-06-10 12:58:09 +0200133
134Verify Vnf2 Interfaces
garciadeblas7a9e0312023-12-11 22:24:46 +0100135 [Documentation] Check whether IP addresses of the second VNF configured inside the VM meet the expected CIDR.
136 Variable Should Exist ${VNF2_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available
137 Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available
138 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip --brief addr show up | grep -v "^lo" | awk '{print $3}'
garciadeblas321726f2022-12-21 11:43:06 +0100139 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +0100140 @{ip}= Split String ${stdout}
141 Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX}
142 Should Match Regexp ${ip}[2] ${DATANET2_PREFIX} msg=${ip}[2] doesn't match subnet's regexp ${DATANET2_PREFIX}
143 Should Match Regexp ${ip}[3] ${DATANET3_PREFIX} msg=${ip}[3] doesn't match subnet's regexp ${DATANET3_PREFIX}
aguilardc5468a12022-06-10 12:58:09 +0200144
aguilardf848c142021-06-28 15:47:54 +0200145Ping from Vnf1 to Vnf2
garciadeblas7a9e0312023-12-11 22:24:46 +0100146 [Documentation] Check connectivity from the first VNF to the second VNF using ping.
147 Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available
148 Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available
149 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF2_IPMGMT}
garciadeblas321726f2022-12-21 11:43:06 +0100150 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +0100151 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP1}
garciadeblas321726f2022-12-21 11:43:06 +0100152 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +0100153 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP2}
garciadeblas321726f2022-12-21 11:43:06 +0100154 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +0100155 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP3}
garciadeblas321726f2022-12-21 11:43:06 +0100156 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200157
aguilardf848c142021-06-28 15:47:54 +0200158Ping from Vnf2 to Vnf1
garciadeblas7a9e0312023-12-11 22:24:46 +0100159 [Documentation] Check connectivity from the second VNF to the first VNF using ping.
160 Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available
161 Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available
162 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IPMGMT}
garciadeblas321726f2022-12-21 11:43:06 +0100163 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +0100164 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP1}
garciadeblas321726f2022-12-21 11:43:06 +0100165 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +0100166 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP2}
garciadeblas321726f2022-12-21 11:43:06 +0100167 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +0100168 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP3}
garciadeblas321726f2022-12-21 11:43:06 +0100169 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200170
aguilardf848c142021-06-28 15:47:54 +0200171Delete NS Instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100172 [Documentation] Delete NS instance.
aguilardf848c142021-06-28 15:47:54 +0200173 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100174 Delete NS ${NS_NAME}
aguilardf848c142021-06-28 15:47:54 +0200175
176Delete NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +0100177 [Documentation] Delete NS package from OSM.
aguilardf848c142021-06-28 15:47:54 +0200178 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100179 Delete NSD ${NSD_NAME}
aguilardf848c142021-06-28 15:47:54 +0200180
181Delete VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +0100182 [Documentation] Delete VNF package from OSM.
aguilardf848c142021-06-28 15:47:54 +0200183 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100184 Delete VNFD ${VNFD_NAME}
aguilardf848c142021-06-28 15:47:54 +0200185
186
187*** Keywords ***
188Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200189 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100190 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
191 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
192 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}