
{#
Copyright 2017-present Open Networking Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#}


tosca_definitions_version: tosca_simple_yaml_1_0

description: Setup CORD-related services -- vOLT, vCPE, vBNG.

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

topology_template:
  node_templates:
    service_ceilometer:
      type: tosca.nodes.CeilometerService
      requirements:
      properties:
          view_url: /admin/monitoring/ceilometerservice/$id$/
          kind: ceilometer
          ceilometer_enable_pub_sub: true
          public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
          private_key_fn: /opt/xos/services/monitoring/keys/monitoringservice_rsa
      artifacts:
          pubkey: /opt/xos/services/monitoring/keys/monitoringservice_rsa.pub

#    service_sflow:
#      type: tosca.nodes.SFlowService
#      requirements:
#      properties:
#          view_url: /admin/monitoring/sflowservice/$id$/
#          kind: sflow
#          sflow_port: 6343
#          sflow_api_port: 33333

    Private:
      type: tosca.nodes.NetworkTemplate

    management:
      type: tosca.nodes.network.Network.XOS
      properties:
          no-create: true
          no-delete: true
          no-update: true

#    ceilometer_network:
#      type: tosca.nodes.network.Network.XOS
#      properties:
#          ip_version: 4
#          labels: ceilometer_client_access
#      requirements:
#          - network_template:
#              node: Private
#              relationship: tosca.relationships.UsesNetworkTemplate
#          - owner:
#              node: {{ site_name }}_ceilometer
#              relationship: tosca.relationships.MemberOfSlice
#          - connection:
#              node: {{ site_name }}_ceilometer
#              relationship: tosca.relationships.ConnectsToSlice

    {{ site_name }}:
      type: tosca.nodes.Site

    trusty-server-multi-nic:
      type: tosca.nodes.Image

    ceilometer-trusty-server-multi-nic:
      type: tosca.nodes.Image

    ceilometer-service-trusty-server-multi-nic:
      type: tosca.nodes.Image

    m1.small:
      type: tosca.nodes.Flavor

    {{ site_name }}_ceilometer:
      description: Ceilometer Proxy Slice
      type: tosca.nodes.Slice
      requirements:
          - ceilometer_service:
              node: service_ceilometer
              relationship: tosca.relationships.MemberOfService
          - site:
              node: {{ site_name }}
              relationship: tosca.relationships.MemberOfSite
          - default_image:
                node: ceilometer-trusty-server-multi-nic
                relationship: tosca.relationships.DefaultImage
          - management:
              node: management
              relationship: tosca.relationships.ConnectsToNetwork
          - m1.small:
              node: m1.small
              relationship: tosca.relationships.DefaultFlavor

    # Virtual machines
    ceilometer_service_instance:
      type: tosca.nodes.Compute
      capabilities:
        # Host container properties
        host:
         properties:
           num_cpus: 2
           disk_size: 40 GB
           mem_size: 4 GB
      requirements:
          - slice:
                node: {{ site_name }}_ceilometer
                relationship: tosca.relationships.MemberOfSlice
          - image:
                node: ceilometer-service-trusty-server-multi-nic
                relationship: tosca.relationships.UsesImage

#    {{ site_name }}_sflow:
#      description: Slice for sFlow service
#      type: tosca.nodes.Slice
#      requirements:
#          - sflow_service:
#              node: service_sflow
#              relationship: tosca.relationships.MemberOfService
#          - site:
#              node: {{ site_name }}
#              relationship: tosca.relationships.MemberOfSite

# MOVING this section to monitoringtenant.yaml
#    my_ceilometer_tenant:
#      description: Ceilometer Service default Tenant
#      type: tosca.nodes.CeilometerTenant
#      requirements:
#          - provider_service:
#              node: service_ceilometer
#              relationship: tosca.relationships.MemberOfService
#          - dependency:
#              node: ceilometer_service_instance
#              relationship: tosca.relationships.DependsOn
       
    # Virtual machines
#    sflow_service_instance:
#      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: Ubuntu
#            version: 14.10
#      requirements:
#          - slice:
#                node: {{ site_name }}_sflow
#                relationship: tosca.relationships.MemberOfSlice

# MOVING the below sections to monitoringtenant.yaml
#    Ceilometer:
#      type: tosca.nodes.DashboardView
#      properties:
#          url: template:xosCeilometerDashboard
#    Tenant:
#      type: tosca.nodes.DashboardView
#      properties:
#          no-create: true
#          no-update: true
#          no-delete: true
#
#    padmin@vicci.org:
#      type: tosca.nodes.User
#      properties:
#          firstname: XOS
#          lastname: admin
#          is_admin: true
#      requirements:
#          - tenant_dashboard:
#              node: Tenant
#              relationship: tosca.relationships.UsesDashboard
#          - ceilometer_dashboard:
#              node: Ceilometer
#              relationship: tosca.relationships.UsesDashboard
