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/shared_network_slicing_data.py
32 Suite Teardown Run Keyword And Ignore Error Test Cleanup
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
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
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
69 Create NST '%{PACKAGES_FOLDER}/${nst}'
70 Create NST '%{PACKAGES_FOLDER}/${nst2}'
72 Network Slice One Instance Test
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
78 ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey}
79 Set Suite Variable ${nsi_id} ${id}
82 Network Slice Two Instance Test
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
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
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
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 Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip}
113 Get First Slice Vnf IPs
114 [Documentation] Obtains the list of IPs addresses in the first slice and sets the list as a suite variable (slice1_vnfs_ips)
116 [Tags] shared_network_slicing SLICING-02
118 # Get all the ns_id in the slice except the middle one
119 @{ip_list} Get Slice Vnf Ip Addresses ${slice_name}
120 Set Suite Variable ${slice1_vnfs_ips} ${ip_list}
124 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
126 [Tags] shared_network_slicing SLICING-02
128 Sleep 60s Waiting for the network to be up
129 # Ping to the middle VNF
130 Test Connectivity ${mgmt_vnf_ip}
133 Test Middle Vnf SSH Access
134 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
136 [Tags] shared_network_slicing SLICING-02
138 Sleep 30s Waiting ssh daemon to be up
139 Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey}
142 Test First Slice Connectivity
143 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
144 ... and pings all the IP addresses in the list (slice1_vnfs_ips)
146 [Tags] shared_network_slicing SLICING-02
148 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice1_vnfs_ips}
151 Stop Slice One Instance
152 [Documentation] Stops the slice instance (slice_name)
154 [Tags] shared_network_slicing SLICING-02 cleanup
156 Delete NSI ${slice_name}
159 Second Network Slice Ns Count
160 [Documentation] Counts the NS in both slice instances and should be equal to 2
162 [Tags] shared_network_slicing SLICING-02
164 ${slice1_count}= Get Slice Ns Count ${slice_name}
165 ${slice2_count}= Get Slice Ns Count ${slice2_name}
166 ${together}= Evaluate ${slice1_count} + ${slice2_count}
167 Should Be Equal As Integers ${together} 2
169 Get Second Slice Vnf IPs
170 [Documentation] Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips)
172 [Tags] shared_network_slicing SLICING-02
174 # Get all the ns_id in the slice
175 @{ip_list} Get Slice Vnf Ip Addresses ${slice2_name}
176 Set Suite Variable ${slice2_vnfs_ips} ${ip_list}
179 Test Second Slice Connectivity
180 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
181 ... and pings all the IP addresses in the list (slice2_vnfs_ips)
183 [Tags] shared_network_slicing SLICING-02
185 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice2_vnfs_ips}
188 Stop Slice Two Instance
189 [Documentation] Stops the slice instance (slice2_name)
191 [Tags] shared_network_slicing SLICING-02 cleanup
193 Delete NSI ${slice2_name}
196 Delete Slice One Template
197 [Documentation] Deletes the NST (nst_name) from OSM
199 [Tags] shared_network_slicing SLICING-02 cleanup
201 Delete NST ${nst_name}
204 Delete Slice Two Template
205 [Documentation] Deletes the NST (nst2_name) from OSM
207 [Tags] shared_network_slicing SLICING-02 cleanup
209 Delete NST ${nst2_name}
212 Delete NS Descriptors
213 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
215 [Tags] shared_network_slicing SLICING-02 cleanup
217 Delete NSD ${nsd1_name}
218 Delete NSD ${nsd2_name}
221 Delete VNF Descriptors
222 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
224 [Tags] shared_network_slicing SLICING-02 cleanup
226 Delete VNFD ${vnfd1_name}
227 Delete VNFD ${vnfd2_name}
232 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and templates
234 Run Keyword If Test Failed Delete NST ${nst_name}
235 Run Keyword If Test Failed Delete NST ${nst2_name}
237 Run Keyword If Test Failed Delete NSD ${nsd1_name}
238 Run Keyword If Test Failed Delete NSD ${nsd2_name}
240 Run Keyword If Test Failed Delete VNFD ${vnfd1_name}
241 Run Keyword If Test Failed Delete VNFD ${vnfd2_name}