tosca_definitions_version: tosca_simple_yaml_1_0

description: Template for deploying a single server with predefined properties.

imports:
   - custom_types/xos.yaml

topology_template:
  node_templates:
    mysite:
      type: tosca.nodes.Site

    Private:
      type: tosca.nodes.NetworkTemplate

    producer_private_network:
      type: tosca.nodes.network.Network
      properties:
          ip_version: 4
      requirements:
          - network_template:
              node: Private
              relationship: tosca.relationships.UsesNetworkTemplate
          - slice:
              node: mysite_producer
              relationship: tosca.relationships.MemberOfSlice

    mysite_producer:
      type: tosca.nodes.Slice
      requirements:
          - slice:
                node: mysite
                relationship: tosca.relationships.MemberOfSite

    mysite_consumer:
      type: tosca.nodes.Slice
      requirements:
          - slice:
                node: mysite
                relationship: tosca.relationships.MemberOfSite
          - network:
                node: producer_private_network
                relationship: tosca.relationships.ConnectsToNetwork

    producer_server:
      type: tosca.nodes.Compute
      capabilities:
        # Host container properties
        host:
         properties:
           num_cpus: 1
           disk_size: 10 GB
           mem_size: 4 MB
        # Guest Operating System properties
        os:
          properties:
            # host Operating System image properties
            architecture: x86_64
            type: linux
            distribution: rhel
            version: 6.5
      requirements:
          - slice:
                node: mysite_producer
                relationship: tosca.relationships.MemberOfSlice

    consumer_server:
      type: tosca.nodes.Compute
      capabilities:
        # Host container properties
        host:
         properties:
           num_cpus: 1
           disk_size: 10 GB
           mem_size: 4 MB
        # Guest Operating System properties
        os:
          properties:
            # host Operating System image properties
            architecture: x86_64
            type: linux
            distribution: rhel
            version: 6.5
      requirements:
          - slice:
                node: mysite_consumer
                relationship: tosca.relationships.MemberOfSlice

    producer_pvt_net_port:
        type: tosca.nodes.network.Port
        requirements:
            - link:
                  node: producer_private_network
                  relationship: tosca.relationships.network.LinksTo
            - binding:
                  node: producer_server
                  relationship: tosca.relationships.network.BindsTo

    consumer_pvt_net_port:
        type: tosca.nodes.network.Port
        requirements:
            - link:
                  node: producer_private_network
                  relationship: tosca.relationships.network.LinksTo
            - binding:
                  node: consumer_server
                  relationship: tosca.relationships.network.BindsTo



