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 Library OperatingSystem
22 Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
23 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
24 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot
25 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot
26 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
27 Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
28 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
30 Variables %{ROBOT_DEVOPS_FOLDER}/resources/slice_02-shared_network_slicing_data.py
32 Suite Teardown Run Keyword And Ignore Error Test Cleanup
40 ${vnf_member_index} middle
41 ${vnf_ip_addr} ${EMPTY}
42 ${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
47 Create Slice VNF Descriptors
48 [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
50 [Tags] shared_network_slicing SLICING-02 sanity regression
52 Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}'
53 Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}'
56 Create Slice NS Descriptors
57 [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
59 [Tags] shared_network_slicing SLICING-02 sanity regression
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 [Tags] shared_network_slicing SLICING-02 sanity regression
69 Create NST '%{PACKAGES_FOLDER}/${nst}'
70 Create NST '%{PACKAGES_FOLDER}/${nst2}'
72 Network Slice First Instance
73 [Documentation] Instantiates the First NST recently onboarded (nst_name) and sets the instantiation id as a suite variable (nsi_id)
74 ... The slice contains 3 NS (1 shared)
76 [Tags] shared_network_slicing SLICING-02 sanity regression
78 ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey}
79 Set Suite Variable ${nsi_id} ${id}
82 Network Slice Second Instance
83 [Documentation] Instantiates the Second NST recently onboarded (nst2_name) and sets the instantiation id as a suite variable (nsi2_id)
84 ... The slice contains 2 NS (1 shared)
86 [Tags] shared_network_slicing SLICING-02 sanity regression
88 ${id}= Create Network Slice ${nst2_name} %{VIM_TARGET} ${slice2_name} ${nst_config} ${publickey}
89 Set Suite Variable ${nsi2_id} ${id}
92 First Network Slice Ns Count
93 [Documentation] Counts the NS in both slice instances and shoul be equal to 4
95 [Tags] shared_network_slicing SLICING-02 sanity regression
97 ${slice1_count}= Get Slice Ns Count ${slice_name}
98 ${slice2_count}= Get Slice Ns Count ${slice2_name}
99 ${together}= Evaluate ${slice1_count} + ${slice2_count}
100 Should Be Equal As Integers ${together} 4
103 Get Middle Vnf Management Ip
104 [Documentation] Obtains the management IP of the shared NS main (only) VNF and sets it as a suite variable (mgmt_vnf_ip)
106 [Tags] shared_network_slicing SLICING-02 sanity regression
108 ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1
109 ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index}
110 Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty
111 Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip}
114 Get First Slice Vnf IPs
115 [Documentation] Obtains the list of IPs addresses in the first slice and sets the list as a suite variable (slice1_vnfs_ips)
117 [Tags] shared_network_slicing SLICING-02 sanity regression
119 # Get all the ns_id in the slice except the middle one
120 @{ip_list} Get Slice Vnf Ip Addresses ${slice_name}
121 Should Be True ${ip_list} is not None
122 Set Suite Variable ${slice1_vnfs_ips} ${ip_list}
126 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
128 [Tags] shared_network_slicing SLICING-02 sanity regression
130 Sleep 60s Waiting for the network to be up
131 # Ping to the middle VNF
132 Test Connectivity ${mgmt_vnf_ip}
135 Test Middle Vnf SSH Access
136 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
138 [Tags] shared_network_slicing SLICING-02 sanity regression
140 Sleep 30s Waiting ssh daemon to be up
141 Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey}
144 Test First Slice Connectivity
145 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
146 ... and pings all the IP addresses in the list (slice1_vnfs_ips)
148 [Tags] shared_network_slicing SLICING-02 sanity regression
150 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice1_vnfs_ips}
153 Stop Slice One Instance
154 [Documentation] Stops the slice instance (slice_name)
156 [Tags] shared_network_slicing SLICING-02 sanity regression cleanup
158 Delete NSI ${slice_name}
161 Second Network Slice Ns Count
162 [Documentation] Counts the NS in both slice instances and should be equal to 2
164 [Tags] shared_network_slicing SLICING-02 sanity regression
166 ${slice1_count}= Get Slice Ns Count ${slice_name}
167 ${slice2_count}= Get Slice Ns Count ${slice2_name}
168 ${together}= Evaluate ${slice1_count} + ${slice2_count}
169 Should Be Equal As Integers ${together} 2
171 Get Second Slice Vnf IPs
172 [Documentation] Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips)
174 [Tags] shared_network_slicing SLICING-02 sanity regression
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 [Tags] shared_network_slicing SLICING-02 sanity regression
188 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice2_vnfs_ips}
191 Stop Slice Two Instance
192 [Documentation] Stops the slice instance (slice2_name)
194 [Tags] shared_network_slicing SLICING-02 sanity regression cleanup
196 Delete NSI ${slice2_name}
199 Delete Slice One Template
200 [Documentation] Deletes the NST (nst_name) from OSM
202 [Tags] shared_network_slicing SLICING-02 sanity regression cleanup
204 Delete NST ${nst_name}
207 Delete Slice Two Template
208 [Documentation] Deletes the NST (nst2_name) from OSM
210 [Tags] shared_network_slicing SLICING-02 sanity regression cleanup
212 Delete NST ${nst2_name}
215 Delete NS Descriptors
216 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
218 [Tags] shared_network_slicing SLICING-02 sanity regression cleanup
220 Delete NSD ${nsd1_name}
221 Delete NSD ${nsd2_name}
224 Delete VNF Descriptors
225 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
227 [Tags] shared_network_slicing SLICING-02 sanity regression cleanup
229 Delete VNFD ${vnfd1_name}
230 Delete VNFD ${vnfd2_name}
235 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and templates
237 Run Keyword If Test Failed Delete NST ${nst_name}
238 Run Keyword If Test Failed Delete NST ${nst2_name}
240 Run Keyword If Test Failed Delete NSD ${nsd1_name}
241 Run Keyword If Test Failed Delete NSD ${nsd2_name}
243 Run Keyword If Test Failed Delete VNFD ${vnfd1_name}
244 Run Keyword If Test Failed Delete VNFD ${vnfd2_name}