Repository navigation
Add cloud-controlled key rotation via download/blobset - #1512
Draft
khyatimahendru wants to merge 37 commits into
Draft
khyatimahendru wants to merge 37 commits into
khyatimahendru wants to merge 37 commits into
Conversation
…Upload - Add schema/upload_discovery.json defining DiscoveryUpload and ScanManifest for chunked packet capture streaming over upload/discovery. - Add 'upload' to SubType enum in schema/envelope.json and remove legacy schema/events_streams.json. - Regenerate Java and Python schema classes, HTML documentation, and .gencode_hash.txt. - Add schema validation fixtures under tests/schemas/upload_discovery/ and document depth: 'trace' in docs/specs/discovery.md and docs/specs/discovery_bacnet.md. - Ensure deterministic device ID ordering in SiteModel.getDeviceIds().
…entlib - Add --upload_pubsub_topic_id support in MqttToPubSubBridge to route subType='upload' messages to a dedicated Pub/Sub publisher with graceful shutdown draining. - Register uufi_upload flow in UdmiServicePod and udmis/etc/local_pod.json for local upload/# pass-through. - Add publish_upload helper to clientlib BaseManager and include upload/# in MessageConnection default subscribe topics. - Add unit tests in MqttToPubSubBridgeTest covering upload publisher routing and shutdown.
- Add PcapUploadHandler to reassemble gzip-compressed upload/discovery chunks in order, verify terminal SHA-256 digests, and archive .pcap and scan_manifest.json artifacts to GCS or local disk. - Exclude subType='upload' messages from RawFallbackHandler so raw PCAP chunks are never persisted in udmi_messages. - Add udmi_pcap_captures table in PostgresManager to track capture lifecycle metadata and URIs. - Add trigger_bacnet_trace and get_pcap_capture tools across Butler discovery, ButlerProvider, ButlerMcpServer, and ButlerClient with unit tests and schema docs.
…CAP streaming
- Enforce strict UDMI discovery depth compliance ('buckets', 'entries', 'system', 'details', 'trace') across Spotter providers and fail fast on non-canonical legacy depths.
- Emit canonical '<TYPE>/<INSTANCE>' BACnet refs, hyphenated object types and ancillary keys, explicit families.ipv4.port (47808), ARP-resolved families.ethmac, and routed MS/TP '<net>:<mac>' bindings.
- Decode BACnet/IP BVLL Forwarded-NPDU real controller IPs/ports behind BBMDs, NPDU SNET/SADR MS/TP headers, and I-Am-Router-To-Network DNET lists in PassiveFamilyProvider.
- Implement raw-socket (SOCK_RAW) BACnet Who-Is and Who-Is-Router-To-Network discovery rounds during depth: 'trace' without binding UDP 47808, and stream gzipped DiscoveryUpload chunks with SHA-256 and ScanManifest over upload/discovery.
- Update reassemble_pcap, compare_field_parity, Spotter documentation, and unit/integration test suites.
…odel - Lazily initialize Google Cloud Storage client in PcapUploadHandler._upload_to_gcs when BUTLER_PCAP_GCS_BUCKET is set and require sha256 on terminal EOF markers. - Guard SpotterDiscoveryManager against superseded scan generation races when active scans are cancelled or replaced. - Preserve BACnet I-Am enrichment and routed MS/TP re-emission across passive_sec holdoff intervals and bound I-Am-Router-To-Network parsing by bvlc_len. - Issue per-range BACnet Who-Is discovery calls instead of collapsing disjoint addrs ranges and validate Nmap target specifications. - Collect sorted device IDs into LinkedHashSet in SiteModel.getDeviceIds() and require connection spec in ButlerProvider.trigger_bacnet_trace.
- Wrap 101-character gracefulShutdown call in MqttToPubSubBridge.java to satisfy Checkstyle LineLength (<= 100 chars). - Code-quote protocol and compression terms (BVLL, BBMD, NPDU, MS/TP, DNET, gzip) in docs/specs/discovery.md, docs/specs/discovery_bacnet.md, and docs/tools/spotter.md for Docs Spelling Checks.
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
…it interface, exclude_capture_host, and I-Am manifest counts
…ad_discovery.scan
…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)
…r-named-scans-parity)
…otter-named-scans-parity
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds cloud-controlled credential and private key rotation over the ephemeral
download/blobsetchannel (download://_iot_endpoint_config), allowing the cloud to provision rotated credentials orPEMprivate keys without retaining secret material inconfigor relying on heterogeneous edge device key generation.Depends on #1511
Key changes in this PR:
schema/download_blobset.json,schema/configuration_endpoint.json,schema/envelope.json,docs/specs/blob_updates.md): AddsBlobsetDownload, addsdownloadtoEnvelope.subType, and extendsEndpointConfigurationwithexpiry(date-time) and ephemeralkey_bytes(PEMprivate key material delivered over non-retained QoS 0download/blobset).clientlib& Spotter (clientlib/python/src/udmi/core/{device.py,messaging/mqtt_messaging_client.py}): Subscribes todownload/#at MQTT QoS 0, handlesconfig.blobset.blobs._iot_endpoint_configdownload://URLs (phase: "apply"->download/blobset-> canonical JSON SHA-256 andexpiryvalidation -> atomic0600key file rotation with.bakbackup andkey_bytesstripping before persistence ->phase: "final"and connection reset), rejecting SHA-256 mismatches or expired payloads with status500.edge/spotter/tests/test_key_rotation.py,tests/schemas/download_blobset/): Covers QoS 0 subscription, happy-path private key rotation (permissions, backup, secret stripping), SHA-256 mismatch rejection, and expired credential rejection.Verification
edge/spotter/bin/run_spotter_tests unit— 106 unit tests + 3 self-tests passed (exit 0)bin/gencode check— schema/code/docs/presentation hashes verified (exit 0)bin/test_schema— schema fixture validation passed (exit 0)bin/test_generated_classes_py— passed (exit 0)pylint --rcfile=pyproject.toml src/udmi/core/device.py src/udmi/core/messaging/mqtt_messaging_client.py— 10.00/10 (exit 0)PR Stack
named-scansspotter-implspotter-named-scans-parityspotter-key-rotationdownload/blobsetAuthor Declaration
Pull request created by Gemini