2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
16 Documentation [BASIC-19] NS with a single VNF and two VDU linked by a VLD with ip-profile.
18 Library OperatingSystem
23 Resource ../lib/vnfd_lib.resource
24 Resource ../lib/nsd_lib.resource
25 Resource ../lib/ns_lib.resource
26 Resource ../lib/ssh_lib.resource
28 Test Tags basic_19 cluster_main daily regression
30 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
34 # NS and VNF descriptor package folder and ids
35 ${VNFD_PKG} ipprofile_2vm_vnf
36 ${VNFD_NAME} ipprofile_2vm-vnf
37 ${NSD_PKG} ipprofile_2vm_ns
38 ${NSD_NAME} ipprofile_2vm-ns
40 # NS instance name and configuration
42 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
44 # SSH keys and username to be used
45 ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
49 ${VNF_MEMBER_INDEX_1} vnf
50 ${INTERNAL_PREFIX} ^192.168.200.*
52 ${SUCCESS_RETURN_CODE} 0
57 [Documentation] Upload VNF package for the testsuite.
58 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
61 [Documentation] Upload NS package for the testsuite.
62 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
64 Instantiate Network Service
65 [Documentation] Instantiate NS for the testsuite.
66 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
67 Set Suite Variable ${NS_ID} ${id}
70 [Documentation] Get VNF information, specifically the VNF instance id and the mgmt IP address.
71 Variable Should Exist ${NS_ID} msg=Network service instance is not available
72 @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID}
74 Set Suite Variable ${VNF_ID} ${vnfr_list}[0]
75 ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1}
76 Set Suite Variable ${VNF_IPMGMT} ${ip}
80 [Documentation] Check whether IP addresses are syntactically valid.
81 Variable Should Exist ${VNF_ID} msg=VNF is not available
82 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"'
83 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
84 Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX}
85 ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"'
86 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False
87 Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX}
90 [Documentation] Delete NS instance.
95 [Documentation] Delete NS package from OSM.
97 Delete NSD ${NSD_NAME}
100 [Documentation] Delete VNF package from OSM.
102 Delete VNFD ${VNFD_NAME}
107 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
108 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
109 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
110 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}