interface.html 8.1 KB

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