blob: 5831e36484a21dba557f77006006d3a7a8bcf7b2 [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 ***
garciadeblas4cf45d72021-04-08 13:52:22 +020016Documentation [SLICE-01] Network Slicing.
17
Felipe Vicensf96bb452020-06-22 08:12:30 +020018Library OperatingSystem
19Library String
20Library Collections
21Library Process
22Library SSHLibrary
23Library yaml
24
25Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
26Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
27Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot
28Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot
29Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
30Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
31Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
32
aguilarhernac0b3a8e2021-05-12 08:56:23 +000033Variables %{ROBOT_DEVOPS_FOLDER}/resources/slice_01-network_slicing_data.py
34
garciadeblas4cf45d72021-04-08 13:52:22 +020035Force Tags slice_01 cluster_slices daily regression
36
garciadeblasd225e552020-10-02 16:10:14 +000037Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020038
39
40*** Variables ***
aguilarherna576487e2021-05-05 15:47:11 +000041
42${ns_id} ${EMPTY}
aguilarhernac0b3a8e2021-05-12 08:56:23 +000043${username} ubuntu
44${password} ${EMPTY}
Felipe Vicensf96bb452020-06-22 08:12:30 +020045${vnf_member_index} middle
46${vnf_ip_addr} ${EMPTY}
47${mgmt_vnf_ip} ${EMPTY}
48${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
49
aguilarherna576487e2021-05-05 15:47:11 +000050*** Test Cases ***
aguilarhernac0b3a8e2021-05-12 08:56:23 +000051
Felipe Vicensf96bb452020-06-22 08:12:30 +020052Create Slice VNF Descriptors
53 [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
54
Felipe Vicensf96bb452020-06-22 08:12:30 +020055 Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}'
56 Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}'
57
58
59Create Slice NS Descriptors
60 [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
61
Felipe Vicensf96bb452020-06-22 08:12:30 +020062 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
Felipe Vicensf96bb452020-06-22 08:12:30 +020068 Create NST '%{PACKAGES_FOLDER}/${nst}'
69
70Network Slice Instance Test
71 [Documentation] Instantiates the NST recently onboarded and sets the instantiation id as a suite variable (nsi_id)
72
Felipe Vicensf96bb452020-06-22 08:12:30 +020073 ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey}
74 Set Suite Variable ${nsi_id} ${id}
75
76
77Get Middle Vnf Management Ip
78 [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)
79
Felipe Vicensf96bb452020-06-22 08:12:30 +020080 ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1
81 ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index}
82 Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty
83 Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip}
84
85
86Get Slice Vnf Ip Addresses
87 [Documentation] Obtains the list of IPs addresses in the slice and sets the list as a suite variable (slice_vnfs_ips)
88
Felipe Vicensf96bb452020-06-22 08:12:30 +020089 # Get all the ns_id in the slice except the middle one to avoid self ping
90 @{slice_ns_list} Get Slice Ns List Except One ${slice_name} ${middle_ns_name}
91 log many @{slice_ns_list}
92 @{temp_list}= Create List
93 # For each ns_id in the list, get all the vnf_id and their IP addresses
94 FOR ${ns_id} IN @{slice_ns_list}
95 log ${ns_id}
96 @{vnf_id_list} Get Ns Vnf List ${ns_id}
97 # For each vnf_id in the list, get all its IP addresses
98 @{ns_ip_list} Get Ns Ip List @{vnf_id_list}
99 @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list}
100 END
101 Log List ${temp_list}
102 Set Suite Variable ${slice_vnfs_ips} ${temp_list}
103
104
105Test Middle Ns Ping
106 [Documentation] Pings the slice middle vnf (mgmt_vnf_ip)
107
Felipe Vicensf96bb452020-06-22 08:12:30 +0200108 Sleep 60s Waiting for the network to be up
109 # Ping to the middle VNF
110 log ${mgmt_vnf_ip}
111 Test Connectivity ${mgmt_vnf_ip}
112
113
114Test Middle Vnf SSH Access
115 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
116
Felipe Vicensf96bb452020-06-22 08:12:30 +0200117 Sleep 30s Waiting ssh daemon to be up
118 Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey}
119
120
121Test Slice Connectivity
122 [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
123 ... and pings all the IP addresses in the list (slice_vnfs_ips)
124
Felipe Vicensf96bb452020-06-22 08:12:30 +0200125 Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice_vnfs_ips}
126
127
garciadeblas15081452020-10-02 20:50:49 +0000128Delete Slice Instance
Felipe Vicensf96bb452020-06-22 08:12:30 +0200129 [Documentation] Stops the slice instance (slice_name)
garciadeblas4cf45d72021-04-08 13:52:22 +0200130 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200131
132 Delete NSI ${slice_name}
133
134
135Delete Slice Template
136 [Documentation] Deletes the NST (nst_name) from OSM
garciadeblas4cf45d72021-04-08 13:52:22 +0200137 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200138
139 Delete NST ${nst_name}
140
141
142Delete NS Descriptors
143 [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name
garciadeblas4cf45d72021-04-08 13:52:22 +0200144 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200145
146 Delete NSD ${nsd1_name}
147 Delete NSD ${nsd2_name}
148
149
150Delete VNF Descriptors
151 [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
garciadeblas4cf45d72021-04-08 13:52:22 +0200152 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200153
154 Delete VNFD ${vnfd1_name}
155 Delete VNFD ${vnfd2_name}
156
157
158*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000159Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200160 [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and template
161
garciadeblas15081452020-10-02 20:50:49 +0000162 Run Keyword If Any Tests Failed Delete NSI ${slice_name}
163
garciadeblasd225e552020-10-02 16:10:14 +0000164 Run Keyword If Any Tests Failed Delete NST ${nst_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200165
garciadeblasd225e552020-10-02 16:10:14 +0000166 Run Keyword If Any Tests Failed Delete NSD ${nsd1_name}
167 Run Keyword If Any Tests Failed Delete NSD ${nsd2_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200168
garciadeblasd225e552020-10-02 16:10:14 +0000169 Run Keyword If Any Tests Failed Delete VNFD ${vnfd1_name}
170 Run Keyword If Any Tests Failed Delete VNFD ${vnfd2_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200171
172
173