Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / basic_11-native_charms.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-11] Native Charms
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_11   cluster_ee_config   cluster_relations   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}   charm-packages/native_charm_vnf
34 ${VNFD_NAME}   native_charm-vnf
35 ${NSD_PKG}   charm-packages/native_charm_ns
36 ${NSD_NAME}   native_charm-ns
37
38 # NS instance name and configuration
39 ${NS_NAME}   basic_11_native_charms
40 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
41 ${NS_TIMEOUT}   15min
42
43 # SSH keys and username to be used
44 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
45 ${PRIVATEKEY}   %{HOME}/.ssh/id_rsa
46 ${USERNAME}   ubuntu
47 ${PASSWORD}   ${EMPTY}
48
49 ${ACTION_NAME}   touch
50 ${VNF_MEMBER_INDEX_1}   vnf1
51 ${VNF_MEMBER_INDEX_2}   vnf2
52 ${DAY_1_FILE_NAME}   /home/ubuntu/first-touch
53 ${DAY_2_FILE_NAME_1}   /home/ubuntu/mytouch1
54 ${DAY_2_FILE_NAME_2}   /home/ubuntu/mytouch2
55
56
57 *** Test Cases ***
58 Create Charm VNF Descriptor
59     [Documentation]   Upload VNF package for the testsuite.
60     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
61
62 Create Charm NS Descriptor
63     [Documentation]   Upload NS package for the testsuite.
64     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
65
66 Instantiate Charm Network Service
67     [Documentation]   Instantiate NS for the testsuite.
68     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}   ${NS_TIMEOUT}
69     Set Suite Variable   ${NS_ID}   ${id}
70
71 Get Management Ip Addresses
72     [Documentation]   Get the mgmt IP address of the two VNF of the NS.
73     ${ip_addr_1}=   Get Vnf Management Ip Address   ${NS_ID}   ${VNF_MEMBER_INDEX_1}
74     Log   ${ip_addr_1}
75     Set Suite Variable   ${VNF_1_IP_ADDR}   ${ip_addr_1}
76     ${ip_addr_2}=   Get Vnf Management Ip Address   ${NS_ID}   ${VNF_MEMBER_INDEX_2}
77     Log   ${ip_addr_2}
78     Set Suite Variable   ${VNF_2_IP_ADDR}   ${ip_addr_2}
79
80 Test SSH Access
81     [Documentation]   Check that both VNF are accessible via SSH in their respective mgmt IP address.
82     Variable Should Exist   ${VNF_1_IP_ADDR}   msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available
83     Variable Should Exist   ${VNF_2_IP_ADDR}   msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available
84     Sleep   30s   Waiting ssh daemon to be up
85     Test SSH Connection   ${VNF_1_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}
86     Test SSH Connection   ${VNF_2_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}
87
88 Check Remote Files Created Via Day 1 Operations
89     [Documentation]   The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}.
90     ...               This test checks whether that files have been created or not.
91     Check If Remote File Exists   ${VNF_1_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   ${DAY_1_FILE_NAME}
92     Check If Remote File Exists   ${VNF_2_IP_ADDR}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   ${DAY_1_FILE_NAME}
93
94 Delete NS Instance
95     [Documentation]   Delete NS instance.
96     [Tags]   cleanup
97     Delete NS   ${NS_NAME}
98
99 Delete NS Descriptor
100     [Documentation]   Delete NS package from OSM.
101     [Tags]   cleanup
102     Delete NSD   ${NSD_NAME}
103
104 Delete VNF Descriptor
105     [Documentation]   Delete VNF package from OSM.
106     [Tags]   cleanup
107     Delete VNFD   ${VNFD_NAME}
108
109
110 *** Keywords ***
111 Suite Cleanup
112     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
113     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
114     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
115     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}