fix(vdu): vdu number of instances now is taking into account. Bug 1477
[osm/NBI.git] / osm_nbi / tests / test_pkg_descriptors.py
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License"); you may
3 # not use this file except in compliance with the License. You may obtain
4 # 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, WITHOUT
10 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 # License for the specific language governing permissions and limitations
12 # under the License.
13 #
14 # For those usages not covered by the Apache License, Version 2.0 please
15 # contact: esousa@whitestack.com or alfonso.tiernosepulveda@telefonica.com
16 ##
17
18 """Contains database content needed for tests"""
19
20 __author__ = "Pedro de la Cruz Ramos, pedro.delacruzramos@altran.com"
21 __date__ = "2019-11-20"
22
23 db_vnfds_text = """
24 ---
25 - _admin:
26 created: 1566823352.7154346
27 modified: 1566823352.7154346
28 onboardingState: ONBOARDED
29 operationalState: ENABLED
30 projects_read:
31 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
32 projects_write:
33 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
34 storage:
35 descriptor: hackfest_3charmed_vnfd/hackfest_3charmed_vnfd.yaml
36 folder: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
37 fs: local
38 path: /app/storage/
39 pkg-dir: hackfest_3charmed_vnfd
40 zipfile: package.tar.gz
41 type: vnfd
42 usageState: NOT_IN_USE
43 userDefinedData: {}
44 _id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
45 id: hackfest3charmed-vnf
46 description: >-
47 A VNF consisting of 2 VDUs connected to an internal VL, and one VDU with
48 cloud-init
49 product-name: hackfest3charmed-vnf
50 version: '1.0'
51 mgmt-cp: vnf-mgmt-ext
52
53 virtual-compute-desc:
54 - id: mgmt-compute
55 virtual-cpu:
56 num-virtual-cpu: 2
57 virtual-memory:
58 size: '2'
59 - id: data-compute
60 virtual-cpu:
61 num-virtual-cpu: 2
62 virtual-memory:
63 size: '2'
64
65 virtual-storage-desc:
66 - id: mgmt-storage
67 size-of-storage: '20'
68 - id: data-storage
69 size-of-storage: '20'
70
71 sw-image-desc:
72 - id: hackfest3-mgmt
73 name: hackfest3-mgmt
74
75 vdu:
76 - id: mgmtVM
77 name: mgmtVM
78 cloud-init-file: cloud-config.txt
79 sw-image-desc: hackfest3-mgmt
80 virtual-compute-desc: mgmt-compute
81 virtual-storage-desc:
82 - mgmt-storage
83 int-cpd:
84 - id: vnf-mgmt
85 virtual-network-interface-requirement:
86 - name: mgmtVM-eth0
87 position: 1
88 virtual-interface:
89 type: VIRTIO
90 - id: mgmtVM-internal
91 int-virtual-link-desc: internal
92 virtual-network-interface-requirement:
93 - name: mgmtVM-eth1
94 position: 2
95 virtual-interface:
96 type: VIRTIO
97 - id: dataVM
98 name: dataVM
99 sw-image-desc: hackfest3-mgmt
100 virtual-compute-desc: data-compute
101 virtual-storage-desc:
102 - data-storage
103 int-cpd:
104 - id: dataVM-internal
105 int-virtual-link-desc: internal
106 virtual-network-interface-requirement:
107 - name: dataVM-eth1
108 position: 1
109 virtual-interface:
110 type: VIRTIO
111 - id: vnf-data
112 virtual-network-interface-requirement:
113 - name: dataVM-eth0
114 position: 2
115 virtual-interface:
116 type: VIRTIO
117 monitoring-parameter:
118 - id: dataVM_cpu_util
119 name: dataVM_cpu_util
120 performance-metric: cpu_utilization
121
122 int-virtual-link-desc:
123 - id: internal
124
125 ext-cpd:
126 - id: vnf-mgmt-ext
127 int-cpd: # Connection to int-cpd
128 vdu-id: mgmtVM
129 cpd: vnf-mgmt
130 - id: vnf-data-ext
131 int-cpd: # Connection to int-cpd
132 vdu-id: dataVM
133 cpd: vnf-data
134
135 df:
136 - id: hackfest_default
137 vdu-profile:
138 - id: mgmtVM
139 min-number-of-instances: 1
140 - id: dataVM
141 min-number-of-instances: 1
142 max-number-of-instances: 10
143 instantiation-level:
144 - id: default
145 vdu-level:
146 - vdu-id: mgmtVM
147 number-of-instances: 1
148 - vdu-id: dataVM
149 number-of-instances: 1
150 scaling-aspect:
151 - id: scale_dataVM
152 name: scale_dataVM
153 max-scale-level: 10
154 aspect-delta-details:
155 deltas:
156 - id: delta1
157 vdu-delta:
158 - id: vdudelta1
159 number-of-instances: 1
160 scaling-policy:
161 - name: auto_cpu_util_above_threshold
162 scaling-type: automatic
163 enabled: true
164 threshold-time: 0
165 cooldown-time: 60
166 scaling-criteria:
167 - name: cpu_util_above_threshold
168 scale-in-relational-operation: LE
169 scale-in-threshold: '15.0000000000'
170 scale-out-relational-operation: GE
171 scale-out-threshold: '60.0000000000'
172 vnf-monitoring-param-ref: dataVM_cpu_util
173 scaling-config-action:
174 - trigger: post-scale-out
175 vnf-config-primitive-name-ref: touch
176 - trigger: pre-scale-in
177 vnf-config-primitive-name-ref: touch
178 lcm-operations-configuration:
179 operate-vnf-op-config:
180 day1-2:
181 - id: hackfest3charmed-vnf
182 execution-environment-list:
183 - id: simple-ee
184 juju:
185 charm: simple
186 initial-config-primitive:
187 - seq: "1"
188 execution-environment-ref: simple-ee
189 name: config
190 parameter:
191 - name: ssh-hostname
192 value: <rw_mgmt_ip>
193 - name: ssh-username
194 value: ubuntu
195 - name: ssh-password
196 value: osm4u
197 - seq: "2"
198 execution-environment-ref: simple-ee
199 name: touch
200 parameter:
201 - name: filename
202 value: <touch_filename>
203 config-primitive:
204 - name: touch
205 execution-environment-ref: simple-ee
206 parameter:
207 - data-type: STRING
208 default-value: <touch_filename2>
209 name: filename
210 """
211
212 db_nsds_text = """
213 ---
214 - _admin:
215 created: 1566823353.971486
216 modified: 1566823353.971486
217 onboardingState: ONBOARDED
218 operationalState: ENABLED
219 projects_read:
220 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
221 projects_write:
222 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
223 storage:
224 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
225 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
226 fs: local
227 path: /app/storage/
228 pkg-dir: hackfest_3charmed_nsd
229 zipfile: package.tar.gz
230 usageState: NOT_IN_USE
231 userDefinedData: {}
232 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
233 id: hackfest3charmed-ns
234 name: hackfest3charmed-ns
235 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet VLs
236 designer: OSM
237 version: '1.0'
238
239 vnfd-id:
240 - hackfest3charmed-vnf
241
242 virtual-link-desc:
243 - id: mgmt
244 mgmt-network: true
245 - id: datanet
246 mgmt-network: false
247
248 df:
249 - id: hackfest_charmed_DF
250 vnf-profile:
251 - id: hackfest_vnf1 # member-vnf-index-ref: 1
252 vnfd-id: hackfest3charmed-vnf
253 virtual-link-connectivity:
254 - virtual-link-profile-id: mgmt
255 constituent-cpd-id:
256 - constituent-base-element-id: hackfest_vnf1
257 constituent-cpd-id: vnf-mgmt-ext
258 - virtual-link-profile-id: datanet
259 constituent-cpd-id:
260 - constituent-base-element-id: hackfest_vnf1
261 constituent-cpd-id: vnf-data-ext
262 - id: hackfest_vnf2 # member-vnf-index-ref: 2
263 vnfd-id: hackfest3charmed-vnf
264 virtual-link-connectivity:
265 - virtual-link-profile-id: mgmt
266 constituent-cpd-id:
267 - constituent-base-element-id: hackfest_vnf2
268 constituent-cpd-id: vnf-mgmt-ext
269 - virtual-link-profile-id: datanet
270 constituent-cpd-id:
271 - constituent-base-element-id: hackfest_vnf2
272 constituent-cpd-id: vnf-data-ext
273 """