Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_attribute with a requirement as parameter #56

Open
philippemerle opened this issue Apr 1, 2022 · 6 comments
Open

get_attribute with a requirement as parameter #56

philippemerle opened this issue Apr 1, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@philippemerle
Copy link
Collaborator

Parsing the following service template

tosca_definitions_version: tosca_simple_yaml_1_3
topology_template:
  node_templates:
    compute:
      type: tosca.nodes.Compute
      capabilities:
        host:
          properties:
            name: mycompute
    software:
      type: tosca.nodes.SoftwareComponent
      requirements:
        - host: compute
      interfaces:
        Standard:
          operations:
            configure:
              inputs:
                property_host_name:  { get_property: [ SELF, host, name ]}
                attribute_host_name: { get_attribute: [ SELF, host, name ]}

produces an error

[ERROR] issue.yaml@21,38:topology_template:node_templates:software:interfaces:Standard:operations:configure:inputs:attribute_host_name: {'get_attribute': ['SELF', 'host', 'name']} - host attribute undefined!

As get_property: [ SELF, host, name ] is considered as a correct expression, then get_attribute: [ SELF, host, name ] shall be considered as a correct expression.

@lauwers
Copy link

lauwers commented Apr 1, 2022

The example is invalid TOSCA in my opinion since it assigns values to properties (the "name' property of the 'host' capabilty) and input parameters('property_host_name' and 'attribute_host_name') that have not been previously defined. Ubicity generates the following error output:

     "topology": {
        "node_templates": {
          "compute": {
            "capabilities": {
              "host": {
                "properties": {
                  "name": "not previously defined"
                }
              }
            },
            "line": 4
          },
          "software": {
            "interfaces": {
              "Standard": {
                "operations": {
                  "configure": {
                    "inputs": {
                      "property_host_name": "not previously defined",
                      "attribute_host_name": "not previously defined"
                    }
                  }
                }
              }
            },
            "line": 10
          }
        },
        "line": 2
      }
    }

@philippemerle
Copy link
Collaborator Author

According to Section 5.5.3 of TOSCA 1.3, tosca.capabilities.Compute has a property named name. It seems that this property is not defined in Ubicity, see https://ubicity.com/profiles.html#/types/capability/45.

@philippemerle
Copy link
Collaborator Author

There are many examples where operation input parameters are assigned without defined previously.

@lauwers
Copy link

lauwers commented Apr 1, 2022

My apologies, you are correct about tosca.capabilities.Compute. Apparently I have had this bug since v1.1 when tosca.capabilities.Compute was first introduced as a subclass of tosca.capabiities.Container. It took over all the properties oftosca.capabilities.Container defined in v1.0, but it also added a new ``name'' property which I neglected to add.

@lauwers
Copy link

lauwers commented Apr 1, 2022

In my opinion, it is OK for a node type definition to add input parameters to an interface definition that have not been previously defined in the corresponding interface type, but I believe it should be an error for a node template to add interface inputs that have not been previously defined in the corresponding interface definition. Could you point me to one of the examples in the spec so we can discuss this in the TOSCA Language Ad-Hoc?

@philippemerle
Copy link
Collaborator Author

Have a look to examples in Sections 11.1.15.3, 11.1.16.3, 11.1.17.3.1, and 11.1.18.3.1 of TOSCA 1.3.

philippemerle added a commit that referenced this issue Apr 4, 2022
@philippemerle philippemerle self-assigned this May 12, 2022
@philippemerle philippemerle added the enhancement New feature or request label May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants