Hi Ran,

When I refer the TOSCA spec, it says 

" An optional key that declares a property as required (true) or not (false)."
property_required: represents an optional boolean value (true or false) 
indicating whether or not the property is required.  If this keyname is not 
present on a property definition, then the property SHALL be considered 
required (i.e., true) by default.

It is not clear to whom this property is required or not ? 

With your argument, it seems we always need to provide a default value to an 
input, when we don’t declare in my service template. Is my understanding 
correct here ?
But the TOSCA spec says the default value is always an optional one. Also since 
the parser validates the service template inputs according to the "required" 
field am not sure why we need another validation during the execution ?

I also don’t find any reference in TOSCA spec which says, all inputs defined in 
node type be declared in node template to be used by any operation. Could you 
please help me with that reference in TOSCA spec ?


Regards,
DJ

-----Original Message-----
From: Ran Ziv [mailto:[email protected]] 
Sent: Thursday, May 25, 2017 5:16 PM
To: [email protected]
Subject: Re: Query on operation inputs

Yes, I understand the confusion here. The issue is that, despite its name, the 
"required" field isn't what defines whether an input is optional or not
- it is only relevant during the parsing phase (This is according to our 
understanding of the TOSCA spec. Tal could probably expand more on this).
What's relevant for deciding whether an input is required or not for actual 
execution is whether it has a default value - so all inputs would have a value 
when the actual execution takes place.

I hope this helps clearing this confusing issue..

Ran

On Thu, May 25, 2017 at 2:08 PM, D Jayachandran <[email protected]
> wrote:

> Hi Ran,
>
> Thanks for your response.
>
> In my case, I have defined the inputs as optional under the create 
> operation of my custom node type.
> Since it is an optional input, I haven't declared it in my node-template.
> I assume optional input may or may not be declared in a service template ?
> Am I missing something here ?
>
> Please find below the node type and node template in my case.
>
> # python /root/incubator-ariatosca/aria/cli/main.py executions start 
> -s
> demo-sr-1 install
> Required inputs [u'labels'] have not been specified - expected inputs:
> [u'isService', u'name', u'exposed_port', u'image', u'labels', 
> u'target_port', u'target_host']
>
> Node-type
>
> node_types:
>     test.nodes.Container.Application:
>         derived_from: tosca.nodes.Root
>         properties:
>             name:
>               type: string
>               required: true
>             image:
>               type: string
>               required: true
>             port:
>               type: integer
>               required: false
>         interfaces:
>             Standard:
>                 type: tosca.interfaces.node.lifecycle.Standard
>                 create:
>                         inputs:
>                             name:
>                                 type: string
>                                 required: true
>                             image:
>                                 type: string
>                                 required: true
>                             exposed_port:
>                                 type: integer
>                                 required: false
>                             target_port:
>                                 type: integer
>                                 required: false
>                             target_host:
>                                 type: integer
>                                 required: false
>                             labels:
>                                 type: string
>                                 required: false
>                             isService:
>                                 type: boolean
>                                 required: false
>                         implementation:
>                             primary: sample > sample.samplemethod
>
> Node template:
>
>         web_app:
>             type: test.nodes.Container.Application
>             properties:
>                 name: { get_input: web_app_name }
>                 image: { get_input: web_app_image }
>                 port: { get_input: web_app_port }
>             requirements:
>                 - dependency:
>                       node: database
>                       relationship:
>                           type: tosca.relationships.DependsOn
>             interfaces:
>                 Standard:
>                      create:
>                         inputs:
>                             name: { get_input: web_app_name }
>                             image: { get_property: [ web_app, image] }
>                             exposed_port: { get_property: [ web_app, 
> port] }
>                             target_host: { get_property: [ database, 
> name] }
>                             target_port: { get_property: [ database, 
> port] }
>                             isService: true
>
> Regards,
> DJ
>
> -----Original Message-----
> From: Ran Ziv [mailto:[email protected]]
> Sent: Thursday, May 25, 2017 4:07 PM
> To: [email protected]
> Subject: Re: Query on operation inputs
>
> Hi,
>
> Weird, I remember responding to this mail before, but it doesn't seem 
> like I have.
> In any case, it is indeed our intention that no inputs may be passed 
> into operations unless they have been clearly declared in the 
> service-template.
> ARIA opts to be a strict implementation of TOSCA wherever possible.
>
> Ran
>
> On Thu, May 25, 2017 at 1:22 PM, D Jayachandran < 
> [email protected]
> > wrote:
>
> > Hi,
> >
> > The latest Apache-aria is throwing a validation error during the 
> > execution of a service.
> > It demands all the operation inputs defined in a node type be 
> > declared in the service template though they are optional inputs.
> > Could you please let us know if this change was intentional ?
> >
> >
> > Regards,
> > DJ(D Jayachandran)
> >
>

Reply via email to