{% load i18n sizeformat %}
{% load url from future %}

<h3>{% trans "Subnet Overview" %}</h3>

<div class="info row detail">
  <h4>{% trans "Subnet" %}</h4>
  <hr class="header_rule">
  <dl class="dl-horizontal">
    <dt>{% trans "Name" %}</dt>
    <dd>{{ subnet.name|default:_("None") }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ subnet.id|default:_("None") }}</dd>
    {% url 'horizon:project:networks:detail' subnet.network_id as network_url %}
    <dt>{% trans "Network ID" %}</dt>
    <dd><a href="{{ network_url }}">{{ subnet.network_id|default:_("None") }}</a></dd>
    <dt>{% trans "IP version" %}</dt>
    <dd>{{ subnet.ipver_str|default:_("-") }}</dd>
    <dt>{% trans "CIDR" %}</dt>
    <dd>{{ subnet.cidr|default:_("None") }}</dd>
    <dt>{% trans "IP allocation pool" %}</dt>
    <dd>
      {% for pool in subnet.allocation_pools %}
        {% trans "Start" %}  {{ pool.start }}
        {% trans " - End" %} {{ pool.end   }}<br>
      {% endfor %}
    </dd>
    <dt>{% trans "Gateway IP" %}</dt>
    <dd>{{ subnet.gateway_ip|default:_("-") }}</dd>
    <dt>{% trans "DHCP Enable" %}<dt>
    <dd>{{ subnet.enable_dhcp|yesno|capfirst }}</dd>
    {% if subnet.ip_version == 6 %}
      <dt>{% trans "IPv6 Address Configuration Mode" %}<dt>
      {% if subnet.ipv6_modes_desc %}
        <dd>{{ subnet.ipv6_modes_desc }}</dd>
      {% else %}
        <dd>{% blocktrans with ra_mode=subnet.ipv6_ra_mode addr_mode=subnet.ipv6_address_mode %}
        Other IPv6 modes: ipv6_ra_mode={{ ra_mode }}, ipv6_address_mode={{ addr_mode }}
        {% endblocktrans %}</dd>
      {% endif %}
    {% endif %}
    <dt>{% trans "Additional routes" %}</dt>
    <dd>
      {% for route in subnet.host_routes %}
        {% trans "Destination" %} {{ route.destination }}
        {% trans " : Next hop" %} {{ route.nexthop }}<br>
        {% empty %}
        {% trans "None" %}
      {% endfor %}
    </dd>
    <dt>{% trans "DNS name server" %}</dt>
    <dd>
      {% for dns in subnet.dns_nameservers %}
        {{ dns }}
        {% empty %}
        {% trans "None" %}
      {% endfor %}
    </dd>
  </dl>
</div>
