blob: 9bc2391825f28bfae602eeda8b5ccf8c301bfafc [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}
86 log ${vnf1_ipmgmt}
87 ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2}
88 Set Suite Variable ${vnf2_ipmgmt} ${ip}
89 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
95 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq '."ip-address"' | tr -d \\"
96 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}
garciadeblasf4ebaa82022-06-23 13:33:26 +020099 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface2_name}")' | yq '."ip-address"' | tr -d \\"
100 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}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200103 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface3_name}")' | yq '."ip-address"' | tr -d \\"
104 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
113 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq '."ip-address"' | tr -d \\"
114 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}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200117 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface2_name}")' | yq '."ip-address"' | tr -d \\"
118 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}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200121 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface3_name}")' | yq '."ip-address"' | tr -d \\"
122 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
127Ping from Vnf1 to Vnf2
128
garciadeblasf4ebaa82022-06-23 13:33:26 +0200129 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
aguilardf848c142021-06-28 15:47:54 +0200131 Sleep 30 seconds Wait for SSH daemon to be up
132 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf2_ipmgmt}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200133 log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200134 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip1}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200135 log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200136 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip2}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200137 log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200138 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip3}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200139 log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200140
141
142Ping from Vnf2 to Vnf1
143
garciadeblasf4ebaa82022-06-23 13:33:26 +0200144 Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available
145 Variable Should Exist ${privatekey} msg=SSH private key not available
aguilardf848c142021-06-28 15:47:54 +0200146 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ipmgmt}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200147 log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200148 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip1}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200149 log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200150 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip2}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200151 log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200152 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip3}
garciadeblasf4ebaa82022-06-23 13:33:26 +0200153 log ${stdout}
aguilardf848c142021-06-28 15:47:54 +0200154
155
156Delete NS Instance
157 [Tags] cleanup
158
garciadeblasf4ebaa82022-06-23 13:33:26 +0200159 Delete NS ${ns_name}
aguilardf848c142021-06-28 15:47:54 +0200160
161
162Delete NS Descriptor
163 [Tags] cleanup
164
garciadeblasf4ebaa82022-06-23 13:33:26 +0200165 Delete NSD ${nsd_name}
aguilardf848c142021-06-28 15:47:54 +0200166
167
168Delete VNF Descriptor
169 [Tags] cleanup
170
garciadeblasf4ebaa82022-06-23 13:33:26 +0200171 Delete VNFD ${vnfd_name}
aguilardf848c142021-06-28 15:47:54 +0200172
173
174*** Keywords ***
175Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200176 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
aguilardf848c142021-06-28 15:47:54 +0200177
garciadeblasf4ebaa82022-06-23 13:33:26 +0200178 Run Keyword If Any Tests Failed Delete NS ${ns_name}
179 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
180 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}