Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / basic_05-instantiation_parameters_in_cloud_init.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   [BASIC-05] Instantiation parameters in cloud-init.
17
18 Library   OperatingSystem
19 Library   SSHLibrary
20
21 Resource   ../lib/vnfd_lib.resource
22 Resource   ../lib/nsd_lib.resource
23 Resource   ../lib/ns_lib.resource
24 Resource   ../lib/ssh_lib.resource
25
26 Test Tags   basic_05   cluster_main   daily   regression   azure
27
28 Suite 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_cloudinit_vnf
34 ${VNFD_NAME}   ubuntu_cloudinit-vnf
35 ${NSD_PKG}   ubuntu_cloudinit_ns
36 ${NSD_NAME}   ubuntu_cloudinit-ns
37
38 # NS instance name and configuration
39 ${NS_NAME}   basic_05_instantiation_params_cloud_init
40 ${VNF_MEMBER_INDEX}   vnf
41 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], additionalParamsForVnf: [ { member-vnf-index: "${VNF_MEMBER_INDEX}", additionalParams: { password: "${NEW_PASSWORD}" } } ] }
42
43 # SSH user and password
44 ${USERNAME}   ubuntu
45 ${NEW_PASSWORD}   newpassword
46
47
48 *** Test Cases ***
49 Create Cloudinit VNF Descriptor
50     [Documentation]   Upload VNF package for the testsuite.
51     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
52
53 Create Cloudinit NS Descriptor
54     [Documentation]   Upload NS package for the testsuite.
55     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
56
57 Instantiate Cloudinit Network Service Using Instantiation Parameters
58     [Documentation]   Instantiates the NS using the instantiation parameter 'additionalParamsForVnf' to change the password of the default user.
59     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${EMPTY}
60     Set Suite Variable   ${NS_ID}   ${id}
61
62 Get Management Ip Addresses
63     [Documentation]   Retrieve VNF mgmt IP address from OSM.
64     ${ip_addr}=   Get Vnf Management Ip Address   ${NS_ID}   ${VNF_MEMBER_INDEX}
65     Log   ${ip_addr}
66     Set Suite Variable   ${VNF_IP_ADDR}   ${ip_addr}
67
68 Test SSH Access With The New Password
69     [Documentation]   Test SSH access with the new password configured via cloud-init.
70     Variable Should Exist   ${VNF_IP_ADDR}   msg=IP address of the management VNF is not available
71     Sleep   30s   Waiting ssh daemon to be up
72     Test SSH Connection   ${VNF_IP_ADDR}   ${USERNAME}   ${NEW_PASSWORD}   ${EMPTY}
73
74 Delete NS Instance
75     [Documentation]   Delete NS instance.
76     [Tags]   cleanup
77     Delete NS   ${NS_NAME}
78
79 Delete NS Descriptor
80     [Documentation]   Delete NS package from OSM.
81     [Tags]   cleanup
82     Delete NSD   ${NSD_NAME}
83
84 Delete VNF Descriptor
85     [Documentation]   Delete VNF package from OSM.
86     [Tags]   cleanup
87     Delete VNFD   ${VNFD_NAME}
88
89
90 *** Keywords ***
91 Suite Cleanup
92     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
93     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
94     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
95     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}