tosca_definitions_version: alien_dsl_1_4_0
description: Alien4Cloud generated service template
metadata:
  template_name: ValueAssignment
  template_version: 0.1.0-SNAPSHOT
  template_author: admin

imports:
  - tosca-normative-types: <normative-types.yml>

node_types:
  yorc.types.A:
    derived_from: tosca.nodes.SoftwareComponent
    properties:
      document_root:
        type: string
      empty:
        type: string
      optionalEmpty:
        type: string
        required: false
    interfaces:
      Standard:
        inputs:
          G1: "G1"
          G2: {get_property: [SELF, document_root]}
          G3: {get_property: [SELF, empty]}
          G4: {get_property: [SELF, optionalEmpty]}
        create:
          inputs:
            A1: {get_property: [SELF, document_root]}
            A2: {get_attribute: [HOST, ip_address]}
            A3: {get_property: [SELF, empty]}
            A4: {get_property: [SELF, optionalEmpty]}
          implementation: /tmp/create.sh
  yorc.types.B:
    derived_from: tosca.nodes.SoftwareComponent
    capabilities:
      cap: yorc.types.Cap

relationship_types:
  yorc.types.Rel:
    derived_from: tosca.relationships.Root
    interfaces:
      Configure:
        inputs:
          G1: "G1"
          G2: {get_property: [SOURCE, document_root]}
          G3: {get_attribute: [TARGET, ip_address]}
        pre_configure_source:
          inputs:
            A1: {get_property: [SOURCE, document_root]}
            A2: {get_attribute: [TARGET, ip_address]}
          implementation: /tmp/pre_configure_source.sh
        add_source:
          inputs:
            A1: {get_property: [SOURCE, document_root]}
            A2: {get_attribute: [TARGET, ip_address]}
          implementation: /tmp/add_source.sh

capability_types:
  yorc.types.Cap:
    derived_from: tosca.capabilities.Root
    properties:
      Cap1:
        type: string
        default: "DCap1"
      Cap2:
        type: string
        default: ""
    attributes:
      myattr:
        # this attribute will be set in test and appear in injected capability attrs
        type: string
      myNonSetAttr:
        # this attribute will not be set in test and wont appear in injected capability attrs
        type: string

topology_template:
  node_templates:
    NodeA:
      type: yorc.types.A
      properties:
        document_root: /var/www
        empty: ""
      requirements:
        - host:
            node: ComputeA
            capability: tosca.capabilities.Container
            relationship: tosca.relationships.HostedOn
        - connect:
            node: NodeB
            capability: yorc.types.Cap
            relationship: yorc.types.Rel

    NodeB:
      type: yorc.types.B
      capabilities:
        cap:
          properties:
            Cap2: "DCap2"
      requirements:
        - host:
            node: ComputeB
            capability: tosca.capabilities.Container
            relationship: tosca.relationships.HostedOn
    ComputeA:
      type: tosca.nodes.Compute
    ComputeB:
      type: tosca.nodes.Compute
