netbox-eosl 0.1.0__tar.gz → 0.2.1__tar.gz

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.
Files changed (20) hide show
  1. {netbox_eosl-0.1.0/netbox_eosl.egg-info → netbox_eosl-0.2.1}/PKG-INFO +155 -145
  2. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/README.md +21 -11
  3. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl/__init__.py +1 -1
  4. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl/client.py +45 -6
  5. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl/management/commands/eosl_check.py +21 -12
  6. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl/matching.py +43 -7
  7. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl/template_content.py +4 -4
  8. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl/templates/netbox_eosl/eosl_panel.html +10 -1
  9. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1/netbox_eosl.egg-info}/PKG-INFO +155 -145
  10. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/pyproject.toml +1 -1
  11. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/setup.cfg +4 -4
  12. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/tests/test_matching.py +45 -0
  13. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/LICENSE +0 -0
  14. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/MANIFEST.in +0 -0
  15. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl/management/__init__.py +0 -0
  16. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl/management/commands/__init__.py +0 -0
  17. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl.egg-info/SOURCES.txt +0 -0
  18. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl.egg-info/dependency_links.txt +0 -0
  19. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl.egg-info/requires.txt +0 -0
  20. {netbox_eosl-0.1.0 → netbox_eosl-0.2.1}/netbox_eosl.egg-info/top_level.txt +0 -0
@@ -1,145 +1,155 @@
1
- Metadata-Version: 2.4
2
- Name: netbox-eosl
3
- Version: 0.1.0
4
- Summary: Show source-backed hardware end-of-service-life status on NetBox Devices and Device Types, from EOSL.ai.
5
- Author-email: "EOSL.ai" <hello@eosl.ai>
6
- License: Apache-2.0
7
- Project-URL: Homepage, https://eosl.ai/
8
- Project-URL: Data source, https://eosl.ai/api/
9
- Project-URL: Source, https://github.com/Kranny36/netbox-eosl
10
- Keywords: netbox,netbox-plugin,eosl,end-of-life,eol,lifecycle,dcim
11
- Classifier: Framework :: Django
12
- Classifier: Intended Audience :: System Administrators
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Topic :: System :: Networking :: Monitoring
16
- Requires-Python: >=3.10
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: requests>=2.25
20
- Dynamic: license-file
21
-
22
- # netbox-eosl
23
-
24
- Show **source-backed hardware end-of-service-life (EOSL) status** on your NetBox Devices and
25
- Device Types, straight from [EOSL.ai](https://eosl.ai) — where every date links to the vendor's
26
- own end-of-life bulletin.
27
-
28
- A panel appears on the right side of each Device and Device Type page: end-of-sale date,
29
- end-of-service-life date, the EOSL Exposure Score, a link to the vendor bulletin, and a link to
30
- the full EOSL.ai model page. A `manage.py eosl_check` command audits your whole inventory.
31
-
32
- Matching is **exact part-number only** — the plugin never fuzzy-matches, so it can't put a wrong
33
- end-of-life date on the wrong device. If a part number isn't in the database, it says so and
34
- offers a search link instead of guessing.
35
-
36
- ## Requirements
37
-
38
- | | |
39
- |---|---|
40
- | NetBox | **4.3** or later (uses the `models` template-extension API) |
41
- | Python | 3.10+ |
42
- | Network | outbound HTTPS to `eosl.ai` from the NetBox host |
43
-
44
- ## Install
45
-
46
- ```bash
47
- # In your NetBox virtual environment
48
- source /opt/netbox/venv/bin/activate
49
- pip install netbox-eosl
50
- ```
51
-
52
- Add it to NetBox's `configuration.py`:
53
-
54
- ```python
55
- PLUGINS = [
56
- "netbox_eosl",
57
- ]
58
- ```
59
-
60
- (Optional) tune it:
61
-
62
- ```python
63
- PLUGINS_CONFIG = {
64
- "netbox_eosl": {
65
- "api_url": "https://eosl.ai", # data source origin
66
- "cache_timeout": 86400, # seconds to cache the lookup table (default 24h)
67
- "request_timeout": 5, # network timeout in seconds
68
- },
69
- }
70
- ```
71
-
72
- Then restart NetBox and run migrations (none are added, but this reloads plugins):
73
-
74
- ```bash
75
- python /opt/netbox/netbox/manage.py migrate
76
- sudo systemctl restart netbox netbox-rq
77
- ```
78
-
79
- Add `netbox-eosl` to your `local_requirements.txt` so upgrades keep it installed.
80
-
81
- ## Use
82
-
83
- **In the UI** — open any Device or Device Type that has a **part number** set. The
84
- "Hardware End-of-Life" card appears in the right column.
85
-
86
- **Inventory audit** — from the NetBox host:
87
-
88
- ```bash
89
- python /opt/netbox/netbox/manage.py eosl_check
90
- ```
91
-
92
- ```
93
- EOSL.ai audit — 214 device types
94
- Past / action recommended: 57
95
- Ending soon (plan/watch): 18
96
- Tracked, supported: 44
97
- Active — no EOL announced: 9
98
- Not found in EOSL.ai: 79
99
- No part number set: 7
100
-
101
- Past end-of-service-life:
102
- Cisco Catalyst 3850-48P (WS-C3850-48P-S) — EOSL 2025-10 — 12 in service — https://eosl.ai/system/cisco-catalyst-3850/
103
- ...
104
- ```
105
-
106
- Use `--past-only` to print just the past-EOSL list (handy in a cron/report).
107
-
108
- ## How matching works
109
-
110
- The plugin downloads `https://eosl.ai/data/lookup.json` (the same part-number → status map that
111
- powers the eosl.ai bulk checker) and caches it. For each Device Type it resolves the `part_number`
112
- field (a Device inherits it from its Device Type) in three deterministic, conservative steps:
113
-
114
- 1. **Exact** match (case-insensitive).
115
- 2. **Loose** match — ignores spaces/dashes/case, so `FortiGate 60E` resolves `FortiGate-60E`.
116
- 3. **Vendor-gated aliases** — expands a manufacturer's short SKU form to the catalogued long form,
117
- but **only when the NetBox manufacturer matches that vendor**. E.g. a Fortinet `FG-60E` resolves
118
- `FortiGate-60E`, `FS-148E` → `FortiSwitch-148E`, `FAP-221E` → `FortiAP-221E`. The vendor gate means
119
- a non-Fortinet `FG-…` can never be mis-resolved onto a Fortinet record.
120
-
121
- There is **no fuzzy or substring matching**. No part number, or no confident match → a neutral
122
- "not tracked" panel with a search link. Nothing is inferred.
123
-
124
- The matching logic lives in `netbox_eosl/matching.py` (no Django imports) and is unit-tested in
125
- `tests/` — run `python tests/test_matching.py` (or `pytest`).
126
-
127
- ## Data & trust
128
-
129
- - Dates come from EOSL.ai, sourced from each vendor's official end-of-life bulletin and linked
130
- for verification. Where a vendor publishes no per-model EOSL date, EOSL.ai computes it from the
131
- vendor's published support-life policy and labels it "computed".
132
- - This plugin **reads** public data; it sends none of your inventory anywhere. The only outbound
133
- request is fetching the public lookup table.
134
- - Confirm any critical date against the linked vendor bulletin before a purchase, renewal, or
135
- migration decision.
136
-
137
- ## License
138
-
139
- Apache-2.0. See `LICENSE`.
140
-
141
- ## Contributing / publishing
142
-
143
- Issues and PRs welcome — especially additional vendor SKU aliases (see `FORTINET_PREFIX` in
144
- `matching.py` for the pattern) and screenshots. Maintainers: see `PUBLISHING.md` for the
145
- PyPI + NetBox-community release steps.
1
+ Metadata-Version: 2.4
2
+ Name: netbox-eosl
3
+ Version: 0.2.1
4
+ Summary: Show source-backed hardware end-of-service-life status on NetBox Devices and Device Types, from EOSL.ai.
5
+ Author-email: "EOSL.ai" <hello@eosl.ai>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://eosl.ai/
8
+ Project-URL: Data source, https://eosl.ai/api/
9
+ Project-URL: Source, https://github.com/Kranny36/netbox-eosl
10
+ Keywords: netbox,netbox-plugin,eosl,end-of-life,eol,lifecycle,dcim
11
+ Classifier: Framework :: Django
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: System :: Networking :: Monitoring
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: requests>=2.25
20
+ Dynamic: license-file
21
+
22
+ # netbox-eosl
23
+
24
+ Show **source-backed hardware end-of-service-life (EOSL) status** on your NetBox Devices and
25
+ Device Types, straight from [EOSL.ai](https://eosl.ai) — where every date links to the vendor's
26
+ own end-of-life bulletin.
27
+
28
+ A panel appears on the right side of each Device and Device Type page: end-of-sale date,
29
+ end-of-service-life date, the Support Runway Score, a link to the vendor bulletin, and a link to
30
+ the full EOSL.ai model page. A `manage.py eosl_check` command audits your whole inventory.
31
+
32
+ Matching is deterministic and never fuzzy, so the plugin can't put a wrong end-of-life date on the
33
+ wrong device. When it resolves a vendor short code or packaging variant, the panel shows what it
34
+ matched from. If a part number isn't in the database, it says so and offers a search link instead of
35
+ guessing.
36
+
37
+ ## Requirements
38
+
39
+ | | |
40
+ |---|---|
41
+ | NetBox | **4.3** or later (uses the `models` template-extension API) |
42
+ | Python | 3.10+ |
43
+ | Network | outbound HTTPS to `eosl.ai` from the NetBox host |
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ # In your NetBox virtual environment
49
+ source /opt/netbox/venv/bin/activate
50
+ pip install netbox-eosl
51
+ ```
52
+
53
+ Add it to NetBox's `configuration.py`:
54
+
55
+ ```python
56
+ PLUGINS = [
57
+ "netbox_eosl",
58
+ ]
59
+ ```
60
+
61
+ (Optional) tune it:
62
+
63
+ ```python
64
+ PLUGINS_CONFIG = {
65
+ "netbox_eosl": {
66
+ "api_url": "https://eosl.ai", # data source origin
67
+ "cache_timeout": 86400, # seconds to cache the lookup table (default 24h)
68
+ "request_timeout": 5, # network timeout in seconds
69
+ },
70
+ }
71
+ ```
72
+
73
+ Then restart NetBox and run migrations (none are added, but this reloads plugins):
74
+
75
+ ```bash
76
+ python /opt/netbox/netbox/manage.py migrate
77
+ sudo systemctl restart netbox netbox-rq
78
+ ```
79
+
80
+ Add `netbox-eosl` to your `local_requirements.txt` so upgrades keep it installed.
81
+
82
+ ## Use
83
+
84
+ **In the UI** — open any Device or Device Type that has a **part number** set. The
85
+ "Hardware End-of-Life" card appears in the right column.
86
+
87
+ **Inventory audit** — from the NetBox host:
88
+
89
+ ```bash
90
+ python /opt/netbox/netbox/manage.py eosl_check
91
+ ```
92
+
93
+ ```
94
+ EOSL.ai audit: 214 device types
95
+ Past / action recommended: 57
96
+ Ending soon (plan/watch): 18
97
+ Tracked, supported: 44
98
+ Active, no EOL announced: 9
99
+ Not found in EOSL.ai: 79
100
+ No part number set: 7
101
+
102
+ Needs action (past end-of-service-life, or action recommended):
103
+ Cisco Catalyst 3850-48P (WS-C3850-48P-S): Little or no runway, end of service life 2025-10, 12 in service, https://eosl.ai/system/cisco-catalyst-3850/
104
+ Fortinet FortiGate 60E (FortiGate-60E): Action recommended, end of service life 2026-12, 3 in service, https://eosl.ai/system/fortinet-fortigate-60e/
105
+ ...
106
+ ```
107
+
108
+ "Action recommended" includes hardware whose last date of support is still ahead, so each line
109
+ carries its status and date. Use `--past-only` to print just that list (handy in a cron/report).
110
+
111
+ ## How matching works
112
+
113
+ The plugin downloads `https://eosl.ai/data/lookup.json` (the same part-number → status map that
114
+ powers the eosl.ai bulk checker) and caches it. For each Device Type it resolves the `part_number`
115
+ field (a Device inherits it from its Device Type) in deterministic, conservative steps:
116
+
117
+ 1. **Exact** match (case-insensitive).
118
+ 2. **Loose** match — ignores spaces/dashes/case, so `FortiGate 60E` resolves `FortiGate-60E`.
119
+ 3. **Vendor-gated aliases** — expands a manufacturer's short SKU form to the catalogued long form,
120
+ but **only when the NetBox manufacturer matches that vendor**. E.g. a Fortinet `FG-60E` resolves
121
+ `FortiGate-60E`, `FS-148E` → `FortiSwitch-148E`, `FAP-221E` → `FortiAP-221E`. The vendor gate means
122
+ a non-Fortinet `FG-…` can never be mis-resolved onto a Fortinet record.
123
+ 4. **Variant aliases** from `https://eosl.ai/data/aliases.json`: packaging forms of the same hardware,
124
+ such as Juniper `EX4300-48T-TAA` or Cisco `ASA5506`. EOSL.ai admits an alias only when every record
125
+ it could mean has the same vendor and the same dates; short keys and keys shared across vendors
126
+ resolve only when the NetBox manufacturer names the vendor. The file is optional: if it cannot be
127
+ fetched, matching runs without it.
128
+ 5. If the part number finds nothing, the device type's **model name** is tried with the same rules
129
+ (NetBox's device-type library leaves some part numbers blank, e.g. Dell "PowerEdge R730").
130
+
131
+ There is **no fuzzy or substring matching**. No part number, or no confident match → a neutral
132
+ "not tracked" panel with a search link. Nothing is inferred.
133
+
134
+ The matching logic lives in `netbox_eosl/matching.py` (no Django imports) and is unit-tested in
135
+ `tests/` — run `python tests/test_matching.py` (or `pytest`).
136
+
137
+ ## Data & trust
138
+
139
+ - Dates come from EOSL.ai, sourced from each vendor's official end-of-life bulletin and linked
140
+ for verification. Where a vendor publishes no per-model EOSL date, EOSL.ai computes it from the
141
+ vendor's published support-life policy and labels it "computed".
142
+ - This plugin **reads** public data; it sends none of your inventory anywhere. The only outbound
143
+ requests fetch the public lookup table and the alias file.
144
+ - Confirm any critical date against the linked vendor bulletin before a purchase, renewal, or
145
+ migration decision.
146
+
147
+ ## License
148
+
149
+ Apache-2.0. See `LICENSE`.
150
+
151
+ ## Contributing / publishing
152
+
153
+ Issues and PRs welcome — especially additional vendor SKU aliases (see `FORTINET_PREFIX` in
154
+ `matching.py` for the pattern) and screenshots. Maintainers: see `PUBLISHING.md` for the
155
+ PyPI + NetBox-community release steps.
@@ -5,12 +5,13 @@ Device Types, straight from [EOSL.ai](https://eosl.ai) — where every date link
5
5
  own end-of-life bulletin.
6
6
 
7
7
  A panel appears on the right side of each Device and Device Type page: end-of-sale date,
8
- end-of-service-life date, the EOSL Exposure Score, a link to the vendor bulletin, and a link to
8
+ end-of-service-life date, the Support Runway Score, a link to the vendor bulletin, and a link to
9
9
  the full EOSL.ai model page. A `manage.py eosl_check` command audits your whole inventory.
10
10
 
11
- Matching is **exact part-number only** — the plugin never fuzzy-matches, so it can't put a wrong
12
- end-of-life date on the wrong device. If a part number isn't in the database, it says so and
13
- offers a search link instead of guessing.
11
+ Matching is deterministic and never fuzzy, so the plugin can't put a wrong end-of-life date on the
12
+ wrong device. When it resolves a vendor short code or packaging variant, the panel shows what it
13
+ matched from. If a part number isn't in the database, it says so and offers a search link instead of
14
+ guessing.
14
15
 
15
16
  ## Requirements
16
17
 
@@ -69,26 +70,28 @@ python /opt/netbox/netbox/manage.py eosl_check
69
70
  ```
70
71
 
71
72
  ```
72
- EOSL.ai audit — 214 device types
73
+ EOSL.ai audit: 214 device types
73
74
  Past / action recommended: 57
74
75
  Ending soon (plan/watch): 18
75
76
  Tracked, supported: 44
76
- Active — no EOL announced: 9
77
+ Active, no EOL announced: 9
77
78
  Not found in EOSL.ai: 79
78
79
  No part number set: 7
79
80
 
80
- Past end-of-service-life:
81
- Cisco Catalyst 3850-48P (WS-C3850-48P-S) — EOSL 2025-10 — 12 in service — https://eosl.ai/system/cisco-catalyst-3850/
81
+ Needs action (past end-of-service-life, or action recommended):
82
+ Cisco Catalyst 3850-48P (WS-C3850-48P-S): Little or no runway, end of service life 2025-10, 12 in service, https://eosl.ai/system/cisco-catalyst-3850/
83
+ Fortinet FortiGate 60E (FortiGate-60E): Action recommended, end of service life 2026-12, 3 in service, https://eosl.ai/system/fortinet-fortigate-60e/
82
84
  ...
83
85
  ```
84
86
 
85
- Use `--past-only` to print just the past-EOSL list (handy in a cron/report).
87
+ "Action recommended" includes hardware whose last date of support is still ahead, so each line
88
+ carries its status and date. Use `--past-only` to print just that list (handy in a cron/report).
86
89
 
87
90
  ## How matching works
88
91
 
89
92
  The plugin downloads `https://eosl.ai/data/lookup.json` (the same part-number → status map that
90
93
  powers the eosl.ai bulk checker) and caches it. For each Device Type it resolves the `part_number`
91
- field (a Device inherits it from its Device Type) in three deterministic, conservative steps:
94
+ field (a Device inherits it from its Device Type) in deterministic, conservative steps:
92
95
 
93
96
  1. **Exact** match (case-insensitive).
94
97
  2. **Loose** match — ignores spaces/dashes/case, so `FortiGate 60E` resolves `FortiGate-60E`.
@@ -96,6 +99,13 @@ field (a Device inherits it from its Device Type) in three deterministic, conser
96
99
  but **only when the NetBox manufacturer matches that vendor**. E.g. a Fortinet `FG-60E` resolves
97
100
  `FortiGate-60E`, `FS-148E` → `FortiSwitch-148E`, `FAP-221E` → `FortiAP-221E`. The vendor gate means
98
101
  a non-Fortinet `FG-…` can never be mis-resolved onto a Fortinet record.
102
+ 4. **Variant aliases** from `https://eosl.ai/data/aliases.json`: packaging forms of the same hardware,
103
+ such as Juniper `EX4300-48T-TAA` or Cisco `ASA5506`. EOSL.ai admits an alias only when every record
104
+ it could mean has the same vendor and the same dates; short keys and keys shared across vendors
105
+ resolve only when the NetBox manufacturer names the vendor. The file is optional: if it cannot be
106
+ fetched, matching runs without it.
107
+ 5. If the part number finds nothing, the device type's **model name** is tried with the same rules
108
+ (NetBox's device-type library leaves some part numbers blank, e.g. Dell "PowerEdge R730").
99
109
 
100
110
  There is **no fuzzy or substring matching**. No part number, or no confident match → a neutral
101
111
  "not tracked" panel with a search link. Nothing is inferred.
@@ -109,7 +119,7 @@ The matching logic lives in `netbox_eosl/matching.py` (no Django imports) and is
109
119
  for verification. Where a vendor publishes no per-model EOSL date, EOSL.ai computes it from the
110
120
  vendor's published support-life policy and labels it "computed".
111
121
  - This plugin **reads** public data; it sends none of your inventory anywhere. The only outbound
112
- request is fetching the public lookup table.
122
+ requests fetch the public lookup table and the alias file.
113
123
  - Confirm any critical date against the linked vendor bulletin before a purchase, renewal, or
114
124
  migration decision.
115
125
 
@@ -6,7 +6,7 @@ guesses, so it cannot assert an end-of-life date NetBox isn't certain about.
6
6
  """
7
7
  from netbox.plugins import PluginConfig
8
8
 
9
- __version__ = "0.1.0"
9
+ __version__ = "0.2.1"
10
10
 
11
11
 
12
12
  class EOSLConfig(PluginConfig):
@@ -16,6 +16,7 @@ from . import matching
16
16
  logger = logging.getLogger("netbox.plugins.netbox_eosl")
17
17
 
18
18
  _SKU_CACHE_KEY = "netbox_eosl:skus:v2"
19
+ _ALIAS_CACHE_KEY = "netbox_eosl:aliases:v1"
19
20
  # In-process memo of the built indexes, rebuilt only when the sku set changes.
20
21
  _MEMO = {"token": None, "idx": (None, None)}
21
22
 
@@ -35,7 +36,7 @@ def _load_skus():
35
36
  resp = requests.get(
36
37
  url,
37
38
  timeout=_cfg("request_timeout"),
38
- headers={"User-Agent": "netbox-eosl/0.1 (+https://eosl.ai)"},
39
+ headers={"User-Agent": "netbox-eosl/0.2 (+https://eosl.ai)"},
39
40
  )
40
41
  resp.raise_for_status()
41
42
  skus = resp.json().get("skus", [])
@@ -48,6 +49,29 @@ def _load_skus():
48
49
  return skus
49
50
 
50
51
 
52
+ def _load_aliases():
53
+ """Return https://eosl.ai/data/aliases.json (variant aliases, HISTORY §82), cached, or None.
54
+
55
+ Optional by design: when it cannot be fetched, matching is exactly what it was without it.
56
+ """
57
+ al = cache.get(_ALIAS_CACHE_KEY)
58
+ if al is not None:
59
+ return al or None
60
+ url = _cfg("api_url").rstrip("/") + "/data/aliases.json"
61
+ try:
62
+ resp = requests.get(url, timeout=_cfg("request_timeout"),
63
+ headers={"User-Agent": "netbox-eosl/0.2 (+https://eosl.ai)"})
64
+ resp.raise_for_status()
65
+ data = resp.json()
66
+ al = {"open": data.get("open") or {}, "gated": data.get("gated") or {}}
67
+ except (requests.RequestException, ValueError) as exc:
68
+ logger.info("netbox-eosl: no alias table from %s (%s); matching without it", url, exc)
69
+ cache.set(_ALIAS_CACHE_KEY, {}, 300)
70
+ return None
71
+ cache.set(_ALIAS_CACHE_KEY, al, _cfg("cache_timeout"))
72
+ return al
73
+
74
+
51
75
  def _indexes():
52
76
  """(exact, loose) indexes, rebuilt in-process only when the sku count changes."""
53
77
  skus = _load_skus()
@@ -58,16 +82,26 @@ def _indexes():
58
82
  return _MEMO["idx"]
59
83
 
60
84
 
61
- def lookup_part(part_number, vendor=None):
85
+ def lookup_part(part_number, vendor=None, model=None):
62
86
  """Resolve one part number (optionally with its NetBox manufacturer name) to a display dict, or None.
63
87
 
64
- Passing `vendor` enables vendor-gated aliases (e.g. Fortinet FG-60E -> FortiGate-60E) without risking
65
- a cross-vendor false match. The returned dict is safe to hand straight to the template.
88
+ Passing `vendor` enables vendor-gated aliases (e.g. Fortinet FG-60E -> FortiGate-60E, Meraki MX67C ->
89
+ MX67C-HW-NA) without risking a cross-vendor false match. `model` is the device type's model name,
90
+ tried only when the part number finds nothing: NetBox's own device-type library leaves some part
91
+ numbers blank and names the product in the model ("PowerEdge R640"). Same matcher, same rules.
66
92
  """
67
- if not part_number:
93
+ if not part_number and not model:
68
94
  return None
69
95
  exact, loose_index = _indexes()
70
- rec = matching.match(part_number, vendor, exact, loose_index)
96
+ aliases = _load_aliases()
97
+ rec = None
98
+ matched_from = None
99
+ for candidate in (part_number, model):
100
+ if candidate:
101
+ rec = matching.match(candidate, vendor, exact, loose_index, aliases)
102
+ if rec:
103
+ matched_from = candidate
104
+ break
71
105
  if not rec:
72
106
  return None
73
107
  state, label, css = matching.classify(rec)
@@ -86,6 +120,11 @@ def lookup_part(part_number, vendor=None):
86
120
  "state_label": label,
87
121
  "state_css": css,
88
122
  "page_url": (_cfg("api_url").rstrip("/") + "/system/" + slug + "/") if slug else _cfg("api_url"),
123
+ # What NetBox held that produced the match, shown when it differs from the catalogued part
124
+ # (a vendor short code, a packaging variant, or the device type's model name), so a reader
125
+ # never sees a different part number with no explanation.
126
+ "matched_from": matched_from if matched_from != rec.get("p") else None,
127
+ "matched_by_model": bool(matched_from) and matched_from == model and matched_from != part_number,
89
128
  }
90
129
 
91
130
 
@@ -1,8 +1,9 @@
1
1
  """`manage.py eosl_check` — audit your NetBox device types against EOSL.ai.
2
2
 
3
- Prints a summary of how many tracked device types are past end-of-service-life, ending soon,
4
- still active, or not found in the EOSL.ai database — plus the list of past-EOSL types with how
5
- many device instances you run. Read-only; changes nothing in NetBox.
3
+ Prints a summary of how many tracked device types need action, are ending soon, are still
4
+ supported or active, or are not found in the EOSL.ai database, then lists the device types that need
5
+ action (past end-of-service-life, or close enough that EOSL.ai rates the runway as action recommended)
6
+ with how many device instances you run. Read-only; changes nothing in NetBox.
6
7
  """
7
8
  from collections import Counter
8
9
 
@@ -19,7 +20,7 @@ class Command(BaseCommand):
19
20
  parser.add_argument(
20
21
  "--past-only",
21
22
  action="store_true",
22
- help="Skip the summary; just list device types past end-of-service-life.",
23
+ help="Skip the summary; just list device types that need action (past or near end-of-service-life).",
23
24
  )
24
25
 
25
26
  def handle(self, *args, **options):
@@ -29,10 +30,15 @@ class Command(BaseCommand):
29
30
 
30
31
  for dt in device_types:
31
32
  part = (dt.part_number or "").strip()
32
- if not part:
33
+ model = (dt.model or "").strip()
34
+ if not part and not model:
33
35
  counts["no_part_number"] += 1
34
36
  continue
35
- rec = lookup_part(part)
37
+ # The manufacturer turns on vendor-gated forms (Fortinet FG-60E, Meraki MX67C); without it
38
+ # the audit missed parts the device page matched. The model is tried when the part number
39
+ # finds nothing (HISTORY §82).
40
+ mfr = getattr(getattr(dt, "manufacturer", None), "name", "") or ""
41
+ rec = lookup_part(part, mfr, model)
36
42
  if not rec:
37
43
  counts["not_found"] += 1
38
44
  continue
@@ -43,12 +49,12 @@ class Command(BaseCommand):
43
49
  total = sum(counts.values())
44
50
 
45
51
  if not options.get("past_only"):
46
- self.stdout.write(self.style.MIGRATE_HEADING("EOSL.ai audit — {} device types".format(total)))
52
+ self.stdout.write(self.style.MIGRATE_HEADING("EOSL.ai audit: {} device types".format(total)))
47
53
  label = {
48
54
  "risk": "Past / action recommended",
49
55
  "watch": "Ending soon (plan/watch)",
50
56
  "clear": "Tracked, supported",
51
- "active": "Active — no EOL announced",
57
+ "active": "Active, no EOL announced",
52
58
  "not_found": "Not found in EOSL.ai",
53
59
  "no_part_number": "No part number set",
54
60
  }
@@ -58,22 +64,25 @@ class Command(BaseCommand):
58
64
 
59
65
  if past_rows:
60
66
  self.stdout.write("")
61
- self.stdout.write(self.style.WARNING("Past end-of-service-life:"))
67
+ # One heading for both bands: "Action recommended" includes hardware whose last date of
68
+ # support is still ahead, so this list must never be headed "past end-of-service-life".
69
+ self.stdout.write(self.style.WARNING("Needs action (past end-of-service-life, or action recommended):"))
62
70
  for dt, rec in sorted(past_rows, key=lambda r: r[1].get("eosl") or ""):
63
71
  try:
64
72
  instances = dt.instances.count()
65
73
  except Exception:
66
74
  instances = "?"
67
75
  self.stdout.write(
68
- " {vendor} {model} ({part}) — EOSL {eosl} — {n} in service — {url}".format(
76
+ " {vendor} {model} ({part}): {status}, end of service life {eosl}, {n} in service, {url}".format(
69
77
  vendor=rec.get("vendor") or (dt.manufacturer and dt.manufacturer.name) or "",
70
78
  model=dt.model,
71
79
  part=rec.get("part"),
72
- eosl=rec.get("eosl") or "n/a",
80
+ status=rec.get("state_label"),
81
+ eosl=rec.get("eosl") or "not published",
73
82
  n=instances,
74
83
  url=rec.get("page_url"),
75
84
  )
76
85
  )
77
86
  elif not options.get("past_only"):
78
87
  self.stdout.write("")
79
- self.stdout.write(self.style.SUCCESS("No device types are past end-of-service-life. 🎉"))
88
+ self.stdout.write(self.style.SUCCESS("No device types need action."))
@@ -32,17 +32,37 @@ def loose(s):
32
32
 
33
33
 
34
34
  def build_index(skus):
35
- """Return (exact, loose_index): UPPER(pid)->rec and loose(pid)->rec. First writer wins on collisions."""
36
- exact, loose_index = {}, {}
35
+ """Return (exact, loose_index): UPPER(pid)->rec and loose(pid)->rec.
36
+
37
+ A loose key shared by two different families is struck out rather than resolved: stripping
38
+ punctuation collapses distinct products onto one key (UAP-Outdoor / UAP-Outdoor+, and Palo Alto
39
+ GP-100 against Dell GP100, across vendors), and first-writer-wins handed back whichever came first
40
+ in the file. Unresolved is the correct answer to an ambiguous key. Same rule as src/match.js and
41
+ functions/mcp.js (HISTORY §82).
42
+ """
43
+ exact, loose_index, ambiguous = {}, {}, set()
37
44
  for rec in skus:
38
45
  pid = (rec.get("p") or "").strip().upper()
39
46
  if not pid:
40
47
  continue
41
48
  exact.setdefault(pid, rec)
42
- loose_index.setdefault(loose(pid), rec)
49
+ lk = loose(pid)
50
+ if lk in loose_index:
51
+ if str(loose_index[lk].get("f")) != str(rec.get("f")):
52
+ ambiguous.add(lk)
53
+ else:
54
+ loose_index[lk] = rec
55
+ for k in ambiguous:
56
+ loose_index.pop(k, None)
43
57
  return exact, loose_index
44
58
 
45
59
 
60
+ def _vendor_ok(vendor, rec):
61
+ """True when no vendor is named, or the named vendor and the record's vendor contain one another."""
62
+ lv, rv = loose(vendor), loose(rec.get("v"))
63
+ return not lv or lv in rv or rv in lv
64
+
65
+
46
66
  def _is_fortinet(vendor):
47
67
  return bool(vendor) and "FORTINET" in vendor.upper()
48
68
 
@@ -67,17 +87,31 @@ def candidate_loose_keys(part, vendor=None):
67
87
  return keys
68
88
 
69
89
 
70
- def match(part, vendor, exact, loose_index):
71
- """Resolve a part number to a record, or None. Exact -> loose -> vendor-gated alias."""
90
+ def match(part, vendor, exact, loose_index, aliases=None):
91
+ """Resolve a part number to a record, or None. Exact -> loose -> Fortinet short code -> variant alias.
92
+
93
+ `aliases` is https://eosl.ai/data/aliases.json (optional). Its entries are vetted when the site is
94
+ built: every record an alias could mean has the same vendor and the same dates (EX4300-48T-TAA ->
95
+ EX4300-48T, ASA5506 -> ASA5506-K8). "gated" aliases apply only when a vendor is named, and an alias
96
+ hit must belong to the named vendor, so a Juniper MX80 can never resolve to a Meraki MX80.
97
+ """
72
98
  if not part:
73
99
  return None
74
100
  u = part.strip().upper()
75
101
  if u in exact:
76
102
  return exact[u]
77
- for k in candidate_loose_keys(part, vendor):
103
+ keys = candidate_loose_keys(part, vendor)
104
+ for k in keys:
78
105
  rec = loose_index.get(k)
79
106
  if rec:
80
107
  return rec
108
+ if aliases:
109
+ opened, gated = aliases.get("open") or {}, aliases.get("gated") or {}
110
+ for k in keys:
111
+ p = opened.get(k) or (gated.get(k) if loose(vendor) else None)
112
+ rec = exact.get(str(p).upper()) if p else None
113
+ if rec and _vendor_ok(vendor, rec):
114
+ return rec
81
115
  return None
82
116
 
83
117
 
@@ -86,7 +120,9 @@ def classify(rec):
86
120
  if rec.get("a"):
87
121
  return ("active", "Active — no EOL announced", "success")
88
122
  band = rec.get("xb") or ""
89
- if band in ("High exposure", "Action recommended"):
123
+ # "Little or no runway" is the current name for past-support hardware; "High exposure" is kept
124
+ # for older cached lookup files (HISTORY §82).
125
+ if band in ("Little or no runway", "High exposure", "Action recommended"):
90
126
  return ("risk", band, "danger")
91
127
  if band in ("Plan", "Watch"):
92
128
  return ("watch", band, "warning")
@@ -11,12 +11,12 @@ def _manufacturer_name(device_type):
11
11
  return getattr(mfr, "name", "") or ""
12
12
 
13
13
 
14
- def _panel(extension, part_number, vendor):
14
+ def _panel(extension, part_number, vendor, model=""):
15
15
  """Shared renderer for both models."""
16
16
  return extension.render(
17
17
  _TEMPLATE,
18
18
  extra_context={
19
- "eosl": lookup_part(part_number, vendor),
19
+ "eosl": lookup_part(part_number, vendor, model),
20
20
  "queried_part": part_number,
21
21
  "search_url": search_url(part_number),
22
22
  },
@@ -31,7 +31,7 @@ class DeviceEOSL(PluginTemplateExtension):
31
31
  # A device's ordering PID + manufacturer live on its device type.
32
32
  device_type = getattr(device, "device_type", None)
33
33
  part = getattr(device_type, "part_number", "") or ""
34
- return _panel(self, part, _manufacturer_name(device_type))
34
+ return _panel(self, part, _manufacturer_name(device_type), getattr(device_type, "model", "") or "")
35
35
 
36
36
 
37
37
  class DeviceTypeEOSL(PluginTemplateExtension):
@@ -40,7 +40,7 @@ class DeviceTypeEOSL(PluginTemplateExtension):
40
40
  def right_page(self):
41
41
  device_type = self.context["object"]
42
42
  part = getattr(device_type, "part_number", "") or ""
43
- return _panel(self, part, _manufacturer_name(device_type))
43
+ return _panel(self, part, _manufacturer_name(device_type), getattr(device_type, "model", "") or "")
44
44
 
45
45
 
46
46
  template_extensions = [DeviceEOSL, DeviceTypeEOSL]
@@ -2,7 +2,10 @@
2
2
  <div class="card">
3
3
  <h2 class="card-header">
4
4
  Hardware End-of-Life
5
- <a href="https://eosl.ai/" target="_blank" rel="noopener" class="float-end text-muted" title="Data source: EOSL.ai" style="font-size:0.7em;font-weight:400;">EOSL.ai</a>
5
+ {# card-actions is NetBox 4.x's header slot; float-end ran the link into the title on 4.7. #}
6
+ <div class="card-actions">
7
+ <a href="https://eosl.ai/" target="_blank" rel="noopener" class="btn btn-ghost-secondary btn-sm" title="Data source: EOSL.ai">EOSL.ai</a>
8
+ </div>
6
9
  </h2>
7
10
  {% if eosl %}
8
11
  <table class="table table-hover attr-table">
@@ -14,6 +17,12 @@
14
17
  <th scope="row">Part number</th>
15
18
  <td><code>{{ eosl.part }}</code></td>
16
19
  </tr>
20
+ {% if eosl.matched_from %}
21
+ <tr>
22
+ <th scope="row">Matched from</th>
23
+ <td><code>{{ eosl.matched_from }}</code> <span class="text-muted">({% if eosl.matched_by_model %}device type model name{% else %}same hardware, different part number form{% endif %})</span></td>
24
+ </tr>
25
+ {% endif %}
17
26
  {% if eosl.end_of_sale %}
18
27
  <tr>
19
28
  <th scope="row">End of sale</th>
@@ -1,145 +1,155 @@
1
- Metadata-Version: 2.4
2
- Name: netbox-eosl
3
- Version: 0.1.0
4
- Summary: Show source-backed hardware end-of-service-life status on NetBox Devices and Device Types, from EOSL.ai.
5
- Author-email: "EOSL.ai" <hello@eosl.ai>
6
- License: Apache-2.0
7
- Project-URL: Homepage, https://eosl.ai/
8
- Project-URL: Data source, https://eosl.ai/api/
9
- Project-URL: Source, https://github.com/Kranny36/netbox-eosl
10
- Keywords: netbox,netbox-plugin,eosl,end-of-life,eol,lifecycle,dcim
11
- Classifier: Framework :: Django
12
- Classifier: Intended Audience :: System Administrators
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Topic :: System :: Networking :: Monitoring
16
- Requires-Python: >=3.10
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: requests>=2.25
20
- Dynamic: license-file
21
-
22
- # netbox-eosl
23
-
24
- Show **source-backed hardware end-of-service-life (EOSL) status** on your NetBox Devices and
25
- Device Types, straight from [EOSL.ai](https://eosl.ai) — where every date links to the vendor's
26
- own end-of-life bulletin.
27
-
28
- A panel appears on the right side of each Device and Device Type page: end-of-sale date,
29
- end-of-service-life date, the EOSL Exposure Score, a link to the vendor bulletin, and a link to
30
- the full EOSL.ai model page. A `manage.py eosl_check` command audits your whole inventory.
31
-
32
- Matching is **exact part-number only** — the plugin never fuzzy-matches, so it can't put a wrong
33
- end-of-life date on the wrong device. If a part number isn't in the database, it says so and
34
- offers a search link instead of guessing.
35
-
36
- ## Requirements
37
-
38
- | | |
39
- |---|---|
40
- | NetBox | **4.3** or later (uses the `models` template-extension API) |
41
- | Python | 3.10+ |
42
- | Network | outbound HTTPS to `eosl.ai` from the NetBox host |
43
-
44
- ## Install
45
-
46
- ```bash
47
- # In your NetBox virtual environment
48
- source /opt/netbox/venv/bin/activate
49
- pip install netbox-eosl
50
- ```
51
-
52
- Add it to NetBox's `configuration.py`:
53
-
54
- ```python
55
- PLUGINS = [
56
- "netbox_eosl",
57
- ]
58
- ```
59
-
60
- (Optional) tune it:
61
-
62
- ```python
63
- PLUGINS_CONFIG = {
64
- "netbox_eosl": {
65
- "api_url": "https://eosl.ai", # data source origin
66
- "cache_timeout": 86400, # seconds to cache the lookup table (default 24h)
67
- "request_timeout": 5, # network timeout in seconds
68
- },
69
- }
70
- ```
71
-
72
- Then restart NetBox and run migrations (none are added, but this reloads plugins):
73
-
74
- ```bash
75
- python /opt/netbox/netbox/manage.py migrate
76
- sudo systemctl restart netbox netbox-rq
77
- ```
78
-
79
- Add `netbox-eosl` to your `local_requirements.txt` so upgrades keep it installed.
80
-
81
- ## Use
82
-
83
- **In the UI** — open any Device or Device Type that has a **part number** set. The
84
- "Hardware End-of-Life" card appears in the right column.
85
-
86
- **Inventory audit** — from the NetBox host:
87
-
88
- ```bash
89
- python /opt/netbox/netbox/manage.py eosl_check
90
- ```
91
-
92
- ```
93
- EOSL.ai audit — 214 device types
94
- Past / action recommended: 57
95
- Ending soon (plan/watch): 18
96
- Tracked, supported: 44
97
- Active — no EOL announced: 9
98
- Not found in EOSL.ai: 79
99
- No part number set: 7
100
-
101
- Past end-of-service-life:
102
- Cisco Catalyst 3850-48P (WS-C3850-48P-S) — EOSL 2025-10 — 12 in service — https://eosl.ai/system/cisco-catalyst-3850/
103
- ...
104
- ```
105
-
106
- Use `--past-only` to print just the past-EOSL list (handy in a cron/report).
107
-
108
- ## How matching works
109
-
110
- The plugin downloads `https://eosl.ai/data/lookup.json` (the same part-number → status map that
111
- powers the eosl.ai bulk checker) and caches it. For each Device Type it resolves the `part_number`
112
- field (a Device inherits it from its Device Type) in three deterministic, conservative steps:
113
-
114
- 1. **Exact** match (case-insensitive).
115
- 2. **Loose** match — ignores spaces/dashes/case, so `FortiGate 60E` resolves `FortiGate-60E`.
116
- 3. **Vendor-gated aliases** — expands a manufacturer's short SKU form to the catalogued long form,
117
- but **only when the NetBox manufacturer matches that vendor**. E.g. a Fortinet `FG-60E` resolves
118
- `FortiGate-60E`, `FS-148E` → `FortiSwitch-148E`, `FAP-221E` → `FortiAP-221E`. The vendor gate means
119
- a non-Fortinet `FG-…` can never be mis-resolved onto a Fortinet record.
120
-
121
- There is **no fuzzy or substring matching**. No part number, or no confident match → a neutral
122
- "not tracked" panel with a search link. Nothing is inferred.
123
-
124
- The matching logic lives in `netbox_eosl/matching.py` (no Django imports) and is unit-tested in
125
- `tests/` — run `python tests/test_matching.py` (or `pytest`).
126
-
127
- ## Data & trust
128
-
129
- - Dates come from EOSL.ai, sourced from each vendor's official end-of-life bulletin and linked
130
- for verification. Where a vendor publishes no per-model EOSL date, EOSL.ai computes it from the
131
- vendor's published support-life policy and labels it "computed".
132
- - This plugin **reads** public data; it sends none of your inventory anywhere. The only outbound
133
- request is fetching the public lookup table.
134
- - Confirm any critical date against the linked vendor bulletin before a purchase, renewal, or
135
- migration decision.
136
-
137
- ## License
138
-
139
- Apache-2.0. See `LICENSE`.
140
-
141
- ## Contributing / publishing
142
-
143
- Issues and PRs welcome — especially additional vendor SKU aliases (see `FORTINET_PREFIX` in
144
- `matching.py` for the pattern) and screenshots. Maintainers: see `PUBLISHING.md` for the
145
- PyPI + NetBox-community release steps.
1
+ Metadata-Version: 2.4
2
+ Name: netbox-eosl
3
+ Version: 0.2.1
4
+ Summary: Show source-backed hardware end-of-service-life status on NetBox Devices and Device Types, from EOSL.ai.
5
+ Author-email: "EOSL.ai" <hello@eosl.ai>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://eosl.ai/
8
+ Project-URL: Data source, https://eosl.ai/api/
9
+ Project-URL: Source, https://github.com/Kranny36/netbox-eosl
10
+ Keywords: netbox,netbox-plugin,eosl,end-of-life,eol,lifecycle,dcim
11
+ Classifier: Framework :: Django
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: System :: Networking :: Monitoring
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: requests>=2.25
20
+ Dynamic: license-file
21
+
22
+ # netbox-eosl
23
+
24
+ Show **source-backed hardware end-of-service-life (EOSL) status** on your NetBox Devices and
25
+ Device Types, straight from [EOSL.ai](https://eosl.ai) — where every date links to the vendor's
26
+ own end-of-life bulletin.
27
+
28
+ A panel appears on the right side of each Device and Device Type page: end-of-sale date,
29
+ end-of-service-life date, the Support Runway Score, a link to the vendor bulletin, and a link to
30
+ the full EOSL.ai model page. A `manage.py eosl_check` command audits your whole inventory.
31
+
32
+ Matching is deterministic and never fuzzy, so the plugin can't put a wrong end-of-life date on the
33
+ wrong device. When it resolves a vendor short code or packaging variant, the panel shows what it
34
+ matched from. If a part number isn't in the database, it says so and offers a search link instead of
35
+ guessing.
36
+
37
+ ## Requirements
38
+
39
+ | | |
40
+ |---|---|
41
+ | NetBox | **4.3** or later (uses the `models` template-extension API) |
42
+ | Python | 3.10+ |
43
+ | Network | outbound HTTPS to `eosl.ai` from the NetBox host |
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ # In your NetBox virtual environment
49
+ source /opt/netbox/venv/bin/activate
50
+ pip install netbox-eosl
51
+ ```
52
+
53
+ Add it to NetBox's `configuration.py`:
54
+
55
+ ```python
56
+ PLUGINS = [
57
+ "netbox_eosl",
58
+ ]
59
+ ```
60
+
61
+ (Optional) tune it:
62
+
63
+ ```python
64
+ PLUGINS_CONFIG = {
65
+ "netbox_eosl": {
66
+ "api_url": "https://eosl.ai", # data source origin
67
+ "cache_timeout": 86400, # seconds to cache the lookup table (default 24h)
68
+ "request_timeout": 5, # network timeout in seconds
69
+ },
70
+ }
71
+ ```
72
+
73
+ Then restart NetBox and run migrations (none are added, but this reloads plugins):
74
+
75
+ ```bash
76
+ python /opt/netbox/netbox/manage.py migrate
77
+ sudo systemctl restart netbox netbox-rq
78
+ ```
79
+
80
+ Add `netbox-eosl` to your `local_requirements.txt` so upgrades keep it installed.
81
+
82
+ ## Use
83
+
84
+ **In the UI** — open any Device or Device Type that has a **part number** set. The
85
+ "Hardware End-of-Life" card appears in the right column.
86
+
87
+ **Inventory audit** — from the NetBox host:
88
+
89
+ ```bash
90
+ python /opt/netbox/netbox/manage.py eosl_check
91
+ ```
92
+
93
+ ```
94
+ EOSL.ai audit: 214 device types
95
+ Past / action recommended: 57
96
+ Ending soon (plan/watch): 18
97
+ Tracked, supported: 44
98
+ Active, no EOL announced: 9
99
+ Not found in EOSL.ai: 79
100
+ No part number set: 7
101
+
102
+ Needs action (past end-of-service-life, or action recommended):
103
+ Cisco Catalyst 3850-48P (WS-C3850-48P-S): Little or no runway, end of service life 2025-10, 12 in service, https://eosl.ai/system/cisco-catalyst-3850/
104
+ Fortinet FortiGate 60E (FortiGate-60E): Action recommended, end of service life 2026-12, 3 in service, https://eosl.ai/system/fortinet-fortigate-60e/
105
+ ...
106
+ ```
107
+
108
+ "Action recommended" includes hardware whose last date of support is still ahead, so each line
109
+ carries its status and date. Use `--past-only` to print just that list (handy in a cron/report).
110
+
111
+ ## How matching works
112
+
113
+ The plugin downloads `https://eosl.ai/data/lookup.json` (the same part-number → status map that
114
+ powers the eosl.ai bulk checker) and caches it. For each Device Type it resolves the `part_number`
115
+ field (a Device inherits it from its Device Type) in deterministic, conservative steps:
116
+
117
+ 1. **Exact** match (case-insensitive).
118
+ 2. **Loose** match — ignores spaces/dashes/case, so `FortiGate 60E` resolves `FortiGate-60E`.
119
+ 3. **Vendor-gated aliases** — expands a manufacturer's short SKU form to the catalogued long form,
120
+ but **only when the NetBox manufacturer matches that vendor**. E.g. a Fortinet `FG-60E` resolves
121
+ `FortiGate-60E`, `FS-148E` → `FortiSwitch-148E`, `FAP-221E` → `FortiAP-221E`. The vendor gate means
122
+ a non-Fortinet `FG-…` can never be mis-resolved onto a Fortinet record.
123
+ 4. **Variant aliases** from `https://eosl.ai/data/aliases.json`: packaging forms of the same hardware,
124
+ such as Juniper `EX4300-48T-TAA` or Cisco `ASA5506`. EOSL.ai admits an alias only when every record
125
+ it could mean has the same vendor and the same dates; short keys and keys shared across vendors
126
+ resolve only when the NetBox manufacturer names the vendor. The file is optional: if it cannot be
127
+ fetched, matching runs without it.
128
+ 5. If the part number finds nothing, the device type's **model name** is tried with the same rules
129
+ (NetBox's device-type library leaves some part numbers blank, e.g. Dell "PowerEdge R730").
130
+
131
+ There is **no fuzzy or substring matching**. No part number, or no confident match → a neutral
132
+ "not tracked" panel with a search link. Nothing is inferred.
133
+
134
+ The matching logic lives in `netbox_eosl/matching.py` (no Django imports) and is unit-tested in
135
+ `tests/` — run `python tests/test_matching.py` (or `pytest`).
136
+
137
+ ## Data & trust
138
+
139
+ - Dates come from EOSL.ai, sourced from each vendor's official end-of-life bulletin and linked
140
+ for verification. Where a vendor publishes no per-model EOSL date, EOSL.ai computes it from the
141
+ vendor's published support-life policy and labels it "computed".
142
+ - This plugin **reads** public data; it sends none of your inventory anywhere. The only outbound
143
+ requests fetch the public lookup table and the alias file.
144
+ - Confirm any critical date against the linked vendor bulletin before a purchase, renewal, or
145
+ migration decision.
146
+
147
+ ## License
148
+
149
+ Apache-2.0. See `LICENSE`.
150
+
151
+ ## Contributing / publishing
152
+
153
+ Issues and PRs welcome — especially additional vendor SKU aliases (see `FORTINET_PREFIX` in
154
+ `matching.py` for the pattern) and screenshots. Maintainers: see `PUBLISHING.md` for the
155
+ PyPI + NetBox-community release steps.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "netbox-eosl"
7
- version = "0.1.0"
7
+ version = "0.2.1"
8
8
  description = "Show source-backed hardware end-of-service-life status on NetBox Devices and Device Types, from EOSL.ai."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -73,3 +73,48 @@ def test_matching():
73
73
 
74
74
  if __name__ == "__main__":
75
75
  sys.exit(0 if run() else 1)
76
+
77
+
78
+ # ---- HISTORY §82: status bands, variant aliases, loose-key collisions -------------------------
79
+ def test_little_or_no_runway_is_risk():
80
+ """71% of parts carry this band; it used to fall through to the neutral style."""
81
+ assert matching.classify({"xb": "Little or no runway"})[0] == "risk"
82
+ assert matching.classify({"xb": "Action recommended"})[0] == "risk"
83
+ assert matching.classify({"xb": "Watch"})[0] == "watch"
84
+ assert matching.classify({"a": 1, "xb": "Current"})[0] == "active"
85
+
86
+
87
+ ALIAS_SKUS = SKUS + [
88
+ {"p": "EX4300-48T", "v": "Juniper", "f": "EX4300", "s": "juniper-ex4300", "eos": "2024-03", "eol": "2029-03", "xb": "Watch"},
89
+ {"p": "MX80-HW", "v": "Cisco Meraki", "f": "Cisco Meraki MX80", "s": "meraki-mx80", "eos": "2017-03", "eol": "2022-03", "xb": "Little or no runway"},
90
+ {"p": "GP-100", "v": "Palo Alto Networks", "f": "GlobalProtect", "s": "pa-gp-100", "xb": "Little or no runway"},
91
+ {"p": "GP100", "v": "Dell", "f": "Greenplum DCA", "s": "dell-greenplum", "xb": "Little or no runway"},
92
+ ]
93
+ ALIASES = {"open": {"EX430048TTAA": "EX4300-48T"}, "gated": {"MX80": "MX80-HW"}}
94
+
95
+
96
+ def _m(part, vendor):
97
+ exact, loose = matching.build_index(ALIAS_SKUS)
98
+ rec = matching.match(part, vendor, exact, loose, ALIASES)
99
+ return rec["p"] if rec else None
100
+
101
+
102
+ def test_variant_alias_open():
103
+ assert _m("EX4300-48T-TAA", "Juniper Networks") == "EX4300-48T"
104
+ assert _m("EX4300-48T-TAA", None) == "EX4300-48T"
105
+
106
+
107
+ def test_variant_alias_gated_needs_the_right_vendor():
108
+ assert _m("MX80", "Cisco") == "MX80-HW" # NetBox's library files Meraki under "Cisco"
109
+ assert _m("MX80", "Juniper") is None # a Juniper MX80 router is not a Meraki MX80
110
+ assert _m("MX80", None) is None
111
+
112
+
113
+ def test_loose_key_shared_by_two_families_does_not_resolve():
114
+ assert _m("GP-100", "Palo Alto Networks") == "GP-100" # exact still wins
115
+ assert _m("GP 100", None) is None # GP100 (Dell) vs GP-100 (Palo Alto)
116
+
117
+
118
+ def test_without_aliases_behaviour_is_unchanged():
119
+ exact, loose = matching.build_index(ALIAS_SKUS)
120
+ assert matching.match("EX4300-48T-TAA", "Juniper", exact, loose) is None
File without changes
File without changes