Hi,
Yes this scenario is working fine. But in my case, I am not assigning
default value to attribute in node type instead assigning the attribute
value through a plugin(sample-1.0.0 in my case) using,
ctx.node.attributes['config'] = "test" .
Then I am trying to fetch this value through get_attribute function in
another operation. You can find the service template used below. I saved it
as a file named "test.yaml"

tosca_definitions_version: tosca_simple_yaml_1_0
imports:
  - aria-1.0

node_types:
  my_Node_Server:
    derived_from: tosca.nodes.Root
    attributes:
      vmme_configuration:
        type: string

topology_template:
   policies:
     sample:
       type: aria.Plugin
       properties:
         version: 1.0.0
         enabled: true

   node_templates:
     v_mme:
       type: my_Node_Server
       interfaces:
         Standard:
           create:
             implementation: sample > sample.sample_test.call_test
           configure:
             implementation: sample > sample.sample_test.call_name
             inputs:
               config: {get_attribute: [ v_mme, vmme_configuration ]}

-----Original Message-----
From: Tal Liron [mailto:t...@cloudify.co]
Sent: Tuesday, December 05, 2017 7:05 PM
To: dev@ariatosca.incubator.apache.org
Subject: Re: get_attribute function not supporting SELF as
<modelable_entity_name>

Sure, it is seen below. I saved it as a file named "v.yaml" and then ran
these commands to see the values of the function calls, which in both cases
was "hello":

aria service-templates store v.yaml v
aria service-templates show v -f

The file "v.yaml":

tosca_definitions_version: tosca_simple_yaml_1_0

data_types:

  Payload:
    properties:
      config:
        type: string

node_types:

  my_Node_Server:
    derived_from: tosca.nodes.Root
    attributes:
      vmme_configuration:
        type: string
        default: hello
    interfaces:
      Standard:
        type: tosca.interfaces.node.lifecycle.Standard
        create:
          implementation: sample.sample_test.call_test
          inputs: {}
        configure:
          implementation: sample.sample_test.call_name
          inputs:
            payload:
              type: Payload

topology_template:

   node_templates:
     v_mme:
       type: my_Node_Server
       interfaces:
         Standard:
           configure:
             inputs:
               payload: {
                 "config": {get_attribute: [ SELF, vmme_configuration ]}}
               config: {get_attribute: [ SELF, vmme_configuration ]}




On Tue, Dec 5, 2017 at 1:56 PM, Vaishali Krishnamurthy <
v.krishnamurt...@globallogic.com.invalid> wrote:

> I have tried the same in the latest master version. Could you please
> provide the service template you used ?
>
> -----Original Message-----
> From: Tal Liron [mailto:t...@cloudify.co]
> Sent: Tuesday, December 05, 2017 3:41 PM
> To: dev@ariatosca.incubator.apache.org
> Subject: Re: get_attribute function not supporting SELF as
> <modelable_entity_name>
>
> I tried here and it did work for me. Are you using the latest master
> version? We had a few recent commits that have fixed various things.
>
> Perhaps you can provide a fully working minimal example that could
> clearly reproduce this bug?
>
> On Tue, Dec 5, 2017 at 12:02 PM, Vaishali Krishnamurthy <
> v.krishnamurt...@globallogic.com.invalid> wrote:
>
> > Thanks. I tried this workaround. Still, the get_attribute function
> > returns the value 'none' when used in the first level of inputs. In
> > my case, I am trying to update the attribute value in one operation
> > using plugin and fetch the updated attribute value in another
> > operation using the get_attribute function, for which it returns
> > 'none' when I use SELF as modelable entity.
> > For the same scenario if I use the node name as modelable entity, it
> > works fine.
> >
> > -----Original Message-----
> > From: Tal Liron [mailto:t...@cloudify.co]
> > Sent: Tuesday, December 05, 2017 3:10 PM
> > To: dev@ariatosca.incubator.apache.org
> > Subject: Re: get_attribute function not supporting SELF as
> > <modelable_entity_name>
> >
> > The bug, in case you want to follow its progress:
> > https://issues.apache.org/jira/browse/ARIA-424
> >
> > On Tue, Dec 5, 2017 at 11:35 AM, Tal Liron <t...@cloudify.co> wrote:
> >
> > > There is a bug here, but it has nothing to do with SELF.
> > >
> > > The issue is that you are using an "ad hoc", typeless input here
> > > for the "configure" operation. Because it's typeless, ARIA sends
> > > it "as is" and thus has no idea that what's inside might be a
> > > syntactical intrinsic function.
> > >
> > > I will open a big for this, but for now the workaround is to
> > > explicitly declare the input at the type, which I think is
> > > generally a good idea. (And actually, I would rather ARIA not
> > > allow the current typeless input
> > > situation.)
> > >
> > > Here's how it would look:
> > >
> > > tosca_definitions_version: tosca_simple_yaml_1_0
> > >
> > > data_types:
> > >
> > >   Payload:
> > >     properties:
> > >       config:
> > >         type: string
> > >
> > > node_types:
> > >
> > >   my_Node_Server:
> > >     derived_from: tosca.nodes.Root
> > >     attributes:
> > >       vmme_configuration:
> > >         type: string
> > >         default: test default value
> > >     interfaces:
> > >       Standard:
> > >         type: tosca.interfaces.node.lifecycle.Standard
> > >         create:
> > >           implementation: sample.sample_test.call_test
> > >           inputs: {}
> > >         configure:
> > >           implementation: sample.sample_test.call_name
> > >           inputs:
> > >             payload:
> > >               type: Payload
> > >
> > > topology_template:
> > >
> > >    node_templates:
> > >      v_mme:
> > >        type: my_Node_Server
> > >        interfaces:
> > >          Standard:
> > >            configure:
> > >              inputs:
> > >                payload:
> > >                  config: {get_attribute: [ SELF, vmme_configuration ]}
> > >                config: {get_attribute: [ SELF, vmme_configuration
> > > ]}
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Tue, Dec 5, 2017 at 10:58 AM, Vaishali Krishnamurthy <
> > > v.krishnamurt...@globallogic.com.invalid> wrote:
> > >
> > >> Here, I have used the get_attribute in the input defined in the
> > >> second level, for which it returns me the dictionary object.
> > >> inputs:
> > >>       payload: {
> > >>             "config": {get_attribute: [ SELF, vmme_configuration
> > >> ]}}
> > >>
> > >> When I use the get_attribute in inputs defined in the first level
> > >> it returns me none.
> > >> inputs:
> > >>        config: {get_attribute: [ SELF, vmme_configuration ]}
> > >>
> > >> Please find the service template below.
> > >> node_types:
> > >>   my_Node_Server:
> > >>     derived_from: tosca.nodes.Root
> > >>     attributes:
> > >>       vmme_configuration:
> > >>         type: string
> > >>     interfaces:
> > >>       Standard:
> > >>         create:
> > >>           implementation: sample > sample.sample_test.call_test
> > >>           inputs: {}
> > >>         configure:
> > >>           implementation: sample > sample.sample_test.call_name
> > >>           inputs: {}
> > >>
> > >> topology_template:
> > >>
> > >>    node_templates:
> > >>      v_mme:
> > >>        type: my_Node_Server
> > >>        interfaces:
> > >>          Standard:
> > >>            configure:
> > >>              inputs:
> > >>                payload: {
> > >>                  "config": {get_attribute: [ SELF,
> > >> vmme_configuration
> > ]}}
> > >>                config: {get_attribute: [ SELF, vmme_configuration
> > >> ]}
> > >>
> > >> Regards,
> > >> Vaishali.
> > >>
> > >> -----Original Message-----
> > >> From: Tal Liron [mailto:t...@cloudify.co]
> > >> Sent: Tuesday, December 05, 2017 2:06 PM
> > >> To: dev@ariatosca.incubator.apache.org
> > >> Subject: Re: get_attribute function not supporting SELF as
> > >> <modelable_entity_name>
> > >>
> > >> Thanks for the report. Do you possibly have a minimal TOSCA
> > >> template we can use to reproduce the error?
> > >>
> > >> On Tue, Dec 5, 2017 at 8:29 AM, Vaishali Krishnamurthy <
> > >> v.krishnamurt...@globallogic.com.invalid> wrote:
> > >>
> > >> > Hi,
> > >> >
> > >> > We have observed the attribute resolution is not proper when we
> > >> > use SELF as <modelable_entity_name> in  get_attribute function
> > >> > and it works fine when we use the node name as
> > >> > <modelable_entity_name> .
> > >> > With SELF it takes the default value. Could you confirm if
> > >> > there is any fix for this issue ?
> > >> >
> > >> >
> > >> > Regards,
> > >> >
> > >> > Vaishali
> > >> >
> > >>
> > >
> > >
> >
>

Reply via email to