OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

tosca message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: RE: [tosca] Questions on the TOSCA model


Hi Nikunj,

 

1.       You can’t specify constraints on properties in a node template. You can think of a node template as an “instance” of a node of a certain Node Type. When you define the node type, you specify all the properties for that type and any constraints on those properties. In the node template, you would assign values to those properties. Said another way: the “properties” key in a node type is used for “property definitions” and the “properties” key in a node template is for “property assignments”. When you assign values to properties, your software should validate whether those values satisfy the constraints specified in the node type.

 

2.       Two comments on your second question:

a.       If you have Compute nodes that need properties beyond those defined in tosca.nodes.Compute, you will have to create a derived Node Type that adds those properties. You can define your new node type in a separate YAML file that can be imported in the service templates that need it.

b.      If you want to create “standard” values that should be used for all your Compute nodes, you could do the following:

·   Create a separate file (e.g. standard-compute.yaml) that defines a node template (e.g. called standard_compute)  of your Compute type and assign your standard property values to that node template

·   Import this file into the service templates that want to use the standard property values

·   When defining node templates, use the “copy” key to copy all the property values from your standard_compute node templat

 

Here is sample YAML

 

tosca_definitions_version: tosca_simple_yaml_1_0_0

imports:

   - standard-compute.yaml

topology_template:

  node_templates:

    node_template_1:

      copy: standard_compute

 

Please be aware that there is one potential problem with this: node templates (including standard_compute) are defined inside a topology_template. It is assumed that there is only one topology_template per service template. The behavior where a service template that has a topology_template includes another file that also has a topology_template is undefined. This is an issue that needs to be resolved in the spec.

 

c.       Another option might be to put the dsl_definition statement into its own file and import it, but depending on the YAML parser this might not work (since “import” is a Tosca concept, not a YAML concept). Anybody have any opinions about whether this should work or not?

 

 

Hope this helps,

 

Chris

 

 

From: tosca@lists.oasis-open.org [mailto:tosca@lists.oasis-open.org] On Behalf Of Nikunj Nemani
Sent: Wednesday, April 29, 2015 12:04 AM
To: tosca@lists.oasis-open.org
Subject: [tosca] Questions on the TOSCA model

 

Hello,

 

Recently, I have been trying to model few applications in TOSCA.

I have two questions, appreciate your response and help.

 

1. Can constraints be specified inline on properties of node template ? In the spec I could find the constraints only defined either in the node template or in the inputs. 

E.g. - Is this a valid TOSCA node template ?

 

    appserver:

        type: tosca.Nodes.Compute

        properties: 

        

num_cpus:

       

type: integer

       

description: Number of CPUs

       

default: 1

       

required: true

       

constraints:

       

- in_range: [1, 4] #alternate is to specify as num_cpus: {in_range [1, 4] }

  

2 . I  have a of a list of properties which I want to use across my nodes in different blueprints. E.g. I have a set of properties which I want to apply to all my linux nodes whether it is CentOS or RedHat in a LAMP stack or in a JavaStack. How can I define that ? I know that I can define a dsl_definition, but that will only be within a blueprint (or application). The other thing I can do is define a  different nodeType, for e.g 

linux_property_list:

derived_from: tosca.Nodes.Root

 

properties:

VirtualMachine.admin.ThinProvision: true

VMware.SCSI.Type: pvscsi

MonitoringOptions: true

MonitoringOptions.HasAlerting: true

ProjectCode:

 

But when I want to use it in my node template, is this valid ? (Note the properties are a combination of the property_list as well as very specific properties for that node)

 

appserver:

        type: tosca.Nodes.Compute

 

properties:

- linux_property_list

        num_cpus:

        type: integer

        description: Number of CPUs

        default: 1

        required: true

        mem_size: 4 MB

        disk_size: 10 GB

        

Thanks and Regards,

Nikunj Nemani



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]