Implement PNFD Model driven conversion
[sdc.git] / openecomp-be / lib / openecomp-tosca-converter-lib / openecomp-tosca-converter-core / src / main / resources / pnfdTransformationTemplate / model-driven-conversion.yaml
1 - transformation-for: nodeTemplate #block
2   name: PnfExtCp transformation #transformation name
3   description: converts any node template that has a type tosca.nodes.nfv.PnfExtCp #transformation description
4   query:  # Block query. Searches for node_template(s) with the same attributes. Ignores the node_template name.
5           # Supports recursive structure of key (string): value (new map or string).
6           # Each lvl can contain more than one key that will be treated as an AND.
7           # Must have the same structure in the original node_template declaration, otherwise the node_template will not be found.
8     type: tosca.nodes.nfv.PnfExtCp
9   conversions: # List of conversions/transformations that will be applied to the node_template attributes.
10     - query:  # Attribute query for "type". Finds one attribute inside the node_template(s) found with the block query.
11               # Supports recursive structure of key (string): value (new map or string).
12               # Each lvl can only contain one key.
13               # If the attribute is found, the transformation strategy defined in this element will be applied.
14               # Must have the same structure in the original node_template declaration, otherwise the attribute will not be found.
15         type:
16       to-name: type # New attribute name.
17       to-value:
18         # Replace transformation strategy: replaces the old value for a new one. Must have this structure.
19         strategy: replace # Transformation strategy name.
20         from: tosca.nodes.nfv.PnfExtCp # Original attribute value.
21         to: org.openecomp.resource.cp.v2.extCP # New attribute value.
22     - query: # Another attribute query. This time for "properties/layer_protocols"
23         properties:
24           layer_protocols:
25       to-name: ip_requirements
26       to-value:
27         # Replace in list strategy: replaces specific values of a list for new ones.
28         strategy: replaceInList
29         list: # List of values to be replaced
30           - from: ipv4 # Searches for "ipv4" value and...
31             to: #...replaces for the following map
32               assingment_method: dhcp
33               ip_version: 4
34           - from: ipv6 # Another list value search and replace
35             to:
36               assingment_method: dhcp
37               ip_version: 6
38       # When a TOSCA { get_input: provided-input-name } function is found, the "provided-input-name"
39       # will be converted using the "transformation-for: getInputFunction" with name "ipRequirements".
40       to-get-input: ipRequirements
41 - transformation-for: getInputFunction # Transforms inputs called by get_input TOSCA function.
42   name: ipRequirements  # Transformation name, used to be referred by "to-get-input" transformation attribute.
43   description: converts IpRequirements inputs when called by a get_input TOSCA function
44   conversions: #this part works exactly the same as the correspondent node_template transformation declarations.
45     - query:
46         type:
47       to-name: type
48       to-value:
49         strategy: copy
50     - query:
51         description:
52       to-name: description
53       to-value:
54         strategy: copy
55     - query:
56         entry_schema:
57           type:
58       to-name: type
59       to-value:
60         strategy: replace
61         from: string
62         to: org.openecomp.datatypes.network.IpRequirements
63     - query:
64         default:
65       to-name: default
66       to-value:
67         strategy: replaceInList
68         list:
69           - from: ipv4
70             to:
71               assingment_method: dhcp
72               ip_version: 4
73           - from: ipv6
74             to:
75               assingment_method: dhcp
76               ip_version: 6