netbox-device-view 0.1.2__py3-none-any.whl → 0.1.4__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.
- netbox_device_view/templates/netbox_device_view/deviceview.html +0 -4
- netbox_device_view/utils.py +21 -28
- {netbox_device_view-0.1.2.dist-info → netbox_device_view-0.1.4.dist-info}/METADATA +4 -2
- {netbox_device_view-0.1.2.dist-info → netbox_device_view-0.1.4.dist-info}/RECORD +6 -6
- {netbox_device_view-0.1.2.dist-info → netbox_device_view-0.1.4.dist-info}/WHEEL +1 -1
- {netbox_device_view-0.1.2.dist-info → netbox_device_view-0.1.4.dist-info}/top_level.txt +0 -0
|
@@ -92,10 +92,6 @@
|
|
|
92
92
|
<input onChange="this.form.submit()" type="checkbox" name="cable_colors" class="form-check-input" {% if cable_colors == "on" %}checked{% endif %} />
|
|
93
93
|
<label for="cable_colors" class="form-check-label">Cable Colors</label>
|
|
94
94
|
</div>
|
|
95
|
-
<div class="form-check">
|
|
96
|
-
<input onChange="this.form.submit()" type="checkbox" name="something_else" class="form-check-input" {% if something_else == "on" %}checked{% endif %} />
|
|
97
|
-
<label for="something_else" class="form-check-label">something_else</label>
|
|
98
|
-
</div>
|
|
99
95
|
</form>
|
|
100
96
|
</div>
|
|
101
97
|
</div>
|
netbox_device_view/utils.py
CHANGED
|
@@ -5,10 +5,12 @@ from django.core.exceptions import ObjectDoesNotExist
|
|
|
5
5
|
import re
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def process_interfaces(interfaces, ports_chassis, dev
|
|
8
|
+
def process_interfaces(interfaces, ports_chassis, dev):
|
|
9
9
|
if interfaces is not None:
|
|
10
10
|
for itf in interfaces:
|
|
11
|
-
|
|
11
|
+
if itf.type == "virtual" or itf.type == "lag":
|
|
12
|
+
continue
|
|
13
|
+
regex = r"^(?P<type>([a-zA-Z\-_]*))(\/|(?P<dev>[0-9]+).|\s)?((?P<module>[0-9]+).|\s)?((?P<port>[0-9]+))$"
|
|
12
14
|
matches = re.search(regex, itf.name.lower())
|
|
13
15
|
if matches:
|
|
14
16
|
itf.stylename = (
|
|
@@ -17,37 +19,28 @@ def process_interfaces(interfaces, ports_chassis, dev=1):
|
|
|
17
19
|
+ "-"
|
|
18
20
|
+ matches["port"]
|
|
19
21
|
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if sw not in ports_chassis and sw != 999:
|
|
28
|
-
ports_chassis[sw] = []
|
|
29
|
-
if sw != 999:
|
|
30
|
-
ports_chassis[sw].append(itf)
|
|
22
|
+
else:
|
|
23
|
+
itf.stylename = re.sub(r"[^.a-zA-Z\d]", "-", itf.name.lower())
|
|
24
|
+
if itf.stylename.isdigit():
|
|
25
|
+
itf.stylename = f"p{itf.stylename}"
|
|
26
|
+
if dev not in ports_chassis:
|
|
27
|
+
ports_chassis[dev] = []
|
|
28
|
+
ports_chassis[dev].append(itf)
|
|
31
29
|
return ports_chassis
|
|
32
30
|
|
|
33
31
|
|
|
34
|
-
def process_ports(ports, ports_chassis,
|
|
32
|
+
def process_ports(ports, ports_chassis, dev):
|
|
35
33
|
if ports is not None:
|
|
36
34
|
for port in ports:
|
|
37
|
-
regex = r"^(?P<type>([A-Za-z]+))[\s]?((?P<port>[0-9]+))$"
|
|
38
|
-
matches = re.search(regex, port.name.lower())
|
|
39
|
-
port.is_port = True
|
|
40
|
-
if matches:
|
|
41
|
-
port.stylename = (matches["type"] or "") + "-" + matches["port"]
|
|
42
|
-
else:
|
|
43
|
-
port.stylename = re.sub(r"[^.a-zA-Z\d]", "-", port.name.lower())
|
|
44
|
-
sw = where
|
|
45
35
|
if port.type == "virtual":
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if
|
|
50
|
-
|
|
36
|
+
continue
|
|
37
|
+
port.is_port = True
|
|
38
|
+
port.stylename = re.sub(r"[^.a-zA-Z\d]", "-", port.name.lower())
|
|
39
|
+
if port.stylename.isdigit():
|
|
40
|
+
port.stylename = f"p{port.stylename}"
|
|
41
|
+
if dev not in ports_chassis:
|
|
42
|
+
ports_chassis[dev] = []
|
|
43
|
+
ports_chassis[dev].append(port)
|
|
51
44
|
return ports_chassis
|
|
52
45
|
|
|
53
46
|
|
|
@@ -62,7 +55,7 @@ def prepare(obj):
|
|
|
62
55
|
device_type=obj.device_type
|
|
63
56
|
).grid_template_area
|
|
64
57
|
modules[1] = obj.modules.all()
|
|
65
|
-
ports_chassis = process_interfaces(obj.interfaces.all(), ports_chassis)
|
|
58
|
+
ports_chassis = process_interfaces(obj.interfaces.all(), ports_chassis, 1)
|
|
66
59
|
ports_chassis = process_ports(obj.frontports.all(), ports_chassis, "Front")
|
|
67
60
|
ports_chassis = process_ports(obj.rearports.all(), ports_chassis, "Rear")
|
|
68
61
|
ports_chassis = process_ports(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: netbox-device-view
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: NetBox Device View plugin
|
|
5
5
|
Home-page: https://github.com/peterbaumert/netbox-device-view
|
|
6
6
|
Author: Peter Baumert
|
|
@@ -54,10 +54,12 @@ For each Device Type you need to add a DeviceView.
|
|
|
54
54
|
|
|
55
55
|
It is based on a CSS grid view with 32 columns and 2 rows.
|
|
56
56
|
You need to specify the grid-template-areas.
|
|
57
|
-
- Interface positions will use the following format: {interfacename}{module}-{port}
|
|
57
|
+
- Interface positions will use the following format: {interfacename}{module}-{port}
|
|
58
|
+
or fallback to all lower case + [^.a-zA-Z\d] changed to "-"
|
|
58
59
|
- leading "empties" can be specified as x
|
|
59
60
|
- trailing "empties" can be specified as z
|
|
60
61
|
- between "empties" can be named s{0-99}
|
|
62
|
+
- numeric only ports have to be prefixed with "p" e.g. "p1"
|
|
61
63
|
|
|
62
64
|
Example for Cisco C9300-24T with 8x 10G module ( more in [examples](https://github.com/peterbaumert/netbox-device-view/blob/main/examples/) folder )
|
|
63
65
|
|
|
@@ -6,7 +6,7 @@ netbox_device_view/navigation.py,sha256=FYzQyTOz8xzLs559KeI0nbY2nPlKipsfPeiV5y1n
|
|
|
6
6
|
netbox_device_view/tables.py,sha256=ejhKjD5fGo_tLUhTExqBhDL_TbYVe9TPnzF-ZWHqujY,351
|
|
7
7
|
netbox_device_view/template_content.py,sha256=gK7KNUcangjNl4janloXjGqs1jBSKllvYLhyf2_LaEA,1072
|
|
8
8
|
netbox_device_view/urls.py,sha256=UhLOmfj0v4ofRnHM-bxisTnIPQ2viS8I47AyHiA20LU,839
|
|
9
|
-
netbox_device_view/utils.py,sha256=
|
|
9
|
+
netbox_device_view/utils.py,sha256=uUPJnwYfEpM6H61Z-BkyNeQwmWm3xJY5Z9-Xe9Jp7f8,3191
|
|
10
10
|
netbox_device_view/views.py,sha256=8OQQE-BZPM_ZXXopiRGJStdXq6eAE_tndfRVvHLkA2U,1778
|
|
11
11
|
netbox_device_view/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
netbox_device_view/api/serializers.py,sha256=IQEFuIh7X22MWO4jxv4MctZQxln-DgH2eo-0IbdvBl4,456
|
|
@@ -15,9 +15,9 @@ netbox_device_view/api/views.py,sha256=4sID0Rad-OVBnTD4MTpMpMYg-FnOLQlsyIhfcNsg2
|
|
|
15
15
|
netbox_device_view/migrations/0001_initial.py,sha256=2maF1lEro3LuqdQqKwrBs1ABpw7KsTdTqLxiSlrU_SI,1783
|
|
16
16
|
netbox_device_view/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
netbox_device_view/static/netbox_device_view/css/device_view.css,sha256=VnvjTMPrEnUkpb_odDe6-VJKhBXZ6RuII4Ce3EnPDCc,833
|
|
18
|
-
netbox_device_view/templates/netbox_device_view/deviceview.html,sha256=
|
|
18
|
+
netbox_device_view/templates/netbox_device_view/deviceview.html,sha256=iYfqjTO_tvp0c7_0s7AxKmzHC_6JRxxbRahPxoTi3NQ,2893
|
|
19
19
|
netbox_device_view/templates/netbox_device_view/ports.html,sha256=H-OVDZfpa-s3NB5a3ZJmrNbir001wfYfKJss8bppBgk,1716
|
|
20
|
-
netbox_device_view-0.1.
|
|
21
|
-
netbox_device_view-0.1.
|
|
22
|
-
netbox_device_view-0.1.
|
|
23
|
-
netbox_device_view-0.1.
|
|
20
|
+
netbox_device_view-0.1.4.dist-info/METADATA,sha256=7V-rw6KG23oeodAYd_z02M7Z9VORPlL3-mXI4mk65U8,3753
|
|
21
|
+
netbox_device_view-0.1.4.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
22
|
+
netbox_device_view-0.1.4.dist-info/top_level.txt,sha256=Cj7X6_XpLT0jnyTyX5DMqttqc8_z3uhRYCmvnXLfWOs,19
|
|
23
|
+
netbox_device_view-0.1.4.dist-info/RECORD,,
|
|
File without changes
|