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.
20 ${success_return_code} 0
21 ${slice_launch_pol_time} 30sec
22 ${slice_delete_pol_time} 15sec
23 ${vim_timeout_multiplier} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0}
29 [Documentation] Instantiates a NST and returns an instantiation id (nsi), verifying the slice is successfully instantiated
31 ... nst: Name of the slice template
32 ... vim_name: Name of the VIM entry already in OSM
33 ... slice_name: Name of the slice instance
34 ... slice_config: Extra parameters that might require the slice instantiation i.e. configuration attributes
35 ... publickey: SSH public key of the local machine
36 ... Execution example:
37 ... \${nsi}= Create Network Slice \${nst} \${vim_name} \${slice_name} \${slice_config} \${publickey}
39 [Arguments] ${nst} ${vim_name} ${slice_name} ${slice_config} ${publickey} ${slice_launch_max_wait_time}=6min ${config_file}=${EMPTY}
41 ${slice_launch_max_wait_time}= Convert Time ${slice_launch_max_wait_time} result_format=number
42 ${slice_launch_max_wait_time}= Evaluate ${slice_launch_max_wait_time} * ${vim_timeout_multiplier}
43 ${config_attr} Set Variable If '${slice_config}'!='${EMPTY}' --config '${slice_config}' \
44 ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \
45 ${config_file_attr} Set Variable If '${config_file}'!='${EMPTY}' --config_file '${config_file}' \
47 ${nsi_id}= Instantiate Network Slice ${slice_name} ${nst} ${vim_name} ${config_attr} ${config_file_attr} ${sshkeys_attr}
50 WAIT UNTIL KEYWORD SUCCEEDS ${slice_launch_max_wait_time} ${slice_launch_pol_time} Check For Network Slice Instance To Configured ${slice_name}
51 Check For Network Slice Instance For Failure ${slice_name}
55 Instantiate Network Slice
56 [Documentation] Instantiates a NST and returns an instantiation id (nsi)
58 ... slice_name: Name of the slice instance
59 ... nst: Name of the slice template
60 ... vim_name: Name of the VIM entry already in OSM
61 ... slice_extra_args: Extra parameters that might require the slice instantiation i.e. configuration attributes
62 ... Execution example:
63 ... \${nsi}= Instantiate Network Slice \${slice_name} \${nst} \${vim_name} \${config_attr}
65 [Arguments] ${slice_name} ${nst} ${vim_name} ${slice_extra_args} ${sshkeys_attr}
67 ${rc} ${stdout}= Run and Return RC and Output osm nsi-create --nsi_name ${slice_name} --nst_name ${nst} --vim_account ${vim_name} ${sshkeys_attr} ${slice_extra_args}
69 Should Be Equal As Integers ${rc} ${success_return_code}
74 [Documentation] Retrieves the list of NS in a slice
76 ... slice_name: Name of the slice instance
77 ... Execution example:
78 ... \@{slice_ns_list}= Get Slice Ns List \${slice_name}
80 [Arguments] ${slice_name}
82 Should Not Be Empty ${slice_name}
83 @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '{print $4}' 2>&1
84 # Returns a String of ns_id and needs to be converted into a list
85 @{ns_list} = Split String ${ns_list_string}[1]
90 Get Slice Ns List Except One
91 [Documentation] Retrieves the list of NS in a slice removing one from the list. This is done to save time in the tests, avoiding one VNF to ping itself.
93 ... slice_name: Name of the slice instance
94 ... exception_ns: Name of the ns that will not appear in the final list
95 ... Execution example:
96 ... \@{slice_ns_list}= Get Slice Ns List Except One \${slice_name} \${exception_ns}
98 [Arguments] ${slice_name} ${exception_ns}
100 Should Not Be Empty ${slice_name}
101 Should Not Be Empty ${exception_ns}
103 @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '!/${exception_ns}/' | awk '{print $4}' 2>&1
104 # Returns a String of ns_id and needs to be converted into a list
105 @{ns_list} = Split String ${ns_list_string}[1]
111 [Documentation] Returns the count of all the NS in a slice
113 ... slice_name: Name of the slice instance
114 ... Execution example:
115 ... \${slice_ns_count}= Get Slice Ns Count \${slice_name}
117 [Arguments] ${slice_name}
119 Should Not Be Empty ${slice_name}
120 ${rc} ${stdout}= Run and Return RC and Output osm ns-list | grep ${slice_name} | wc -l 2>&1
122 Should Be Equal As Integers ${rc} ${success_return_code}
126 Get Slice Vnf Ip Addresses
127 [Documentation] Retrieves the list of IP addresses that belong to each of the VNFs in the slice
129 ... slice_name: Name of the slice instance
130 ... Execution example:
131 ... \@{slice_ip_address_list}= Get Slice Vnf Ip Addresses \${slice_name}
133 [Arguments] ${slice_name}
135 # Get all the ns_id in the slice
136 @{slice_ns_list} Get Slice Ns List ${slice_name}
137 Log Many @{slice_ns_list}
138 @{temp_list}= Create List
139 # For each ns_id in the list, get all the vnf_id and their IP addresses
140 FOR ${ns_id} IN @{slice_ns_list}
142 @{vnf_id_list} Get Ns Vnf List ${ns_id}
143 # For each vnf_id in the list, get all its IP addresses
144 @{ns_ip_list} Get Ns Ip List @{vnf_id_list}
145 @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list}
147 Log List ${temp_list}
148 [Return] @{temp_list}
151 Check For Network Slice Instance To Configured
152 [Documentation] Verify the slice has been instantiated
154 ... slice_name: Name of the slice instance
155 ... Execution example:
156 ... Check For Network Slice Instance To Configured \${slice_name}
158 [Arguments] ${slice_name}
160 ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}"
162 Should Be Equal As Integers ${rc} ${success_return_code}
163 Should Contain Any ${stdout} READY BROKEN configured
166 Check For Network Slice Instance For Failure
167 [Documentation] Verify the slice instance is not in failure
169 ... slice_name: Name of the slice instance
170 ... Execution example:
171 ... Check For Network Slice Instance For Failure \${slice_name}
173 [Arguments] ${slice_name}
175 ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}"
177 Should Be Equal As Integers ${rc} ${success_return_code}
178 Should Not Contain ${stdout} failed
182 [Documentation] Delete Network Slice Instance (NSI)
184 ... slice_name: Name of the slice instance
185 ... slice_delete_max_wait_time: Delete operation timeout
186 ... Execution example:
187 ... Delete NST \${slice_name}
189 [Arguments] ${slice_name} ${slice_delete_max_wait_time}=4min
191 ${rc} ${stdout}= Run and Return RC and Output osm nsi-delete ${slice_name}
193 Should Be Equal As Integers ${rc} ${success_return_code}
195 ${slice_delete_max_wait_time}= Convert Time ${slice_delete_max_wait_time} result_format=number
196 ${slice_delete_max_wait_time}= Evaluate ${slice_delete_max_wait_time} * ${vim_timeout_multiplier}
197 WAIT UNTIL KEYWORD SUCCEEDS ${slice_delete_max_wait_time} ${slice_delete_pol_time} Check For Network Slice Instance To Be Deleted ${slice_name}
200 Check For Network Slice Instance To Be Deleted
201 [Documentation] Verify the slice instance is not present
203 ... slice_name: Name of the slice instance
204 ... Execution example:
205 ... Check For Network Slice Instance \${slice_name}
207 [Arguments] ${slice_name}
209 ${rc} ${stdout}= Run and Return RC and Output osm nsi-list | awk '{print $2}' | grep ${slice_name}
210 Should Not Be Equal As Strings ${stdout} ${slice_name}