blob: 2d1ab31d441a8b405244ede1fbdade671750a2c5 [file] [log] [blame]
Gabriel Cuba245b04f2023-05-09 12:37:29 -05001# 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 ***
14Documentation [BASIC-29] NS with a single VNF and two VDU linked by a VLD with ipv6-profile.
15
16Library OperatingSystem
17Library String
18Library Collections
19Library SSHLibrary
20Library JSONLibrary
21
22Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot
23Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
24Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
25Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
26Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
27Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot
28
29Force Tags basic_29 cluster_main daily
30
31Suite Teardown Run Keyword And Ignore Error Suite Cleanup
32
33
34*** Variables ***
35# NS and VNF descriptor package folder and ids
36${vnfd_pkg} ipv6profile_2vm_vnf
37${vnfd_name} ipv6profile_2vm-vnf
38${nsd_pkg} ipv6profile_2vm_ns
39${nsd_name} ipv6profile_2vm-ns
40
41# NS instance name and configuration
42${ns_name} basic_29
43${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
44
45# SSH keys and username to be used
46${publickey} %{HOME}/.ssh/id_rsa.pub
47${username} ubuntu
48
49# VNFs data
50${vnf_member_index_1} vnf
51${internal_prefix} ^2001:db8::*
52
53${success_return_code} 0
54
55
56*** Test Cases ***
57Create VNF Descriptor
58
59 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
60
61
62Create NS Descriptor
63
64 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
65
66
67Instantiate Network Service
68
69 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
70 Set Suite Variable ${ns_id} ${id}
71
72
73Get Vnf Info
74
75 Variable Should Exist ${ns_id} msg=Network service instance is not available
76 @{vnfr_list}= Get Ns Vnfr Ids ${ns_id}
77 Log List ${vnfr_list}
78 Set Suite Variable ${vnf_id} ${vnfr_list}[0]
79 ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1}
80 Set Suite Variable ${vnf_ipmgmt} ${ip}
81 Log ${vnf_ipmgmt}
82
83
84Check Vnf IPs
85
86 Variable Should Exist ${vnf_id} msg=VNF is not available
garciadeblas9553b6f2023-06-19 12:00:49 +020087 ${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"'
Gabriel Cuba245b04f2023-05-09 12:37:29 -050088 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
89 Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix}
garciadeblas9553b6f2023-06-19 12:00:49 +020090 ${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"'
Gabriel Cuba245b04f2023-05-09 12:37:29 -050091 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
92 Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix}
93
94Check that ipv6 address_mode and ra_mode are set
95
garciadeblas9553b6f2023-06-19 12:00:49 +020096 ${rc} ${vim_info}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq -r '.vim_info[].interfaces[].vim_info'
Gabriel Cuba245b04f2023-05-09 12:37:29 -050097 ${subnet_id}= Get Regexp Matches ${vim_info} {ip_address: '2001:db8::.*', subnet_id: ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})} 1
98 ${subnet_info}= Get Subnet ${subnet_id}[0]
99 ${json_object}= Convert String to JSON ${subnet_info}
100 ${address_mode}= Get From Dictionary ${json_object} ipv6_address_mode
101 ${ra_mode}= Get From Dictionary ${json_object} ipv6_ra_mode
102 Should Be Equal ${address_mode} dhcpv6-stateful msg=ipv6_address_mode does not equals to dhcpv6-stateful
103 Should Be Equal ${ra_mode} dhcpv6-stateful msg=ipv6_ra_mode does not equals to dhcpv6-stateful
104
105
106Delete NS Instance
107 [Tags] cleanup
108
109 Delete NS ${ns_name}
110
111
112Delete NS Descriptor
113 [Tags] cleanup
114
115 Delete NSD ${nsd_name}
116
117
118Delete VNF Descriptor
119 [Tags] cleanup
120
121 Delete VNFD ${vnfd_name}
122
123
124*** Keywords ***
125Suite Cleanup
126 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
127
128 Run Keyword If Any Tests Failed Delete NS ${ns_name}
129 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
130 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}