ipfabric_netbox 3.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ipfabric_netbox might be problematic. Click here for more details.
- ipfabric_netbox/__init__.py +42 -0
- ipfabric_netbox/api/__init__.py +2 -0
- ipfabric_netbox/api/nested_serializers.py +99 -0
- ipfabric_netbox/api/serializers.py +160 -0
- ipfabric_netbox/api/urls.py +21 -0
- ipfabric_netbox/api/views.py +111 -0
- ipfabric_netbox/choices.py +226 -0
- ipfabric_netbox/filtersets.py +125 -0
- ipfabric_netbox/forms.py +1063 -0
- ipfabric_netbox/jobs.py +95 -0
- ipfabric_netbox/migrations/0001_initial.py +342 -0
- ipfabric_netbox/migrations/0002_ipfabricsnapshot_status.py +17 -0
- ipfabric_netbox/migrations/0003_ipfabricsource_type_and_more.py +49 -0
- ipfabric_netbox/migrations/0004_ipfabricsync_auto_merge.py +17 -0
- ipfabric_netbox/migrations/0005_alter_ipfabricrelationshipfield_source_model_and_more.py +64 -0
- ipfabric_netbox/migrations/0006_alter_ipfabrictransformmap_target_model.py +48 -0
- ipfabric_netbox/migrations/__init__.py +0 -0
- ipfabric_netbox/models.py +874 -0
- ipfabric_netbox/navigation.py +62 -0
- ipfabric_netbox/signals.py +68 -0
- ipfabric_netbox/tables.py +208 -0
- ipfabric_netbox/template_content.py +13 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/diff.html +72 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/json.html +20 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/logs_pending.html +6 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/merge_form.html +22 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/site_topology_button.html +70 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/site_topology_modal.html +61 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/snapshotdata.html +60 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/sync_delete.html +19 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/transform_map_field_map.html +11 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/transform_map_relationship_map.html +11 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabric_table.html +55 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricbranch.html +141 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricsnapshot.html +105 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricsource.html +111 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricsync.html +103 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap.html +41 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_list.html +17 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_restore.html +59 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/branch_all.html +10 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/branch_progress.html +19 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/branch_status.html +1 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/job_logs.html +53 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/sync_last_branch.html +1 -0
- ipfabric_netbox/templates/ipfabric_netbox/sync_list.html +126 -0
- ipfabric_netbox/templates/static/ipfabric_netbox/css/rack.css +9 -0
- ipfabric_netbox/tests/__init__.py +0 -0
- ipfabric_netbox/tests/test_models.py +1340 -0
- ipfabric_netbox/urls.py +141 -0
- ipfabric_netbox/utilities/__init__.py +0 -0
- ipfabric_netbox/utilities/ipfutils.py +591 -0
- ipfabric_netbox/utilities/logging.py +93 -0
- ipfabric_netbox/utilities/nbutils.py +105 -0
- ipfabric_netbox/utilities/transform_map.py +35 -0
- ipfabric_netbox/views.py +845 -0
- ipfabric_netbox-3.1.2.dist-info/METADATA +88 -0
- ipfabric_netbox-3.1.2.dist-info/RECORD +59 -0
- ipfabric_netbox-3.1.2.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{% load form_helpers %}
|
|
2
|
+
{% load i18n %}
|
|
3
|
+
|
|
4
|
+
<form action="{{ form_url }}" method="post">
|
|
5
|
+
{% csrf_token %}
|
|
6
|
+
<div class="modal-header">
|
|
7
|
+
<h5 class="modal-title">Confirm Restore</h5>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="modal-body">
|
|
10
|
+
<p>
|
|
11
|
+
{% blocktrans trimmed %}
|
|
12
|
+
Are you sure you want to <strong class="text-danger">restore</strong> the Transform Maps? This restores from GitLab and will overwrite any changes made in NetBox.
|
|
13
|
+
{% endblocktrans %}
|
|
14
|
+
</p>
|
|
15
|
+
{% if dependent_objects %}
|
|
16
|
+
<p>
|
|
17
|
+
{% trans "The following objects will be deleted as a result of this action." %}
|
|
18
|
+
</p>
|
|
19
|
+
<div class="accordion" id="deleteAccordion">
|
|
20
|
+
{% for model, instances in dependent_objects.items %}
|
|
21
|
+
<div class="accordion-item">
|
|
22
|
+
<h2 class="accordion-header" id="deleteheading{{ forloop.counter }}">
|
|
23
|
+
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{{ forloop.counter }}" aria-expanded="false" aria-controls="collapse{{ forloop.counter }}">
|
|
24
|
+
{% with object_count=instances|length %}
|
|
25
|
+
{{ object_count }}
|
|
26
|
+
{% if object_count == 1 %}
|
|
27
|
+
{{ model|meta:"verbose_name" }}
|
|
28
|
+
{% else %}
|
|
29
|
+
{{ model|meta:"verbose_name_plural" }}
|
|
30
|
+
{% endif %}
|
|
31
|
+
{% endwith %}
|
|
32
|
+
</button>
|
|
33
|
+
</h2>
|
|
34
|
+
<div id="collapse{{ forloop.counter }}" class="accordion-collapse collapse" aria-labelledby="deleteheading{{ forloop.counter }}" data-bs-parent="#deleteAccordion">
|
|
35
|
+
<div class="accordion-body p-0">
|
|
36
|
+
<div class="list-group list-group-flush">
|
|
37
|
+
{% for instance in instances %}
|
|
38
|
+
{% with url=instance.get_absolute_url %}
|
|
39
|
+
<a {% if url %}href="{{ url }}" {% endif %}class="list-group-item list-group-item-action">{{ instance }}</a>
|
|
40
|
+
{% endwith %}
|
|
41
|
+
{% endfor %}
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
{% endfor %}
|
|
47
|
+
</div>
|
|
48
|
+
{% endif %}
|
|
49
|
+
{% render_form form %}
|
|
50
|
+
</div>
|
|
51
|
+
<div class="modal-footer">
|
|
52
|
+
{% if return_url %}
|
|
53
|
+
<a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
|
|
54
|
+
{% else %}
|
|
55
|
+
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
|
56
|
+
{% endif %}
|
|
57
|
+
<button type="submit" class="btn btn-danger">Restore</button>
|
|
58
|
+
</div>
|
|
59
|
+
</form>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
<div id="sync_status" hx-swap-oob="true">
|
|
3
|
+
{% include 'ipfabric_netbox/partials/branch_status.html' with object=object %}
|
|
4
|
+
</div>
|
|
5
|
+
<div id="sync_progress" hx-swap-oob="true">
|
|
6
|
+
{% include 'ipfabric_netbox/partials/branch_progress.html' %}
|
|
7
|
+
</div>
|
|
8
|
+
<div id="sync_logs">
|
|
9
|
+
{% include 'ipfabric_netbox/partials/job_logs.html' with job_results=job_results job=job %}
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{% load helpers %}
|
|
2
|
+
<div class="card">
|
|
3
|
+
<h5 class="card-header">Progress</h5>
|
|
4
|
+
<div class="card-body">
|
|
5
|
+
{% if statistics %}
|
|
6
|
+
<table class="table table-hover attr-table">
|
|
7
|
+
{% for model, util in statistics.items %}
|
|
8
|
+
<tr>
|
|
9
|
+
<th scope="row">{{ model }}</th>
|
|
10
|
+
<td>{% utilization_graph util %}</td>
|
|
11
|
+
</tr>
|
|
12
|
+
{% endfor %}
|
|
13
|
+
</table>
|
|
14
|
+
{% else %}
|
|
15
|
+
Sync progress pending...<br>
|
|
16
|
+
<small class="text-muted">Last updated {% now "H:i:s" %}</small>
|
|
17
|
+
{% endif %}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{% badge object.sync.get_status_display bg_color=object.sync.get_status_color %}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{% load humanize %}
|
|
2
|
+
{% load helpers %}
|
|
3
|
+
|
|
4
|
+
<p>
|
|
5
|
+
{% if job.started %}
|
|
6
|
+
Started: <strong>{{ job.started|isodatetime }}</strong>
|
|
7
|
+
{% elif job.scheduled %}
|
|
8
|
+
Scheduled for: <strong>{{ job.scheduled|isodatetime }}</strong> ({{ job.scheduled|naturaltime }})
|
|
9
|
+
{% else %}
|
|
10
|
+
Created: <strong>{{ job.created|isodatetime }}</strong>
|
|
11
|
+
{% endif %}
|
|
12
|
+
{% if job.completed %}
|
|
13
|
+
Duration: <strong>{{ job.duration }}</strong>
|
|
14
|
+
{% endif %}
|
|
15
|
+
<span id="pending-result-label">{% badge job.get_status_display job.get_status_color %}</span>
|
|
16
|
+
</p>
|
|
17
|
+
{% if not job.completed %}
|
|
18
|
+
{% include 'ipfabric_netbox/inc/logs_pending.html' %}
|
|
19
|
+
{% endif %}
|
|
20
|
+
<div class="card">
|
|
21
|
+
<h5 class="card-header">Sync Results</h5>
|
|
22
|
+
<div class="card-body">
|
|
23
|
+
<table class="table table-hover report">
|
|
24
|
+
<thead>
|
|
25
|
+
<tr class="table-headings">
|
|
26
|
+
<th>Time</th>
|
|
27
|
+
<th>Level</th>
|
|
28
|
+
<th>Object</th>
|
|
29
|
+
<th>Message</th>
|
|
30
|
+
</tr>
|
|
31
|
+
</thead>
|
|
32
|
+
<tbody>
|
|
33
|
+
{% for time, level, obj, url, message in job_results.logs %}
|
|
34
|
+
<tr class="{% if level == 'failure' %}danger{% elif level %}{{ level }}{% endif %}">
|
|
35
|
+
<td>{{ time }}</td>
|
|
36
|
+
<td>
|
|
37
|
+
<label class="badge bg-{% if level == 'failure' %}danger{% else %}{{ level }}{% endif %}">{{ level|title }}</label>
|
|
38
|
+
</td>
|
|
39
|
+
<td>
|
|
40
|
+
{% if obj and url %}
|
|
41
|
+
<a href="{{ url }}">{{ obj }}</a>
|
|
42
|
+
{% elif obj %}
|
|
43
|
+
{{ obj }}
|
|
44
|
+
{% else %}
|
|
45
|
+
{{ ''|placeholder }}
|
|
46
|
+
{% endif %}
|
|
47
|
+
</td>
|
|
48
|
+
<td class="rendered-markdown">{{ message|markdown }}</td>
|
|
49
|
+
</tr>
|
|
50
|
+
{% endfor %}
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
53
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{% if last_branch %}<a href="{% url 'plugins:ipfabric_netbox:ipfabricbranch' pk=last_branch.pk %}">{{ last_branch.name }}{% else %}{{ ""|placeholder }}{% endif %}</a>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{% extends 'base/layout.html' %}
|
|
2
|
+
{% load buttons %}
|
|
3
|
+
{% load helpers %}
|
|
4
|
+
{% load perms %}
|
|
5
|
+
|
|
6
|
+
{% block title %}Ingestion{% endblock %}
|
|
7
|
+
|
|
8
|
+
{% block tabs %}
|
|
9
|
+
<ul class="nav nav-tabs px-3">
|
|
10
|
+
<li class="nav-item" role="presentation">
|
|
11
|
+
<a class="nav-link active" role="tab">Ingestion</a>
|
|
12
|
+
</li>
|
|
13
|
+
</ul>
|
|
14
|
+
{% endblock tabs %}
|
|
15
|
+
|
|
16
|
+
{% block controls %}
|
|
17
|
+
<div class="controls">
|
|
18
|
+
<div class="control-group">
|
|
19
|
+
{% block extra_controls %}{% endblock %}
|
|
20
|
+
{% add_button model %}
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
{% endblock controls %}
|
|
24
|
+
|
|
25
|
+
{% block content %}
|
|
26
|
+
<div class="tab-content">
|
|
27
|
+
{% for sync in syncs %}
|
|
28
|
+
<div class="card">
|
|
29
|
+
<h5 class="card-header" id="module{{ module.pk }}">
|
|
30
|
+
<!-- TODO: Cannot delete without serializer https://github.com/netbox-community/netbox/issues/13640-->
|
|
31
|
+
<!-- {% if perms.ipfabric_netbox.delete_ipfabricsync %}
|
|
32
|
+
<div class="float-end">
|
|
33
|
+
<a href="{% url 'plugins:ipfabric_netbox:ipfabricsync_delete' pk=sync.pk %}" class="btn btn-danger btn-sm">
|
|
34
|
+
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete
|
|
35
|
+
</a>
|
|
36
|
+
</div>
|
|
37
|
+
{% endif %} -->
|
|
38
|
+
<i class="mdi mdi-cloud-sync"></i><i class="mdi mdi-sync"></i> <a href="{% url 'plugins:ipfabric_netbox:ipfabricsync' pk=sync.pk %}">{{ sync.name}}</a>
|
|
39
|
+
|
|
40
|
+
</h5>
|
|
41
|
+
<div class="card-body">
|
|
42
|
+
{% include 'inc/sync_warning.html' with object=module %}
|
|
43
|
+
<table class="table table-hover table-headings reports">
|
|
44
|
+
<thead>
|
|
45
|
+
<tr>
|
|
46
|
+
<th width="200">Source</th>
|
|
47
|
+
<th width="400">Snapshot</th>
|
|
48
|
+
<th>Status</th>
|
|
49
|
+
<th>Last Run</th>
|
|
50
|
+
</tr>
|
|
51
|
+
</thead>
|
|
52
|
+
<tbody>
|
|
53
|
+
<tr>
|
|
54
|
+
<td><a href="{% url 'plugins:ipfabric_netbox:ipfabricsource' pk=sync.snapshot_data.source.pk %}">{{ sync.snapshot_data.source.name }}</a></td>
|
|
55
|
+
<td><a href="{% url 'plugins:ipfabric_netbox:ipfabricsnapshot' pk=sync.snapshot_data.pk %}">{{ sync.snapshot_data.name}}</a></td>
|
|
56
|
+
<td>{% badge sync.get_status_display last_job.get_status_color %}</td>
|
|
57
|
+
<td>{{sync.last_synced}}</td>
|
|
58
|
+
</tr>
|
|
59
|
+
</tbody>
|
|
60
|
+
<!-- <tbody>
|
|
61
|
+
{% with jobs=module.get_latest_jobs %}
|
|
62
|
+
{% for report_name, report in module.reports.items %}
|
|
63
|
+
{% with last_job=jobs|get_key:report.name %}
|
|
64
|
+
<tr>
|
|
65
|
+
<td>
|
|
66
|
+
<a href="{% url 'extras:report' module=module.python_name name=report.class_name %}" id="{{ report.module }}.{{ report.class_name }}">{{ report.name }}</a>
|
|
67
|
+
</td>
|
|
68
|
+
<td>{{ report.description|markdown|placeholder }}</td>
|
|
69
|
+
{% if last_job %}
|
|
70
|
+
<td>
|
|
71
|
+
<a href="{% url 'extras:report_result' job_pk=last_job.pk %}">{{ last_job.created|isodatetime }}</a>
|
|
72
|
+
</td>
|
|
73
|
+
<td>
|
|
74
|
+
{% badge last_job.get_status_display last_job.get_status_color %}
|
|
75
|
+
</td>
|
|
76
|
+
{% else %}
|
|
77
|
+
<td class="text-muted">Never</td>
|
|
78
|
+
<td>{{ ''|placeholder }}</td>
|
|
79
|
+
{% endif %}
|
|
80
|
+
<td>
|
|
81
|
+
{% if perms.extras.run_report %}
|
|
82
|
+
<div class="float-end noprint">
|
|
83
|
+
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
|
|
84
|
+
{% csrf_token %}
|
|
85
|
+
<button type="submit" name="_run" class="btn btn-primary btn-sm" style="width: 110px">
|
|
86
|
+
{% if last_job %}
|
|
87
|
+
<i class="mdi mdi-replay"></i> Run Again
|
|
88
|
+
{% else %}
|
|
89
|
+
<i class="mdi mdi-play"></i> Run Report
|
|
90
|
+
{% endif %}
|
|
91
|
+
</button>
|
|
92
|
+
</form>
|
|
93
|
+
</div>
|
|
94
|
+
{% endif %}
|
|
95
|
+
</td>
|
|
96
|
+
</tr>
|
|
97
|
+
{% for method, stats in last_job.data.items %}
|
|
98
|
+
<tr>
|
|
99
|
+
<td colspan="4" class="method">
|
|
100
|
+
<span class="ps-3">{{ method }}</span>
|
|
101
|
+
</td>
|
|
102
|
+
<td class="text-end text-nowrap report-stats">
|
|
103
|
+
<span class="badge bg-success">{{ stats.success }}</span>
|
|
104
|
+
<span class="badge bg-info">{{ stats.info }}</span>
|
|
105
|
+
<span class="badge bg-warning">{{ stats.warning }}</span>
|
|
106
|
+
<span class="badge bg-danger">{{ stats.failure }}</span>
|
|
107
|
+
</td>
|
|
108
|
+
</tr>
|
|
109
|
+
{% endfor %}
|
|
110
|
+
{% endwith %}
|
|
111
|
+
{% endfor %}
|
|
112
|
+
{% endwith %}
|
|
113
|
+
</tbody> -->
|
|
114
|
+
</table>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
{% empty %}
|
|
118
|
+
<div class="alert alert-info" role="alert">
|
|
119
|
+
<h4 class="alert-heading">Injest Jobs Settings Found</h4>
|
|
120
|
+
{% if perms.extras.add_reportmodule %}
|
|
121
|
+
Get started by <a href="{% url 'plugins:ipfabric_netbox:ipfabricsync_add' %}">creating an injestion</a> from an IP Fabric source.
|
|
122
|
+
{% endif %}
|
|
123
|
+
</div>
|
|
124
|
+
{% endfor %}
|
|
125
|
+
</div>
|
|
126
|
+
{% endblock content %}
|
|
File without changes
|