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-31] Basic NS with two multi-VDU VNF
18 Library OperatingSystem
24 Resource ../lib/vnfd_lib.resource
25 Resource ../lib/nsd_lib.resource
26 Resource ../lib/ns_lib.resource
27 Resource ../lib/connectivity_lib.resource
28 Resource ../lib/ssh_lib.resource
30 Test Tags basic_31 cluster_main daily regression
32 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
36 # NS and VNF descriptor package folder and ids
37 ${VNFD_PKG} multivdu_multiattach_vnf
38 ${VNFD_NAME} multivdu_multiattach-vnf
39 ${NSD_PKG} multivdu_multiattach_ns
40 ${NSD_NAME} multivdu_multiattach-ns
42 # NS instance name and configuration
43 ${NS_NAME} multivdu_multiattach
44 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
46 # SSH keys and username to be used
47 ${VDU0_USERNAME} ubuntu
48 ${VDU0_PASSWORD} ${EMPTY}
49 ${VDU0_PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
50 ${VDU0_PRIVATEKEY} %{HOME}/.ssh/id_rsa
51 ${VDU1_USERNAME} ubuntu
52 ${VDU1_PASSWORD} osmpass
53 ${VDU1_PUBLICKEY} ${EMPTY}
54 ${VDU1_PRIVATEKEY} ${EMPTY}
57 ${VNF_MEMBER_INDEX} vnf
58 ${VNF_IP_ADDR} ${EMPTY}
59 ${WAIT_GUARD_FOR_VM_BOOT} 50s
63 Create Multiattach VNF Descriptor
64 [Documentation] Upload VNF package for the testsuite.
65 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
67 Create Multiattach NS Descriptor
68 [Documentation] Upload NS package for the testsuite.
69 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
71 Network Service Instance Test
72 [Documentation] Instantiate NS for the testsuite.
73 ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${VDU0_PUBLICKEY}
76 IF "${status}" == "FAIL" Set Global Variable ${VDU0_PUBLICKEY} ${EMPTY}
77 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${VDU0_PUBLICKEY}
78 Set Suite Variable ${NS_ID} ${id}
79 Sleep ${WAIT_GUARD_FOR_VM_BOOT} Waiting for VM's daemons to be up and running
82 [Documentation] Get the VNF instance id from OSM.
83 ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_MEMBER_INDEX}
84 Set Suite Variable ${VNF_ID} ${vnf_id}
86 Get Vnf Management Ip Addresses
87 [Documentation] Get the IP addresses of the two VDU of the VNF.
88 ${rc} ${vdu0_ip}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq -r '.vdur[0].interfaces[]."ip-address"'
90 ${rc} ${vdu1_ip}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq -r '.vdur[1].interfaces[]."ip-address"'
92 Set Suite Variable ${MGMT_IP_ADDR_0} ${vdu0_ip}
93 Set Suite Variable ${MGMT_IP_ADDR_1} ${vdu1_ip}
95 Ensure that VDUs can share data
96 [Documentation] Connect via SSH to the two VDUs of the VNF and check that the volume is shared as expected.
97 Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_0} ${VDU0_USERNAME} ${VDU0_PASSWORD} ${VDU0_PRIVATEKEY} sudo mkfs.ext3 -F /dev/vdb && sudo mkdir /shared && sudo mount /dev/vdb /shared && sudo chown ubuntu:ubuntu /shared && echo "osmtest" > /shared/test_file
99 Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_1} ${VDU1_USERNAME} ${VDU1_PASSWORD} ${VDU1_PRIVATEKEY} sudo mkdir /shared && sudo mount /dev/vdb /shared && ls /shared
100 Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_1} ${VDU1_USERNAME} ${VDU1_PASSWORD} ${VDU1_PRIVATEKEY} cat /shared/test_file
101 ${stdout}= Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_0} ${VDU0_USERNAME} ${VDU0_PASSWORD} ${VDU0_PRIVATEKEY} cat /shared/test_file
103 Should Be Equal ${stdout} osmtest Shared data can't be read
105 Delete NS Instance Test
106 [Documentation] Delete NS instance.
110 Delete NS Descriptor Test
111 [Documentation] Delete NS package from OSM.
113 Delete NSD ${NSD_NAME}
115 Delete VNF Descriptor Test
116 [Documentation] Delete VNF package from OSM.
118 Delete VNFD ${VNFD_NAME}
123 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
124 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
125 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
126 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}