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 Variables %{ROBOT_DEVOPS_FOLDER}/resources/slice_02-shared_network_slicing_data.py
34 Force Tags slice_02 cluster_slices daily regression
36 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
44 ${vnf_member_index} middle
45 ${vnf_ip_addr} ${EMPTY}
46 ${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
51 Create Slice VNF Descriptors
52 [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
54 Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}'
55 Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}'
58 Create Slice NS Descriptors
59 [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
61 Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}'
62 Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}'
64 Create Slice Templates
65 [Documentation] Onboards the Network Slice Templates: nst, nst2 (in the variables file)
67 Create NST '%{PACKAGES_FOLDER}/${nst}'
68 Create NST '%{PACKAGES_FOLDER}/${nst2}'
70 Network Slice First Instance
71 [Documentation] Instantiates the First NST recently onboarded (nst_name) and sets the instantiation id as a suite variable (nsi_id)
72 ... The slice contains 3 NS (1 shared)
74 ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey}
75 Set Suite Variable ${nsi_id} ${id}
78 Network Slice Second Instance
79 [Documentation] Instantiates the Second NST recently onboarded (nst2_name) and sets the instantiation id as a suite variable (nsi2_id)
80 ... The slice contains 2 NS (1 shared)
82 ${id}= Create Network Slice ${nst2_name} %{VIM_TARGET} ${slice2_name} ${nst_config} ${publickey}
83 Set Suite Variable ${nsi2_id} ${id}
86 First Network Slice Ns Count
87 [Documentation] Counts the NS in both slice instances and shoul be equal to 4
89 ${slice1_count}= Get Slice Ns Count ${slice_name}
90 ${slice2_count}= Get Slice Ns Count ${slice2_name}
91 ${together}= Evaluate ${slice1_count} + ${slice2_count}
92 Should Be Equal As Integers ${together} 4
95 Get Middle Vnf Management Ip
96 [Documentation] Obtains the management IP of the shared NS main (only) VNF and sets it as a suite variable (mgmt_vnf_ip)
98 ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1
99 ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index}
100 Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty
101 Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip}
104 Get First Slice Vnf IPs
105 [Documentation] Obtains the list of IPs addresses in the first slice and sets the list as a suite variable (slice1_vnfs_ips)
107 # Get all the ns_id in the slice except the middle one
108 @{ip_list} Get Slice Vnf Ip Addresses ${slice_name}
109 Should Be True ${ip_list} is not None
110 Set Suite Variable ${slice1_vnfs_ips} ${ip_list}
114 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
116 Sleep 60s Waiting for the network to be up
117 # Ping to the middle VNF
118 Test Connectivity ${mgmt_vnf_ip}
121 Test Middle Vnf SSH Access
122 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
124 Sleep 30s Waiting ssh daemon to be up
125 Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey}
128 Test First Slice Connectivity
129 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
130 ... and pings all the IP addresses in the list (slice1_vnfs_ips)
132 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice1_vnfs_ips}
135 Delete Slice One Instance
136 [Documentation] Stops the slice instance (slice_name)
140 Delete NSI ${slice_name}
143 Second Network Slice Ns Count
144 [Documentation] Counts the NS in both slice instances and should be equal to 2
146 ${slice1_count}= Get Slice Ns Count ${slice_name}
147 ${slice2_count}= Get Slice Ns Count ${slice2_name}
148 ${together}= Evaluate ${slice1_count} + ${slice2_count}
149 Should Be Equal As Integers ${together} 2
151 Get Second Slice Vnf IPs
152 [Documentation] Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips)
154 # Get all the ns_id in the slice
155 @{ip_list} Get Slice Vnf Ip Addresses ${slice2_name}
156 Should Be True ${ip_list} is not None
157 Set Suite Variable ${slice2_vnfs_ips} ${ip_list}
160 Test Second Slice Connectivity
161 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
162 ... and pings all the IP addresses in the list (slice2_vnfs_ips)
164 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice2_vnfs_ips}
167 Delete Slice Two Instance
168 [Documentation] Stops the slice instance (slice2_name)
172 Delete NSI ${slice2_name}
175 Delete Slice One Template
176 [Documentation] Deletes the NST (nst_name) from OSM
180 Delete NST ${nst_name}
183 Delete Slice Two Template
184 [Documentation] Deletes the NST (nst2_name) from OSM
188 Delete NST ${nst2_name}
191 Delete NS Descriptors
192 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
196 Delete NSD ${nsd1_name}
197 Delete NSD ${nsd2_name}
200 Delete VNF Descriptors
201 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
205 Delete VNFD ${vnfd1_name}
206 Delete VNFD ${vnfd2_name}
211 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and templates
213 Run Keyword If Any Tests Failed Delete NSI ${slice_name}
214 Run Keyword If Any Tests Failed Delete NSI ${slice2_name}
216 Run Keyword If Any Tests Failed Delete NST ${nst_name}
217 Run Keyword If Any Tests Failed Delete NST ${nst2_name}
219 Run Keyword If Any Tests Failed Delete NSD ${nsd1_name}
220 Run Keyword If Any Tests Failed Delete NSD ${nsd2_name}
222 Run Keyword If Any Tests Failed Delete VNFD ${vnfd1_name}
223 Run Keyword If Any Tests Failed Delete VNFD ${vnfd2_name}