4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 Documentation [SLICE-02] Shared Network Slicing.
20 Library OperatingSystem
26 Resource ../lib/vnfd_lib.resource
27 Resource ../lib/nsd_lib.resource
28 Resource ../lib/nst_lib.resource
29 Resource ../lib/nsi_lib.resource
30 Resource ../lib/ns_lib.resource
31 Resource ../lib/connectivity_lib.resource
32 Resource ../lib/ssh_lib.resource
34 Test Tags slice_02 cluster_slices daily regression
36 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
40 # NS and VNF descriptor package files
41 ${VNFD1_PKG} slice_basic_vnf
42 ${VNFD2_PKG} slice_basic_middle_vnf
43 ${NSD1_PKG} slice_basic_ns
44 ${NSD2_PKG} slice_basic_middle_ns
45 ${NST} slice_basic_nst/slice_basic_nst.yaml
46 ${NST2} slice_basic_nst/slice_basic_2nd_nst.yaml
49 ${SLICE_NAME} slicebasic
50 ${SLICE2_NAME} sliceshared
51 ${MIDDLE_NS_NAME} slicebasic.slice_basic_nsd_2
54 ${NST_NAME} slice_basic_nst
55 ${NST2_NAME} slice_basic_nst2
56 ${VNFD1_NAME} slice_basic_vnf
57 ${VNFD2_NAME} slice_basic_middle_vnf
58 ${NSD1_NAME} slice_basic_ns
59 ${NSD2_NAME} slice_basic_middle_ns
61 # SSH keys and username to be used
62 ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
63 ${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)
75 Create VNFD '%{PACKAGES_FOLDER}/${VNFD1_PKG}'
76 Create VNFD '%{PACKAGES_FOLDER}/${VNFD2_PKG}'
78 Create Slice NS Descriptors
79 [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
80 Create NSD '%{PACKAGES_FOLDER}/${NSD1_PKG}'
81 Create NSD '%{PACKAGES_FOLDER}/${NSD2_PKG}'
83 Create Slice Templates
84 [Documentation] Onboards the Network Slice Templates: nst, nst2 (in the variables file)
85 Create NST '%{PACKAGES_FOLDER}/${NST}'
86 Create NST '%{PACKAGES_FOLDER}/${NST2}'
88 Network Slice First Instance
89 [Documentation] Instantiates the First NST recently onboarded (nst_name) and sets the instantiation id as a suite variable (nsi_id)
90 ... The slice contains 3 NS (1 shared)
91 ${id}= Create Network Slice ${NST_NAME} %{VIM_TARGET} ${SLICE_NAME} ${NST_CONFIG} ${PUBLICKEY}
92 Set Suite Variable ${NSI_ID} ${id}
94 Network Slice Second Instance
95 [Documentation] Instantiates the Second NST recently onboarded (nst2_name) and sets the instantiation id as a suite variable (nsi2_id)
96 ... The slice contains 2 NS (1 shared)
97 ${id}= Create Network Slice ${NST2_NAME} %{VIM_TARGET} ${SLICE2_NAME} ${NST_CONFIG} ${PUBLICKEY}
98 Set Suite Variable ${NSI2_ID} ${id}
100 First Network Slice Ns Count
101 [Documentation] Counts the NS in both slice instances and shoul be equal to 4
102 ${slice1_count}= Get Slice Ns Count ${SLICE_NAME}
103 ${slice2_count}= Get Slice Ns Count ${SLICE2_NAME}
104 ${together}= Evaluate ${slice1_count} + ${slice2_count}
105 Should Be Equal As Integers ${together} 4
107 Get Middle Vnf Management Ip
108 [Documentation] Obtains the management IP of the shared NS main (only) VNF and sets it as a suite variable (mgmt_vnf_ip)
109 ${middle_ns_id}= Run And Return RC And Output osm ns-list | grep ${MIDDLE_NS_NAME} | awk '{print $4}' 2>&1
110 ${vnf_ip}= Get Vnf Management Ip Address ${middle_ns_id}[1] ${VNF_MEMBER_INDEX}
111 IF '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty
112 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)
116 # Get all the ns_id in the slice except the middle one
117 @{ip_list}= Get Slice Vnf Ip Addresses ${SLICE_NAME}
118 Should Be True ${ip_list} is not None
119 Set Suite Variable ${SLICE1_VNFS_IPS} ${ip_list}
122 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
123 Sleep 60s Waiting for the network to be up
124 # Ping to the middle VNF
125 Test Connectivity ${MGMT_VNF_IP}
127 Test Middle Vnf SSH Access
128 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
129 Sleep 30s Waiting ssh daemon to be up
130 Test SSH Connection ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY}
132 Test First Slice Connectivity
133 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
134 ... and pings all the IP addresses in the list (slice1_vnfs_ips)
135 Ping Many ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} @{SLICE1_VNFS_IPS}
137 Delete Slice One Instance
138 [Documentation] Stops the slice instance (slice_name)
140 Delete NSI ${SLICE_NAME}
142 Second Network Slice Ns Count
143 [Documentation] Counts the NS in both slice instances and should be equal to 2
144 ${slice1_count}= Get Slice Ns Count ${SLICE_NAME}
145 ${slice2_count}= Get Slice Ns Count ${SLICE2_NAME}
146 ${together}= Evaluate ${slice1_count} + ${slice2_count}
147 Should Be Equal As Integers ${together} 2
149 Get Second Slice Vnf IPs
150 [Documentation] Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips)
151 # Get all the ns_id in the slice
152 @{ip_list}= Get Slice Vnf Ip Addresses ${SLICE2_NAME}
153 Should Be True ${ip_list} is not None
154 Set Suite Variable ${SLICE2_VNFS_IPS} ${ip_list}
156 Test Second Slice Connectivity
157 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
158 ... and pings all the IP addresses in the list (slice2_vnfs_ips)
159 Ping Many ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} @{SLICE2_VNFS_IPS}
161 Delete Slice Two Instance
162 [Documentation] Stops the slice instance (slice2_name)
164 Delete NSI ${SLICE2_NAME}
166 Delete Slice One Template
167 [Documentation] Deletes the NST (nst_name) from OSM
169 Delete NST ${NST_NAME}
171 Delete Slice Two Template
172 [Documentation] Deletes the NST (nst2_name) from OSM
174 Delete NST ${NST2_NAME}
176 Delete NS Descriptors
177 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
179 Delete NSD ${NSD1_NAME}
180 Delete NSD ${NSD2_NAME}
182 Delete VNF Descriptors
183 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
185 Delete VNFD ${VNFD1_NAME}
186 Delete VNFD ${VNFD2_NAME}
191 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and templates
192 Run Keyword If Any Tests Failed Delete NSI ${SLICE_NAME}
193 Run Keyword If Any Tests Failed Delete NSI ${SLICE2_NAME}
195 Run Keyword If Any Tests Failed Delete NST ${NST_NAME}
196 Run Keyword If Any Tests Failed Delete NST ${NST2_NAME}
198 Run Keyword If Any Tests Failed Delete NSD ${NSD1_NAME}
199 Run Keyword If Any Tests Failed Delete NSD ${NSD2_NAME}
201 Run Keyword If Any Tests Failed Delete VNFD ${VNFD1_NAME}
202 Run Keyword If Any Tests Failed Delete VNFD ${VNFD2_NAME}