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 |
1 |
"""Contains database content needed for tests""" |
19 |
|
|
20 |
1 |
__author__ = "Pedro de la Cruz Ramos, pedro.delacruzramos@altran.com" |
21 |
1 |
__date__ = "2019-11-20" |
22 |
|
|
23 |
|
|
24 |
|
# Exploit exists in the key kdu.helm-chart |
25 |
1 |
vnfd_exploit_text = """ |
26 |
|
_id: 00000000-0000-0000-0000-000000000000 |
27 |
|
id: n2vc-rce_vnfd |
28 |
|
df: |
29 |
|
- id: default-df |
30 |
|
kdu: |
31 |
|
- name: exploit |
32 |
|
helm-chart: "local/exploit --post-renderer /bin/bash" |
33 |
|
helm-version: v3 |
34 |
|
""" |
35 |
|
|
36 |
|
# Exploit in kdu.helm-chart is fixed |
37 |
1 |
vnfd_exploit_fixed_text = """ |
38 |
|
id: n2vc-rce_vnfd |
39 |
|
df: |
40 |
|
- id: default-df |
41 |
|
kdu: |
42 |
|
- name: exploit |
43 |
|
helm-chart: "local/exploit" |
44 |
|
helm-version: v3 |
45 |
|
""" |
46 |
|
|
47 |
1 |
db_vnfds_text = """ |
48 |
|
--- |
49 |
|
- _admin: |
50 |
|
created: 1566823352.7154346 |
51 |
|
modified: 1566823352.7154346 |
52 |
|
onboardingState: ONBOARDED |
53 |
|
operationalState: ENABLED |
54 |
|
projects_read: |
55 |
|
- 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4 |
56 |
|
projects_write: |
57 |
|
- 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4 |
58 |
|
storage: |
59 |
|
descriptor: hackfest_3charmed_vnfd/hackfest_3charmed_vnfd.yaml |
60 |
|
folder: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77 |
61 |
|
fs: local |
62 |
|
path: /app/storage/ |
63 |
|
pkg-dir: hackfest_3charmed_vnfd |
64 |
|
zipfile: package.tar.gz |
65 |
|
type: vnfd |
66 |
|
usageState: NOT_IN_USE |
67 |
|
userDefinedData: {} |
68 |
|
_id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77 |
69 |
|
id: hackfest3charmed-vnf |
70 |
|
description: >- |
71 |
|
A VNF consisting of 2 VDUs connected to an internal VL, and one VDU with |
72 |
|
cloud-init |
73 |
|
product-name: hackfest3charmed-vnf |
74 |
|
version: '1.0' |
75 |
|
mgmt-cp: vnf-mgmt-ext |
76 |
|
|
77 |
|
virtual-compute-desc: |
78 |
|
- id: mgmt-compute |
79 |
|
virtual-cpu: |
80 |
|
num-virtual-cpu: 2 |
81 |
|
virtual-memory: |
82 |
|
size: '2' |
83 |
|
- id: data-compute |
84 |
|
virtual-cpu: |
85 |
|
num-virtual-cpu: 2 |
86 |
|
virtual-memory: |
87 |
|
size: '2' |
88 |
|
|
89 |
|
virtual-storage-desc: |
90 |
|
- id: mgmt-storage |
91 |
|
size-of-storage: '20' |
92 |
|
- id: data-storage |
93 |
|
size-of-storage: '20' |
94 |
|
|
95 |
|
sw-image-desc: |
96 |
|
- id: hackfest3-mgmt |
97 |
|
name: hackfest3-mgmt |
98 |
|
|
99 |
|
vdu: |
100 |
|
- id: mgmtVM |
101 |
|
name: mgmtVM |
102 |
|
cloud-init-file: cloud-config.txt |
103 |
|
sw-image-desc: hackfest3-mgmt |
104 |
|
virtual-compute-desc: mgmt-compute |
105 |
|
virtual-storage-desc: |
106 |
|
- mgmt-storage |
107 |
|
int-cpd: |
108 |
|
- id: vnf-mgmt |
109 |
|
virtual-network-interface-requirement: |
110 |
|
- name: mgmtVM-eth0 |
111 |
|
position: 1 |
112 |
|
virtual-interface: |
113 |
|
type: VIRTIO |
114 |
|
- id: mgmtVM-internal |
115 |
|
int-virtual-link-desc: internal |
116 |
|
virtual-network-interface-requirement: |
117 |
|
- name: mgmtVM-eth1 |
118 |
|
position: 2 |
119 |
|
virtual-interface: |
120 |
|
type: VIRTIO |
121 |
|
- alarm: |
122 |
|
- actions: |
123 |
|
alarm: |
124 |
|
- url: https://webhook.site |
125 |
|
insufficient-data: |
126 |
|
- url: https://webhook.site |
127 |
|
ok: |
128 |
|
- url: https://webhook.site |
129 |
|
alarm-id: alarm-1 |
130 |
|
vnf-monitoring-param-ref: dataVM_cpu_util |
131 |
|
id: dataVM |
132 |
|
name: dataVM |
133 |
|
sw-image-desc: hackfest3-mgmt |
134 |
|
virtual-compute-desc: data-compute |
135 |
|
virtual-storage-desc: |
136 |
|
- data-storage |
137 |
|
int-cpd: |
138 |
|
- id: dataVM-internal |
139 |
|
int-virtual-link-desc: internal |
140 |
|
virtual-network-interface-requirement: |
141 |
|
- name: dataVM-eth1 |
142 |
|
position: 1 |
143 |
|
virtual-interface: |
144 |
|
type: VIRTIO |
145 |
|
- id: vnf-data |
146 |
|
virtual-network-interface-requirement: |
147 |
|
- name: dataVM-eth0 |
148 |
|
position: 2 |
149 |
|
virtual-interface: |
150 |
|
type: VIRTIO |
151 |
|
monitoring-parameter: |
152 |
|
- id: dataVM_cpu_util |
153 |
|
name: dataVM_cpu_util |
154 |
|
performance-metric: cpu_utilization |
155 |
|
|
156 |
|
int-virtual-link-desc: |
157 |
|
- id: internal |
158 |
|
|
159 |
|
ext-cpd: |
160 |
|
- id: vnf-mgmt-ext |
161 |
|
int-cpd: # Connection to int-cpd |
162 |
|
vdu-id: mgmtVM |
163 |
|
cpd: vnf-mgmt |
164 |
|
- id: vnf-data-ext |
165 |
|
int-cpd: # Connection to int-cpd |
166 |
|
vdu-id: dataVM |
167 |
|
cpd: vnf-data |
168 |
|
|
169 |
|
df: |
170 |
|
- id: hackfest_default |
171 |
|
vdu-profile: |
172 |
|
- id: mgmtVM |
173 |
|
min-number-of-instances: 1 |
174 |
|
- id: dataVM |
175 |
|
min-number-of-instances: 1 |
176 |
|
max-number-of-instances: 10 |
177 |
|
instantiation-level: |
178 |
|
- id: default |
179 |
|
vdu-level: |
180 |
|
- vdu-id: mgmtVM |
181 |
|
number-of-instances: 1 |
182 |
|
- vdu-id: dataVM |
183 |
|
number-of-instances: 1 |
184 |
|
scaling-aspect: |
185 |
|
- id: scale_dataVM |
186 |
|
name: scale_dataVM |
187 |
|
max-scale-level: 10 |
188 |
|
aspect-delta-details: |
189 |
|
deltas: |
190 |
|
- id: delta1 |
191 |
|
vdu-delta: |
192 |
|
- id: dataVM |
193 |
|
number-of-instances: 1 |
194 |
|
scaling-policy: |
195 |
|
- name: auto_cpu_util_above_threshold |
196 |
|
scaling-type: automatic |
197 |
|
enabled: true |
198 |
|
threshold-time: 0 |
199 |
|
cooldown-time: 60 |
200 |
|
scaling-criteria: |
201 |
|
- name: cpu_util_above_threshold |
202 |
|
scale-in-relational-operation: LE |
203 |
|
scale-in-threshold: '15.0000000000' |
204 |
|
scale-out-relational-operation: GE |
205 |
|
scale-out-threshold: '60.0000000000' |
206 |
|
vnf-monitoring-param-ref: dataVM_cpu_util |
207 |
|
scaling-config-action: |
208 |
|
- trigger: post-scale-out |
209 |
|
vnf-config-primitive-name-ref: touch |
210 |
|
- trigger: pre-scale-in |
211 |
|
vnf-config-primitive-name-ref: touch |
212 |
|
healing-aspect: |
213 |
|
- id: heal_dataVM |
214 |
|
healing-policy: |
215 |
|
- vdu-id: dataVM |
216 |
|
event-name: heal-alarm |
217 |
|
recovery-type: automatic |
218 |
|
action-on-recovery: REDEPLOY_ONLY |
219 |
|
cooldown-time: 180 |
220 |
|
day1: false |
221 |
|
lcm-operations-configuration: |
222 |
|
operate-vnf-op-config: |
223 |
|
day1-2: |
224 |
|
- id: hackfest3charmed-vnf |
225 |
|
execution-environment-list: |
226 |
|
- id: simple-ee |
227 |
|
juju: |
228 |
|
charm: simple |
229 |
|
initial-config-primitive: |
230 |
|
- seq: "1" |
231 |
|
execution-environment-ref: simple-ee |
232 |
|
name: config |
233 |
|
parameter: |
234 |
|
- name: ssh-hostname |
235 |
|
value: <rw_mgmt_ip> |
236 |
|
- name: ssh-username |
237 |
|
value: ubuntu |
238 |
|
- name: ssh-password |
239 |
|
value: osm4u |
240 |
|
- seq: "2" |
241 |
|
execution-environment-ref: simple-ee |
242 |
|
name: touch |
243 |
|
parameter: |
244 |
|
- name: filename |
245 |
|
value: <touch_filename> |
246 |
|
config-primitive: |
247 |
|
- name: touch |
248 |
|
execution-environment-ref: simple-ee |
249 |
|
parameter: |
250 |
|
- data-type: STRING |
251 |
|
default-value: <touch_filename2> |
252 |
|
name: filename |
253 |
|
""" |
254 |
|
|
255 |
1 |
db_nsds_text = """ |
256 |
|
--- |
257 |
|
- _admin: |
258 |
|
created: 1566823353.971486 |
259 |
|
modified: 1566823353.971486 |
260 |
|
onboardingState: ONBOARDED |
261 |
|
operationalState: ENABLED |
262 |
|
projects_read: |
263 |
|
- 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4 |
264 |
|
projects_write: |
265 |
|
- 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4 |
266 |
|
storage: |
267 |
|
descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml |
268 |
|
folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da |
269 |
|
fs: local |
270 |
|
path: /app/storage/ |
271 |
|
pkg-dir: hackfest_3charmed_nsd |
272 |
|
zipfile: package.tar.gz |
273 |
|
usageState: NOT_IN_USE |
274 |
|
userDefinedData: {} |
275 |
|
_id: 8c2f8b95-bb1b-47ee-8001-36dc090678da |
276 |
|
id: hackfest3charmed-ns |
277 |
|
name: hackfest3charmed-ns |
278 |
|
description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet VLs |
279 |
|
designer: OSM |
280 |
|
version: '1.0' |
281 |
|
|
282 |
|
vnfd-id: |
283 |
|
- hackfest3charmed-vnf |
284 |
|
|
285 |
|
virtual-link-desc: |
286 |
|
- id: mgmt |
287 |
|
mgmt-network: true |
288 |
|
- id: datanet |
289 |
|
mgmt-network: false |
290 |
|
|
291 |
|
df: |
292 |
|
- id: hackfest_charmed_DF |
293 |
|
vnf-profile: |
294 |
|
- id: hackfest_vnf1 # member-vnf-index-ref: 1 |
295 |
|
vnfd-id: hackfest3charmed-vnf |
296 |
|
virtual-link-connectivity: |
297 |
|
- virtual-link-profile-id: mgmt |
298 |
|
constituent-cpd-id: |
299 |
|
- constituent-base-element-id: hackfest_vnf1 |
300 |
|
constituent-cpd-id: vnf-mgmt-ext |
301 |
|
- virtual-link-profile-id: datanet |
302 |
|
constituent-cpd-id: |
303 |
|
- constituent-base-element-id: hackfest_vnf1 |
304 |
|
constituent-cpd-id: vnf-data-ext |
305 |
|
- id: hackfest_vnf2 # member-vnf-index-ref: 2 |
306 |
|
vnfd-id: hackfest3charmed-vnf |
307 |
|
virtual-link-connectivity: |
308 |
|
- virtual-link-profile-id: mgmt |
309 |
|
constituent-cpd-id: |
310 |
|
- constituent-base-element-id: hackfest_vnf2 |
311 |
|
constituent-cpd-id: vnf-mgmt-ext |
312 |
|
- virtual-link-profile-id: datanet |
313 |
|
constituent-cpd-id: |
314 |
|
- constituent-base-element-id: hackfest_vnf2 |
315 |
|
constituent-cpd-id: vnf-data-ext |
316 |
|
""" |
317 |
|
|
318 |
1 |
db_sfc_nsds_text = """ |
319 |
|
- _admin: |
320 |
|
userDefinedData: {} |
321 |
|
revision: 1 |
322 |
|
created: 1683713524.2696395 |
323 |
|
modified: 1683713524.3553684 |
324 |
|
projects_read: |
325 |
|
- 93601899-b310-4a56-a765-91539d5f675d |
326 |
|
projects_write: |
327 |
|
- 93601899-b310-4a56-a765-91539d5f675d |
328 |
|
onboardingState: ONBOARDED |
329 |
|
operationalState: ENABLED |
330 |
|
usageState: NOT_IN_USE |
331 |
|
storage: |
332 |
|
fs: mongo |
333 |
|
path: /app/storage/ |
334 |
|
folder: '2eb45633-03e3-4909-a87d-a564f5943948:1' |
335 |
|
pkg-dir: cirros_vnffg_ns |
336 |
|
descriptor: cirros_vnffg_ns/cirros_vnffg_nsd.yaml |
337 |
|
zipfile: package.tar.gz |
338 |
|
_id: 2eb45633-03e3-4909-a87d-a564f5943948 |
339 |
|
id: cirros_vnffg-ns |
340 |
|
designer: OSM |
341 |
|
version: '1.0' |
342 |
|
name: cirros_vnffg-ns |
343 |
|
|
344 |
|
vnfd-id: |
345 |
|
- cirros_vnffg-vnf |
346 |
|
|
347 |
|
virtual-link-desc: |
348 |
|
- id: osm-ext |
349 |
|
mgmt-network: true |
350 |
|
|
351 |
|
vnffgd: |
352 |
|
- id: vnffg1 |
353 |
|
vnf-profile-id: |
354 |
|
- Mid-vnf1 |
355 |
|
nfpd: |
356 |
|
- id: forwardingpath1 |
357 |
|
position-desc-id: |
358 |
|
- id: position1 |
359 |
|
cp-profile-id: |
360 |
|
- id: cpprofile2 |
361 |
|
constituent-profile-elements: |
362 |
|
- id: vnf1 |
363 |
|
order: 0 |
364 |
|
constituent-base-element-id: Mid-vnf1 |
365 |
|
ingress-constituent-cpd-id: vnf-cp0-ext |
366 |
|
egress-constituent-cpd-id: vnf-cp0-ext |
367 |
|
match-attributes: |
368 |
|
- id: rule1_80 |
369 |
|
ip-proto: 6 |
370 |
|
source-ip-address: 20.20.1.2 |
371 |
|
destination-ip-address: 20.20.3.5 |
372 |
|
source-port: 0 |
373 |
|
destination-port: 80 |
374 |
|
nfp-position-element-id: |
375 |
|
- test |
376 |
|
nfp-position-element: |
377 |
|
- id: test |
378 |
|
|
379 |
|
df: |
380 |
|
- id: default-df |
381 |
|
vnf-profile: |
382 |
|
- id: '1' |
383 |
|
virtual-link-connectivity: |
384 |
|
- constituent-cpd-id: |
385 |
|
- constituent-base-element-id: '1' |
386 |
|
constituent-cpd-id: eth0-ext |
387 |
|
virtual-link-profile-id: osm-ext |
388 |
|
vnfd-id: cirros_vnffg-vnf |
389 |
|
description: Simple NS example with vnffgd |
390 |
|
""" |