interface.html 17 KB

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