blob: 2f531cb3a7ae509c3c9a0a26f82d7efbebe36a18 [file] [log] [blame]
Felipe Vicensf96bb452020-06-22 08:12:30 +02001# Copyright 2020 Atos
2#
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
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
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.
14
15*** Settings ***
16Library OperatingSystem
17Library String
18Library Collections
19Library Process
20Library SSHLibrary
21Library yaml
22
23Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
24Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
25Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot
26Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot
27Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
28Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
29Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
30
31Variables %{ROBOT_DEVOPS_FOLDER}/resources/slice_01-network_slicing_data.py
32
33Suite Teardown Run Keyword And Ignore Error Test Cleanup
34
35
36*** Variables ***
37
38${ns_id} ${EMPTY}
39${username} ubuntu
40${password} ${EMPTY}
41${vnf_member_index} middle
42${vnf_ip_addr} ${EMPTY}
43${mgmt_vnf_ip} ${EMPTY}
44${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
45
46*** Test Cases ***
47
48Create Slice VNF Descriptors
49 [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
50
51 [Tags] basic_network_slicing SLICING-01 sanity regression
52
53 Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}'
54 Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}'
55
56
57Create Slice NS Descriptors
58 [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
59
60 [Tags] basic_network_slicing SLICING-01 sanity regression
61
62 Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}'
63 Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}'
64
65Create Slice Template
66 [Documentation] Onboards the Network Slice Template: nst (in the variables file)
67
68 [Tags] basic_network_slicing SLICING-01 sanity regression
69
70 Create NST '%{PACKAGES_FOLDER}/${nst}'
71
72Network Slice Instance Test
73 [Documentation] Instantiates the NST recently onboarded and sets the instantiation id as a suite variable (nsi_id)
74
75 [Tags] basic_network_slicing SLICING-01 sanity regression
76
77 ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey}
78 Set Suite Variable ${nsi_id} ${id}
79
80
81Get 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)
83
84 [Tags] basic_network_slicing SLICING-01 sanity regression
85
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 Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty
89 Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip}
90
91
92Get Slice Vnf Ip Addresses
93 [Documentation] Obtains the list of IPs addresses in the slice and sets the list as a suite variable (slice_vnfs_ips)
94
95 [Tags] basic_network_slicing SLICING-01 sanity regression
96
97 # Get all the ns_id in the slice except the middle one to avoid self ping
98 @{slice_ns_list} Get Slice Ns List Except One ${slice_name} ${middle_ns_name}
99 log many @{slice_ns_list}
100 @{temp_list}= Create List
101 # For each ns_id in the list, get all the vnf_id and their IP addresses
102 FOR ${ns_id} IN @{slice_ns_list}
103 log ${ns_id}
104 @{vnf_id_list} Get Ns Vnf List ${ns_id}
105 # For each vnf_id in the list, get all its IP addresses
106 @{ns_ip_list} Get Ns Ip List @{vnf_id_list}
107 @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list}
108 END
109 Log List ${temp_list}
110 Set Suite Variable ${slice_vnfs_ips} ${temp_list}
111
112
113Test Middle Ns Ping
114 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
115
116 [Tags] basic_network_slicing SLICING-01 sanity regression
117 Sleep 60s Waiting for the network to be up
118 # Ping to the middle VNF
119 log ${mgmt_vnf_ip}
120 Test Connectivity ${mgmt_vnf_ip}
121
122
123Test Middle Vnf SSH Access
124 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
125
126 [Tags] basic_network_slicing SLICING-01 sanity regression
127 Sleep 30s Waiting ssh daemon to be up
128 Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey}
129
130
131Test Slice Connectivity
132 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
133 ... and pings all the IP addresses in the list (slice_vnfs_ips)
134
135 [Tags] basic_network_slicing SLICING-01 sanity regression
136
137 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice_vnfs_ips}
138
139
140Stop Slice Instance
141 [Documentation] Stops the slice instance (slice_name)
142
143 [Tags] basic_network_slicing SLICING-01 sanity regression cleanup
144
145 Delete NSI ${slice_name}
146
147
148Delete Slice Template
149 [Documentation] Deletes the NST (nst_name) from OSM
150
151 [Tags] basic_network_slicing SLICING-01 sanity regression cleanup
152
153 Delete NST ${nst_name}
154
155
156Delete NS Descriptors
157 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
158
159 [Tags] basic_network_slicing SLICING-01 sanity regression cleanup
160
161 Delete NSD ${nsd1_name}
162 Delete NSD ${nsd2_name}
163
164
165Delete VNF Descriptors
166 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
167
168 [Tags] basic_network_slicing SLICING-01 sanity regression cleanup
169
170 Delete VNFD ${vnfd1_name}
171 Delete VNFD ${vnfd2_name}
172
173
174*** Keywords ***
175Test Cleanup
176 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and template
177
178 Run Keyword If Test Failed Delete NST ${nst_name}
179
180 Run Keyword If Test Failed Delete NSD ${nsd1_name}
181 Run Keyword If Test Failed Delete NSD ${nsd2_name}
182
183 Run Keyword If Test Failed Delete VNFD ${vnfd1_name}
184 Run Keyword If Test Failed Delete VNFD ${vnfd2_name}
185
186
187