{% load i18n sizeformat %}

<div class="detail">
  <dl class="dl-horizontal">
    <dt>{% trans "Name" %}</dt>
    <dd>{{ port.name|default:_("None") }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ port.id|default:_("None") }}</dd>
    <dt>{% trans "Network Name" %}</dt>
    <dd>{{ port.network_name|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 "MAC Address" %}</dt>
    <dd>{{ port.mac_address|default:_("None") }}</dd>
    <dt>{% trans "Status" %}</dt>
    <dd>{{ port.status_label|default:_("None") }}</dd>
    <dt>{% trans "Admin State" %}</dt>
    <dd>{{ port.admin_state_label|default:_("None") }}</dd>
    {% if port.mac_state %}
      <dt>{% trans "MAC Learning State" %}</dt>
      <dd>{{ port.mac_state }}</dd>
    {% endif %}
  </dl>

  <dl class="dl-horizontal">
    <h4>{% trans "Fixed IP" %}</h4>
    <hr class="header_rule">
    {% if port.fixed_ips.items|length > 1 %}
      {% for ip in port.fixed_ips %}
      <dt>{% trans "IP Address" %}</dt>
      <dd>{{ ip.ip_address }}</dd>
      {% url 'horizon:project:networks:subnets:detail' ip.subnet_id as subnet_url %}
      <dt>{% trans "Subnet ID" %}</dt>
      <dd><a href="{{ subnet_url }}">{{ ip.subnet_id }}</a></dd>
      {% endfor %}
    {% else %}
      <dd>{% trans "None" %}</dd>
    {% endif %}
  </dl>

  <dl class="dl-horizontal">
    <h4>{% trans "Attached Device" %}</h4>
    <hr class="header_rule">
    {% if port.device_id|length > 1 or port.device_owner %}
      <dt>{% trans "Device Owner" %}</dt>
      <dd>{{ port.device_owner|default:_("None") }}</dd>
      <dt>{% trans "Device ID" %}</dt>
      <dd>{{ port.device_id|default:_("None") }}</dd>
    {% else %}
      <dd>{% trans "No attached device" %}</dd>
    {% endif %}
  </dl>

  <dl class="dl-horizontal">
    <h4>{% trans "Binding" %}</h4>
    <hr class="header_rule">
    {% if port.binding__vnic_type %}
      <dt>{% trans "VNIC Type" %}</dt>
      <dd>{{ port.binding__vnic_type }}</dd>
    {% endif %}
  </dl>
</div>
