{#
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

imports:
   - custom_types/xos.yaml

description: Configures the VTN ONOS service

topology_template:
  node_templates:

    service#ONOS_CORD:
      type: tosca.nodes.ONOSService
      requirements:
      properties:
          kind: onos
          view_url: /admin/onos/onosservice/$id$/
          no_container: true
          rest_hostname: onos-cord.{{ site_suffix }}
          rest_port: 8182
          replaces: service_ONOS_CORD

    service#vtn:
      type: tosca.nodes.VTNService
      properties:
          view_url: /admin/vtn/vtnservice/$id$/
          privateGatewayMac: 00:00:00:00:00:01
          localManagementIp: {{ management_network_ip }}
          ovsdbPort: 6641
          sshUser: root
          sshKeyFile: /root/node_key
          sshPort: 22
          xosEndpoint: xos-chameleon.{{ site_suffix }}:{{ xos_chameleon_port }}
          xosUser: {{ xos_admin_user }}
          xosPassword: {{ xos_admin_pass }}
          replaces: service_vtn
          vtnAPIVersion: 2
          controllerPort: onos-cord.{{ site_suffix }}:6654

    VTN_ONOS_app:
      type: tosca.nodes.ONOSVTNApp
      requirements:
          - onos_tenant:
              node: service#ONOS_CORD
              relationship: tosca.relationships.TenantOfService
          - vtn_service:
              node: service#vtn
              relationship: tosca.relationships.UsedByService
      properties:
          install_dependencies: {{ onos_mavenrepo_url }}/repository/org/opencord/cord-config/{{ cord_config_app_version }}/cord-config-{{ cord_config_app_version }}.oar, {{ onos_mavenrepo_url }}/repository/org/opencord/vtn/{{ cord_vtn_app_version }}/vtn-{{ cord_vtn_app_version }}.oar
          dependencies: org.onosproject.drivers, org.onosproject.drivers.ovsdb, org.onosproject.openflow-base, org.onosproject.ovsdb-base, org.onosproject.dhcp
          autogenerate: vtn-network-cfg

