Dear Chris, Calin and Arturo,
please find DÃnes questions below (he is not authorized to send mails to the TOSCA list).
Greetings,
GÃbor
From: "Nemeth, Denes (Nokia - HU/Budapest)" <
denes.nemeth@nokia.com >
Date: 2020. May 18., Monday 14:02
To: "
tosca@lists.oasis-open.org " <
tosca@lists.oasis-open.org >
Cc: Arturo Martin De Nicolas <
arturo.martin-de-nicolas@ericsson.com >
Subject: Re: [tosca] Use of properties defaults
Hello Chris and Calin and Arturo
I will try to attach a more concrete example that possibly includes all the corner cases to help the discussions.
Even after reading the 2.0 specs for me it is still not clear what is the exact intention.
Is it possible to define a default for a non-required property? (line in yellow).
If one property becomes required that had a default value, than is it used?
(lines in green)
Maybe if only the required properties shall have default values at all, than life would be simpler.
Cheers Denes
tosca_definitions_version: tosca_simple_yaml_1_0
node_types:
my_type_1:
properties:
p0:
type: string
required: false
p1:
type: string
required: false
default: d1
p2:
type: string
required: true
default: d2
p3:
type: string
required: true
my_type_2:
derived_from: my_type_1
properties:
p 1 :
required: true
default: d4
my_type_3:
derived_from: my_type_1
properties:
p 1 :
#required: true assumed even if not stated since true is the default for required
description: dsad
topology_template:
node_templates:
node1:
type: my_type_1
properties:
p0: a
p1: b
p2: c
p3: d
node2:
type: my_type_1
properties:
# p0 does not have a value
# p1 does not have a value
# p2 has value d2
p3: d # this can not be ommited
node3:
type: my_type_2
properties:
# p0 does not have a value
# p1 has value d4
# p2 has value d2
p3: d # this can not be ommited
node4:
type: my_type_3
properties:
p0: a
# p1 has value d1
# p2 has value d2
p3: d
From: <
tosca@lists.oasis-open.org > on behalf of Arturo Martin De Nicolas <
arturo.martin-de-nicolas@ericsson.com >
Date: 2020. May 18., Monday 9:56
To: "
tosca@lists.oasis-open.org " <
tosca@lists.oasis-open.org >
Subject: [tosca] Use of properties defaults
Hello Chris and Calin,
The use of default values for properties in TOSCA is a recurrent topic of controversy in ETSI NFV SOL.
What has been stated in the TOSCA Language WG is that default values are only meaningful for properties that are defined as required = true e.g. in a node type definition.
A default value for a property that is defined as required = false in a node type definition is irrelevant and it will never be used: a node template either provides a property assignment for that property (in which case
the default value is overrriden) or it does not provide a property assignment (in which case the property is not used in this node template).
Unfortunately this is not explicitly written in the TOSCA spec. Furthermore, there is at least one example in 3.4.5.7 in TOSCA 2.0 with a default value for a property which has required = false. In TOSCA 1.3 there are
a few more examples but these are in the profile part.
Can we discuss this topic briefly tomorrow and add a clarification in TOSCA about the use of defaults?
Best regards,
Arturo