2
0

device.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. {% extends 'dcim/device/base.html' %}
  2. {% load render_table from django_tables2 %}
  3. {% load buttons %}
  4. {% load static %}
  5. {% load helpers %}
  6. {% load plugins %}
  7. {% block content %}
  8. <div class="row">
  9. <div class="col col-md-6">
  10. <div class="card">
  11. <h5 class="card-header">
  12. Device
  13. </h5>
  14. <div class="card-body">
  15. <table class="table table-hover attr-table">
  16. <tr>
  17. <th scope="row">Region</th>
  18. <td>
  19. {% if object.site.region %}
  20. {% for region in object.site.region.get_ancestors %}
  21. {{ region|linkify }} /
  22. {% endfor %}
  23. {{ object.site.region|linkify }}
  24. {% else %}
  25. <span class="text-muted">None</span>
  26. {% endif %}
  27. </td>
  28. </tr>
  29. <tr>
  30. <th scope="row">Site</th>
  31. <td>{{ object.site|linkify }}</td>
  32. </tr>
  33. <tr>
  34. <th scope="row">Location</th>
  35. <td>
  36. {% if object.location %}
  37. {% for location in object.location.get_ancestors %}
  38. {{ location|linkify }} /
  39. {% endfor %}
  40. {{ object.location|linkify }}
  41. {% else %}
  42. <span class="text-muted">None</span>
  43. {% endif %}
  44. </td>
  45. </tr>
  46. <tr>
  47. <th scope="row">Rack</th>
  48. <td>
  49. {% if object.rack %}
  50. <a href="{% url 'dcim:rack' pk=object.rack.pk %}">{{ object.rack }}</a>
  51. {% else %}
  52. <span class="text-muted">None</span>
  53. {% endif %}
  54. </td>
  55. </tr>
  56. <tr>
  57. <th scope="row">Position</th>
  58. <td>
  59. {% if object.parent_bay %}
  60. {% with object.parent_bay.device as parent %}
  61. {{ parent|linkify }} / {{ object.parent_bay }}
  62. {% if parent.position %}
  63. (U{{ parent.position }} / {{ parent.get_face_display }})
  64. {% endif %}
  65. {% endwith %}
  66. {% elif object.rack and object.position %}
  67. <span>U{{ object.position }} / {{ object.get_face_display }}</span>
  68. {% elif object.rack and object.device_type.u_height %}
  69. <span class="badge bg-warning">Not racked</span>
  70. {% else %}
  71. <span class="text-muted">&mdash;</span>
  72. {% endif %}
  73. </td>
  74. </tr>
  75. <tr>
  76. <th scope="row">Tenant</th>
  77. <td>
  78. {% if object.tenant.group %}
  79. {{ object.tenant.group|linkify }} /
  80. {% endif %}
  81. {{ object.tenant|linkify|placeholder }}
  82. </td>
  83. </tr>
  84. <tr>
  85. <th scope="row">Device Type</th>
  86. <td>
  87. {{ object.device_type|linkify }} ({{ object.device_type.u_height }}U)
  88. </td>
  89. </tr>
  90. <tr>
  91. <td>Airflow</td>
  92. <td>
  93. {{ object.get_airflow_display|placeholder }}
  94. </td>
  95. </tr>
  96. <tr>
  97. <th scope="row">Serial Number</th>
  98. <td class="font-monospace">{{ object.serial|placeholder }}</td>
  99. </tr>
  100. <tr>
  101. <th scope="row">Asset Tag</th>
  102. <td class="font-monospace">{{ object.asset_tag|placeholder }}</td>
  103. </tr>
  104. </table>
  105. </div>
  106. </div>
  107. {% if vc_members %}
  108. <div class="card">
  109. <h5 class="card-header">
  110. Virtual Chassis
  111. </h5>
  112. <div class="card-body">
  113. <table class="table table-hover attr-table">
  114. <tr>
  115. <th>Device</th>
  116. <th>Position</th>
  117. <th>Master</th>
  118. <th>Priority</th>
  119. </tr>
  120. {% for vc_member in vc_members %}
  121. <tr{% if vc_member == object %} class="info"{% endif %}>
  122. <td>
  123. {{ vc_member|linkify }}
  124. </td>
  125. <td>
  126. {% badge vc_member.vc_position show_empty=True %}
  127. </td>
  128. <td>
  129. {% if object.virtual_chassis.master == vc_member %}<i class="mdi mdi-check-bold"></i>{% endif %}
  130. </td>
  131. <td>
  132. {{ vc_member.vc_priority|default:"" }}
  133. </td>
  134. </tr>
  135. {% endfor %}
  136. </table>
  137. </div>
  138. <div class="card-footer text-end noprint">
  139. <a href="{{ object.virtual_chassis.get_absolute_url }}" class="btn btn-primary btn-sm">
  140. <span class="mdi mdi-arrow-right-bold" aria-hidden="true"></span> View Virtual Chassis
  141. </a>
  142. </div>
  143. </div>
  144. {% endif %}
  145. {% include 'inc/panels/custom_fields.html' %}
  146. {% include 'inc/panels/tags.html' %}
  147. {% include 'inc/panels/comments.html' %}
  148. {% plugin_left_page object %}
  149. </div>
  150. <div class="col col-md-6">
  151. <div class="card">
  152. <h5 class="card-header">
  153. Management
  154. </h5>
  155. <div class="card-body">
  156. <table class="table table-hover attr-table">
  157. <tr>
  158. <th scope="row">Status</th>
  159. <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
  160. </tr>
  161. <tr>
  162. <th scope="row">Role</th>
  163. <td>
  164. <a href="{% url 'dcim:device_list' %}?role={{ object.device_role.slug }}">{{ object.device_role }}</a>
  165. </td>
  166. </tr>
  167. <tr>
  168. <th scope="row">Platform</th>
  169. <td>{{ object.platform|linkify|placeholder }}</td>
  170. </tr>
  171. <tr>
  172. <th scope="row">Primary IPv4</th>
  173. <td>
  174. {% if object.primary_ip4 %}
  175. <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a>
  176. {% if object.primary_ip4.nat_inside %}
  177. (NAT for {{ object.primary_ip4.nat_inside.address.ip|linkify }})
  178. {% elif object.primary_ip4.nat_outside %}
  179. (NAT: {{ object.primary_ip4.nat_outside.address.ip|linkify }})
  180. {% endif %}
  181. {% else %}
  182. <span class="text-muted">&mdash;</span>
  183. {% endif %}
  184. </td>
  185. </tr>
  186. <tr>
  187. <th scope="row">Primary IPv6</th>
  188. <td>
  189. {% if object.primary_ip6 %}
  190. <a href="{% url 'ipam:ipaddress' pk=object.primary_ip6.pk %}">{{ object.primary_ip6.address.ip }}</a>
  191. {% if object.primary_ip6.nat_inside %}
  192. (NAT for {{ object.primary_ip6.nat_inside.address.ip|linkify }})
  193. {% elif object.primary_ip6.nat_outside %}
  194. (NAT: {{ object.primary_ip6.nat_outside.address.ip|linkify }})
  195. {% endif %}
  196. {% else %}
  197. <span class="text-muted">&mdash;</span>
  198. {% endif %}
  199. </td>
  200. </tr>
  201. {% if object.cluster %}
  202. <tr>
  203. <th>Cluster</th>
  204. <td>
  205. {% if object.cluster.group %}
  206. {{ object.cluster.group|linkify }} /
  207. {% endif %}
  208. {{ object.cluster|linkify }}
  209. </td>
  210. </tr>
  211. {% endif %}
  212. </table>
  213. </div>
  214. </div>
  215. {% if object.powerports.exists and object.poweroutlets.exists %}
  216. <div class="card">
  217. <h5 class="card-header">
  218. Power Utilization
  219. </h5>
  220. <div class="card-body">
  221. <table class="table table-hover">
  222. <tr>
  223. <th>Input</th>
  224. <th>Outlets</th>
  225. <th>Allocated</th>
  226. <th>Available</th>
  227. <th>Utilization</th>
  228. </tr>
  229. {% for powerport in object.powerports.all %}
  230. {% with utilization=powerport.get_power_draw powerfeed=powerport.connected_endpoint %}
  231. <tr>
  232. <td>{{ powerport }}</td>
  233. <td>{{ utilization.outlet_count }}</td>
  234. <td>{{ utilization.allocated }}VA</td>
  235. {% if powerfeed.available_power %}
  236. <td>{{ powerfeed.available_power }}VA</td>
  237. <td>{% utilization_graph utilization.allocated|percentage:powerfeed.available_power %}</td>
  238. {% else %}
  239. <td class="text-muted">&mdash;</td>
  240. <td class="text-muted">&mdash;</td>
  241. {% endif %}
  242. </tr>
  243. {% for leg in utilization.legs %}
  244. <tr>
  245. <td style="padding-left: 20px">Leg {{ leg.name }}</td>
  246. <td>{{ leg.outlet_count }}</td>
  247. <td>{{ leg.allocated }}</td>
  248. <td>{{ powerfeed.available_power|divide:3 }}VA</td>
  249. {% with phase_available=powerfeed.available_power|divide:3 %}
  250. <td>{% utilization_graph leg.allocated|percentage:phase_available %}</td>
  251. {% endwith %}
  252. </tr>
  253. {% endfor %}
  254. {% endwith %}
  255. {% endfor %}
  256. </table>
  257. </div>
  258. </div>
  259. {% endif %}
  260. <div class="card">
  261. <h5 class="card-header">
  262. Services
  263. </h5>
  264. <div class="card-body">
  265. {% if services %}
  266. <table class="table table-hover">
  267. {% for service in services %}
  268. {% include 'ipam/inc/service.html' %}
  269. {% endfor %}
  270. </table>
  271. {% else %}
  272. <div class="text-muted">
  273. None
  274. </div>
  275. {% endif %}
  276. </div>
  277. {% if perms.ipam.add_service %}
  278. <div class="card-footer text-end noprint">
  279. <a href="{% url 'ipam:service_add' %}?device={{ object.pk }}" class="btn btn-sm btn-primary">
  280. <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Assign Service
  281. </a>
  282. </div>
  283. {% endif %}
  284. </div>
  285. {% include 'inc/panels/contacts.html' %}
  286. {% include 'inc/panels/image_attachments.html' %}
  287. {% plugin_right_page object %}
  288. </div>
  289. </div>
  290. <div class="row">
  291. <div class="col col-md-12">
  292. {% plugin_full_width_page object %}
  293. </div>
  294. </div>
  295. {% endblock %}