tliron / puccini

Cloud topology management and deployment tools based on TOSCA
https://puccini.cloud
Apache License 2.0
91 stars 20 forks source link

two different behaviours on capability occurrences #69

Closed philippemerle closed 2 years ago

philippemerle commented 3 years ago

Puccuni 0.18.0 signals no problem on the following template:

tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
  MyNodeType:
    capabilities:
      cap:
        type: tosca:Compute
        # default occurrences is [1, UNBOUNDED]
#        occurrences: [1, UNBOUNDED]
topology_template:
  node_templates:
    node:
      type: MyNodeType

But if one uncomments occurrences: [1, UNBOUNDED] then Puccini signals a problem:

$ puccini-tosca compile previous_template.yaml 
PROBLEMS (1)
  Resolution
    @12,5 topology_template.node_templates["node"].capabilities["cap"]: not enough relationships: 0 < 1
$

This seems that there are two totally different behaviours depending on the absence or presence of the occurrences keyname. Moreover TOSCA 1.3 does not specify that each capability MUST BE the target of a relationship.

tliron commented 3 years ago

How do you understand capability "occurrences", then? According to the TOSCA 1.3 spec the default there is [ 1, UNBOUNDED ], but what does that mean? You can read my interpretation here. Essentially, I understand it to refer to the number of incoming relationships. So a minimum of 1 would mean you should get an error if no relationship comes in. And a maximum of 1 means there should be no more than 1 incoming relationship. Thus I actually interpret the default to be [ 0, UNBOUNDED ], because otherwise there would be errors all over the place.

philippemerle commented 2 years ago

The quirk capabilities.occurrences.permissive introduced into release v0.20.0 seems to address this problem. Thank @tliron.