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_max_wait_time} 5min
22 ${slice_launch_pol_time} 30sec
23 ${slice_delete_max_wait_time} 1min
24 ${slice_delete_pol_time} 15sec
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}
41 ${config_attr} Set Variable If '${slice_config}'!='${EMPTY}' --config '${slice_config}' \
42 ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \
44 ${nsi_id}= Instantiate Network Slice ${slice_name} ${nst} ${vim_name} ${config_attr} #${sshkeys_attr}
47 WAIT UNTIL KEYWORD SUCCEEDS ${slice_launch_max_wait_time} ${slice_launch_pol_time} Check For Network Slice Instance To Configured ${slice_name}
48 Check For Network Slice Instance For Failure ${slice_name}
52 Instantiate Network Slice
53 [Documentation] Instantiates a NST and returns an instantiation id (nsi)
55 ... slice_name: Name of the slice instance
56 ... nst: Name of the slice template
57 ... vim_name: Name of the VIM entry already in OSM
58 ... slice_extra_args: Extra parameters that might require the slice instantiation i.e. configuration attributes
59 ... Execution example:
60 ... \${nsi}= Instantiate Network Slice \${slice_name} \${nst} \${vim_name} \${config_attr}
62 [Arguments] ${slice_name} ${nst} ${vim_name} ${slice_extra_args}
64 ${rc} ${stdout}= Run and Return RC and Output osm nsi-create --nsi_name ${slice_name} --nst_name ${nst} --vim_account ${vim_name} ${slice_extra_args}
66 Should Be Equal As Integers ${rc} ${success_return_code}
71 [Documentation] Retrieves the list of NS in a slice
73 ... slice_name: Name of the slice instance
74 ... Execution example:
75 ... \@{slice_ns_list}= Get Slice Ns List \${slice_name}
77 [Arguments] ${slice_name}
79 Should Not Be Empty ${slice_name}
80 @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '{print $4}' 2>&1
81 # Returns a String of ns_id and needs to be converted into a list
82 @{ns_list} = Split String ${ns_list_string}[1]
87 Get Slice Ns List Except One
88 [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.
90 ... slice_name: Name of the slice instance
91 ... exception_ns: Name of the ns that will not appear in the final list
92 ... Execution example:
93 ... \@{slice_ns_list}= Get Slice Ns List Except One \${slice_name} \${exception_ns}
95 [Arguments] ${slice_name} ${exception_ns}
97 Should Not Be Empty ${slice_name}
98 Should Not Be Empty ${exception_ns}
100 @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '!/${exception_ns}/' | awk '{print $4}' 2>&1
101 # Returns a String of ns_id and needs to be converted into a list
102 @{ns_list} = Split String ${ns_list_string}[1]
108 [Documentation] Returns the count of all the NS in a slice
110 ... slice_name: Name of the slice instance
111 ... Execution example:
112 ... \${slice_ns_count}= Get Slice Ns Count \${slice_name}
114 [Arguments] ${slice_name}
116 Should Not Be Empty ${slice_name}
117 ${rc} ${stdout}= Run and Return RC and Output osm ns-list | grep ${slice_name} | wc -l 2>&1
119 Should Be Equal As Integers ${rc} ${success_return_code}
123 Get Slice Vnf Ip Addresses
124 [Documentation] Retrieves the list of IP addresses that belong to each of the VNFs in the slice
126 ... slice_name: Name of the slice instance
127 ... Execution example:
128 ... \@{slice_ip_address_list}= Get Slice Vnf Ip Addresses \${slice_name}
130 [Arguments] ${slice_name}
132 # Get all the ns_id in the slice
133 @{slice_ns_list} Get Slice Ns List ${slice_name}
134 log many @{slice_ns_list}
135 @{temp_list}= Create List
136 # For each ns_id in the list, get all the vnf_id and their IP addresses
137 FOR ${ns_id} IN @{slice_ns_list}
139 @{vnf_id_list} Get Ns Vnf List ${ns_id}
140 # For each vnf_id in the list, get all its IP addresses
141 @{ns_ip_list} Get Ns Ip List @{vnf_id_list}
142 @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list}
144 Log List ${temp_list}
145 [Return] @{temp_list}
148 Check For Network Slice Instance To Configured
149 [Documentation] Verify the slice has been instantiated
151 ... slice_name: Name of the slice instance
152 ... Execution example:
153 ... Check For Network Slice Instance To Configured \${slice_name}
155 [Arguments] ${slice_name}
157 ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}"
159 Should Be Equal As Integers ${rc} ${success_return_code}
160 Should Contain Any ${stdout} READY BROKEN configured
163 Check For Network Slice Instance For Failure
164 [Documentation] Verify the slice instance is not in failure
166 ... slice_name: Name of the slice instance
167 ... Execution example:
168 ... Check For Network Slice Instance For Failure \${slice_name}
170 [Arguments] ${slice_name}
172 ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}"
174 Should Be Equal As Integers ${rc} ${success_return_code}
175 Should Not Contain ${stdout} BROKEN
179 [Documentation] Delete Network Slice Instance (NSI)
181 ... slice_name: Name of the slice instance
182 ... Execution example:
183 ... Delete NST \${slice_name}
185 [Arguments] ${slice_name}
187 ${rc} ${stdout}= Run and Return RC and Output osm nsi-delete ${slice_name}
189 Should Be Equal As Integers ${rc} ${success_return_code}
191 WAIT UNTIL KEYWORD SUCCEEDS ${slice_delete_max_wait_time} ${slice_delete_pol_time} Check For Network Slice Instance To Be Deleted ${slice_name}
194 Check For Network Slice Instance To Be Deleted
195 [Documentation] Verify the slice instance is not present
197 ... slice_name: Name of the slice instance
198 ... Execution example:
199 ... Check For Network Slice Instance \${slice_name}
201 [Arguments] ${slice_name}
203 ${rc} ${stdout}= Run and Return RC and Output osm nsi-list | awk '{print $2}' | grep ${slice_name}
204 Should Not Be Equal As Strings ${stdout} ${slice_name}