interface.html 8.1 KB

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