Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / hackfest_cloudinit.robot
1 *** Comments ***
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
5 #
6 #       http://www.apache.org/licenses/LICENSE-2.0
7 #
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.
13
14
15 *** Settings ***
16 Documentation   [HACKFEST-CLOUDINIT] Basic NS with two multi-VDU VNF with cloudinit
17
18 Library   OperatingSystem
19 Library   String
20 Library   Collections
21 Library   Process
22 Library   SSHLibrary
23
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
29
30 Test Tags   hackfest_cloudinit   cluster_main   daily   regression   sanity   azure
31
32 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
33
34
35 *** Variables ***
36 # NS and VNF descriptor package folder and ids
37 ${VNFD_PKG}   hackfest_cloudinit_vnf
38 ${VNFD_NAME}   hackfest_cloudinit-vnf
39 ${NSD_PKG}   hackfest_cloudinit_ns
40 ${NSD_NAME}   hackfest_cloudinit-ns
41
42 # NS instance name and configuration
43 ${NS_NAME}   hfcloudinit
44 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
45
46 # SSH user and password
47 ${USERNAME}   ubuntu
48 ${PASSWORD}   osm4u
49
50 ${NS_ID}   ${EMPTY}
51 ${VNF_MEMBER_INDEX}   vnf1
52 ${VNF_IP_ADDR}   ${EMPTY}
53
54
55 *** Test Cases ***
56 Create Hackfest Cloudinit VNF Descriptor
57     [Documentation]   Upload VNF package for the testsuite.
58     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
59
60 Create Hackfest Cloudinit NS Descriptor
61     [Documentation]   Upload NS package for the testsuite.
62     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
63
64 Network Service Instance Test
65     [Documentation]   Instantiate NS for the testsuite.
66     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${EMPTY}
67     Set Suite Variable   ${NS_ID}   ${id}
68
69 Get Vnf Ip Address
70     [Documentation]   Get the mgmt IP address of the VNF of the NS.
71     ${ip_addr}=   Get Vnf Management Ip Address   ${NS_ID}   ${VNF_MEMBER_INDEX}
72     Log   ${ip_addr}
73     Set Suite Variable   ${VNF_IP_ADDR}   ${ip_addr}
74
75 Test SSH Access
76     [Documentation]   Check that the VNF is accessible via SSH in its mgmt IP address.
77     Sleep   30s   Waiting ssh daemon to be up
78     Test SSH Connection   ${VNF_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${EMPTY}
79
80 Check Remote File Injected Via Cloud-init
81     [Documentation]   Check that the day-0 configuration via cloudinit worked as expected in the VNF. A file should exist in the VM.
82     ${stdout}=   Execute Remote Command Check Rc Return Output   ${VNF_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${EMPTY}   sudo cat /root/helloworld.txt
83     Log   ${stdout}
84
85 Delete NS Instance Test
86     [Documentation]   Delete NS instance.
87     [Tags]   cleanup
88     Delete NS   ${NS_NAME}
89
90 Delete NS Descriptor Test
91     [Documentation]   Delete NS package from OSM.
92     [Tags]   cleanup
93     Delete NSD   ${NSD_NAME}
94
95 Delete VNF Descriptor Test
96     [Documentation]   Delete VNF package from OSM.
97     [Tags]   cleanup
98     Delete VNFD   ${VNFD_NAME}
99
100
101 *** Keywords ***
102 Suite Cleanup
103     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
104     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
105     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
106     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}