Modifications for test of feature 7953
[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 connection-point:
46 - id: vnf-mgmt
47 name: vnf-mgmt
48 short-name: vnf-mgmt
49 type: VPORT
50 - id: vnf-data
51 name: vnf-data
52 short-name: vnf-data
53 type: VPORT
54 description: A VNF consisting of 2 VDUs connected to an internal VL, and one VDU
55 with cloud-init
56 id: hackfest3charmed-vnf
57 internal-vld:
58 - id: internal
59 internal-connection-point:
60 - id-ref: mgmtVM-internal
61 - id-ref: dataVM-internal
62 name: internal
63 short-name: internal
64 type: ELAN
65 logo: osm.png
66 mgmt-interface:
67 cp: vnf-mgmt
68 monitoring-param:
69 - aggregation-type: AVERAGE
70 id: monitor1
71 name: monitor1
72 vdu-monitoring-param:
73 vdu-monitoring-param-ref: dataVM_cpu_util
74 vdu-ref: dataVM
75 name: hackfest3charmed-vnf
76 scaling-group-descriptor:
77 - max-instance-count: 10
78 name: scale_dataVM
79 scaling-config-action:
80 - trigger: post-scale-out
81 vnf-config-primitive-name-ref: touch
82 - trigger: pre-scale-in
83 vnf-config-primitive-name-ref: touch
84 scaling-policy:
85 - cooldown-time: 60
86 name: auto_cpu_util_above_threshold
87 scaling-criteria:
88 - name: cpu_util_above_threshold
89 scale-in-relational-operation: LE
90 scale-in-threshold: '15.0000000000'
91 scale-out-relational-operation: GE
92 scale-out-threshold: '60.0000000000'
93 vnf-monitoring-param-ref: monitor1
94 scaling-type: automatic
95 threshold-time: 0
96 vdu:
97 - count: 1
98 vdu-id-ref: dataVM
99 short-name: hackfest3charmed-vnf
100 vdu:
101 - count: '1'
102 cloud-init-file: cloud-config.txt
103 id: mgmtVM
104 image: hackfest3-mgmt
105 interface:
106 - external-connection-point-ref: vnf-mgmt
107 name: mgmtVM-eth0
108 position: 1
109 type: EXTERNAL
110 virtual-interface:
111 type: VIRTIO
112 - internal-connection-point-ref: mgmtVM-internal
113 name: mgmtVM-eth1
114 position: 2
115 type: INTERNAL
116 virtual-interface:
117 type: VIRTIO
118 internal-connection-point:
119 - id: mgmtVM-internal
120 name: mgmtVM-internal
121 short-name: mgmtVM-internal
122 type: VPORT
123 name: mgmtVM
124 vm-flavor:
125 memory-mb: '1024'
126 storage-gb: '10'
127 vcpu-count: 1
128 - count: '1'
129 id: dataVM
130 image: hackfest3-mgmt
131 interface:
132 - internal-connection-point-ref: dataVM-internal
133 name: dataVM-eth0
134 position: 1
135 type: INTERNAL
136 virtual-interface:
137 type: VIRTIO
138 - external-connection-point-ref: vnf-data
139 name: dataVM-xe0
140 position: 2
141 type: EXTERNAL
142 virtual-interface:
143 type: VIRTIO
144 internal-connection-point:
145 - id: dataVM-internal
146 name: dataVM-internal
147 short-name: dataVM-internal
148 type: VPORT
149 monitoring-param:
150 - id: dataVM_cpu_util
151 nfvi-metric: cpu_utilization
152 name: dataVM
153 vm-flavor:
154 memory-mb: '1024'
155 storage-gb: '10'
156 vcpu-count: 1
157 version: '1.0'
158 vnf-configuration:
159 config-primitive:
160 - name: touch
161 parameter:
162 - data-type: STRING
163 default-value: <touch_filename2>
164 name: filename
165 initial-config-primitive:
166 - name: config
167 parameter:
168 - name: ssh-hostname
169 value: <rw_mgmt_ip>
170 - name: ssh-username
171 value: ubuntu
172 - name: ssh-password
173 value: osm4u
174 seq: '1'
175 - name: touch
176 parameter:
177 - name: filename
178 value: <touch_filename>
179 seq: '2'
180 juju:
181 charm: simple
182 """
183
184 db_nsds_text = """
185 ---
186 - _admin:
187 created: 1566823353.971486
188 modified: 1566823353.971486
189 onboardingState: ONBOARDED
190 operationalState: ENABLED
191 projects_read:
192 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
193 projects_write:
194 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
195 storage:
196 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
197 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
198 fs: local
199 path: /app/storage/
200 pkg-dir: hackfest_3charmed_nsd
201 zipfile: package.tar.gz
202 usageState: NOT_IN_USE
203 userDefinedData: {}
204 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
205 constituent-vnfd:
206 - member-vnf-index: '1'
207 vnfd-id-ref: hackfest3charmed-vnf
208 - member-vnf-index: '2'
209 vnfd-id-ref: hackfest3charmed-vnf
210 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet
211 VLs
212 id: hackfest3charmed-ns
213 logo: osm.png
214 name: hackfest3charmed-ns
215 short-name: hackfest3charmed-ns
216 version: '1.0'
217 vld:
218 - id: mgmt
219 mgmt-network: true
220 name: mgmt
221 short-name: mgmt
222 type: ELAN
223 vim-network-name: mgmt
224 vnfd-connection-point-ref:
225 - member-vnf-index-ref: '1'
226 vnfd-connection-point-ref: vnf-mgmt
227 vnfd-id-ref: hackfest3charmed-vnf
228 - member-vnf-index-ref: '2'
229 vnfd-connection-point-ref: vnf-mgmt
230 vnfd-id-ref: hackfest3charmed-vnf
231 - id: datanet
232 name: datanet
233 short-name: datanet
234 type: ELAN
235 vnfd-connection-point-ref:
236 - member-vnf-index-ref: '1'
237 vnfd-connection-point-ref: vnf-data
238 vnfd-id-ref: hackfest3charmed-vnf
239 - member-vnf-index-ref: '2'
240 vnfd-connection-point-ref: vnf-data
241 vnfd-id-ref: hackfest3charmed-vnf
242 """