1 # 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
5 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 Documentation [BASIC-18] NS with a VLD with a virtual link profile.
16 Library OperatingSystem
21 Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
22 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
23 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
24 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
26 Force Tags basic_18 cluster_main daily regression
28 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
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
38 # NS instance name and configuration
40 ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
42 # SSH keys and username to be used
43 ${publickey} %{HOME}/.ssh/id_rsa.pub
44 ${privatekey} %{HOME}/.ssh/id_rsa
48 ${vnf_member_index_1} vnf1
49 ${vnf_member_index_2} vnf2
53 ${datanet1_prefix} ^192.168.10.*
54 ${datanet2_prefix} ^192.168.20.*
55 ${datanet3_prefix} ^192.168.30.*
57 ${success_return_code} 0
63 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
68 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
71 Instantiate Network Service
73 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
74 Set Suite Variable ${ns_id} ${id}
79 Variable Should Exist ${ns_id} msg=Network service instance is not available
80 @{vnfr_list}= Get Ns Vnfr Ids ${ns_id}
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}
87 ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2}
88 Set Suite Variable ${vnf2_ipmgmt} ${ip}
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}
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}
127 Verify Vnf1 Interfaces
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 10 seconds Wait for SSH daemon to be up
132 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ip --brief addr show up | grep -v "^lo" | awk '{print $3}'
134 @{ip} = Split String ${stdout}
135 Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix}
136 Should Match Regexp ${ip}[2] ${datanet2_prefix} msg=${ip}[2] doesn't match subnet's regexp ${datanet2_prefix}
137 Should Match Regexp ${ip}[3] ${datanet3_prefix} msg=${ip}[3] doesn't match subnet's regexp ${datanet3_prefix}
140 Verify Vnf2 Interfaces
142 Variable Should Exist ${vnf2_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available
143 Variable Should Exist ${privatekey} msg=SSH private key not available
144 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip --brief addr show up | grep -v "^lo" | awk '{print $3}'
146 @{ip} = Split String ${stdout}
147 Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix}
148 Should Match Regexp ${ip}[2] ${datanet2_prefix} msg=${ip}[2] doesn't match subnet's regexp ${datanet2_prefix}
149 Should Match Regexp ${ip}[3] ${datanet3_prefix} msg=${ip}[3] doesn't match subnet's regexp ${datanet3_prefix}
152 Ping from Vnf1 to Vnf2
154 Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available
155 Variable Should Exist ${privatekey} msg=SSH private key not available
156 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf2_ipmgmt}
158 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip1}
160 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip2}
162 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip3}
166 Ping from Vnf2 to Vnf1
168 Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available
169 Variable Should Exist ${privatekey} msg=SSH private key not available
170 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ipmgmt}
172 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip1}
174 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip2}
176 ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip3}
189 Delete NSD ${nsd_name}
192 Delete VNF Descriptor
195 Delete VNFD ${vnfd_name}
200 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
202 Run Keyword If Any Tests Failed Delete NS ${ns_name}
203 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
204 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}