tosca_definitions_version: tosca_simple_yaml_1_0

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

imports:
   - custom_types/xos.yaml
   - custom_types/cdn.yaml

dsl_definitions:
       large_compute_node: &large_compute_node
           disk_size: 80 GB
           mem_size: 8 GB
           num_cpus: 4
       small_compute_node: &small_compute_node
           disk_size: 20 GB
           mem_size: 2 GB
           num_cpus: 1
       hpc_os: &hpc_os
           architecture: x86_64
           type: linux
           distribution: centos
           version: 5.5

topology_template:
  node_templates:
    HyperCache:
      type: tosca.nodes.CDNService
      description: Content Delivery Network
      properties:
          view_url: /admin/hpc/hpcservice/$id$/
          icon_url: /static/primarycons_blue/network.png

    mysite:
      type: tosca.nodes.Site

    mysite_cmi:
      description: CMI Slice
      type: tosca.nodes.Slice
      requirements:
          - cdn_service:
              node: HyperCache
              relationship: tosca.relationships.MemberOfService
          - site:
              node: mysite
              relationship: tosca.relationships.MemberOfSite

    mysite_hpc:
      description: HyperCache Slice
      type: tosca.nodes.Slice
      requirements:
          - cdn_service:
              node: HyperCache
              relationship: tosca.relationships.MemberOfService
          - site:
              node: mysite
              relationship: tosca.relationships.MemberOfSite

    mysite_dnsredir:
      description: HyperCache Slice
      type: tosca.nodes.Slice
      requirements:
          - cdn_service:
              node: HyperCache
              relationship: tosca.relationships.MemberOfService
          - site:
              node: mysite
              relationship: tosca.relationships.MemberOfSite

    mysite_dnsdemux:
      description: HyperCache Slice
      type: tosca.nodes.Slice
      requirements:
          - cdn_service:
              node: HyperCache
              relationship: tosca.relationships.MemberOfService
          - site:
              node: mysite
              relationship: tosca.relationships.MemberOfSite

    cmi_server:
      type: tosca.nodes.Compute
      capabilities:
        host:
          properties: *large_compute_node
        os:
          properties: *hpc_os
      requirements:
          - slice:
                node: mysite_cmi
                relationship: tosca.relationships.MemberOfSlice

    hpc_server:
      type: tosca.nodes.Compute
      capabilities:
        host:
          properties: *large_compute_node
        os:
          properties: *hpc_os
      requirements:
          - slice:
                node: mysite_hpc
                relationship: tosca.relationships.MemberOfSlice

    dnsredir_server:
      type: tosca.nodes.Compute
      capabilities:
        host:
          properties: *small_compute_node
        os:
          properties: *hpc_os
      requirements:
          - slice:
                node: mysite_dnsredir
                relationship: tosca.relationships.MemberOfSlice

    dnsdemux_server:
      type: tosca.nodes.Compute
      capabilities:
        host:
          properties: *small_compute_node
        os:
          properties: *hpc_os
      requirements:
          - slice:
                node: mysite_dnsdemux
                relationship: tosca.relationships.MemberOfSlice
          - colocate:
                node: dnsredir_server
                relationship: tosca.relationships.SameHost

   # Setup the CDN Service Provider

    main_service_provider:
        type: tosca.nodes.ServiceProvider
        requirements:
           - hpc_service:
                 node: HyperCache
                 relationship: tosca.relationships.MemberOfService

    # Wall Street Journal Content Provider

    wsj_content:
        type: tosca.nodes.ContentProvider
        requirements:
            - service_provider:
                  node: main_service_provider
                  relationship: tosca.relationships.MemberOfServiceProvider

    www.wsj.com:
        type: tosca.nodes.CDNPrefix
        requirements:
             - content_provider:
                   node: wsj_content
                   relationship: tosca.relationships.MemberOfContentProvider
             - default_origin_server:
                   node: http_www.wsj.com
                   relationship: tosca.relationships.DefaultOriginServer

    si.wsj.net:
        type: tosca.nodes.CDNPrefix
        requirements:
             - content_provider:
                   node: wsj_content
                   relationship: tosca.relationships.MemberOfContentProvider
             - default_origin_server:
                   node: http_si.wsj.net
                   relationship: tosca.relationships.DefaultOriginServer

    s.wsj.net:
        type: tosca.nodes.CDNPrefix
        requirements:
             - content_provider:
                   node: wsj_content
                   relationship: tosca.relationships.MemberOfContentProvider
             - default_origin_server:
                   node: http_s.wsj.net
                   relationship: tosca.relationships.DefaultOriginServer

    ore.wsj.net:
        type: tosca.nodes.CDNPrefix
        requirements:
             - content_provider:
                   node: wsj_content
                   relationship: tosca.relationships.MemberOfContentProvider
             - default_origin_server:
                   node: http_ore.wsj.net
                   relationship: tosca.relationships.DefaultOriginServer

    http_www.wsj.com:
        type: tosca.nodes.OriginServer
        requirements:
             - content_provider:
                   node: wsj_content
                   relationship: tosca.relationships.MemberOfContentProvider

    http_si.wsj.net:
        type: tosca.nodes.OriginServer
        requirements:
             - content_provider:
                   node: wsj_content
                   relationship: tosca.relationships.MemberOfContentProvider

    http_s.wsj.net:
        type: tosca.nodes.OriginServer
        requirements:
             - content_provider:
                   node: wsj_content
                   relationship: tosca.relationships.MemberOfContentProvider

    http_ore.wsj.net:
        type: tosca.nodes.OriginServer
        requirements:
             - content_provider:
                   node: wsj_content
                   relationship: tosca.relationships.MemberOfContentProvider

    # ON.Lab content provider

    on_lab_content:
        type: tosca.nodes.ContentProvider
        requirements:
            - service_provider:
                  node: main_service_provider
                  relationship: tosca.relationships.MemberOfServiceProvider

    downloads.onosproject.org:
        type: tosca.nodes.CDNPrefix
        requirements:
             - content_provider:
                   node: on_lab_content
                   relationship: tosca.relationships.MemberOfContentProvider
             - default_origin_server:
                   node: http_downloads.onosproject.org
                   relationship: tosca.relationships.DefaultOriginServer

    onlab.vicci.org:
        type: tosca.nodes.CDNPrefix
        requirements:
             - content_provider:
                   node: on_lab_content
                   relationship: tosca.relationships.MemberOfContentProvider
             - default_origin_server:
                   node: http_onlab.vicci.org
                   relationship: tosca.relationships.DefaultOriginServer

    http_downloads.onosproject.org:
        type: tosca.nodes.OriginServer
        requirements:
             - content_provider:
                   node: on_lab_content
                   relationship: tosca.relationships.MemberOfContentProvider

    http_onlab.vicci.org:
        type: tosca.nodes.OriginServer
        requirements:
             - content_provider:
                   node: on_lab_content
                   relationship: tosca.relationships.MemberOfContentProvider

