Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / epa_02-additional_capabilities.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   [EPA-02] Support for additional EPA capabilities.
17
18 Library   OperatingSystem
19 Library   String
20 Library   Collections
21 Library   SSHLibrary
22
23 Resource   ../lib/vnfd_lib.resource
24 Resource   ../lib/vnf_lib.resource
25 Resource   ../lib/nsd_lib.resource
26 Resource   ../lib/ns_lib.resource
27 Resource   ../lib/openstack_lib.resource
28
29 Test Tags   epa_02   cluster_epa   daily   regression
30
31 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
32
33
34 *** Variables ***
35 # NS and VNF descriptor package folder and ids
36 ${VNFD_PKG}   epa_quota_vnf
37 ${VNFD_NAME}   epa_quota-vnf
38 ${NSD_PKG}   epa_quota_ns
39 ${NSD_NAME}   epa_quota-ns
40
41 # NS instance name and configuration
42 ${NS_NAME}   epa_02-epa_quota_test
43 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
44
45 # SSH public keys file
46 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
47
48 ${NS_ID}   ${EMPTY}
49 ${VNF_SERVER_ID}   ${EMPTY}
50 ${FLAVOR_PROPERTIES}   ${EMPTY}
51 ${SUCCESS_RETURN_CODE}   0
52
53
54 *** Test Cases ***
55 Create VNF Descriptor
56     [Documentation]   Upload VNF package for the testsuite.
57     Remove Environment Variable   OVERRIDES
58     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
59
60 Create NS Descriptor
61     [Documentation]   Upload NS package for the testsuite.
62     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
63
64 Instantiate Network Service
65     [Documentation]   Instantiate the 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}
68
69 Get VNF Server ID
70     [Documentation]   Get the id of the VM at the VIM and store in VNF_SERVER_ID suite variable to be used later on.
71     ${vnfs_list}=   Get Ns Vnf List   ${NS_ID}
72     ${vim_id}=   Get VNF VIM ID   ${vnfs_list}[0]
73     Log   ${vim_id}
74     Set Suite Variable   ${VNF_SERVER_ID}   ${vim_id}
75
76 Get Server Flavor Properties
77     [Documentation]   Get from the VIM the flavor properties of the VM with id VNF_SERVER_ID.
78     ${flavor_id}=   Get Server Flavor ID   ${VNF_SERVER_ID}
79     ${properties}=   Get Flavor Properties   ${flavor_id}
80     Log   ${properties}
81     Set Suite Variable   ${FLAVOR_PROPERTIES}   ${properties}
82
83 Check Flavor Quota Properties
84     [Documentation]   Assert that the flavor properties include the expected EPA parameters included in the descriptor.
85     ${rc}=   Run And Return Rc   echo ${FLAVOR_PROPERTIES} | grep "cpu_shares_level=custom"
86     Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
87     ${rc}=   Run And Return Rc   echo ${FLAVOR_PROPERTIES} | grep "disk_io_shares_level=custom"
88     Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
89     ${rc}=   Run And Return Rc   echo ${FLAVOR_PROPERTIES} | grep "memory_shares_level=custom"
90     Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
91
92 Delete NS Instance
93     [Documentation]   Delete NS instance.
94     [Tags]   cleanup
95     Delete NS   ${NS_NAME}
96
97 Delete NS Descriptor
98     [Documentation]   Delete NS package from OSM.
99     [Tags]   cleanup
100     Delete NSD   ${NSD_NAME}
101
102 Delete VNF Descriptor
103     [Documentation]   Delete VNF package from OSM.
104     [Tags]   cleanup
105     Delete VNFD   ${VNFD_NAME}
106
107
108 *** Keywords ***
109 Suite Cleanup
110     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
111     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
112     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
113     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}