tosca_definitions_version: tosca_simple_yaml_1_0

description: Some VTN related stuff

imports:
   - custom_types/xos.yaml

topology_template:
  node_templates:
    management_template:
      type: tosca.nodes.NetworkTemplate
      properties:
          visibility: private
          translation: none

    management:
      type: tosca.nodes.network.Network
      properties:
          ip_version: 4
          cidr: 172.27.0.0/24
      requirements:
          - network_template:
              node: management_template
              relationship: tosca.relationships.UsesNetworkTemplate
          - owner:
              node: mysite_management
              relationship: tosca.relationships.MemberOfSlice

    mysite:
      type: tosca.nodes.Site

    mysite_management:
      description: This slice exists solely to own the management network
      type: tosca.nodes.Slice
      properties:
          network: noauto
      requirements:
          - site:
              node: mysite
              relationship: tosca.relationships.MemberOfSite

    service_ONOS_VTN:
      type: tosca.nodes.ONOSService
      requirements:
      properties:
          kind: onos
          view_url: /admin/onos/onosservice/$id$/
          public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
          node_key: { get_artifact: [ SELF, nodekey, LOCAL_FILE] }
      artifacts:
          pubkey: /opt/xos/synchronizers/onos/onos_key.pub
          nodekey: /root/setup/node_key

    VTN_ONOS_app:
      type: tosca.nodes.ONOSVTNApp
      requirements:
          - onos_tenant:
              node: service_ONOS_VTN
              relationship: tosca.relationships.TenantOfService
      properties:
          dependencies: org.onosproject.drivers, org.onosproject.drivers.ovsdb, org.onosproject.lldpprovider, org.onosproject.openflow-base, org.onosproject.ovsdb-base, org.onosproject.dhcp, org.onosproject.cordvtn
          rest_onos/v1/network/configuration/: { get_artifact: [ SELF, vtn_network_cfg_json, LOCAL_FILE ] }
      artifacts:
          vtn_network_cfg_json: /root/setup/vtn-network-cfg.json

    # docker image for vcpe containers
    docker-onos:
      # TODO: need to attach this to mydeployment
      type: tosca.nodes.Image
      properties:
        kind: container
        container_format: na
        disk_format: na
        path: onosproject/onos

    mysite:
      type: tosca.nodes.Site

    mysite_onos_vtn:
      description: ONOS Controller Slice for VTN
      type: tosca.nodes.Slice
      requirements:
          - ONOS:
              node: service_ONOS_VTN
              relationship: tosca.relationships.MemberOfService
          - site:
              node: mysite
              relationship: tosca.relationships.MemberOfSite
          - onos_docker_image:
              node: docker-onos
              relationship: tosca.relationships.UsesImage
      properties:
          network: host
          default_isolation: container

    # Virtual machines
    onos_app_vtn:
      type: tosca.nodes.Compute.Container
      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: mysite_onos_vtn
                relationship: tosca.relationships.MemberOfSlice
          - image:
                node: docker-onos
                relationship: tosca.relationships.UsesImage
