tosca-community-contributions
tosca-community-contributions copied to clipboard
Fully specify substitution specification and mechanism (e.g. how to map multiple requirements with the same name, or how to map notifications?)
Hi! Is there any progress on that task? Current syntax for the requirement mapping does not allow to map requirements of the substituted type to requirements of multiple nodes.
Can't the map of requirement mappings be replaced with the list of maps, as it is done in requirement definition and assignment?
For example:
tosca_definitions_version: tosca_2_0_proposal
topology_template:
node_templates:
software_a:
type: SoftwareComponentA
requirements:
- software_b: software_b
- software_c: software_c
# - host: omitted
software_b:
type: SoftwareComponentB
requirements:
# - host: omitted
software_c:
type: SoftwareComponentC
requirements:
# - host: omitted
substitution_mappings:
node_type: ComplexSoftware
capabilities:
endpoint: [ software_a, endpoint ]
requirements:
- host: [ software_a, host ]
- host: [ software_b, host ]
- host: [ software_c, host ]
This may be isomorphic to:
tosca_definitions_version: tosca_2_0_proposal
topology_template:
node_templates:
software_a:
type: SoftwareComponentA
requirements:
- software_b: software_b
- software_c: software_c
- host: compute
software_b:
type: SoftwareComponentB
requirements:
- host: compute
software_c:
type: SoftwareComponentC
requirements:
- host: compute
compute:
type: tosca.nodes.Compute
directives:
- select
substitution_mappings:
node_type: ComplexSoftware
capabilities:
endpoint: [ software_a, endpoint ]
But in the first example the host will be explicitly set in the top level template (where directives: [ substitute ] is used). And the second meaning can be used, when template is deployed independently, and the requirement must be fulfilled
In case, when multiple requirements with the same name are listed in the top level template, each of them is mapped to each node in the substitution:
tosca_definitions_version: tosca_2_0_proposal
topology_template:
node_templates:
software:
type: ComplexSoftware
requirements:
- host: compute_1
- host: compute_2
directives:
- substitute
compute_1:
type: tosca.nodes.Compute
attributes:
public_address: 1.2.3.4
compute_2:
type: tosca.nodes.Compute
attributes:
public_address: 5.6.7.8
Here, after substitution, each software (a, b, c) will have two hosts in the requirements.
Does it break the contract somewhere? Or I miss some validation problems?
Thanks Mikhail for providing these use cases. You are correct that the TOSCA v1.3 syntax does not allow you to unambiguously define intended requirement mapping behavior. I believe there are two different scenarios that need to be supported:
- A single requirement in the substituted node must be mapped onto multiple requirements in the substituting template
- Multiple requirements with the same name in the substituted node must be mapped (separately) to requirement of the substituting template.
Your question is very timely, because the TOSCA TC is planning to revisit v2.0 substitution mapping later this month.