prefix.html 6.0 KB

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