Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / basic_24-affinity_groups.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-24] VNF with two VDUs belonging to an Openstack server group
17
18 Library   OperatingSystem
19 Library   String
20 Library   Collections
21 Library   Process
22
23 Resource   ../lib/vnfd_lib.resource
24 Resource   ../lib/nsd_lib.resource
25 Resource   ../lib/ns_lib.resource
26 Resource   ../lib/vnf_lib.resource
27 Resource   ../lib/openstack_lib.resource
28
29 Test Tags   basic_24   cluster_main   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}   affinity_basic_vnf
37 ${VNFD_NAME}   affinity_basic-vnf
38 ${NSD_PKG}   affinity_basic_ns
39 ${NSD_NAME}   affinity_basic-ns
40
41 # NS instance name and configuration
42 ${NS_NAME}   basic_24
43 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
44
45 # SSH keys and username to be used
46 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
47 ${PRIVATEKEY}   %{HOME}/.ssh/id_rsa
48 ${USERNAME}   ubuntu
49 ${PASSWORD}   ${EMPTY}
50
51 ${NS_ID}   ${EMPTY}
52 ${VNF_MEMBER_INDEX}   affinity-basic-1
53 ${SUCCESS_RETURN_CODE}   0
54
55
56 *** Test Cases ***
57 Create VNF Package
58     [Documentation]   Upload VNF package for the testsuite.
59     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
60
61 Create NS Package
62     [Documentation]   Upload NS package for the testsuite.
63     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
64
65 Network Service Instance Test
66     [Documentation]   Instantiate NS for the testsuite.
67     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}
68     Set Suite Variable   ${NS_ID}   ${id}
69
70 Check Vnf Affinity Groups
71     [Documentation]   Check that all VDUs of the VNF belong to the expected affinity group.
72     Variable Should Exist   ${NS_ID}   msg=NS is not available
73     ${vnf_id}=   Get Vnf Id   ${NS_ID}   ${VNF_MEMBER_INDEX}
74     @{vdur_id_list}=   Get VDU List From VNF   ${vnf_id}
75     FOR   ${vdur_id}   IN   @{vdur_id_list}
76         ${server_group_name}=   Get VDU Affinity Group Name   ${NS_NAME}   ${vnf_id}   ${vdur_id}
77         ${vm_vim_id}=   Get VDU VIM Id   ${vnf_id}   ${vdur_id}
78         Check VM In Server Group   ${vm_vim_id}   ${server_group_name}
79     END
80
81 Delete NS Instance Test
82     [Documentation]   Delete NS instance.
83     [Tags]   cleanup
84     Delete NS   ${NS_NAME}
85
86 Delete NS Descriptor Test
87     [Documentation]   Delete NS package from OSM.
88     [Tags]   cleanup
89     Delete NSD   ${NSD_NAME}
90
91 Delete VNF Descriptor Test
92     [Documentation]   Delete VNF package from OSM.
93     [Tags]   cleanup
94     Delete VNFD   ${VNFD_NAME}
95
96
97 *** Keywords ***
98 Suite Cleanup
99     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
100     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
101     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
102     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}