ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From D Jayachandran <d.jayachand...@ericsson.com>
Subject RE: Query related to substitution mapping
Date Wed, 31 May 2017 07:59:56 GMT
Hi Tal,

Thanks for the explanation.
I tried having the custom type in a separate file and imported it to both web.yaml and db.yaml.
Now in my web.yaml "database" node-template is still an abstract one. To have the node-template
"db-app" being substituted in place of "database" in web.yaml I still need to import db.yaml.
This was my first question, Do we need to import db.yaml ( which provides the substitutable
node-templates ) to web.yaml ( which has the  abstract node template ) ?

I also tried the below without any custom node-type

1) Created a service-template "st-1" from db.yaml 
2) Created a service-template "st-2" from web.yaml
3) Had an abstract node-template "database" ( node-type: tosca.nodes.Database) as part of
web.yaml "database"
4) Had an substation mapping of node-type "tosca.nodes.Database" with capability as "database_endpoint"
5) I dint import db.yaml to web.yaml

I would expect the ARIA to go through the available service-templates (st-1) which provides
the substation capability when I try to create a service from "st-2" ( web.yaml)
But it fails here, as it has no target node_template. So it looks like ARIA wants the db.yaml
to be imported to have the node-template ?


Please find below yaml files and results.

Node templates:
+----+------------+-------------+-----------------------+----------------------------+
| id |    name    | description | service_template_name |         type_name          |
+----+------------+-------------+-----------------------+----------------------------+
| 1  |   db_app   |             |          st-1         |    tosca.nodes.Database    |
| 2  | db_server  |             |          st-1         |      tosca.nodes.DBMS      |
| 3  |  db_host   |             |          st-1         |    tosca.nodes.Compute     |
| 4  | web_server |             |          st-2         |   tosca.nodes.WebServer    |
| 5  |  web_host  |             |          st-2         |    tosca.nodes.Compute     |
| 6  |  web_app   |             |          st-2         | tosca.nodes.WebApplication |
| 7  |  database  |             |          st-2         |    tosca.nodes.Database    |
+----+------------+-------------+-----------------------+----------------------------+

[root@DJ-DEV substitution]#
[root@DJ-DEV substitution]#
[root@DJ-DEV substitution]# aria services create -t st-2 s1
Creating new service from service template st-2...
Validation issues:
  5: requirement "host" of node "database_1" has no target node template


Web.yaml

tosca_definitions_version: tosca_simple_yaml_1_0

topology_template:

  node_templates:

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

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

    web_host:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          create:
            implementation: sample.samplemethod
          delete:
            implementation: sample.samplemethod

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



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: sample.samplemethod
          delete:
            implementation: sample.samplemethod
      requirements:
        - host:
            node: db_server

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

    db_host:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          create:
            implementation: sample.samplemethod
          delete:
            implementation: sample.samplemethod

Regards
DJ

-----Original Message-----
From: Tal Liron [mailto:tal@gigaspaces.com] 
Sent: Friday, May 26, 2017 9:40 PM
To: dev@ariatosca.incubator.apache.org
Subject: Re: Query related to substitution mapping

Thanks, DJ. Much clearer now. Also it seems that the Apache mailing list throws away attachments,
so we will have to paste things in email.

I will clarify my meaning: I did not mean to say that you need to import types, just that
those types must be *available*. Indeed you'll see that the examples given in the TOSCA spec
don't use imports all. However, those examples use standard simple profile types. In your
example you are using a custom type.

How substitution mapping actually happens depends on the orchestrator, TOSCA only specifies
the grammar. So, how would the orchestrator know that types in different services are compatible
and can be chained/proxies/whatever in order to implement service composition? All TOSCA provides
us with here is names: the type name and the mapped capability names.

That's fine, but ARIA is a validating parser. It doesn't just treat these names at arbitrary
strings, it checks to make sure that the type exists and that that the mapped capabilities
match those in the type. This is critical for making sure the resulting service is valid and
can indeed be composed by the orchestrator.

So, how would you make sure that db.yaml knows about the "my.nodes.database" type? My proposed
solution is to always define types in separate files (think: header files in C) which could
then be imported by any other file that needs them.

In this case I would "my.nodes.database" in its own file, let's say types.yaml. Then db.yaml
and web.yaml can both import types.yaml. The former is a "provider" while the latter is a
"consumer", but both work with the same basic type.

Does this make sense?






On Fri, May 26, 2017 at 4:18 AM, D Jayachandran <d.jayachandran@ericsson.com
> wrote:

> 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: dev@ariatosca.incubator.apache.org
> Cc: Vaishnavi K.R <vaishnavi.k.r@ericsson.com>; S Shenbaga Rajan < 
> s.shenbaga.rajan@ericsson.com>
> 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:tal@gigaspaces.com]
> Sent: Thursday, May 25, 2017 10:32 PM
> To: dev@ariatosca.incubator.apache.org
> 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 < 
> d.jayachandran@ericsson.com
> > 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
> tal@gigaspaces.com | +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>
>



--
Tal Liron
Senior Engineer
tal@gigaspaces.com | +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>
Mime
View raw message