netbox-cisco-ise 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_cisco_ise/__init__.py +5 -2
- netbox_cisco_ise/ise_client.py +16 -4
- netbox_cisco_ise/views.py +43 -18
- {netbox_cisco_ise-0.1.2.dist-info → netbox_cisco_ise-0.1.4.dist-info}/METADATA +1 -1
- netbox_cisco_ise-0.1.4.dist-info/RECORD +13 -0
- {netbox_cisco_ise-0.1.2.dist-info → netbox_cisco_ise-0.1.4.dist-info}/WHEEL +1 -1
- netbox_cisco_ise-0.1.2.dist-info/RECORD +0 -13
- {netbox_cisco_ise-0.1.2.dist-info → netbox_cisco_ise-0.1.4.dist-info}/licenses/LICENSE +0 -0
- {netbox_cisco_ise-0.1.2.dist-info → netbox_cisco_ise-0.1.4.dist-info}/top_level.txt +0 -0
netbox_cisco_ise/__init__.py
CHANGED
|
@@ -7,7 +7,7 @@ Shows endpoint identity, profiling data, active session status, and network acce
|
|
|
7
7
|
|
|
8
8
|
from netbox.plugins import PluginConfig
|
|
9
9
|
|
|
10
|
-
__version__ = "0.1.
|
|
10
|
+
__version__ = "0.1.4"
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class CiscoISEConfig(PluginConfig):
|
|
@@ -49,7 +49,10 @@ class CiscoISEConfig(PluginConfig):
|
|
|
49
49
|
# {"manufacturer": "cisco", "device_type": ".*phone.*", "lookup": "endpoint"}, # Cisco phones by MAC
|
|
50
50
|
# ]
|
|
51
51
|
"device_mappings": [
|
|
52
|
-
{
|
|
52
|
+
{
|
|
53
|
+
"manufacturer": r"cisco",
|
|
54
|
+
"lookup": "nad",
|
|
55
|
+
}, # Default: Cisco devices as NADs
|
|
53
56
|
],
|
|
54
57
|
}
|
|
55
58
|
|
netbox_cisco_ise/ise_client.py
CHANGED
|
@@ -275,7 +275,9 @@ class ISEClient:
|
|
|
275
275
|
cached["cached"] = True
|
|
276
276
|
return cached
|
|
277
277
|
|
|
278
|
-
result = self._make_ers_request(
|
|
278
|
+
result = self._make_ers_request(
|
|
279
|
+
"/networkdevice", params={"filter": f"ipaddress.EQ.{ip_address}"}
|
|
280
|
+
)
|
|
279
281
|
|
|
280
282
|
return self._process_nad_result(result, cache_key)
|
|
281
283
|
|
|
@@ -295,7 +297,9 @@ class ISEClient:
|
|
|
295
297
|
cached["cached"] = True
|
|
296
298
|
return cached
|
|
297
299
|
|
|
298
|
-
result = self._make_ers_request(
|
|
300
|
+
result = self._make_ers_request(
|
|
301
|
+
"/networkdevice", params={"filter": f"name.CONTAINS.{name}"}
|
|
302
|
+
)
|
|
299
303
|
|
|
300
304
|
return self._process_nad_result(result, cache_key)
|
|
301
305
|
|
|
@@ -308,7 +312,11 @@ class ISEClient:
|
|
|
308
312
|
resources = search_result.get("resources", [])
|
|
309
313
|
|
|
310
314
|
if not resources:
|
|
311
|
-
return {
|
|
315
|
+
return {
|
|
316
|
+
"error": "Network device not found in ISE",
|
|
317
|
+
"not_found": True,
|
|
318
|
+
"is_nad": False,
|
|
319
|
+
}
|
|
312
320
|
|
|
313
321
|
# Get full NAD details
|
|
314
322
|
nad_id = resources[0].get("id")
|
|
@@ -357,7 +365,11 @@ class ISEClient:
|
|
|
357
365
|
"ro_community": bool(snmp_settings.get("roCommunity")),
|
|
358
366
|
"polling_interval": snmp_settings.get("pollingInterval"),
|
|
359
367
|
},
|
|
360
|
-
"trustsec_enabled": bool(
|
|
368
|
+
"trustsec_enabled": bool(
|
|
369
|
+
trustsec_settings.get("deviceAuthenticationSettings", {}).get(
|
|
370
|
+
"sgaDeviceId"
|
|
371
|
+
)
|
|
372
|
+
),
|
|
361
373
|
"coA_port": nad.get("coaPort"),
|
|
362
374
|
"cached": False,
|
|
363
375
|
}
|
netbox_cisco_ise/views.py
CHANGED
|
@@ -51,10 +51,18 @@ def get_device_lookup_method(device):
|
|
|
51
51
|
|
|
52
52
|
# Get device info for matching
|
|
53
53
|
manufacturer = device.device_type.manufacturer
|
|
54
|
-
manufacturer_slug =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
manufacturer_slug = (
|
|
55
|
+
manufacturer.slug.lower() if manufacturer and manufacturer.slug else ""
|
|
56
|
+
)
|
|
57
|
+
manufacturer_name = (
|
|
58
|
+
manufacturer.name.lower() if manufacturer and manufacturer.name else ""
|
|
59
|
+
)
|
|
60
|
+
device_type_slug = (
|
|
61
|
+
device.device_type.slug.lower() if device.device_type.slug else ""
|
|
62
|
+
)
|
|
63
|
+
device_type_model = (
|
|
64
|
+
device.device_type.model.lower() if device.device_type.model else ""
|
|
65
|
+
)
|
|
58
66
|
|
|
59
67
|
# Check each mapping
|
|
60
68
|
for mapping in mappings:
|
|
@@ -66,12 +74,15 @@ def get_device_lookup_method(device):
|
|
|
66
74
|
manufacturer_match = False
|
|
67
75
|
if manufacturer_pattern:
|
|
68
76
|
try:
|
|
69
|
-
if re.search(
|
|
70
|
-
manufacturer_pattern,
|
|
71
|
-
):
|
|
77
|
+
if re.search(
|
|
78
|
+
manufacturer_pattern, manufacturer_slug, re.IGNORECASE
|
|
79
|
+
) or re.search(manufacturer_pattern, manufacturer_name, re.IGNORECASE):
|
|
72
80
|
manufacturer_match = True
|
|
73
81
|
except re.error:
|
|
74
|
-
if
|
|
82
|
+
if (
|
|
83
|
+
manufacturer_pattern in manufacturer_slug
|
|
84
|
+
or manufacturer_pattern in manufacturer_name
|
|
85
|
+
):
|
|
75
86
|
manufacturer_match = True
|
|
76
87
|
|
|
77
88
|
if not manufacturer_match:
|
|
@@ -81,12 +92,15 @@ def get_device_lookup_method(device):
|
|
|
81
92
|
if device_type_pattern:
|
|
82
93
|
device_type_match = False
|
|
83
94
|
try:
|
|
84
|
-
if re.search(
|
|
85
|
-
device_type_pattern,
|
|
86
|
-
):
|
|
95
|
+
if re.search(
|
|
96
|
+
device_type_pattern, device_type_slug, re.IGNORECASE
|
|
97
|
+
) or re.search(device_type_pattern, device_type_model, re.IGNORECASE):
|
|
87
98
|
device_type_match = True
|
|
88
99
|
except re.error:
|
|
89
|
-
if
|
|
100
|
+
if (
|
|
101
|
+
device_type_pattern in device_type_slug
|
|
102
|
+
or device_type_pattern in device_type_model
|
|
103
|
+
):
|
|
90
104
|
device_type_match = True
|
|
91
105
|
|
|
92
106
|
if not device_type_match:
|
|
@@ -134,9 +148,11 @@ class DeviceISEView(generic.ObjectView):
|
|
|
134
148
|
|
|
135
149
|
def get(self, request, pk):
|
|
136
150
|
"""Handle GET request for the ISE tab."""
|
|
137
|
-
device =
|
|
138
|
-
|
|
139
|
-
|
|
151
|
+
device = (
|
|
152
|
+
Device.objects.select_related("device_type__manufacturer")
|
|
153
|
+
.prefetch_related("interfaces")
|
|
154
|
+
.get(pk=pk)
|
|
155
|
+
)
|
|
140
156
|
|
|
141
157
|
client = get_client()
|
|
142
158
|
config = settings.PLUGINS_CONFIG.get("netbox_cisco_ise", {})
|
|
@@ -158,7 +174,10 @@ class DeviceISEView(generic.ObjectView):
|
|
|
158
174
|
if "error" not in ise_data:
|
|
159
175
|
# Also get session data for connected endpoints
|
|
160
176
|
session_data = client.get_active_session_by_mac(mac_address)
|
|
161
|
-
if
|
|
177
|
+
if (
|
|
178
|
+
"error" in session_data
|
|
179
|
+
and session_data.get("connected") is False
|
|
180
|
+
):
|
|
162
181
|
# Not connected is fine, just no active session
|
|
163
182
|
pass
|
|
164
183
|
else:
|
|
@@ -179,8 +198,14 @@ class DeviceISEView(generic.ObjectView):
|
|
|
179
198
|
ise_data = client.get_network_device_by_ip(management_ip)
|
|
180
199
|
|
|
181
200
|
# If IP lookup failed or no IP, try hostname
|
|
182
|
-
|
|
183
|
-
|
|
201
|
+
# Use VC name for virtual chassis members (original hostname)
|
|
202
|
+
lookup_hostname = (
|
|
203
|
+
device.virtual_chassis.name
|
|
204
|
+
if device.virtual_chassis
|
|
205
|
+
else device.name
|
|
206
|
+
)
|
|
207
|
+
if ("error" in ise_data or not ise_data) and lookup_hostname:
|
|
208
|
+
ise_data = client.get_network_device_by_name(lookup_hostname)
|
|
184
209
|
|
|
185
210
|
if "error" in ise_data:
|
|
186
211
|
error = ise_data.get("error")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: netbox-cisco-ise
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: NetBox plugin for Cisco ISE integration - endpoint tracking, NAD management, and session visibility
|
|
5
5
|
Author-email: sieteunoseis <jeremy.worden@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
netbox_cisco_ise/__init__.py,sha256=RNZeW8KihZEVJpBGTL_6SBkjgt1tdSeVirRGrE9MC90,2203
|
|
2
|
+
netbox_cisco_ise/ise_client.py,sha256=sfeC-cLv0JWo_NdxZG9M4VEGNyLYCVymB6iItGCUvH8,16403
|
|
3
|
+
netbox_cisco_ise/navigation.py,sha256=mMN4EyzZl6ehoqflLeYy7logt39wpCN2TEsPfqn1VtI,507
|
|
4
|
+
netbox_cisco_ise/urls.py,sha256=3tJHJyEQXYZ2WXw4zq1kds7xpgyHl1-HwVHlgtJA84E,304
|
|
5
|
+
netbox_cisco_ise/views.py,sha256=pT8dSh_1LN1PjDkTHEePukUvShXsy49dRr8Mmhudcgw,9422
|
|
6
|
+
netbox_cisco_ise/templates/netbox_cisco_ise/endpoint_tab.html,sha256=aS7R0oTjkUmqlP7i2zfrFhYs9F-LknJgcomGGK60u7w,9868
|
|
7
|
+
netbox_cisco_ise/templates/netbox_cisco_ise/nad_tab.html,sha256=Y5rCGyoSqzRmfridJp2BmC3HkPGRhvWdZ3Mp-C81qYk,8783
|
|
8
|
+
netbox_cisco_ise/templates/netbox_cisco_ise/settings.html,sha256=ZsnJ_AclJUDa-h7vJTd5Clh7pc3OOBx6Tf9Y_bx3oIE,8953
|
|
9
|
+
netbox_cisco_ise-0.1.4.dist-info/licenses/LICENSE,sha256=KmjHs19UP3vo7K2IWXkq3JDKG9PatSbqeLPwu3o2k7g,10761
|
|
10
|
+
netbox_cisco_ise-0.1.4.dist-info/METADATA,sha256=Q4Iu1gbIBW87E0SwjkbA6TWguH6MnBMOt2CONuPola0,8859
|
|
11
|
+
netbox_cisco_ise-0.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
+
netbox_cisco_ise-0.1.4.dist-info/top_level.txt,sha256=LMP1ppZRzqtdaMGzz53KgacW_PEwyLSM9wwIMuBvJ00,17
|
|
13
|
+
netbox_cisco_ise-0.1.4.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
netbox_cisco_ise/__init__.py,sha256=t9Qytd6-ihq47KQZCZUV_a9xRF-VNSoWSzHEv1j9tB8,2156
|
|
2
|
-
netbox_cisco_ise/ise_client.py,sha256=zUMakBU6lmSi-digrMxr6JKAbqyvBAPWz4l1eD8iDa8,16228
|
|
3
|
-
netbox_cisco_ise/navigation.py,sha256=mMN4EyzZl6ehoqflLeYy7logt39wpCN2TEsPfqn1VtI,507
|
|
4
|
-
netbox_cisco_ise/urls.py,sha256=3tJHJyEQXYZ2WXw4zq1kds7xpgyHl1-HwVHlgtJA84E,304
|
|
5
|
-
netbox_cisco_ise/views.py,sha256=h0Yeo1xn1duPC1njgilq8aVbuFvSGfW8lIqERIwbe0w,8855
|
|
6
|
-
netbox_cisco_ise/templates/netbox_cisco_ise/endpoint_tab.html,sha256=aS7R0oTjkUmqlP7i2zfrFhYs9F-LknJgcomGGK60u7w,9868
|
|
7
|
-
netbox_cisco_ise/templates/netbox_cisco_ise/nad_tab.html,sha256=Y5rCGyoSqzRmfridJp2BmC3HkPGRhvWdZ3Mp-C81qYk,8783
|
|
8
|
-
netbox_cisco_ise/templates/netbox_cisco_ise/settings.html,sha256=ZsnJ_AclJUDa-h7vJTd5Clh7pc3OOBx6Tf9Y_bx3oIE,8953
|
|
9
|
-
netbox_cisco_ise-0.1.2.dist-info/licenses/LICENSE,sha256=KmjHs19UP3vo7K2IWXkq3JDKG9PatSbqeLPwu3o2k7g,10761
|
|
10
|
-
netbox_cisco_ise-0.1.2.dist-info/METADATA,sha256=CEP13iSkwoI30XQxrxdIRbJ5eupziKs1AsQocL6k_Ag,8859
|
|
11
|
-
netbox_cisco_ise-0.1.2.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
12
|
-
netbox_cisco_ise-0.1.2.dist-info/top_level.txt,sha256=LMP1ppZRzqtdaMGzz53KgacW_PEwyLSM9wwIMuBvJ00,17
|
|
13
|
-
netbox_cisco_ise-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|