Abstract Compute node template is not supported

Bug #2055132 reported by Miguel Caballer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
TOSCA Parser
New
Undecided
Unassigned

Bug Description

In case that try to use a simple abstract compute node like this one:

tosca_definitions_version: tosca_simple_yaml_1_0_0

description: Template with requirements against hosting infrastructure.

topology_template:

  node_templates:

    mysql_compute:
      type: Compute
      capabilities:
        host:
          properties:
            num_cpus: { equal: 2 }
            mem_size: { greater_or_equal: 2 GB }
        os:
          properties:
            architecture: { equal: x86_64 }
            type: linux
            distribution: ubuntu

You get an error, as it is trying to validate the constraints without considering the "operator" functions:

Traceback (most recent call last):
  File "/usr/local/bin/tosca-parser", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/toscaparser/shell.py", line 116, in main
    ParserShell().main(args)
  File "/usr/local/lib/python3.10/site-packages/toscaparser/shell.py", line 59, in main
    self.parse(path)
  File "/usr/local/lib/python3.10/site-packages/toscaparser/shell.py", line 68, in parse
    tosca = ToscaTemplate(path, None, a_file)
  File "/usr/local/lib/python3.10/site-packages/toscaparser/tosca_template.py", line 105, in __init__
    self.topology_template = self._topology_template()
  File "/usr/local/lib/python3.10/site-packages/toscaparser/tosca_template.py", line 120, in _topology_template
    return TopologyTemplate(self._tpl_topology_template(),
  File "/usr/local/lib/python3.10/site-packages/toscaparser/topology_template.py", line 57, in __init__
    self.nodetemplates = self._nodetemplates()
  File "/usr/local/lib/python3.10/site-packages/toscaparser/topology_template.py", line 97, in _nodetemplates
    tpl.validate(self)
  File "/usr/local/lib/python3.10/site-packages/toscaparser/nodetemplate.py", line 188, in validate
    self._validate_capabilities()
  File "/usr/local/lib/python3.10/site-packages/toscaparser/entity_template.py", line 185, in _validate_capabilities
    self._validate_capabilities_properties(capabilities)
  File "/usr/local/lib/python3.10/site-packages/toscaparser/entity_template.py", line 198, in _validate_capabilities_properties
    prop.validate()
  File "/usr/local/lib/python3.10/site-packages/toscaparser/properties.py", line 72, in validate
    self._validate_constraints()
  File "/usr/local/lib/python3.10/site-packages/toscaparser/properties.py", line 77, in _validate_constraints
    constraint.validate(self.value)
  File "/usr/local/lib/python3.10/site-packages/toscaparser/elements/constraints.py", line 186, in validate
    if not self._is_valid(value):
  File "/usr/local/lib/python3.10/site-packages/toscaparser/elements/constraints.py", line 282, in _is_valid
    value >= self.constraint_value):
TypeError: '>=' not supported between instances of 'dict' and 'int'

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.