90fb33b735dc82635cae3d9f5aaeecb709805d5f
[vnfrqts/requirements.git] / docs / Chapter5 / Heat / ONAP Heat Cinder Volumes.rst
1 .. Licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2017 AT&T Intellectual Property.  All rights reserved.
4
5 .. _ONAP Heat Cinder Volumes:
6
7 ONAP Heat Cinder Volumes
8 ----------------------------
9
10 Cinder Volumes are created with the heat resource OS::Cinder::Volume.
11
12 As stated in :need:`R-46119`, :need:`R-90748`, :need:`R-03251`, a
13 VNF's Heat Orchestration Template's Resource OS::Heat::CinderVolume
14 **MAY** be defined in a Base Module, Incremental Module, or Cinder
15 Volume Module.
16
17 ONAP supports the independent deployment of a Cinder volume via separate
18 Heat Orchestration Templates, the Cinder Volume module. This allows the
19 volume to persist after VNF deletion so that they can be reused on
20 another instance (e.g., during a failover activity).
21
22 A Base Module or Incremental Module may have a corresponding volume
23 module. Use of separate volume modules is optional. A Cinder volume may
24 be embedded within the Base Module or Incremental Module if persistence
25 is not required.
26
27 If a VNF Base Module or Incremental Module has an independent volume
28 module, the scope of volume templates must be 1:1 with Base module or
29 Incremental module. A single volume module must create only the volumes
30 required by a single Incremental module or Base module.
31
32 As stated in :need:`R-11200`, a VNF's Cinder Volume Module, when it exists,
33 **MUST** be 1:1 with a Base module or Incremental module.  That is,
34 A single volume module must create only the volumes required by a
35 single Incremental module or Base module.
36
37 As stated in :need:`R-30395`, a VNF's Cinder Volume Module **MAY** utilize
38 nested heat.
39
40 As stated in :need:`R-89913`, a VNF's Heat Orchestration Template's Cinder Volume
41 Module Output Parameter(s) **MUST** include the
42 UUID(s) of the Cinder Volumes created in template,
43 while others **MAY** be included.
44
45 As stated in :need:`R-07443`, a VNF's Heat Orchestration Templates' Cinder Volume
46 Module Output Parameter's name and type **MUST** match the input parameter
47 name and type in the corresponding Base Module or Incremental Module unless
48 the Output Parameter is of the type 'comma_delimited_list',
49 then the corresponding input parameter **MUST** be declared as type 'json'.
50
51 A single volume module must create only the volumes
52 required by a single Incremental module or Base module.
53
54 The following rules apply to independent volume Heat templates:
55
56 .. req::
57     :id: R-79531
58     :target: VNF
59     :keyword: MUST
60
61     The VNF Heat Orchestration Template **MUST** define
62     "outputs" in the volume template for each Cinder volume
63     resource universally unique identifier (UUID) (i.e. ONAP
64     Volume Template Output Parameters).
65
66 -  The VNF Incremental Module or Base Module must define input
67    parameters that match each Volume output parameter (i.e., ONAP Volume
68    Template Output Parameters).
69
70    -  ONAP will supply the volume template outputs automatically to the
71       bases/incremental template input parameters.
72
73 -  Volume modules may utilize nested Heat templates.
74
75 Optional Property availability_zone
76 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77
78 .. req::
79     :id: R-25190
80     :target: VNF
81     :keyword: SHOULD NOT
82
83     A VNF's Heat Orchestration Template's Resource 'OS::Cinder::Volume'
84     **SHOULD NOT** declare the property 'availability_zone'.
85
86 If the property is used, the value **MUST**
87 be enumerated in the environment file and must be set to nova', which
88 is the default. There are no requirements on the parameter naming
89 convention with the exception that the naming convention **MUST NOT** be the
90 same as the 'OS::Nova::Server' property 'availability_zone' (i.e.,
91 'availability_zone_{index}').
92
93 Optional Property volume_type
94 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95
96 OpenStack supports multiple volume types. If the OS::Cinder::Volume optional
97 property volume_type is not specified, the OpenStack default volume type is
98 used. If a specific volume type is required, the property is used and
99 the value **MUST** be enumerated in the environment file. There are no
100 requirements on the parameter naming convention
101
102 Cinder Volume Examples
103 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104
105 *Examples: Volume Template*
106
107 A VNF has a Cinder volume module, named incremental\_volume.yaml, that
108 creates an independent Cinder volume for a VM in the module
109 incremental.yaml. The incremental\_volume.yaml defines a parameter in
110 the output section, lb\_volume\_id\_0 which is the UUID of the cinder
111 volume. lb\_volume\_id\_0 is defined as a parameter in incremental.yaml.
112 ONAP captures the UUID value of lb\_volume\_id\_0 from the volume module
113 output statement and provides the value to the incremental module.
114
115 Note that the example below is not a complete Heat Orchestration
116 Template. The {vm-type} has been defined as "lb" for load balancer
117
118 incremental\_volume.yaml
119
120 .. code-block:: yaml
121
122  parameters:
123     vnf_name:
124        type: string
125     lb_volume_size_0:
126        type: number
127     ...
128
129  resources:
130     dns_volume_0:
131        type: OS::Cinder::Volume
132        properties:
133           name:
134              str_replace:
135                 template: VNF_NAME_volume_0
136                 params:
137                    VNF_NAME: { get_param: vnf_name }
138           size: {get_param: dns_volume_size_0}
139     ...
140
141  outputs:
142     lb_volume_id_0:
143        value: {get_resource: dns_volume_0}
144     ...
145
146
147 incremental.yaml
148
149 .. code-block:: yaml
150
151  parameters:
152     lb_name_0:
153        type: string
154     lb_volume_id_0:
155        type: string
156     ...
157
158  resources:
159     lb_0:
160        type: OS::Nova::Server
161        properties:
162           name: {get_param: dns_name_0}
163           networks:
164           ...
165
166     lb_0_volume_attach:
167        type: OS::Cinder::VolumeAttachment
168        properties:
169           instance_uuid: { get_resource: lb_0 }
170           volume_id: { get_param: lb_volume_id_0 }
171
172