interface.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. {% extends 'dcim/device_component.html' %}
  2. {% load helpers %}
  3. {% load plugins %}
  4. {% load render_table from django_tables2 %}
  5. {% block extra_controls %}
  6. {% if perms.dcim.add_interface and not object.is_virtual %}
  7. <a href="{% url 'dcim:interface_add' %}?device={{ object.device.pk }}&parent={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-sm btn-green-400 m-1">
  8. <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Child Interface
  9. </a>
  10. {% endif %}
  11. {{ block.super }}
  12. {% endblock %}
  13. {% block content %}
  14. <div class="row mb-3">
  15. <div class="col col-md-6">
  16. <div class="card">
  17. <h5 class="card-header">
  18. Interface
  19. </h5>
  20. <div class="card-body">
  21. <table class="table table-hover">
  22. <tr>
  23. <td colspan="2">
  24. {% if object.enabled %}
  25. <span class="badge bg-success">Enabled</span>
  26. {% else %}
  27. <span class="badge bg-danger">Disabled</span>
  28. {% endif %}
  29. </td>
  30. </tr>
  31. <tr>
  32. <td colspan="2">
  33. {% if object.mgmt_only %}
  34. <span class="badge bg-success">Management Only</span>
  35. {% else %}
  36. <span class="badge bg-danger">Not Management Only</span>
  37. {% endif %}
  38. </td>
  39. </tr>
  40. <tr>
  41. <th scope="row">Device</th>
  42. <td>
  43. <a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
  44. </td>
  45. </tr>
  46. <tr>
  47. <th scope="row">Name</th>
  48. <td>{{ object.name }}</td>
  49. </tr>
  50. <tr>
  51. <th scope="row">Label</th>
  52. <td>{{ object.label|placeholder }}</td>
  53. </tr>
  54. <tr>
  55. <th scope="row">Type</th>
  56. <td>{{ object.get_type_display }}</td>
  57. </tr>
  58. <tr>
  59. <th scope="row">LAG</th>
  60. <td>
  61. {% if object.lag%}
  62. <a href="{{ object.lag.get_absolute_url }}">{{ object.lag }}</a>
  63. {% else %}
  64. <span class="text-muted">None</span>
  65. {% endif %}
  66. </td>
  67. </tr>
  68. <tr>
  69. <th scope="row">Description</th>
  70. <td>{{ object.description|placeholder }} </td>
  71. </tr>
  72. <tr>
  73. <th scope="row">MTU</th>
  74. <td>{{ object.mtu|placeholder }}</td>
  75. </tr>
  76. <tr>
  77. <th scope="row">MAC Address</th>
  78. <td><span class="text-monospace">{{ object.mac_address|placeholder }}</span></td>
  79. </tr>
  80. <tr>
  81. <th scope="row">802.1Q Mode</th>
  82. <td>{{ object.get_mode_display }}</td>
  83. </tr>
  84. </table>
  85. </div>
  86. </div>
  87. {% include 'inc/custom_fields_panel.html' %}
  88. {% include 'extras/inc/tags_panel.html' with tags=object.tags.all %}
  89. {% plugin_left_page object %}
  90. </div>
  91. <div class="col col-md-6">
  92. {% if object.is_connectable %}
  93. <div class="card">
  94. <h5 class="card-header">
  95. Connection
  96. </h5>
  97. <div class="card-body">
  98. {% if object.mark_connected %}
  99. <div class="text-muted">
  100. <span class="text-success"><i class="mdi mdi-check-bold"></i></span> Marked as Connected
  101. </div>
  102. {% elif object.cable %}
  103. <table class="table table-hover">
  104. {% if object.connected_endpoint.device %}
  105. <tr>
  106. <td colspan="2">
  107. {% if object.connected_endpoint.enabled %}
  108. <span class="badge bg-success">Enabled</span>
  109. {% else %}
  110. <span class="badge bg-danger">Disabled</span>
  111. {% endif %}
  112. </td>
  113. </tr>
  114. {% endif %}
  115. <tr>
  116. <th scope="row">Cable</th>
  117. <td>
  118. <a href="{{ object.cable.get_absolute_url }}">{{ object.cable }}</a>
  119. <a href="{% url 'dcim:interface_trace' pk=object.pk %}" class="btn btn-primary btn-sm lh-1" title="Trace">
  120. <i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
  121. </a>
  122. </td>
  123. </tr>
  124. {% if object.connected_endpoint.device %}
  125. {% with iface=object.connected_endpoint %}
  126. <tr>
  127. <th scope="row">Device</th>
  128. <td>
  129. <a href="{{ iface.device.get_absolute_url }}">{{ iface.device }}</a>
  130. </td>
  131. </tr>
  132. <tr>
  133. <th scope="row">Name</th>
  134. <td>
  135. <a href="{{ iface.get_absolute_url }}">{{ iface.name }}</a>
  136. </td>
  137. </tr>
  138. <tr>
  139. <th scope="row">Type</th>
  140. <td>{{ iface.get_type_display }}</td>
  141. </tr>
  142. <tr>
  143. <th scope="row">LAG</th>
  144. <td>
  145. {% if iface.lag%}
  146. <a href="{{ iface.lag.get_absolute_url }}">{{ iface.lag }}</a>
  147. {% else %}
  148. <span class="text-muted">None</span>
  149. {% endif %}
  150. </td>
  151. </tr>
  152. <tr>
  153. <th scope="row">Description</th>
  154. <td>{{ iface.description|placeholder }}</td>
  155. </tr>
  156. <tr>
  157. <th scope="row">MTU</th>
  158. <td>{{ iface.mtu|placeholder }}</td>
  159. </tr>
  160. <tr>
  161. <th scope="row">MAC Address</th>
  162. <td>{{ iface.mac_address|placeholder }}</td>
  163. </tr>
  164. <tr>
  165. <th scope="row">802.1Q Mode</th>
  166. <td>{{ iface.get_mode_display }}</td>
  167. </tr>
  168. {% endwith %}
  169. {% elif object.connected_endpoint.circuit %}
  170. {% with ct=object.connected_endpoint %}
  171. <tr>
  172. <th scope="row">Provider</th>
  173. <td><a href="{{ ct.circuit.provider.get_absolute_url }}">{{ ct.circuit.provider }}</a></td>
  174. </tr>
  175. <tr>
  176. <th scope="row">Circuit</th>
  177. <td><a href="{{ ct.circuit.get_absolute_url }}">{{ ct.circuit }}</a></td>
  178. </tr>
  179. <tr>
  180. <th scope="row">Side</th>
  181. <td>{{ ct.term_side }}</td>
  182. </tr>
  183. {% endwith %}
  184. {% endif %}
  185. <tr>
  186. <th scope="row">Path Status</th>
  187. <td>
  188. {% if object.path.is_active %}
  189. <span class="badge bg-success">Reachable</span>
  190. {% else %}
  191. <span class="badge bg-danger">Not Reachable</span>
  192. {% endif %}
  193. </td>
  194. </tr>
  195. </table>
  196. {% else %}
  197. <div class="text-muted">
  198. Not Connected
  199. {% if perms.dcim.add_cable %}
  200. <div class="dropdown float-end">
  201. <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  202. <span class="mdi mdi-ethernet-cable" aria-hidden="true"></span> Connect
  203. </button>
  204. <ul class="dropdown-menu dropdown-menu-end">
  205. <li>
  206. <a class="dropdown-item" href="{% url 'dcim:interface_connect' termination_a_id=object.pk termination_b_type='interface' %}?return_url={{ object.get_absolute_url }}">
  207. Interface
  208. </a>
  209. </li>
  210. <li>
  211. <a class="dropdown-item" href="{% url 'dcim:interface_connect' termination_a_id=object.pk termination_b_type='front-port' %}?return_url={{ object.get_absolute_url }}">
  212. Front Port
  213. </a>
  214. </li>
  215. <li>
  216. <a class="dropdown-item" href="{% url 'dcim:interface_connect' termination_a_id=object.pk termination_b_type='rear-port' %}?return_url={{ object.get_absolute_url }}">
  217. Rear Port
  218. </a>
  219. </li>
  220. <li>
  221. <a class="dropdown-item" href="{% url 'dcim:interface_connect' termination_a_id=object.pk termination_b_type='circuit-termination' %}?return_url={{ object.get_absolute_url }}">
  222. Circuit Termination
  223. </a>
  224. </li>
  225. </ul>
  226. </div>
  227. {% endif %}
  228. </div>
  229. {% endif %}
  230. </div>
  231. </div>
  232. {% endif %}
  233. {% if object.is_lag %}
  234. <div class="card">
  235. <h5 class="card-header">LAG Members</h5>
  236. <div class="card-body">
  237. <table class="table table-hover table-headings">
  238. <thead>
  239. <tr>
  240. <th>Parent</th>
  241. <th>Interface</th>
  242. <th>Type</th>
  243. </tr>
  244. </thead>
  245. <tbody>
  246. {% for member in object.member_interfaces.all %}
  247. <tr>
  248. <td>
  249. <a href="{{ member.device.get_absolute_url }}">{{ member.device }}</a>
  250. </td>
  251. <td>
  252. <a href="{{ member.get_absolute_url }}">{{ member }}</a>
  253. </td>
  254. <td>
  255. {{ member.get_type_display }}
  256. </td>
  257. </tr>
  258. {% empty %}
  259. <tr>
  260. <td colspan="3" class="text-muted">No member interfaces</td>
  261. </tr>
  262. {% endfor %}
  263. </tbody>
  264. </table>
  265. </div>
  266. </div>
  267. {% endif %}
  268. {% plugin_right_page object %}
  269. </div>
  270. </div>
  271. <div class="row mb-3">
  272. <div class="col col-md-12">
  273. <div class="card">
  274. <h5 class="card-header">
  275. IP Addresses
  276. </h5>
  277. <div class="card-body">
  278. {% if ipaddress_table.rows %}
  279. {% render_table ipaddress_table 'inc/table.html' %}
  280. {% else %}
  281. <div class="text-muted">None</div>
  282. {% endif %}
  283. </div>
  284. {% if perms.ipam.add_ipaddress %}
  285. <div class="card-footer text-end noprint">
  286. <a href="{% url 'ipam:ipaddress_add' %}?device={{ object.device.pk }}&interface={{ object.pk }}" class="btn btn-sm btn-primary">
  287. <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add IP Address
  288. </a>
  289. </div>
  290. {% endif %}
  291. </div>
  292. </div>
  293. </div>
  294. <div class="row mb-3">
  295. <div class="col col-md-12">
  296. {% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
  297. </div>
  298. </div>
  299. <div class="row mb-3">
  300. <div class="col col-md-12">
  301. {% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %}
  302. </div>
  303. </div>
  304. <div class="row mb-3">
  305. <div class="col col-md-12">
  306. {% plugin_full_width_page object %}
  307. </div>
  308. </div>
  309. {% endblock %}