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

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

<div class="info row detail">
  <h4>{% trans "Port" %}</h4>
  <hr class="header_rule">
  <dl>
    <dt>{% trans "Name" %}</dt>
    <dd>{{ port.name|default:_("None") }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ port.id|default:_("None") }}</dd>
    {% url 'horizon:project:networks:detail' port.network_id as network_url %}
    <dt>{% trans "Network ID" %}</dt>
    <dd><a href="{{ network_url }}">{{ port.network_id|default:_("None") }}</a></dd>
    <dt>{% trans "Project ID" %}</dt>
    <dd>{{ port.tenant_id|default:"-" }}</dd>
    <dt>{% trans "Fixed IP" %}</dt>
    <dd>
      {% if port.fixed_ips.items|length > 1 %}
        {% for ip in port.fixed_ips %}
          <b>{% trans "IP address:" %}</b> {{ ip.ip_address }},
          <b>{% trans "Subnet ID" %}</b> {{ ip.subnet_id }}<br>
        {% endfor %}
      {% else %}
        {% trans "None" %}
      {% endif %}
    </dd>
    <dt>{% trans "Mac Address" %}</dt>
    <dd>{{ port.mac_address|default:_("None") }}</dd>
    <dt>{% trans "Status" %}</dt>
    <dd>{{ port.status|default:_("None") }}</dd>
    <dt>{% trans "Admin State" %}</dt>
    <dd>{{ port.admin_state|default:_("None") }}</dd>
    {% if port.mac_state %}
      <dt>{% trans "MAC Learning State" %}</dt>
      <dd>{{ port.mac_state }}</dd>
    {% endif %}
    <dt>{% trans "Attached Device" %}</dt>
    {% if port.device_id|length > 1 or port.device_owner %}
      <dd><b>{% trans "Device Owner" %}</b>: {{ port.device_owner|default:_("None") }}</dd>
      <dd><b>{% trans "Device ID" %}</b>: {{ port.device_id|default:"-" }}</dd>
    {% else %}
      <dd>{% trans "No attached device" %}</dd>
    {% endif %}
  </dl>
</div>
