Repository navigation
Add support for named discovery scans - #1498
Conversation
Allow discovery configurations to define multiple independent scan schedules (such as concurrent periodic and on-demand scans, or distinct scans targeting the same protocol family) under `config.discovery.scans.<scan>`, reporting per-scan status in `state.discovery.scans.<scan>` and attributing emitted events via `scan` in `events_discovery`. Named scans declare their target protocol via `family` in `config_discovery_family`, while legacy `config.discovery.families.<family>` entries preserve implicit key-based targeting and reject mismatched `family` overrides. `DiscoveryManager` coordinates both legacy family scans and named scans across shared protocol providers with mutual exclusion, preemption, and retry backoff.
Define named scans as a standalone primary mechanism in the discovery specs, schemas, and examples rather than framing them relative to legacy `families`. Extract scan scheduling into a concrete scheduler with FIFO deferral for busy sporadic scans, periodic retry semantics without implicit start-time fallback, and non-blocking host state locking so provider callbacks cannot deadlock `stopScan()` during config updates.
# Conflicts: # .gencode_hash.txt
Replace host-level lock hooks with a single-monitor outbox in DiscoveryScheduler and streamline DiscoveryManagerTest around behavioral coverage. Simplify periodic scheduling to target the next upcoming grid slot and skip busy periodic slots without emitting error noise, keeping the discovery spec and schema aligned.
# Conflicts: # .gencode_hash.txt # gencode/java/udmi/schema/DiscoveryEvents.java # gencode/python/udmi/schema/events_discovery.py
…scans Introduce a dedicated schema/config_discovery_scan.json (ScanDiscoveryConfig) with required family for discovery.scans.<name>, remove family from schema/config_discovery_family.json so legacy discovery.families.<family> statically forbids it, regenerate Java/Python/HTML bindings, and update DiscoveryScheduler, DiscoverySequences, DiscoveryManagerTest, and schema error fixtures.
# Conflicts: # .gencode_hash.txt
…etsdn#1498 (FamilyDiscoveryConfig)
# Conflicts: # .gencode_hash.txt # gencode/java/udmi/schema/DiscoveryConfig.java
| "family": { | ||
| "existingJavaType": "String" | ||
| }, | ||
| "scan": { |
There was a problem hiding this comment.
and/or we should consider the envelope subSetKey attribute from the config proposals. If that were to exist, and be set to this same value, would we still need/want this? It's necessary information, I'm just wondering if we should go that route out of the gate instead of adding this field here.
I'm going to have the same consideration with the alarms proposal, so would be good to conceptually align on how we want to do it to have some modicum of consistency across features.
There was a problem hiding this comment.
For device-originated discovery scans, we would still need scan in the payload: MQTT devices don't have access to envelope attributes like subSetKey -- they only publish to /devices/{device_id}/events/discovery -- which is the same reason family and generation already live in events_discovery.json.
That said, event.scan and envelope.subSetKey have the same regex pattern, so a UDMIS processor can project event.scan into envelope.subSetKey downstream for Pub/Sub routing & filtering if we want consistent envelope-level routing across named scans and alarms. Happy to align in a follow-up!
|
No worries, all good. Also, I _think_ a topic can be something like
events/discovery/<key> if we wanted, there's no reason that attribute
(subFolder) has to be one word, and so we theoretically could break that
out into subSetKey later. Not saying it's necessarily a good idea just that
I think it'd actually work (that's what MQTT does, I think)
…On Tue, Dec 1, 2026 at 8:58 AM Khyati Mahendru ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In schema/events_discovery.json
<#1498 (comment)>:
> @@ -29,6 +29,11 @@
"family": {
"existingJavaType": "String"
},
+ "scan": {
For device-originated discovery scans, we would still need scan in the
payload: MQTT devices don't have access to envelope attributes like
subSetKey -- they only publish to /devices/{device_id}/events/discovery --
which is the same reason family and generation already live in
events_discovery.json.
That said, event.scan and envelope.subSetKey have the same regex pattern,
so a UDMIS processor can project event.scan into envelope.subSetKey
downstream for Pub/Sub routing & filtering if we want consistent
envelope-level routing across named scans and alarms. Happy to align in a
follow-up!
—
Reply to this email directly, view it on GitHub
<#1498?email_source=notifications&email_token=AAIEPD227NWUN2K6OMNVWVD5332DDA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMJTGU4TONBYGEZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#discussion_r4757779212>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIEPDYG3DXISCGAJ7E6UDT5332DDAVCNFSNUABFKJSXA33TNF2G64TZHMZDONBTGAZTEMRQHNEXG43VMU5TMNJQHAYDOMZRGAZ2C5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAIEPDY5HIZ2X65V7YM7HML5332DDA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMJTGU4TONBYGEZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AAIEPD7IWJB75BTX6QXYFWT5332DDA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMJTGU4TONBYGEZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
<faucetsdn/udmi/pull/1498/review/6135974812 ***@***.***>
|
…otter-named-scans-parity
Summary
Adds UDMI support for named discovery scans (building on #1449) so devices can run multiple independently scheduled scans of the same protocol family—such as a nightly periodic scan alongside an on-demand targeted scan—without colliding on a single
config.discovery.families.<family>key.Covers schemas, specs, generated bindings/docs, Java
pubber, and thevalidator/sequencertest suite (scan_named). Pythonclientlibandedge/spotteradoption will follow in a separate PR.Key Changes
scansmaps toconfig_discovery.jsonandstate_discovery.json,familytoconfig_discovery_family.json(keeping a single sharedFamilyDiscoveryConfigschema acrossfamiliesandscans), andscantoevents_discovery.json, with updated specs indocs/specs/discovery*.mdand regenerated bindings/fixtures (bin/gencode).DiscoverySchedulerto run named and legacy scans with per-family mutual exclusion—sporadic scans defer FIFO inpendingwhen busy, while periodic scans target the next upcoming grid slot and skip busy slots without error noise.scans.<name>entries require a supportedfamily; legacyfamilies.<family>entries reject explicitfamilyfields; negative intervals/durations andnulladdresses reportphase: stopped(level: 500) until corrected.familiesNotes (@grafnu): Periodic scans now require a non-nullgeneration(omitting it terminates the loop) and schedule the next upcoming grid slot without past-slot catch-up; non-scan-capable providers (ipv4/ipv6/ether) are skipped cleanly instead of throwing.scan_named(ALPHA) covering error reporting, recovery,event.scanattribution, and state cleanup.Testing
Verified at commit
8458ae13a(after unifyingFamilyDiscoveryConfigand mergingupstream/master):bin/gencode check&PYTHONPATH=gencode/python python3 bin/test_generated_classes.py— passed (exit 0)pubber/bin/build check(105 tests, 18 inDiscoveryManagerTest),validator/bin/build check,udmis/bin/build check(243 tests) — all passed with Checkstyle clean (exit 0)bin/test_schema&bin/test_trace simple— passed (exit 0)Author Declaration
Pull request created by Gemini