tliron / puccini

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

valid_values and min_length constraints failed #100

Closed philippemerle closed 2 years ago

philippemerle commented 2 years ago

puccini failed to compile the following template

tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
  MyNodeType:
    properties:
      l:
        type: list
        entry_schema:
          type: string
        constraints:
          - valid_values:
              - [ "VALUE" ]
      m:
        type: map
        entry_schema:
          type: string
        constraints:
          - min_length: 1
topology_template:
  node_templates:
    node:
      type: MyNodeType
      properties:
        l: [ "VALUE" ]
        m:
          key1: value1
          key2: value2
$ puccini-tosca compile --coerce puccini-issues/issue_coerce.yaml
PROBLEMS (2)
  file:/Users/merle/Documents/CLOUDNET/inria-gitlab/use-cases/etsi-nfv-sol-001/4.2.1/puccini-issues/issue_coerce.yaml
    @23,9 topology_template.node_templates["node"].properties["l"]: returned false in call to tosca.constraint.valid_values("VALUE","VALUE")
    @24,9 topology_template.node_templates["node"].properties["m"]: returned false in call to tosca.constraint.min_length("key1: value1¶key2: value2",1)
$

but the properties of node template seem to satisfy the constraints.

Is it really a problem in the template? or is it an issue in the puccini coerce implementation of both valid_values and min_length?

tliron commented 2 years ago

Thank you, there were indeed issues with both comparison and length for non-primitive values.