summaryrefslogtreecommitdiffstats
path: root/docs/guides/onap-user/design/parameter_resolution/ubuntu_example/ubuntuCDS_heat/base_ubuntuCDS.yaml
blob: ad250fa5249f6364c7de297d8da55ac967222818 (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
heat_template_version: 2013-05-23

description: Heat template to deploy a ubuntuCDS VM

parameters:
  # Metadata required by ONAP
  vnf_name:
    type: string
    label: VM name
    description: The VM name
  vnf_id:
    type: string
    label: VNF ID
    description: The VNF ID is provided by ONAP
  vf_module_id:
    type: string
    label: VF module ID
    description: The VF Module ID is provided by ONAP

# Server parameters, naming required by ONAP
  ubuntuCDS_image_name:
    type: string
    label: Image name or ID
    description: Image to be used for compute instance
  ubuntuCDS_flavor_name:
    type: string
    label: Flavor
    description: Type of instance (flavor) to be used
  ubuntuCDS_pub_key:
    type: string
    label: Public key
    description: Public key to be installed on the compute instance
  ubuntuCDS_name_0:
    type: string
    label: VM name
    description: The VM name

# Network parameters, naming required by ONAP
  admin_plane_net_name:
    type: string
    label: management network
    description: The external management network

resources:
  random-str:
    type: OS::Heat::RandomString
    properties:
      length: 4

  ubuntuCDS_instantiated_key_name:
    type: OS::Nova::KeyPair
    properties:
      name:
        str_replace:
          template: pre_base_rand
          params:
            pre: key_
            base: { get_param: vnf_name }
            rand: { get_resource: random-str }
      public_key: { get_param: ubuntuCDS_pub_key }
      save_private_key: false

  ubuntuCDS_admin_security_group:
    type: OS::Neutron::SecurityGroup
    properties:
      description: security group
      name:
        str_replace:
          template: pre_base_rand
          params:
            pre: sg_
            base: { get_param: vnf_name }
            rand: { get_resource: random-str }
      rules: [
        {remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22},
        {remote_ip_prefix: 0.0.0.0/0, protocol: icmp}]

  ubuntuCDS_0_admin_plane_port_0:
    type: OS::Neutron::Port
    properties:
      name:
        str_replace:
          template: pre_base_rand
          params:
            pre: port_
            base: { get_param: vnf_name }
            rand: { get_resource: random-str }
      network: { get_param: admin_plane_net_name }
      security_groups: [{ get_resource: ubuntuCDS_admin_security_group }]

  ubuntuCDS_VM_settings:
    type: OS::Heat::SoftwareConfig
    properties:
      config: |
            #!/bin/bash
            sudo apt-get update

  ubuntuCDS_server_0:
    type: OS::Nova::Server
    properties:
      image: { get_param: ubuntuCDS_image_name }
      flavor: { get_param: ubuntuCDS_flavor_name }
      name: { get_param: ubuntuCDS_name_0 }
      metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }, vnf_name: { get_param: vnf_name }}
      key_name: { get_resource: ubuntuCDS_instantiated_key_name }
      networks:
        - port: { get_resource: ubuntuCDS_0_admin_plane_port_0 }
      user_data_format: RAW
      user_data:
        get_resource: ubuntuCDS_VM_settings