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
23 Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
24 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
25 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot
26 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot
27 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
28 Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
29 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
31 Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_network_slicing_data.py
33 Suite Teardown Run Keyword And Ignore Error Test Cleanup
42 ${vnf_ip_addr} ${EMPTY}
43 ${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
48 Create Slice VNF Descriptors
49 [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
51 [Tags] basic_network_slicing SLICING-01
53 Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}'
54 Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}'
57 Create Slice NS Descriptors
58 [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
60 [Tags] basic_network_slicing SLICING-01
62 Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}'
63 Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}'
66 [Documentation] Onboards the Network Slice Template: nst (in the variables file)
68 [Tags] basic_network_slicing SLICING-01
70 Create NST '%{PACKAGES_FOLDER}/${nst}'
72 Network Slice Instance Test
73 [Documentation] Instantiates the NST recently onboarded and sets the instantiation id as a suite variable (nsi_id)
75 [Tags] basic_network_slicing SLICING-01
77 ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey}
78 Set Suite Variable ${nsi_id} ${id}
81 Get Middle Vnf Management Ip
82 [Documentation] Obtains the management IP of the slice middle VNF (name in the reources file) and sets the ip as a suite variable (mgmt_vnf_ip)
84 [Tags] basic_network_slicing SLICING-01
86 ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1
87 ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index}
88 Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip}
91 Get Slice Vnf Ip Addresses
92 [Documentation] Obtains the list of IPs addresses in the slice and sets the list as a suite variable (slice_vnfs_ips)
94 [Tags] basic_network_slicing SLICING-01
96 # Get all the ns_id in the slice except the middle one to avoid self ping
97 @{slice_ns_list} Get Slice Ns List Except One ${slice_name} ${middle_ns_name}
98 log many @{slice_ns_list}
99 @{temp_list}= Create List
100 # For each ns_id in the list, get all the vnf_id and their IP addresses
101 FOR ${ns_id} IN @{slice_ns_list}
103 @{vnf_id_list} Get Ns Vnf List ${ns_id}
104 # For each vnf_id in the list, get all its IP addresses
105 @{ns_ip_list} Get Ns Ip List @{vnf_id_list}
106 @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list}
108 Log List ${temp_list}
109 Set Suite Variable ${slice_vnfs_ips} ${temp_list}
113 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
115 [Tags] basic_network_slicing SLICING-01
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 [Tags] basic_network_slicing SLICING-01
125 Sleep 30s Waiting ssh daemon to be up
126 Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey}
129 Test Slice Connectivity
130 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
131 ... and pings all the IP addresses in the list (slice_vnfs_ips)
133 [Tags] basic_network_slicing SLICING-01
134 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice_vnfs_ips}
138 [Documentation] Stops the slice instance (slice_name)
140 [Tags] basic_network_slicing SLICING-01 cleanup
142 Delete NSI ${slice_name}
145 Delete Slice Template
146 [Documentation] Deletes the NST (nst_name) from OSM
148 [Tags] basic_network_slicing SLICING-01 cleanup
150 Delete NST ${nst_name}
153 Delete NS Descriptors
154 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
156 [Tags] basic_network_slicing SLICING-01 cleanup
158 Delete NSD ${nsd1_name}
159 Delete NSD ${nsd2_name}
162 Delete VNF Descriptors
163 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
165 [Tags] basic_network_slicing SLICING-01 cleanup
167 Delete VNFD ${vnfd1_name}
168 Delete VNFD ${vnfd2_name}
173 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and template
175 Run Keyword If Test Failed Delete NST ${nst_name}
177 Run Keyword If Test Failed Delete NSD ${nsd1_name}
178 Run Keyword If Test Failed Delete NSD ${nsd2_name}
180 Run Keyword If Test Failed Delete VNFD ${vnfd1_name}
181 Run Keyword If Test Failed Delete VNFD ${vnfd2_name}