tosca_definitions_version: tosca_simple_yaml_1_0

description: Onboard XOS

imports:
   - custom_types/xos.yaml

topology_template:
  node_templates:

    xos:
      type: tosca.nodes.XOS
      properties:
        ui_port: {{ xos_ui_port }}
        bootstrap_ui_port: {{ xos_bootstrap_ui_port }}
        docker_project_name: {{ cord_profile | regex_replace('\W','') }}
        db_container_name: {{ cord_profile | regex_replace('\W','') }}bs_xos_db_1
{% if use_redis %}
        redis_container_name: {{ cord_profile | regex_replace('\W','') }}bs_xos_redis_1
{% endif %}
{% if frontend_only is defined %}
        frontend_only: {{ frontend_only }}
{% endif %}
{% if source_ui_image is defined %}
        source_ui_image: {{ source_ui_image }}
{% endif %}

    /opt/xos/xos_configuration/xos_common_config:
      type: tosca.nodes.XOSVolume
      properties:
          host_path: {{ cord_profile_dir }}/xos_common_config
          read_only: True
      requirements:
          - xos:
             node: xos
             relationship: tosca.relationships.UsedByXOS

    /opt/cord_profile:
      type: tosca.nodes.XOSVolume
      properties:
          host_path: {{ cord_profile_dir }}
          read_only: True
      requirements:
          - xos:
             node: xos
             relationship: tosca.relationships.UsedByXOS

{% for library in xos_libraries %}
    /opt/xos_libraries/{{ library }}:
      type: tosca.nodes.XOSVolume
      properties:
          host_path: {{ cord_dir }}/orchestration/xos_libraries/{{ library }}
          read_only: True
      requirements:
          - xos:
             node: xos
             relationship: tosca.relationships.UsedByXOS

{% endfor %}


{% for service in xos_services %}
    /opt/xos_services/{{ service.path | basename }}:
      type: tosca.nodes.XOSVolume
      properties:
          host_path: {{ cord_dir }}/{{ service.path }}
          read_only: {{ service.read_only | default("True") }}
      requirements:
          - xos:
             node: xos
             relationship: tosca.relationships.UsedByXOS

{% endfor %}

{% for volume in xos_docker_volumes %}
    {{ volume.container }}:
      type: tosca.nodes.XOSVolume
      properties:
          host_path: {{ volume.host }}
          read_only: {{ volume.read_only | default("True") }}
      requirements:
          - xos:
             node: xos
             relationship: tosca.relationships.UsedByXOS

{% endfor %}

