prefix.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. {% extends 'ipam/prefix/base.html' %}
  2. {% load humanize %}
  3. {% load helpers %}
  4. {% load plugins %}
  5. {% block content %}
  6. <div class="row">
  7. <div class="col col-md-6">
  8. <div class="card">
  9. <h5 class="card-header">Prefix</h5>
  10. <div class="card-body">
  11. <table class="table table-hover attr-table">
  12. <tr>
  13. <th scope="row">Family</th>
  14. <td>IPv{{ object.family }}</td>
  15. </tr>
  16. <tr>
  17. <th scope="row">VRF</th>
  18. <td>
  19. {% if object.vrf %}
  20. <a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a>
  21. {% else %}
  22. <span>Global</span>
  23. {% endif %}
  24. </td>
  25. </tr>
  26. <tr>
  27. <th scope="row">Tenant</th>
  28. <td>
  29. {% if object.tenant.group %}
  30. {{ object.tenant.group|linkify }} /
  31. {% endif %}
  32. {{ object.tenant|linkify|placeholder }}
  33. </td>
  34. </tr>
  35. <tr>
  36. <th scope="row">Aggregate</th>
  37. <td>
  38. {% if aggregate %}
  39. <a href="{% url 'ipam:aggregate' pk=aggregate.pk %}">{{ aggregate.prefix }}</a> ({{ aggregate.rir }})
  40. {% else %}
  41. <span class="text-warning">None</span>
  42. {% endif %}
  43. </td>
  44. </tr>
  45. <tr>
  46. <th scope="row">Site</th>
  47. <td>
  48. {% if object.site %}
  49. {% if object.site.region %}
  50. {{ object.site.region|linkify }} /
  51. {% endif %}
  52. {{ object.site|linkify }}
  53. {% else %}
  54. <span class="text-muted">None</span>
  55. {% endif %}
  56. </td>
  57. </tr>
  58. <tr>
  59. <th scope="row">VLAN</th>
  60. <td>
  61. {% if object.vlan %}
  62. {% if object.vlan.group %}
  63. {{ object.vlan.group|linkify }} /
  64. {% endif %}
  65. {{ object.vlan|linkify }}
  66. {% else %}
  67. <span class="text-muted">None</span>
  68. {% endif %}
  69. </td>
  70. </tr>
  71. <tr>
  72. <th scope="row">Status</th>
  73. <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
  74. </tr>
  75. <tr>
  76. <th scope="row">Role</th>
  77. <td>{{ object.role|linkify|placeholder }}</td>
  78. </tr>
  79. <tr>
  80. <th scope="row">Description</th>
  81. <td>{{ object.description|placeholder }}</td>
  82. </tr>
  83. <tr>
  84. <th scope="row">Is a pool</th>
  85. <td>{% checkmark object.is_pool %}</td>
  86. </tr>
  87. </table>
  88. </div>
  89. </div>
  90. {% plugin_left_page object %}
  91. </div>
  92. <div class="col col-md-6">
  93. <div class="card">
  94. <h5 class="card-header">Addressing</h5>
  95. <div class="card-body">
  96. <table class="table table-hover attr-table">
  97. <tr>
  98. <th scope="row">Utilization</th>
  99. <td>
  100. {% if object.mark_utilized %}
  101. {% utilization_graph 100 warning_threshold=0 danger_threshold=0 %}
  102. <small>(Marked fully utilized)</small>
  103. {% else %}
  104. {% utilization_graph object.get_utilization %}
  105. {% endif %}
  106. </td>
  107. </tr>
  108. {% with child_ip_count=object.get_child_ips.count %}
  109. <tr>
  110. <th scope="row">Child IPs</th>
  111. <td>
  112. <a href="{% url 'ipam:prefix_ipaddresses' pk=object.pk %}">{{ child_ip_count }}</a>
  113. </td>
  114. </tr>
  115. {% endwith %}
  116. {% with available_count=object.get_available_ips.size %}
  117. <tr>
  118. <th scope="row">Available IPs</th>
  119. <td>
  120. {# Use human-friendly words for counts greater than one million #}
  121. {% if available_count > 1000000 %}
  122. {{ available_count|intword }}
  123. {% else %}
  124. {{ available_count|intcomma }}
  125. {% endif %}
  126. </td>
  127. </tr>
  128. {% endwith %}
  129. <tr>
  130. <td>First available IP</td>
  131. <td>
  132. {% with first_available_ip=object.get_first_available_ip %}
  133. {% if first_available_ip %}
  134. {% if perms.ipam.add_ipaddress %}
  135. <a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}">{{ first_available_ip }}</a>
  136. {% else %}
  137. {{ first_available_ip }}
  138. {% endif %}
  139. {% else %}
  140. <span class="text-muted">None</span>
  141. {% endif %}
  142. {% endwith %}
  143. </td>
  144. </tr>
  145. </table>
  146. </div>
  147. </div>
  148. {% include 'inc/panels/custom_fields.html' %}
  149. {% include 'inc/panels/tags.html' %}
  150. {% plugin_right_page object %}
  151. </div>
  152. </div>
  153. <div class="row">
  154. <div class="col col-md-12">
  155. {% if duplicate_prefix_table.rows %}
  156. {% include 'inc/panel_table.html' with table=duplicate_prefix_table heading='Duplicate Prefixes' %}
  157. {% endif %}
  158. {% include 'inc/panel_table.html' with table=parent_prefix_table heading='Parent Prefixes' %}
  159. {% plugin_full_width_page object %}
  160. </div>
  161. </div>
  162. {% endblock %}