blob: 96d7a4dfe331c1992ed99b2f49842cf376c941b0 [file] [log] [blame]
aguilardf848c142021-06-28 15:47:54 +02001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
13*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020014Documentation [BASIC-18] NS with a VLD with a virtual link profile.
aguilardf848c142021-06-28 15:47:54 +020015
16Library OperatingSystem
17Library String
18Library Collections
19Library SSHLibrary
20
21Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
22Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
23Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
24Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
25
26Force Tags basic_18 cluster_main daily regression
27
28Suite Teardown Run Keyword And Ignore Error Suite Cleanup
29
30
31*** Variables ***
32# NS and VNF descriptor package folder and ids
33${vnfd_pkg} ubuntu_4ifaces_vnf
34${vnfd_name} ubuntu_4ifaces-vnf
35${nsd_pkg} ubuntu_4ifaces_ns
36${nsd_name} ubuntu_4ifaces-ns
37
38# NS instance name and configuration
39${ns_name} basic_18
40${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
41
42# SSH keys and username to be used
43${publickey} %{HOME}/.ssh/id_rsa.pub
44${privatekey} %{HOME}/.ssh/id_rsa
45${username} ubuntu
46
47# VNFs data
48${vnf_member_index_1} vnf1
49${vnf_member_index_2} vnf2
garciadeblas6b326822022-06-08 13:15:19 +020050${iface1_name} eth1
aguilardf848c142021-06-28 15:47:54 +020051${iface2_name} eth2
garciadeblas6b326822022-06-08 13:15:19 +020052${iface3_name} eth3
aguilardf848c142021-06-28 15:47:54 +020053${datanet1_prefix} ^192.168.10.*
54${datanet2_prefix} ^192.168.20.*
55${datanet3_prefix} ^192.168.30.*
56
57${success_return_code} 0
58
59
60*** Test Cases ***
61Create VNF Descriptor
62
garciadeblasf4ebaa82022-06-23 13:33:26 +020063 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
aguilardf848c142021-06-28 15:47:54 +020064
65
66Create NS Descriptor
67
garciadeblasf4ebaa82022-06-23 13:33:26 +020068 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
aguilardf848c142021-06-28 15:47:54 +020069
70
71Instantiate Network Service
72
garciadeblasf4ebaa82022-06-23 13:33:26 +020073 ${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
76
77Get Vnfs Info
78
garciadeblasf4ebaa82022-06-23 13:33:26 +020079 Variable Should Exist ${ns_id} msg=Network service instance is not available
80 @{vnfr_list}= Get Ns Vnfr Ids ${ns_id}
aguilardf848c142021-06-28 15:47:54 +020081 Log List ${vnfr_list}
82 Set Suite Variable ${vnf_id1} ${vnfr_list}[0]
83 Set Suite Variable ${vnf_id2} ${vnfr_list}[1]
garciadeblasf4ebaa82022-06-23 13:33:26 +020084 ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1}
85 Set Suite Variable ${vnf1_ipmgmt} ${ip}
garciadeblas321726f2022-12-21 11:43:06 +010086 Log ${vnf1_ipmgmt}
garciadeblasf4ebaa82022-06-23 13:33:26 +020087 ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2}
88 Set Suite Variable ${vnf2_ipmgmt} ${ip}
garciadeblas321726f2022-12-21 11:43:06 +010089 Log ${vnf2_ipmgmt}
aguilardf848c142021-06-28 15:47:54 +020090
91
92Check Vnf1 IPs
93
garciadeblasf4ebaa82022-06-23 13:33:26 +020094 Variable Should Exist ${vnf_id1} msg=VNF1 is not available
garciadeblas9553b6f2023-06-19 12:00:49 +020095 ${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"'
garciadeblasf4ebaa82022-06-23 13:33:26 +020096 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
97 Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix}
aguilardf848c142021-06-28 15:47:54 +020098 Set Suite Variable ${vnf1_ip1} ${stdout}
garciadeblas9553b6f2023-06-19 12:00:49 +020099 ${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"'
garciadeblasf4ebaa82022-06-23 13:33:26 +0200100 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
101 Should Match Regexp ${stdout} ${datanet2_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet2_prefix}
aguilardf848c142021-06-28 15:47:54 +0200102 Set Suite Variable ${vnf1_ip2} ${stdout}
garciadeblas9553b6f2023-06-19 12:00:49 +0200103 ${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"'
garciadeblasf4ebaa82022-06-23 13:33:26 +0200104 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
105 Should Match Regexp ${stdout} ${datanet3_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet3_prefix}
aguilardf848c142021-06-28 15:47:54 +0200106 Set Suite Variable ${vnf1_ip3} ${stdout}
107
108
109
110Check Vnf2 IPs
111
garciadeblasf4ebaa82022-06-23 13:33:26 +0200112 Variable Should Exist ${vnf_id1} msg=VNF2 is not available
garciadeblas9553b6f2023-06-19 12:00:49 +0200113 ${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"'
garciadeblasf4ebaa82022-06-23 13:33:26 +0200114 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
115 Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix}
aguilardf848c142021-06-28 15:47:54 +0200116 Set Suite Variable ${vnf2_ip1} ${stdout}
garciadeblas9553b6f2023-06-19 12:00:49 +0200117 ${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"'
garciadeblasf4ebaa82022-06-23 13:33:26 +0200118 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
119 Should Match Regexp ${stdout} ${datanet2_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet2_prefix}
aguilardf848c142021-06-28 15:47:54 +0200120 Set Suite Variable ${vnf2_ip2} ${stdout}
garciadeblas9553b6f2023-06-19 12:00:49 +0200121 ${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"'
garciadeblasf4ebaa82022-06-23 13:33:26 +0200122 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
123 Should Match Regexp ${stdout} ${datanet3_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet3_prefix}
aguilardf848c142021-06-28 15:47:54 +0200124 Set Suite Variable ${vnf2_ip3} ${stdout}
125
126
aguilardc5468a12022-06-10 12:58:09 +0200127Verify Vnf1 Interfaces
128
129 Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available
130 Variable Should Exist ${privatekey} msg=SSH private key not available
131 Sleep 10 seconds Wait for SSH daemon to be up
132 ${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 +0100133 Log ${stdout}
aguilardc5468a12022-06-10 12:58:09 +0200134 @{ip} = Split String ${stdout}
135 Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix}
136 Should Match Regexp ${ip}[2] ${datanet2_prefix} msg=${ip}[2] doesn't match subnet's regexp ${datanet2_prefix}
137 Should Match Regexp ${ip}[3] ${datanet3_prefix} msg=${ip}[3] doesn't match subnet's regexp ${datanet3_prefix}
138
139
140Verify Vnf2 Interfaces
141
142 Variable Should Exist ${vnf2_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available
143 Variable Should Exist ${privatekey} msg=SSH private key not available
144 ${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 +0100145 Log ${stdout}
aguilardc5468a12022-06-10 12:58:09 +0200146 @{ip} = Split String ${stdout}
147 Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix}
148 Should Match Regexp ${ip}[2] ${datanet2_prefix} msg=${ip}[2] doesn't match subnet's regexp ${datanet2_prefix}
149 Should Match Regexp ${ip}[3] ${datanet3_prefix} msg=${ip}[3] doesn't match subnet's regexp ${datanet3_prefix}
150
151
aguilardf848c142021-06-28 15:47:54 +0200152Ping from Vnf1 to Vnf2
153
garciadeblasf4ebaa82022-06-23 13:33:26 +0200154 Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available
155 Variable Should Exist ${privatekey} msg=SSH private key not available
aguilardf848c142021-06-28 15:47:54 +0200156 ${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 +0100157 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200158 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip1}
garciadeblas321726f2022-12-21 11:43:06 +0100159 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200160 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip2}
garciadeblas321726f2022-12-21 11:43:06 +0100161 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200162 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip3}
garciadeblas321726f2022-12-21 11:43:06 +0100163 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200164
165
166Ping from Vnf2 to Vnf1
167
garciadeblasf4ebaa82022-06-23 13:33:26 +0200168 Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available
169 Variable Should Exist ${privatekey} msg=SSH private key not available
aguilardf848c142021-06-28 15:47:54 +0200170 ${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 +0100171 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200172 ${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 +0100173 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200174 ${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 +0100175 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200176 ${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 +0100177 Log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200178
179
180Delete NS Instance
181 [Tags] cleanup
182
garciadeblasf4ebaa82022-06-23 13:33:26 +0200183 Delete NS ${ns_name}
aguilardf848c142021-06-28 15:47:54 +0200184
185
186Delete NS Descriptor
187 [Tags] cleanup
188
garciadeblasf4ebaa82022-06-23 13:33:26 +0200189 Delete NSD ${nsd_name}
aguilardf848c142021-06-28 15:47:54 +0200190
191
192Delete VNF Descriptor
193 [Tags] cleanup
194
garciadeblasf4ebaa82022-06-23 13:33:26 +0200195 Delete VNFD ${vnfd_name}
aguilardf848c142021-06-28 15:47:54 +0200196
197
198*** Keywords ***
199Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200200 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
aguilardf848c142021-06-28 15:47:54 +0200201
garciadeblasf4ebaa82022-06-23 13:33:26 +0200202 Run Keyword If Any Tests Failed Delete NS ${ns_name}
203 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
204 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}