3cefe5c148137b56029e1ffacf294dd272407931
[osm/tests.git] / robot-systest / testsuite / fail_01-insufficient_resources.robot
1 #   Licensed under the Apache License, Version 2.0 (the "License");
2 #   you may not use this file except in compliance with the License.
3 #   You may obtain a copy of the License at
4 #
5 #       http://www.apache.org/licenses/LICENSE-2.0
6 #
7 #   Unless required by applicable law or agreed to in writing, software
8 #   distributed under the License is distributed on an "AS IS" BASIS,
9 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 #   See the License for the specific language governing permissions and
11 #   limitations under the License.
12
13 *** Settings ***
14 Documentation     [FAIL-01] A single VNF with 2 VDUs, one of them unallocatable because of resources.
15
16 Library   OperatingSystem
17 Library   String
18 Library   Collections
19 Library   SSHLibrary
20
21 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
22 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
23 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
24 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot
25
26 Force Tags   fail_01   cluster_main   daily   regression
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}   simple_2vm_vnf
34 ${vnfd_name}   simple_2vm-vnf
35 ${nsd_pkg}   simple_2vm_ns
36 ${nsd_name}   simple_2vm-ns
37
38 # NS instance name and configuration
39 ${ns_name_prefix}   fail_01
40 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
41
42 # SSH keys to be used
43 ${publickey}   %{HOME}/.ssh/id_rsa.pub
44
45 # Default memory for dataVM VDU (can be overwritten by VM_MEMORY_OVERRIDE environment variable)
46 ${default_memory}   250
47
48 # NS launch timeout and polling time
49 ${ns_launch_max_wait_time}   5min
50 ${ns_launch_pol_time}   15
51
52 # Openstack delete operation timeout and polling time
53 ${os_delete_max_wait_time}   6min
54 ${os_delete_pol_time}   20
55
56
57 *** Test Cases ***
58 Create VNF Descriptor
59
60     ${memory}=   Get Environment Variable    VM_MEMORY_OVERRIDE   default=${default_memory}
61     Create VNFD Overriding Fields   '%{PACKAGES_FOLDER}/${vnfd_pkg}'   virtual-compute-desc.1.virtual-memory.size=${memory}
62
63
64 Create NS Descriptor
65
66     Create NSD  '%{PACKAGES_FOLDER}/${nsd_pkg}'
67
68
69 Cannot Instantiate Network Service
70
71     ${rand}=  Generate Random String  4  [NUMBERS]
72     ${ns_name}=  Catenate   SEPARATOR=_   ${ns_name_prefix}   ${rand}
73     Set Suite Variable  ${ns_name}
74     log   ${ns_name}
75     ${id}=   Instantiate Network Service   ${ns_name}   ${nsd_name}   %{VIM_TARGET}   --config '${ns_config}' --ssh_keys ${publickey}
76     log   ${id}
77     Set Suite Variable  ${ns_id}  ${id}
78     WAIT UNTIL KEYWORD SUCCEEDS   ${ns_launch_max_wait_time}   ${ns_launch_pol_time}   Check For Ns Instance To Configured   ${ns_name}
79     ${rc}   ${stdout}=   run and return rc and output   osm ns-list --filter id="${ns_id}" | grep ${ns_id} | awk '{print $8}'
80     log   ${stdout}
81     Should Contain   ${stdout}   BROKEN
82     ${rc}   ${stdout}=   run and return rc and output   osm ns-show ${ns_id} --literal | yq .errorDetail
83     log   ${stdout}
84     Should Contain   ${stdout}   Deploying at VIM: Error at create vdu
85
86
87 Delete NS Instance And Check VIM
88     [Tags]   cleanup
89
90     Delete NS  ${ns_name}
91     WAIT UNTIL KEYWORD SUCCEEDS   ${os_delete_max_wait_time}   ${os_delete_pol_time}   Check NS Servers In VIM   ${ns_name}   0
92  
93
94 Delete NS Descriptor
95     [Tags]   cleanup
96
97     Delete NSD  ${nsd_name}
98
99
100 Delete VNF Descriptor
101     [Tags]   cleanup
102
103     Delete VNFD  ${vnfd_name}
104
105
106 *** Keywords ***
107 Suite Cleanup
108     [Documentation]  Test Suite Cleanup: Deleting descriptors and NS instance
109
110     Run Keyword If Any Tests Failed  Delete NS  ${ns_name}
111     Run Keyword If Any Tests Failed  Delete NSD  ${nsd_name}
112     Run Keyword If Any Tests Failed  Delete VNFD  ${vnfd_name}