interface.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <tr class="interface{% if not iface.enabled %} danger{% elif iface.connection and iface.connection.connection_status %} success{% elif iface.connection and not iface.connection.connection_status %} info{% endif %}">
  2. {% if selectable and perms.dcim.change_interface or perms.dcim.delete_interface %}
  3. <td class="pk">
  4. <input name="pk" type="checkbox" value="{{ iface.pk }}" />
  5. </td>
  6. {% endif %}
  7. <td>
  8. <i class="fa fa-fw fa-{% if iface.mgmt_only %}wrench{% elif iface.is_virtual %}square{% elif iface.is_wireless %}wifi{% else %}exchange{% endif %}"></i>
  9. <span title="{{ iface.get_form_factor_display }}">{{ iface.name }}</span>
  10. {% if iface.lag %}
  11. <span class="label label-primary">{{ iface.lag.name }}</span>
  12. {% endif %}
  13. {% if iface.description %}
  14. <i class="fa fa-fw fa-comment-o" title="{{ iface.description }}"></i>
  15. {% endif %}
  16. </td>
  17. <td>{{ iface.mtu|default:"" }}</td>
  18. <td>{{ iface.mac_address|default:"" }}</td>
  19. {% if iface.is_lag %}
  20. <td colspan="2" class="text-muted">
  21. LAG interface<br />
  22. <small class="text-muted">{{ iface.member_interfaces.all|join:", "|default:"No members" }}</small>
  23. </td>
  24. {% elif iface.is_virtual %}
  25. <td colspan="2" class="text-muted">Virtual interface</td>
  26. {% elif iface.is_wireless %}
  27. <td colspan="2" class="text-muted">Wireless interface</td>
  28. {% elif iface.connection %}
  29. {% with iface.connected_interface as connected_iface %}
  30. <td>
  31. <a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a>
  32. </td>
  33. <td>
  34. <span title="{{ connected_iface.get_form_factor_display }}">{{ connected_iface }}</span>
  35. </td>
  36. {% endwith %}
  37. {% elif iface.circuit_termination %}
  38. {% with iface.circuit_termination.get_peer_termination as peer_termination %}
  39. <td colspan="2">
  40. <i class="fa fa-fw fa-globe" title="Circuit"></i>
  41. {% if peer_termination %}
  42. {% if peer_termination.interface %}
  43. <a href="{% url 'dcim:device' pk=peer_termination.interface.device.pk %}">{{ peer_termination.interface.device }}</a>
  44. (<a href="{% url 'dcim:site' slug=peer_termination.site.slug %}">{{ peer_termination.site }}</a>)
  45. {% else %}
  46. <a href="{% url 'dcim:site' slug=peer_termination.site.slug %}">{{ peer_termination.site }}</a>
  47. {% endif %}
  48. via
  49. {% endif %}
  50. <a href="{% url 'circuits:circuit' pk=iface.circuit_termination.circuit_id %}">{{ iface.circuit_termination.circuit }}</a>
  51. </td>
  52. {% endwith %}
  53. {% else %}
  54. <td colspan="2">
  55. <span class="text-muted">Not connected</span>
  56. </td>
  57. {% endif %}
  58. <td colspan="2" class="text-right">
  59. {% if show_graphs %}
  60. {% if iface.circuit_termination or iface.connection %}
  61. <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#graphs_modal" data-obj="{{ device.name }} - {{ iface.name }}" data-url="{% url 'dcim-api:interface-graphs' pk=iface.pk %}" title="Show graphs">
  62. <i class="glyphicon glyphicon-signal" aria-hidden="true"></i>
  63. </button>
  64. {% endif %}
  65. {% endif %}
  66. {% if perms.ipam.add_ipaddress %}
  67. <a href="{% url 'ipam:ipaddress_add' %}?interface_site={{ device.site.pk }}&interface_rack={{ device.rack.pk }}&interface_device={{ device.pk }}&interface={{ iface.pk }}&return_url={{ device.get_absolute_url }}" class="btn btn-xs btn-success" title="Add IP address">
  68. <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
  69. </a>
  70. {% endif %}
  71. {% if perms.dcim.change_interface %}
  72. {% if not iface.is_virtual %}
  73. {% if iface.connection %}
  74. {% if iface.connection.connection_status %}
  75. <a href="#" class="btn btn-warning btn-xs interface-toggle connected" data="{{ iface.connection.pk }}" title="Mark planned">
  76. <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>
  77. </a>
  78. {% else %}
  79. <a href="#" class="btn btn-success btn-xs interface-toggle" data="{{ iface.connection.pk }}" title="Mark installed">
  80. <i class="fa fa-plug" aria-hidden="true"></i>
  81. </a>
  82. {% endif %}
  83. <a href="{% url 'dcim:interfaceconnection_delete' pk=iface.connection.pk %}?device={{ device.pk }}" class="btn btn-danger btn-xs" title="Disconnect">
  84. <i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
  85. </a>
  86. {% elif iface.circuit_termination and perms.circuits.change_circuittermination %}
  87. <button class="btn btn-warning btn-xs interface-toggle connected" disabled="disabled" title="Circuits cannot be marked as planned or connected">
  88. <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>
  89. </button>
  90. <a href="{% url 'circuits:circuittermination_edit' pk=iface.circuit_termination.pk %}" class="btn btn-danger btn-xs" title="Edit circuit termination">
  91. <i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
  92. </a>
  93. {% else %}
  94. <a href="{% url 'dcim:interfaceconnection_add' pk=device.pk %}?interface_a={{ iface.pk }}" class="btn btn-success btn-xs" title="Connect">
  95. <i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>
  96. </a>
  97. {% endif %}
  98. {% endif %}
  99. <a href="{% url 'dcim:interface_edit' pk=iface.pk %}" class="btn btn-info btn-xs" title="Edit interface">
  100. <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
  101. </a>
  102. {% endif %}
  103. {% if perms.dcim.delete_interface %}
  104. {% if iface.connection or iface.circuit_termination %}
  105. <button class="btn btn-danger btn-xs" disabled="disabled">
  106. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  107. </button>
  108. {% else %}
  109. <a href="{% url 'dcim:interface_delete' pk=iface.pk %}" class="btn btn-danger btn-xs" title="Delete interface">
  110. <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
  111. </a>
  112. {% endif %}
  113. {% endif %}
  114. </td>
  115. </tr>
  116. {% for ip in iface.ip_addresses.all %}
  117. <tr class="ipaddress">
  118. {% if selectable and perms.dcim.change_interface or perms.dcim.delete_interface %}
  119. <td></td>
  120. {% endif %}
  121. <td colspan="3">
  122. <a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a>
  123. {% if ip.description %}
  124. <i class="fa fa-fw fa-comment-o" title="{{ ip.description }}"></i>
  125. {% endif %}
  126. {% if device.primary_ip4 == ip or device.primary_ip6 == ip %}
  127. <span class="label label-success">Primary</span>
  128. {% endif %}
  129. </td>
  130. <td class="text-right">
  131. {% if ip.vrf %}
  132. <a href="{% url 'ipam:vrf' pk=ip.vrf.pk %}">{{ ip.vrf }}</a>
  133. {% else %}
  134. <span class="text-muted">Global</span>
  135. {% endif %}
  136. </td>
  137. <td>
  138. <span class="label label-{{ ip.get_status_class }}">{{ ip.get_status_display }}</span>
  139. </td>
  140. <td class="text-right">
  141. {% if perms.ipam.change_ipaddress %}
  142. <a href="{% url 'ipam:ipaddress_edit' pk=ip.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-info btn-xs">
  143. <i class="glyphicon glyphicon-pencil" aria-hidden="true" title="Edit IP address"></i>
  144. </a>
  145. {% endif %}
  146. {% if perms.ipam.delete_ipaddress %}
  147. <a href="{% url 'ipam:ipaddress_delete' pk=ip.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs">
  148. <i class="glyphicon glyphicon-trash" aria-hidden="true" title="Delete IP address"></i>
  149. </a>
  150. {% endif %}
  151. </td>
  152. </tr>
  153. {% endfor %}