blob: bc595f9cf44440d14427b80439aca4a4750cc791 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
Felipe Vicensf96bb452020-06-22 08:12:30 +02002# Copyright 2020 Atos
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
garciadeblas7a9e0312023-12-11 22:24:46 +010016
Felipe Vicensf96bb452020-06-22 08:12:30 +020017*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020018Documentation [SLICE-01] Network Slicing.
garciadeblas4cf45d72021-04-08 13:52:22 +020019
Felipe Vicensf96bb452020-06-22 08:12:30 +020020Library OperatingSystem
21Library String
22Library Collections
23Library Process
24Library SSHLibrary
25Library yaml
26
garciadeblas7a9e0312023-12-11 22:24:46 +010027Resource ../lib/vnfd_lib.resource
28Resource ../lib/nsd_lib.resource
29Resource ../lib/nst_lib.resource
30Resource ../lib/nsi_lib.resource
31Resource ../lib/ns_lib.resource
32Resource ../lib/connectivity_lib.resource
33Resource ../lib/ssh_lib.resource
Felipe Vicensf96bb452020-06-22 08:12:30 +020034
garciadeblas7a9e0312023-12-11 22:24:46 +010035Test Tags slice_01 cluster_slices daily regression
garciadeblas4cf45d72021-04-08 13:52:22 +020036
garciadeblasd225e552020-10-02 16:10:14 +000037Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020038
39
40*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020041# NS and VNF descriptor package files
garciadeblas7a9e0312023-12-11 22:24:46 +010042${VNFD1_PKG} slice_basic_vnf
43${VNFD2_PKG} slice_basic_middle_vnf
44${NSD1_PKG} slice_basic_ns
45${NSD2_PKG} slice_basic_middle_ns
46${NST} slice_basic_nst/slice_basic_nst.yaml
aguilarherna576487e2021-05-05 15:47:11 +000047
almagiab4697d32021-05-25 08:56:17 +020048# Descriptor names
garciadeblas7a9e0312023-12-11 22:24:46 +010049${NST_NAME} slice_basic_nst
50${VNFD1_NAME} slice_basic_vnf
51${VNFD2_NAME} slice_basic_middle_vnf
52${NSD1_NAME} slice_basic_ns
53${NSD2_NAME} slice_basic_middle_ns
almagiab4697d32021-05-25 08:56:17 +020054
55# Instance names
garciadeblas7a9e0312023-12-11 22:24:46 +010056${SLICE_NAME} slicebasic
57${MIDDLE_NS_NAME} slicebasic.slice_basic_nsd_2
almagiab4697d32021-05-25 08:56:17 +020058
59# SSH keys and username to be used
garciadeblas7a9e0312023-12-11 22:24:46 +010060${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
61${PRIVATEKEY} %{HOME}/.ssh/id_rsa
62${USERNAME} ubuntu
63${PASSWORD} ${EMPTY}
almagiab4697d32021-05-25 08:56:17 +020064
garciadeblas7a9e0312023-12-11 22:24:46 +010065${VNF_MEMBER_INDEX} middle
66${VNF_IP_ADDR} ${EMPTY}
67${MGMT_VNF_IP} ${EMPTY}
68${NST_CONFIG} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
Felipe Vicensf96bb452020-06-22 08:12:30 +020069
aguilarhernac0b3a8e2021-05-12 08:56:23 +000070
almagiab4697d32021-05-25 08:56:17 +020071*** Test Cases ***
Felipe Vicensf96bb452020-06-22 08:12:30 +020072Create Slice VNF Descriptors
73 [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
garciadeblas7a9e0312023-12-11 22:24:46 +010074 Create VNFD '%{PACKAGES_FOLDER}/${VNFD1_PKG}'
75 Create VNFD '%{PACKAGES_FOLDER}/${VNFD2_PKG}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020076
77Create Slice NS Descriptors
78 [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
garciadeblas7a9e0312023-12-11 22:24:46 +010079 Create NSD '%{PACKAGES_FOLDER}/${NSD1_PKG}'
80 Create NSD '%{PACKAGES_FOLDER}/${NSD2_PKG}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020081
82Create Slice Template
83 [Documentation] Onboards the Network Slice Template: nst (in the variables file)
garciadeblas7a9e0312023-12-11 22:24:46 +010084 Create NST '%{PACKAGES_FOLDER}/${NST}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020085
86Network Slice Instance Test
87 [Documentation] Instantiates the NST recently onboarded and sets the instantiation id as a suite variable (nsi_id)
garciadeblas7a9e0312023-12-11 22:24:46 +010088 ${id}= Create Network Slice ${NST_NAME} %{VIM_TARGET} ${SLICE_NAME} ${NST_CONFIG} ${PUBLICKEY}
89 Set Suite Variable ${NSI_ID} ${id}
Felipe Vicensf96bb452020-06-22 08:12:30 +020090
91Get Middle Vnf Management Ip
92 [Documentation] Obtains the management IP of the slice middle VNF (name in the reources file) and sets the ip as a suite variable (mgmt_vnf_ip)
garciadeblas7a9e0312023-12-11 22:24:46 +010093 ${middle_ns_id}= Run And Return RC And Output osm ns-list | grep ${MIDDLE_NS_NAME} | awk '{print $4}' 2>&1
94 ${vnf_ip}= Get Vnf Management Ip Address ${middle_ns_id}[1] ${VNF_MEMBER_INDEX}
95 IF '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty
96 Set Suite Variable ${MGMT_VNF_IP} ${vnf_ip}
Felipe Vicensf96bb452020-06-22 08:12:30 +020097
98Get Slice Vnf Ip Addresses
99 [Documentation] Obtains the list of IPs addresses in the slice and sets the list as a suite variable (slice_vnfs_ips)
Felipe Vicensf96bb452020-06-22 08:12:30 +0200100 # Get all the ns_id in the slice except the middle one to avoid self ping
garciadeblas7a9e0312023-12-11 22:24:46 +0100101 @{slice_ns_list}= Get Slice Ns List Except One ${SLICE_NAME} ${MIDDLE_NS_NAME}
102 Log Many @{slice_ns_list}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200103 @{temp_list}= Create List
Felipe Vicensf96bb452020-06-22 08:12:30 +0200104 # For each ns_id in the list, get all the vnf_id and their IP addresses
105 FOR ${ns_id} IN @{slice_ns_list}
garciadeblas321726f2022-12-21 11:43:06 +0100106 Log ${ns_id}
garciadeblas7a9e0312023-12-11 22:24:46 +0100107 @{vnf_id_list}= Get Ns Vnf List ${ns_id}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200108 # For each vnf_id in the list, get all its IP addresses
garciadeblas7a9e0312023-12-11 22:24:46 +0100109 @{ns_ip_list}= Get Ns Ip List @{vnf_id_list}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200110 @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200111 END
112 Log List ${temp_list}
garciadeblas7a9e0312023-12-11 22:24:46 +0100113 Set Suite Variable ${SLICE_VNFS_IPS} ${temp_list}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200114
115Test Middle Ns Ping
116 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
Felipe Vicensf96bb452020-06-22 08:12:30 +0200117 Sleep 60s Waiting for the network to be up
118 # Ping to the middle VNF
garciadeblas7a9e0312023-12-11 22:24:46 +0100119 Log ${MGMT_VNF_IP}
120 Test Connectivity ${MGMT_VNF_IP}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200121
122Test Middle Vnf SSH Access
123 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
Felipe Vicensf96bb452020-06-22 08:12:30 +0200124 Sleep 30s Waiting ssh daemon to be up
garciadeblas7a9e0312023-12-11 22:24:46 +0100125 Test SSH Connection ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200126
127Test Slice Connectivity
128 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
garciadeblasf4ebaa82022-06-23 13:33:26 +0200129 ... and pings all the IP addresses in the list (slice_vnfs_ips)
garciadeblas7a9e0312023-12-11 22:24:46 +0100130 Ping Many ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} @{SLICE_VNFS_IPS}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200131
garciadeblas15081452020-10-02 20:50:49 +0000132Delete Slice Instance
Felipe Vicensf96bb452020-06-22 08:12:30 +0200133 [Documentation] Stops the slice instance (slice_name)
garciadeblas4cf45d72021-04-08 13:52:22 +0200134 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100135 Delete NSI ${SLICE_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200136
137Delete Slice Template
138 [Documentation] Deletes the NST (nst_name) from OSM
garciadeblas4cf45d72021-04-08 13:52:22 +0200139 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100140 Delete NST ${NST_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200141
142Delete NS Descriptors
143 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
garciadeblas4cf45d72021-04-08 13:52:22 +0200144 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100145 Delete NSD ${NSD1_NAME}
146 Delete NSD ${NSD2_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200147
148Delete VNF Descriptors
149 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
garciadeblas4cf45d72021-04-08 13:52:22 +0200150 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100151 Delete VNFD ${VNFD1_NAME}
152 Delete VNFD ${VNFD2_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200153
154
155*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000156Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200157 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and template
garciadeblas7a9e0312023-12-11 22:24:46 +0100158 Run Keyword If Any Tests Failed Delete NSI ${SLICE_NAME}
159 Run Keyword If Any Tests Failed Delete NST ${NST_NAME}
160 Run Keyword If Any Tests Failed Delete NSD ${NSD1_NAME}
161 Run Keyword If Any Tests Failed Delete NSD ${NSD2_NAME}
162 Run Keyword If Any Tests Failed Delete VNFD ${VNFD1_NAME}
163 Run Keyword If Any Tests Failed Delete VNFD ${VNFD2_NAME}