3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 Documentation [SLICE-02] Shared Network Slicing.
18 Library OperatingSystem
24 Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
25 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
26 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot
27 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot
28 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
29 Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
30 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
32 Force Tags slice_02 cluster_slices daily regression
34 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
39 # NS and VNF descriptor package files
40 ${vnfd1_pkg} slice_basic_vnf
41 ${vnfd2_pkg} slice_basic_middle_vnf
42 ${nsd1_pkg} slice_basic_ns
43 ${nsd2_pkg} slice_basic_middle_ns
44 ${nst} slice_basic_nst/slice_basic_nst.yaml
45 ${nst2} slice_basic_nst/slice_basic_2nd_nst.yaml
48 ${slice_name} slicebasic
49 ${slice2_name} sliceshared
50 ${middle_ns_name} slicebasic.slice_basic_nsd_2
53 ${nst_name} slice_basic_nst
54 ${nst2_name} slice_basic_nst2
55 ${vnfd1_name} slice_basic_vnf
56 ${vnfd2_name} slice_basic_middle_vnf
57 ${nsd1_name} slice_basic_ns
58 ${nsd2_name} slice_basic_middle_ns
60 # SSH keys and username to be used
61 ${publickey} %{HOME}/.ssh/id_rsa.pub
62 ${privatekey} %{HOME}/.ssh/id_rsa
67 ${vnf_member_index} middle
68 ${vnf_ip_addr} ${EMPTY}
69 ${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
73 Create Slice VNF Descriptors
74 [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
76 Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}'
77 Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}'
80 Create Slice NS Descriptors
81 [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
83 Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}'
84 Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}'
86 Create Slice Templates
87 [Documentation] Onboards the Network Slice Templates: nst, nst2 (in the variables file)
89 Create NST '%{PACKAGES_FOLDER}/${nst}'
90 Create NST '%{PACKAGES_FOLDER}/${nst2}'
92 Network Slice First Instance
93 [Documentation] Instantiates the First NST recently onboarded (nst_name) and sets the instantiation id as a suite variable (nsi_id)
94 ... The slice contains 3 NS (1 shared)
96 ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey}
97 Set Suite Variable ${nsi_id} ${id}
100 Network Slice Second Instance
101 [Documentation] Instantiates the Second NST recently onboarded (nst2_name) and sets the instantiation id as a suite variable (nsi2_id)
102 ... The slice contains 2 NS (1 shared)
104 ${id}= Create Network Slice ${nst2_name} %{VIM_TARGET} ${slice2_name} ${nst_config} ${publickey}
105 Set Suite Variable ${nsi2_id} ${id}
108 First Network Slice Ns Count
109 [Documentation] Counts the NS in both slice instances and shoul be equal to 4
111 ${slice1_count}= Get Slice Ns Count ${slice_name}
112 ${slice2_count}= Get Slice Ns Count ${slice2_name}
113 ${together}= Evaluate ${slice1_count} + ${slice2_count}
114 Should Be Equal As Integers ${together} 4
117 Get Middle Vnf Management Ip
118 [Documentation] Obtains the management IP of the shared NS main (only) VNF and sets it as a suite variable (mgmt_vnf_ip)
120 ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1
121 ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index}
122 Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty
123 Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip}
126 Get First Slice Vnf IPs
127 [Documentation] Obtains the list of IPs addresses in the first slice and sets the list as a suite variable (slice1_vnfs_ips)
129 # Get all the ns_id in the slice except the middle one
130 @{ip_list} Get Slice Vnf Ip Addresses ${slice_name}
131 Should Be True ${ip_list} is not None
132 Set Suite Variable ${slice1_vnfs_ips} ${ip_list}
136 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
138 Sleep 60s Waiting for the network to be up
139 # Ping to the middle VNF
140 Test Connectivity ${mgmt_vnf_ip}
143 Test Middle Vnf SSH Access
144 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
146 Sleep 30s Waiting ssh daemon to be up
147 Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey}
150 Test First Slice Connectivity
151 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
152 ... and pings all the IP addresses in the list (slice1_vnfs_ips)
154 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice1_vnfs_ips}
157 Delete Slice One Instance
158 [Documentation] Stops the slice instance (slice_name)
162 Delete NSI ${slice_name}
165 Second Network Slice Ns Count
166 [Documentation] Counts the NS in both slice instances and should be equal to 2
168 ${slice1_count}= Get Slice Ns Count ${slice_name}
169 ${slice2_count}= Get Slice Ns Count ${slice2_name}
170 ${together}= Evaluate ${slice1_count} + ${slice2_count}
171 Should Be Equal As Integers ${together} 2
173 Get Second Slice Vnf IPs
174 [Documentation] Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips)
176 # Get all the ns_id in the slice
177 @{ip_list} Get Slice Vnf Ip Addresses ${slice2_name}
178 Should Be True ${ip_list} is not None
179 Set Suite Variable ${slice2_vnfs_ips} ${ip_list}
182 Test Second Slice Connectivity
183 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
184 ... and pings all the IP addresses in the list (slice2_vnfs_ips)
186 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice2_vnfs_ips}
189 Delete Slice Two Instance
190 [Documentation] Stops the slice instance (slice2_name)
194 Delete NSI ${slice2_name}
197 Delete Slice One Template
198 [Documentation] Deletes the NST (nst_name) from OSM
202 Delete NST ${nst_name}
205 Delete Slice Two Template
206 [Documentation] Deletes the NST (nst2_name) from OSM
210 Delete NST ${nst2_name}
213 Delete NS Descriptors
214 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
218 Delete NSD ${nsd1_name}
219 Delete NSD ${nsd2_name}
222 Delete VNF Descriptors
223 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
227 Delete VNFD ${vnfd1_name}
228 Delete VNFD ${vnfd2_name}
233 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and templates
235 Run Keyword If Any Tests Failed Delete NSI ${slice_name}
236 Run Keyword If Any Tests Failed Delete NSI ${slice2_name}
238 Run Keyword If Any Tests Failed Delete NST ${nst_name}
239 Run Keyword If Any Tests Failed Delete NST ${nst2_name}
241 Run Keyword If Any Tests Failed Delete NSD ${nsd1_name}
242 Run Keyword If Any Tests Failed Delete NSD ${nsd2_name}
244 Run Keyword If Any Tests Failed Delete VNFD ${vnfd1_name}
245 Run Keyword If Any Tests Failed Delete VNFD ${vnfd2_name}