summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/getAttrDynamicParamEmptyMap/inputs/LCP-Base.template.yaml
blob: 9e0f294840042f28517fd9c464dffc431bedf061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
heat_template_version: 2015-04-30

description: |
  Base resources needed for all LCP based vNFs.

parameters:

  default_prefix:
    type: json
    description: |
      Default prefix for resources. The first key is the override
      value from the ENV file. If it is empty the result will be
      the default value. Otherwise the result will be empty.

  ext_net_info:
    type: json
    description: |
      Maps the network strings used in this HOT file
       to network info for the target cloud.

  ext_net_list:
    type: comma_delimited_list
    description: List of applicable subnet tags.

  int_net_count:
    type: number
    description: Number of internal networks.
    constraints:
      - allowed_values: [1, 2]

  # The value of this parameter should not be overridden.
  int_net1_label:
    type: json
    description: |
      Map the number of internal networks to an internal net1 label
      or the empty string.
    default:
      {"1": "", "2": "INTERNALnet1"}

  # This parameter should always be defaulted.
  int_net2key:
    type: json
    description: |
      Maps the empty string to "default" and any other string to "".
    default: {"": "default"}

  # This parameter should always be defaulted.
  int_net2count:
    type: json
    description: |
      Used to determine whether to create an internal network resource.
      Key'd first by the number of internal networks.
      Then by the internal network in question (0 or 1).
      Then by int_net2key(the provided resource UUID value).
    default: {
      "0": {},
      "1": {
        "0": {"": 0, "default": 1},
        "1": {"": 0, "default": 0}
      },
      "2": {
        "0": {"": 0, "default": 1},
        "1": {"": 0, "default": 1}
      }
    }

  # This parameter should always be defaulted.
  sec_chk:
    type: json
    description: Used to determine how many security groups to create (0 or 1).
    default: {
      "step1": {"": "EMPTY"},
      "step2": {"EMPTY": 1, "": 0}
    }

  security_group:
    type: string
    description: |
      (optional) security group to use instead of generating one.
      Because this is optional we can't use a constraint check to
      verify that it is a security group ID ("" would fail that test).
    default: ""

  total_vm_pairs:
    type: string
    description: |
      This string will evaluate to the number of PairGroups in the VNF.

resources:

  NOKIA-LCP-OpenSec:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: [sec_chk, "step2", {get_param: [sec_chk, "step1", {get_param: security_group}]}]}
      resource_def:
        type: OS::Neutron::SecurityGroup
        properties:
          description: |
            Open security settings.
            This assumes that security is handled internal to the guest.
          name:
            str_replace:
              template: $prefixOpenSecGroup
              params:
                $prefix: {get_param: [default_prefix, ""]}
          rules:
            - {direction: ingress, ethertype: IPv4}
            - {direction: egress, ethertype: IPv4}
            - {direction: ingress, ethertype: IPv6}
            - {direction: egress, ethertype: IPv6}

  NOKIA-LCP-Keypair:
    type: OS::Nova::KeyPair
    properties:
      name:
        str_replace:
          template: $prefixInternalKey
          params:
            $prefix: {get_param: [default_prefix, ""]}
      save_private_key: True

  NOKIA-LCP-InternalNet0:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: [int_net2count, {str_replace: {template: "$str", params: {$str: {get_param: int_net_count}}}}, "0", {get_param: [int_net2key, {get_param: [ext_net_info, "INTERNALnet0", "id"]}]}]}
      resource_def:
        type: OS::Neutron::Net
        properties:
          name:
            str_replace:
              template: $prefixIntNet0
              params:
                $prefix: {get_param: [default_prefix, ""]}
          admin_state_up: True
          shared: False

  NOKIA-LCP-InternalNet1:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: [int_net2count, {str_replace: {template: "$str", params: {$str: {get_param: int_net_count}}}}, "0", {get_param: [int_net2key, {get_param: [ext_net_info, "INTERNALnet1", "id"]}]}]}
      resource_def:
        type: OS::Neutron::Net
        properties:
          name:
            str_replace:
              template: $prefixIntNet1
              params:
                $prefix: {get_param: [default_prefix, ""]}
          admin_state_up: True
          shared: False

  # The CIDR usage is really 169.254.0.0/16 but
  # we don't want the cloud to choose any IP addresses
  # that might also be assigned by the algorithms
  # used by the vNF to determine internal IP addresses.
  NOKIA-LCP-InternalSubNet0:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: [int_net2count, {str_replace: {template: "$str", params: {$str: {get_param: int_net_count}}}}, "0", {get_param: [int_net2key, {get_param: [ext_net_info, "INTERNALnet0", "subnet_id"]}]}]}
      resource_def:
        type: OS::Neutron::Subnet
        properties:
          network:
            str_replace:
              template: $gen$prov
              params:
                $gen: {get_attr: [NOKIA-LCP-InternalNet0, refs, 0]}
                $prov: {get_param: [ext_net_info, "INTERNALnet0", "id"]}
          cidr: "169.254.5.0/24"
          enable_dhcp: False

  NOKIA-LCP-InternalSubNet1:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: [int_net2count, {str_replace: {template: "$str", params: {$str: {get_param: int_net_count}}}}, "0", {get_param: [int_net2key, {get_param: [ext_net_info, "INTERNALnet1", "subnet_id"]}]}]}
      resource_def:
        type: OS::Neutron::Subnet
        properties:
          network:
            str_replace:
              template: $gen$prov
              params:
                $gen: {get_attr: [NOKIA-LCP-InternalNet1, refs, 0]}
                $prov: {get_param: [ext_net_info, "INTERNALnet1", "id"]}
          cidr: "169.254.9.0/24"
          enable_dhcp: False

outputs:

  # Note that the generated and given security groups are mutually exclusive.
  OpenSec:
    description: Open security group.
    value:
      str_replace:
        template: $gen$given
        params:
          $gen: {get_attr: [NOKIA-LCP-OpenSec, refs, 0]}
          $given: {get_param: security_group}

  PrivateKey:
    description: Private SSH key for pre-install intra-VM communication.
    value: {get_attr: [NOKIA-LCP-Keypair, private_key]}

  PublicKey:
    description: Public SSH key for pre-install intra-VM communication.
    value: {get_attr: [NOKIA-LCP-Keypair, public_key]}

  TotalPairCount:
    description: |
      This string will evaluate to the number of PairGroups in the VNF.
    value: {get_param: total_vm_pairs}

  IntNetInfo:
    description: Internal network attributes.
    value: {
      "INTERNALnet0": {
        "id": {
          str_replace: {
            template: "$gen$prov",
            params: {
              $gen: {get_attr: [NOKIA-LCP-InternalNet0, refs, 0]},
              $prov: {get_param: [ext_net_info, "INTERNALnet0", "id"]}
            }
          }
        },
        "subnet_id": {
          str_replace: {
            template: "$gen$prov",
            params: {
              $gen: {get_attr: [NOKIA-LCP-InternalSubNet0, refs, 0]},
              $prov: {get_param: [ext_net_info, "INTERNALnet0", "subnet_id"]}
            }
          }
        },
        "cidr": "169.254.0.0/16",
        "default_gateway": ""
      },
      "INTERNALnet1": {
        "id": {
          str_replace: {
            template: "$gen$prov",
            params: {
              $gen: {get_attr: [NOKIA-LCP-InternalNet1, refs, 0]},
              $prov: {get_param: [ext_net_info, "INTERNALnet1", "id"]}
            }
          }
        },
        "subnet_id": {
          str_replace: {
            template: "$gen$prov",
            params: {
              $gen: {get_attr: [NOKIA-LCP-InternalSubNet1, refs, 0]},
              $prov: {get_param: [ext_net_info, "INTERNALnet1", "subnet_id"]}
            }
          }
        },
        "cidr": "169.254.0.0/16",
        "default_gateway": ""
      }
    }

  NetInfoStr:
    description: Per-subnet information in string format.
    value:
      str_replace:
        template: |
          {
            "subnet_list": "INTERNALnet0 $intnet1 $tag00 $tag01 $tag02 $tag03 $tag04 $tag05 $tag06 $tag07 $tag08 $tag09 $tag10 $tag11",
            "INTERNALnet0": {
              "id": "$gennet0$provnet0",
              "subnet_id": "$gensubnet0$provsubnet0",
              "cidr": "169.254.0.0/16",
              "default_gateway": ""
            },
            "INTERNALnet1": {
              "id": "$gennet1$provnet1",
              "subnet_id": "$gensubnet1$provsubnet1",
              "cidr": "169.254.0.0/16",
              "default_gateway": ""
            },
            "$tag00": {
              "cidr": "$cidr00",
              "default_gateway": "$gw00"
            },
            "$tag01": {
              "cidr": "$cidr01",
              "default_gateway": "$gw01"
            },
            "$tag02": {
              "cidr": "$cidr02",
              "default_gateway": "$gw02"
            },
            "$tag03": {
              "cidr": "$cidr03",
              "default_gateway": "$gw03"
            },
            "$tag04": {
              "cidr": "$cidr04",
              "default_gateway": "$gw04"
            },
            "$tag05": {
              "cidr": "$cidr05",
              "default_gateway": "$gw05"
            },
            "$tag06": {
              "cidr": "$cidr06",
              "default_gateway": "$gw06"
            },
            "$tag07": {
              "cidr": "$cidr07",
              "default_gateway": "$gw07"
            },
            "$tag08": {
              "cidr": "$cidr08",
              "default_gateway": "$gw08"
            },
            "$tag09": {
              "cidr": "$cidr09",
              "default_gateway": "$gw09"
            },
            "$tag10": {
              "cidr": "$cidr10",
              "default_gateway": "$gw10"
            },
            "$tag11": {
              "cidr": "$cidr11",
              "default_gateway": "$gw11"
            }
          }
        params:
          $intnet1: {get_param: [int_net1_label, {str_replace: {template: "$val", params: {$val: {get_param: int_net_count}}}}]}
          $gennet0: {get_attr: [NOKIA-LCP-InternalNet0, refs, 0]}
          $provnet0: {get_param: [ext_net_info, "INTERNALnet0", "id"]}
          $gensubnet0: {get_attr: [NOKIA-LCP-InternalSubNet0, refs, 0]}
          $provsubnet0: {get_param: [ext_net_info, "INTERNALnet0", "subnet_id"]}
          $gennet1: {get_attr: [NOKIA-LCP-InternalNet1, refs, 0]}
          $provnet1: {get_param: [ext_net_info, "INTERNALnet1", "id"]}
          $gensubnet1: {get_attr: [NOKIA-LCP-InternalSubNet1, refs, 0]}
          $provsubnet1: {get_param: [ext_net_info, "INTERNALnet1", "subnet_id"]}
          $tag00: {get_param: [ext_net_list, 0]}
          $cidr00: {get_param: [ext_net_info, {get_param: [ext_net_list, 0]}, cidr]}
          $gw00: {get_param: [ext_net_info, {get_param: [ext_net_list, 0]}, default_gateway]}
          $tag01: {get_param: [ext_net_list, 1]}
          $cidr01: {get_param: [ext_net_info, {get_param: [ext_net_list, 1]}, cidr]}
          $gw01: {get_param: [ext_net_info, {get_param: [ext_net_list, 1]}, default_gateway]}
          $tag02: {get_param: [ext_net_list, 2]}
          $cidr02: {get_param: [ext_net_info, {get_param: [ext_net_list, 2]}, cidr]}
          $gw02: {get_param: [ext_net_info, {get_param: [ext_net_list, 2]}, default_gateway]}
          $tag03: {get_param: [ext_net_list, 3]}
          $cidr03: {get_param: [ext_net_info, {get_param: [ext_net_list, 3]}, cidr]}
          $gw03: {get_param: [ext_net_info, {get_param: [ext_net_list, 3]}, default_gateway]}
          $tag04: {get_param: [ext_net_list, 4]}
          $cidr04: {get_param: [ext_net_info, {get_param: [ext_net_list, 4]}, cidr]}
          $gw04: {get_param: [ext_net_info, {get_param: [ext_net_list, 4]}, default_gateway]}
          $tag05: {get_param: [ext_net_list, 5]}
          $cidr05: {get_param: [ext_net_info, {get_param: [ext_net_list, 5]}, cidr]}
          $gw05: {get_param: [ext_net_info, {get_param: [ext_net_list, 5]}, default_gateway]}
          $tag06: {get_param: [ext_net_list, 6]}
          $cidr06: {get_param: [ext_net_info, {get_param: [ext_net_list, 6]}, cidr]}
          $gw06: {get_param: [ext_net_info, {get_param: [ext_net_list, 6]}, default_gateway]}
          $tag07: {get_param: [ext_net_list, 7]}
          $cidr07: {get_param: [ext_net_info, {get_param: [ext_net_list, 7]}, cidr]}
          $gw07: {get_param: [ext_net_info, {get_param: [ext_net_list, 7]}, default_gateway]}
          $tag08: {get_param: [ext_net_list, 8]}
          $cidr08: {get_param: [ext_net_info, {get_param: [ext_net_list, 8]}, cidr]}
          $gw08: {get_param: [ext_net_info, {get_param: [ext_net_list, 8]}, default_gateway]}
          $tag09: {get_param: [ext_net_list, 9]}
          $cidr09: {get_param: [ext_net_info, {get_param: [ext_net_list, 9]}, cidr]}
          $gw09: {get_param: [ext_net_info, {get_param: [ext_net_list, 9]}, default_gateway]}
          $tag10: {get_param: [ext_net_list, 10]}
          $cidr10: {get_param: [ext_net_info, {get_param: [ext_net_list, 10]}, cidr]}
          $gw10: {get_param: [ext_net_info, {get_param: [ext_net_list, 10]}, default_gateway]}
          $tag11: {get_param: [ext_net_list, 11]}
          $cidr11: {get_param: [ext_net_info, {get_param: [ext_net_list, 11]}, cidr]}
          $gw11: {get_param: [ext_net_info, {get_param: [ext_net_list, 11]}, default_gateway]}

  Version:
    description: |
      Template file version number. This should be updated
      each time a non-comment change is made to this file.
    value: K1