PortDef datatype incorrectly derived_from Root, should be integer

Bug #1567552 reported by Matt Rutkowski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
TOSCA Parser
In Progress
Undecided
Lakshmi Prasanna

Bug Description

if you parse a DataEntity of type PortDef, it incorrectly has its 'derived_from' set as tosca.datatypes.Root; and is not validated correctly as an integer prior to testing if it is "in_range" against PortDef schema constraints.

Revision history for this message
Matt Rutkowski (mrutkows) wrote :

The schema from the TOSCA spec is as follows:
tosca.datatypes.network.PortDef:
  derived_from: integer
  constraints:
    - in_range: [ 1, 65535 ]

description: updated
Revision history for this message
LinusRamuk (sunil-kalidindi) wrote :

As per my current repository cloned from github the Tosca spec is as follows.

tosca.datatypes.network.PortDef:
  derived_from: tosca.datatypes.Root
  type: integer
  constraints:
    - in_range: [ 1, 65535 ]

Could you please elaborate the issue.

Revision history for this message
Matt Rutkowski (mrutkows) wrote :

The correct definition is:
tosca.datatypes.network.PortDef:
  derived_from: integer
  constraints:
    - in_range: [ 1, 65535 ]

A new type def. should exclusively use the "derive_from" property (correct), but not also have a "type" keyname (which should only be used by property definitions.

Revision history for this message
Manasa (manasa-penumatsa) wrote :

If the Tosca definition is as follows :

tosca.datatypes.network.PortDef:
  derived_from: integer
  constraints:
    - in_range: [ 1, 65535 ]

Then statefulentitytype looks for an entry of type "tosca.datatypes.network.integer" in the TOSCA_DEF file which is not available. So it will throw an error as "TypeError:argument of type 'NoneType' is not iterable".

So the definition should be as follows:

tosca.datatypes.network.PortDef:
  derived_from: tosca.datatypes.Root
  type: integer
   constraints:
    - in_range: [ 1, 65535 ]

As per my observation, validation for PortDef is not working, since parameters are not passed to ToscaParser in shell.py

Changed in tosca-parser:
assignee: nobody → Manasa (manasa-penumatsa)
Changed in tosca-parser:
assignee: Manasa (manasa-penumatsa) → nobody
Changed in tosca-parser:
assignee: nobody → Lakshmi Prasanna (lakshmiprasanna-m)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tosca-parser (master)

Fix proposed to branch: master
Review: https://review.openstack.org/309293

Changed in tosca-parser:
status: New → In Progress
Revision history for this message
Sahdev Zala (spzala) wrote :

derived_from: integer seems odd.. the tosca.datatypes.network.PortDef is the only entity in whole spec with such derived_from...everywhere else entities derive from TOSCA type (root etc.). Might be a bug in spec?
@Manasa, thanks, per your observation fixing 'validation' is good idea but that shouldn't close this bug until we are clear on 'derived_from' in spec.

Revision history for this message
Sahdev Zala (spzala) wrote :

PortDef looks more like primitive type but spec has it as complex type and it needs to be treated as complex type. It can be enhanced in future version of spec.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to tosca-parser (master)

Reviewed: https://review.openstack.org/309293
Committed: https://git.openstack.org/cgit/openstack/tosca-parser/commit/?id=e55f28458c79bccc7a56901084c47aaa9864f5d3
Submitter: Jenkins
Branch: master

commit e55f28458c79bccc7a56901084c47aaa9864f5d3
Author: Lakshmi <email address hidden>
Date: Fri Apr 22 12:36:55 2016 +0530

    Added logic to validate the default values from the templates.

    Incorporated the review comments and added unit testcase for the newly added
    method.

    Co-Authored-By: Sahdev Zala <email address hidden>

    Related-bug: #1567552

    Change-Id: I41f574a353495f25957b9b25ce6368fe6e92dbc2

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.