prefix.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. {% extends '_base.html' %}
  2. {% load helpers %}
  3. {% block header %}
  4. <div class="row noprint">
  5. <div class="col-sm-8 col-md-9">
  6. <ol class="breadcrumb">
  7. <li><a href="{% url 'ipam:prefix_list' %}">Prefixes</a></li>
  8. {% if prefix.vrf %}
  9. <li><a href="{% url 'ipam:vrf' pk=prefix.vrf.pk %}">{{ prefix.vrf }}</a></li>
  10. {% endif %}
  11. <li>{{ prefix }}</li>
  12. </ol>
  13. </div>
  14. <div class="col-sm-4 col-md-3">
  15. <form action="{% url 'ipam:prefix_list' %}" method="get">
  16. <div class="input-group">
  17. <input type="text" name="q" class="form-control" placeholder="Search prefixes" />
  18. <span class="input-group-btn">
  19. <button type="submit" class="btn btn-primary">
  20. <span class="fa fa-search" aria-hidden="true"></span>
  21. </button>
  22. </span>
  23. </div>
  24. </form>
  25. </div>
  26. </div>
  27. <div class="pull-right noprint">
  28. {% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %}
  29. <a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ prefix.vrf.pk }}&site={{ prefix.site.pk }}&tenant_group={{ prefix.tenant.group.pk }}&tenant={{ prefix.tenant.pk }}" class="btn btn-success">
  30. <i class="fa fa-plus" aria-hidden="true"></i> Add Child Prefix
  31. </a>
  32. {% endif %}
  33. {% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
  34. <a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ prefix.vrf.pk }}&tenant_group={{ prefix.tenant.group.pk }}&tenant={{ prefix.tenant.pk }}" class="btn btn-success">
  35. <span class="fa fa-plus" aria-hidden="true"></span>
  36. Add an IP Address
  37. </a>
  38. {% endif %}
  39. {% if perms.ipam.change_prefix %}
  40. <a href="{% url 'ipam:prefix_edit' pk=prefix.pk %}" class="btn btn-warning">
  41. <span class="fa fa-pencil" aria-hidden="true"></span>
  42. Edit this prefix
  43. </a>
  44. {% endif %}
  45. {% if perms.ipam.delete_prefix %}
  46. <a href="{% url 'ipam:prefix_delete' pk=prefix.pk %}" class="btn btn-danger">
  47. <span class="fa fa-trash" aria-hidden="true"></span>
  48. Delete this prefix
  49. </a>
  50. {% endif %}
  51. </div>
  52. <h1>{% block title %}{{ prefix }}{% endblock %}</h1>
  53. {% include 'inc/created_updated.html' with obj=prefix %}
  54. <ul class="nav nav-tabs" style="margin-bottom: 20px">
  55. <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
  56. <a href="{% url 'ipam:prefix' pk=prefix.pk %}">Prefix</a>
  57. </li>
  58. <li role="presentation"{% if active_tab == 'prefixes' %} class="active"{% endif %}>
  59. <a href="{% url 'ipam:prefix_prefixes' pk=prefix.pk %}">Child Prefixes <span class="badge">{{ prefix.get_child_prefixes.count }}</span></a>
  60. </li>
  61. <li role="presentation"{% if active_tab == 'ip-addresses' %} class="active"{% endif %}>
  62. <a href="{% url 'ipam:prefix_ipaddresses' pk=prefix.pk %}">IP Addresses <span class="badge">{{ prefix.get_child_ips.count }}</span></a>
  63. </li>
  64. <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
  65. <a href="{% url 'ipam:prefix_changelog' pk=prefix.pk %}">Changelog</a>
  66. </li>
  67. </ul>
  68. {% endblock %}
  69. {% block content %}
  70. <div class="row">
  71. <div class="col-md-5">
  72. <div class="panel panel-default">
  73. <div class="panel-heading">
  74. <strong>Prefix</strong>
  75. </div>
  76. <table class="table table-hover panel-body attr-table">
  77. <tr>
  78. <td>Family</td>
  79. <td>{{ prefix.get_family_display }}</td>
  80. </tr>
  81. <tr>
  82. <td>VRF</td>
  83. <td>
  84. {% if prefix.vrf %}
  85. <a href="{% url 'ipam:vrf' pk=prefix.vrf.pk %}">{{ prefix.vrf }}</a> ({{ prefix.vrf.rd }})
  86. {% else %}
  87. <span>Global</span>
  88. {% endif %}
  89. </td>
  90. </tr>
  91. <tr>
  92. <td>Tenant</td>
  93. <td>
  94. {% if prefix.tenant %}
  95. {% if prefix.tenant.group %}
  96. <a href="{{ prefix.tenant.group.get_absolute_url }}">{{ prefix.tenant.group }}</a>
  97. <i class="fa fa-angle-right"></i>
  98. {% endif %}
  99. <a href="{{ prefix.tenant.get_absolute_url }}">{{ prefix.tenant }}</a>
  100. {% else %}
  101. <span class="text-muted">None</span>
  102. {% endif %}
  103. </td>
  104. </tr>
  105. <tr>
  106. <td>Aggregate</td>
  107. <td>
  108. {% if aggregate %}
  109. <a href="{% url 'ipam:aggregate' pk=aggregate.pk %}">{{ aggregate.prefix }}</a> ({{ aggregate.rir }})
  110. {% else %}
  111. <span class="text-warning">None</span>
  112. {% endif %}
  113. </td>
  114. </tr>
  115. <tr>
  116. <td>Site</td>
  117. <td>
  118. {% if prefix.site %}
  119. {% if prefix.site.region %}
  120. <a href="{{ prefix.site.region.get_absolute_url }}">{{ prefix.site.region }}</a>
  121. <i class="fa fa-angle-right"></i>
  122. {% endif %}
  123. <a href="{% url 'dcim:site' slug=prefix.site.slug %}">{{ prefix.site }}</a>
  124. {% else %}
  125. <span class="text-muted">None</span>
  126. {% endif %}
  127. </td>
  128. </tr>
  129. <tr>
  130. <td>VLAN</td>
  131. <td>
  132. {% if prefix.vlan %}
  133. {% if prefix.vlan.group %}
  134. <a href="{{ prefix.vlan.group.get_absolute_url }}">{{ prefix.vlan.group }}</a>
  135. <i class="fa fa-angle-right"></i>
  136. {% endif %}
  137. <a href="{% url 'ipam:vlan' pk=prefix.vlan.pk %}">{{ prefix.vlan.display_name }}</a>
  138. {% else %}
  139. <span class="text-muted">None</span>
  140. {% endif %}
  141. </td>
  142. </tr>
  143. <tr>
  144. <td>Status</td>
  145. <td>
  146. <span class="label label-{{ prefix.get_status_class }}">{{ prefix.get_status_display }}</span>
  147. </td>
  148. </tr>
  149. <tr>
  150. <td>Role</td>
  151. <td>
  152. {% if prefix.role %}
  153. <a href="{% url 'ipam:prefix_list' %}?role={{ prefix.role.slug }}">{{ prefix.role }}</a>
  154. {% else %}
  155. <span class="text-muted">None</span>
  156. {% endif %}
  157. </td>
  158. </tr>
  159. <tr>
  160. <td>Description</td>
  161. <td>{{ prefix.description|placeholder }}</td>
  162. </tr>
  163. <tr>
  164. <td>Is a pool</td>
  165. <td>
  166. {% if prefix.is_pool %}
  167. <i class="glyphicon glyphicon-ok text-success" title="Yes"></i>
  168. {% else %}
  169. <i class="glyphicon glyphicon-remove text-danger" title="No"></i>
  170. {% endif %}
  171. </td>
  172. </tr>
  173. <tr>
  174. <td>Utilization</td>
  175. <td>{% utilization_graph prefix.get_utilization %}</td>
  176. </tr>
  177. </table>
  178. </div>
  179. {% include 'inc/custom_fields_panel.html' with obj=prefix %}
  180. {% include 'extras/inc/tags_panel.html' with tags=prefix.tags.all url='ipam:prefix_list' %}
  181. </div>
  182. <div class="col-md-7">
  183. {% if duplicate_prefix_table.rows %}
  184. {% include 'panel_table.html' with table=duplicate_prefix_table heading='Duplicate Prefixes' panel_class='danger' %}
  185. {% endif %}
  186. {% include 'panel_table.html' with table=parent_prefix_table heading='Parent Prefixes' panel_class='default' %}
  187. </div>
  188. </div>
  189. {% endblock %}