Revert "Fix bug 1931: adds missing parameter"
[osm/tests.git] / robot-systest / testsuite / k8s_11-simple_helm_k8s_scaling.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     [K8s-11] Simple Helm K8s Scale.
15
16 Library   OperatingSystem
17 Library   String
18 Library   Collections
19 Library   Process
20 Library   SSHLibrary
21
22 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
23 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
24 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
25 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
26 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
27 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot
28
29 Force Tags   k8s_11   cluster_k8s   regression
30
31 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
32
33
34 *** Variables ***
35 # K8s cluster name and version
36 ${k8scluster_name}   k8s11
37 ${k8scluster_version}   v1
38
39 # NS and VNF descriptor package folder and ids
40 ${vnfd_pkg}   openldap_scale_knf
41 ${vnfd_name}   openldap_scale_knf
42 ${nsd_pkg}   openldap_scale_ns
43 ${nsd_name}   openldap_scale_ns
44
45 # NS instance name and configuration
46 ${ns_name}   openldap-scale
47 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
48
49 # Username and SSH private key for accessing OSM host
50 ${username}   ubuntu
51 ${password}   ${EMPTY}
52 ${privatekey}   %{OSM_RSA_FILE}
53
54 ${ns_id}   ${EMPTY}
55 ${publickey}   %{HOME}/.ssh/id_rsa.pub
56 ${vnf_member_index}   openldap
57 ${kdu_name}   native-kdu
58 ${scaling_group}   scale-kdu
59
60 *** Test Cases ***
61 Create Simple K8s Scale VNF Descriptor
62     Create VNFD   '%{PACKAGES_FOLDER}/${vnfd_pkg}'
63
64 Create Simple K8s Scale NS Descriptor
65     Create NSD   '%{PACKAGES_FOLDER}/${nsd_pkg}'
66
67 Add K8s Cluster To OSM
68     Create K8s Cluster  %{K8S_CREDENTIALS}  ${k8scluster_version}  %{VIM_TARGET}  %{VIM_MGMT_NET}  ${k8scluster_name}
69
70 Create Network Service Instance
71     ${id}=   Create Network Service   ${nsd_name}   %{VIM_TARGET}   ${ns_name}   ${ns_config}  ${publickey}
72     Set Suite Variable   ${ns_id}   ${id}
73
74 Get Vnf Id
75     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
76     @{vnfr_list}=  Get Ns Vnfr Ids  ${ns_id}
77     Log List  ${vnfr_list}
78     Set Suite Variable  ${vnf_id}  ${vnfr_list}[0]
79
80 Get Scale Count Before Scale Out
81     [Documentation]     Get the scale count of the application of network service k8s instance
82
83     Variable Should Exist  ${ns_id}  msg=Network service instance is not available
84     ${kdu_count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu_name}
85     log   ${kdu_count}
86     Set Suite Variable  ${initial_kdu_count}  ${kdu_count}
87
88 Perform Manual KDU Scale Out
89     [Documentation]     Scale out the application of network service k8s instance.
90
91     ${ns_op_id_1}=   Execute Manual VNF Scale  ${ns_name}  ${vnf_member_index}  ${scaling_group}  SCALE_OUT
92
93 Check Scale Count After Scale Out
94     [Documentation]     Check whether the scale count is more than one.
95
96     Variable Should Exist  ${initial_kdu_count}  msg=Initial KDU count is not available
97     ${kdu_count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu_name}
98     log   ${kdu_count}
99     Run Keyword Unless  ${kdu_count} == ${initial_kdu_count} + 2  Fail  msg=There is no new KDU in the model after Scale Out
100
101 Perform Manual KDU Scale In
102     [Documentation]     Scale in the application of network service k8s instance.
103
104     ${ns_op_id_2}=   Execute Manual VNF Scale  ${ns_name}  ${vnf_member_index}  ${scaling_group}  SCALE_IN
105
106 Check Scale Count After Scale In
107     [Documentation]     Check whether the scale count is one less.
108
109     ${kdu_count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu_name}
110     Run Keyword Unless  ${kdu_count} == ${initial_kdu_count}  Fail  msg=There is the same number of KDU in the model after Scale In
111
112 Delete NS K8s Instance Test
113     [Tags]   cleanup
114     Delete NS   ${ns_name}
115
116 Remove K8s Cluster from OSM
117     [Tags]   cleanup
118     Delete K8s Cluster  ${k8scluster_name}
119
120 Delete NS Descriptor Test
121     [Tags]   cleanup
122     Delete NSD   ${nsd_name}
123
124 Delete VNF Descriptor Test
125     [Tags]   cleanup
126     Delete VNFD   ${vnfd_name}
127
128
129 *** Keywords ***
130 Suite Cleanup
131     [Documentation]  Test Suit Cleanup: Deleting Descriptor, instance and vim
132     Run Keyword If Any Tests Failed  Delete NS   ${ns_name}
133     Run Keyword If Any Tests Failed  Delete NSD   ${nsd_name}
134     Run Keyword If Any Tests Failed  Delete VNFD   ${vnfd_name}
135     Run Keyword If Any Tests Failed  Delete K8s Cluster   ${k8scluster_name}