Node Templates

node_templates represent instances of Node Types which would eventually represent a running application/service as described in the service template.

Declaration

The node_templates section in the DSL is a dictionary where each key is a node template.

node_templates:

  node_template_1:
    type: ...
    artifacts:
      ...
    properties:
      ...
    interfaces:
      ...
    requirements:
      ...

  node_template_2:
    ...

Definition

Keyname

Required

Type

Description

type

yes

string

The node_type of this node template.

artifacts

no

dict

See TOSCA Artifact definition

properties

no

dict

The properties of the node template matching its node type properties schema.

interfaces

no

interfaces

Used for mapping plugins to interfaces operation or for specifying inputs for already mapped node type operations.

requirements

no

requirements

Used for specifying the requirements this node template has.

Example

node_types:
  # The following node type is used in the node templates section
  nodes.Nginx:
    derived_from: tosca.nodes.WebServer
    properties:
      port:
        description: The default listening port for the Nginx server.
        type: integer
    interfaces:
      Standard:
        create:
          implementation: scripts/install-nginx.sh
          inputs:
            process:
              default:
                env:
                  port: 80
        start: scripts/start-nginx.sh

node_templates:
  vm:
    type: tosca.nodes.Compute
    properties:
      ip: 192.168.0.11

  nginx:
    # We specify that this node template is of the node type we defined in the node types section
    type: nodes.Nginx
    # properties should match nodes.Nginx type properties schema
    properties:
      port: 80
    interfaces:
      Standard:
        create:
          # inputs should match the inputs schema defined in nodes.Nginx for the create operation
          inputs:
            process:
              env:
                port: { get_property: [SELF, port] }
    requirements:
      - type: tosca.requirements.contained_in
        target: vm

See also

For more information, refer to TOSCA Node Templates Section