Feature 11001: Robot framework linting for E2E tests
[osm/tests.git] / robot-systest / testsuite / basic_22-cross_model_relations.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-22] Cross-model relations
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 Resource   ../lib/k8scluster_lib.resource
26
27 Test Tags   basic_22   cluster_ee_config   cluster_relations   regression
28
29 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
30
31
32 *** Variables ***
33 # K8s cluster name and version
34 ${K8SCLUSTER_NAME}   k8sbasic_22
35 ${K8SCLUSTER_VERSION}   v1
36
37 # NS and VNF descriptor package folder and ids
38 ${VNFD_PKG1}   charm-packages/cmr_relation_vnf
39 ${VNFD_PKG2}   charm-packages/cmr_no_relation_vnf
40 ${NSD_PKG}   charm-packages/cmr_relation_ns
41 ${VNFD_NAME1}   cross_model_relation-vnf
42 ${VNFD_NAME2}   cross_model_no_relation-vnf
43 ${NSD_NAME}   cross_model_relation-ns
44
45 # NS instance name and configuration
46 ${NS_NAME}   basic_22
47 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
48 ${NS_TIMEOUT}   15min
49
50 # SSH keys and username to be used
51 ${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
52 ${PRIVATEKEY}   %{HOME}/.ssh/id_rsa
53 ${USERNAME}   ubuntu
54 ${PASSWORD}   ${EMPTY}
55
56
57 *** Test Cases ***
58 Create Charm VNF Descriptor 1
59     [Documentation]   Upload first VNF package for the testsuite.
60     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG1}'
61
62 Create Charm VNF Descriptor 2
63     [Documentation]   Upload second VNF package for the testsuite.
64     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG2}'
65
66 Create Charm NS Descriptor
67     [Documentation]   Upload NS package for the testsuite.
68     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
69
70 Add K8s Cluster To OSM
71     [Documentation]   Register K8s cluster in OSM.
72     Create K8s Cluster   %{K8S_CREDENTIALS}   ${K8SCLUSTER_VERSION}   %{VIM_TARGET}   %{VIM_MGMT_NET}   ${K8SCLUSTER_NAME}
73
74 Instantiate Charm Network Service
75     [Documentation]   Instantiate NS for the testsuite.
76     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}   ${NS_TIMEOUT}
77     Set Suite Variable   ${NS_ID}   ${id}
78
79 # TODO: Check juju status for relations
80
81 Delete NS Instance
82     [Documentation]   Delete NS instance.
83     [Tags]   cleanup
84     Delete NS   ${NS_NAME}
85
86 Remove K8s Cluster from OSM
87     [Documentation]   Unregister K8s cluster from OSM.
88     [Tags]   cleanup
89     Delete K8s Cluster   ${K8SCLUSTER_NAME}
90
91 Delete NS Descriptor
92     [Documentation]   Delete NS package from OSM.
93     [Tags]   cleanup
94     Delete NSD   ${NSD_NAME}
95
96 Delete VNF Descriptor 1
97     [Documentation]   Delete first VNF package from OSM.
98     [Tags]   cleanup
99     Delete VNFD   ${VNFD_NAME1}
100
101 Delete VNF Descriptor 2
102     [Documentation]   Delete second VNF package from OSM.
103     [Tags]   cleanup
104     Delete VNFD   ${VNFD_NAME2}
105
106
107 *** Keywords ***
108 Suite Cleanup
109     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
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 1   ${VNFD_NAME1}
113     Run Keyword If Any Tests Failed   Delete VNFD 2   ${VNFD_NAME2}