Hi Tal,

Did you get the attachments ?

If not . . please find below templates.

db.yaml

tosca_definitions_version: tosca_simple_yaml_1_0

topology_template:

  substitution_mappings:
#    node_type: tosca.nodes.Database
    node_type: my.nodes.database    
    capabilities:
      database_endpoint: [ db_app, database_endpoint ]

  node_templates:

    db_app:
      type: tosca.nodes.Database
      properties:
        name: sub_map_db
      interfaces:
        Standard:
          create:
            implementation: test_plugin.test_method
          delete:
            implementation: test_plugin.test_method
      requirements:
        - host:
            node: db_server

    db_server:
      type: tosca.nodes.DBMS
      interfaces:
        Standard:
          create:
            implementation: test_plugin.test_method
          delete:
            implementation: test_plugin.test_method
      requirements:
        - host:
            node: db_host

    db_host:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          create:
            implementation: test_plugin.test_method
          delete:
            implementation: test_plugin.test_method


web.yaml

tosca_definitions_version: tosca_simple_yaml_1_0

imports:
  - ./db.yaml

node_types:
  my.nodes.database:
    derived_from: tosca.nodes.Database

topology_template:

  node_templates:

    web_app:
      type: tosca.nodes.WebApplication
      interfaces:
        Standard:
          create:
            implementation: test_plugin.test_method
          delete:
            implementation: test_plugin.test_method
      requirements:
        - host:
            node: web_server
        - dependency:
            node: database

    web_server:
      type: tosca.nodes.WebServer
      interfaces:
        Standard:
          create:
            implementation: test_plugin.test_method
          delete:
            implementation: test_plugin.test_method
      requirements:
        - host:
            node: web_host

    web_host:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          create:
            implementation: test_plugin.test_method
          delete:
            implementation: test_plugin.test_method

    database:
#      type: tosca.nodes.Database
      type: my.nodes.database
      properties:
        name: web_db



Regards,
DJ
-----Original Message-----
From: D Jayachandran 
Sent: Friday, May 26, 2017 2:30 PM
To: [email protected]
Cc: Vaishnavi K.R <[email protected]>; S Shenbaga Rajan 
<[email protected]>
Subject: RE: Query related to substitution mapping

Hi Tal,

Please find the attachment for an example of substitution mapping.
The db.yaml is the substituting template which is imported to web.yaml. 
The web.yaml has an abstract node template "database" which would be 
substituted with db.yaml.

We want to understand is it mandatory to have templates imported for 
substitution to work ? Does TOSCA spec says this ?
The use-case for us would be to have substitution mapping without importing the 
template but to find the template from the already available service-templates 
in the Database.

You could refer Section 2.10  in TOSCA simple yaml 1.0 for more information on 
substitution mapping.

Regards,
DJ

-----Original Message-----
From: Tal Liron [mailto:[email protected]]
Sent: Thursday, May 25, 2017 10:32 PM
To: [email protected]
Subject: Re: Query related to substitution mapping

Hi DJ,

I'm not sure what you mean by "the substituting template". Actually, ARIA does 
almost nothing with substitution templates right now, just parses, validates, 
and stores the info. Indeed, if you refer to a node type there, it should be 
expected that the current template would need to know of that type, possibly by 
importing.

Could you provide a short example to clarify?

On Thu, May 25, 2017 at 5:32 AM, D Jayachandran <[email protected]
> wrote:

> Hi,
>
> The substitution mapping works in the latest APACHE ARIA code only if 
> the substituting template is imported in the top-level template.
>
> This seems to be contradicting with the TOSCA specification where the 
> substitution is expected to happen without the import (though not 
> explicitly mentioned).
>
> We are looking at the possible ways to identify the appropriate node 
> template without importing the substituting template. ( Possibly by 
> going through already available service models for a substitutable 
> entity )
>
> Do you have any plans to have substitution mapping work without having 
> the template imported every time ?
> Do you have any feedback on this and if our understanding is correct ?
>
>
> Regards,
> DJ
>
>
>
>


--
Tal Liron
Senior Engineer
[email protected] | +1 (773) 828-9339
Cloudify | http://getcloudify.org
<http://getcloudify.org?utm_source=signaturesatori&utm_medium=email&utm_campaign=general_signature>

<https://twitter.com/CloudifySource>
<https://www.linkedin.com/groups/8467478>
<https://github.com/cloudify-cosmo>   <https://github.com/cloudify-cosmo>
[image: Azure Webinar]
<http://getcloudify.org/webinars/Azure-plugin-for-cloudify-webinar.html?utm_source=signaturesatori&utm_medium=email&utm_campaign=general_signature>

Reply via email to