blob: 49e4961003857a6852910270b94327d634e8a124 [file] [log] [blame]
aguilardf848c142021-06-28 15:47:54 +02001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
13*** Settings ***
14Documentation [BASIC-18] NS with a VLD with a virtual link profile.
15
16Library OperatingSystem
17Library String
18Library Collections
19Library SSHLibrary
20
21Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
22Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
23Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
24Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
25
26Force Tags basic_18 cluster_main daily regression
27
28Suite Teardown Run Keyword And Ignore Error Suite Cleanup
29
30
31*** Variables ***
32# NS and VNF descriptor package folder and ids
33${vnfd_pkg} ubuntu_4ifaces_vnf
34${vnfd_name} ubuntu_4ifaces-vnf
35${nsd_pkg} ubuntu_4ifaces_ns
36${nsd_name} ubuntu_4ifaces-ns
37
38# NS instance name and configuration
39${ns_name} basic_18
40${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
41
42# SSH keys and username to be used
43${publickey} %{HOME}/.ssh/id_rsa.pub
44${privatekey} %{HOME}/.ssh/id_rsa
45${username} ubuntu
46
47# VNFs data
48${vnf_member_index_1} vnf1
49${vnf_member_index_2} vnf2
50${iface1_name} eth1
51${iface2_name} eth2
52${iface3_name} eth3
53${datanet1_prefix} ^192.168.10.*
54${datanet2_prefix} ^192.168.20.*
55${datanet3_prefix} ^192.168.30.*
56
57${success_return_code} 0
58
59
60*** Test Cases ***
61Create VNF Descriptor
62
63 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
64
65
66Create NS Descriptor
67
68 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
69
70
71Instantiate Network Service
72
73 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
74 Set Suite Variable ${ns_id} ${id}
75
76
77Get Vnfs Info
78
79 Variable Should Exist ${ns_id} msg=Network service instance is not available
80 @{vnfr_list}= Get Ns Vnfr Ids ${ns_id}
81 Log List ${vnfr_list}
82 Set Suite Variable ${vnf_id1} ${vnfr_list}[0]
83 Set Suite Variable ${vnf_id2} ${vnfr_list}[1]
84 ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1}
85 Set Suite Variable ${vnf1_ipmgmt} ${ip}
86 log ${vnf1_ipmgmt}
87 ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2}
88 Set Suite Variable ${vnf2_ipmgmt} ${ip}
89 log ${vnf2_ipmgmt}
90
91
92Check Vnf1 IPs
93
94 Variable Should Exist ${vnf_id1} msg=VNF1 is not available
95 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq '."ip-address"' | tr -d \\"
96 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
97 Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix}
98 Set Suite Variable ${vnf1_ip1} ${stdout}
99 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface2_name}")' | yq '."ip-address"' | tr -d \\"
100 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
101 Should Match Regexp ${stdout} ${datanet2_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet2_prefix}
102 Set Suite Variable ${vnf1_ip2} ${stdout}
103 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface3_name}")' | yq '."ip-address"' | tr -d \\"
104 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
105 Should Match Regexp ${stdout} ${datanet3_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet3_prefix}
106 Set Suite Variable ${vnf1_ip3} ${stdout}
107
108
109
110Check Vnf2 IPs
111
112 Variable Should Exist ${vnf_id1} msg=VNF2 is not available
113 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq '."ip-address"' | tr -d \\"
114 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
115 Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix}
116 Set Suite Variable ${vnf2_ip1} ${stdout}
117 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface2_name}")' | yq '."ip-address"' | tr -d \\"
118 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
119 Should Match Regexp ${stdout} ${datanet2_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet2_prefix}
120 Set Suite Variable ${vnf2_ip2} ${stdout}
121 ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface3_name}")' | yq '."ip-address"' | tr -d \\"
122 Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False
123 Should Match Regexp ${stdout} ${datanet3_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet3_prefix}
124 Set Suite Variable ${vnf2_ip3} ${stdout}
125
126
127Ping from Vnf1 to Vnf2
128
129 Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available
130 Variable Should Exist ${privatekey} msg=SSH private key not available
131 Sleep 30 seconds Wait for SSH daemon to be up
132 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf2_ipmgmt}
133 log ${stdout}
134 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip1}
135 log ${stdout}
136 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip2}
137 log ${stdout}
138 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip3}
139 log ${stdout}
140
141
142Ping from Vnf2 to Vnf1
143
144 Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available
145 Variable Should Exist ${privatekey} msg=SSH private key not available
146 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ipmgmt}
147 log ${stdout}
148 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip1}
149 log ${stdout}
150 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip2}
151 log ${stdout}
152 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip3}
153 log ${stdout}
154
155
156Delete NS Instance
157 [Tags] cleanup
158
159 Delete NS ${ns_name}
160
161
162Delete NS Descriptor
163 [Tags] cleanup
164
165 Delete NSD ${nsd_name}
166
167
168Delete VNF Descriptor
169 [Tags] cleanup
170
171 Delete VNFD ${vnfd_name}
172
173
174*** Keywords ***
175Suite Cleanup
176 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
177
178 Run Keyword If Any Tests Failed Delete NS ${ns_name}
179 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
180 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}