Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Proposals
Proposals
Drafts
Proposed registers

OIP-0007: Universal connector contract and the Sparkplug binding

DRAFT Source oips/drafts/OIP-0007/OIP-0007.md

On this page
  1. Summary
  2. Requirements
  3. Patches
  4. Proposal text
  5. Draft folder
FieldValue
StatusDRAFT
Functionobserve (§5.5); no new function (the register keeps exactly twelve). A connector is part of Observe
Affects§4.2 (core objects), §5.5 (sub-list "Connectors", CON-1 to CON-10); new schemas connector-mapping and connector-output with fixtures both ways; registers/functions.yaml (observe objects); registers/relations.yaml (row EXT-MQTT gains schemas, profile and the binding folder); registers/implements-edges.json regenerated; new binding bindings/sparkplug/; schemas/asyncapi/obsp-field.asyncapi.yaml (three Sparkplug channels); new cases CT-NODE-071 to CT-NODE-075
Relates toOIP-0001 and OIP-0005 (no overlapping lines: every one of their patches still applies with these applied). An observed-property register (obsp:prop:<name>) is being proposed separately; this proposal uses only ids that match its pattern and does not create it
Last call30 days (revision of an existing function) unless the editors rule otherwise; see Open questions
Texton this page · OIP-0007.md · README.md

Summary

Section 5.5 says a node "MAY also speak LoRaWAN, OPC UA or vendor buses through a connector", and §6 names MQTT 5 with Sparkplug B as the field transport, but nothing says what a connector must do. Today a connector can turn a native message into an observation by any rule: it can invent a property name for a field…

Requirements

  • CON-1: Source identity. A connector MUST resolve the native identifier of every source (LoRaWAN DevEUI, OPC UA NodeId, LwM2M endpoint name, WIGOS station identifier, FDSN network, station, location and channel code, MMSI, ICAO 24-bit address, Sparkplug group, edge node and device) to an observer UNI through a signed ConnectorMapping. A message from a source the mapping does not resolve MUST NOT produce an observation.
  • CON-2: Platform class. The mapping MUST state for each source whether its platform is FIXED or MOBILE; a mobile platform MUST name its trajectory source.
  • CON-3: Fields. Every native field the connector converts MUST map to a registered observed property (obsp:prop:<name>) and a UCUM unit. A native field the mapping does not map MUST be carried in the output's extensions (obsp.unmapped) as received and MUST NOT be mapped to a property by guess.
  • CON-4: Quality. Native quality and status codes (for example Sparkplug quality properties, OPC UA status codes, QARTOD flags) MUST map to the quality flags of §5.6 by a table in the mapping. A code the table does not list, or a value with no native code, MUST NOT be flagged GOOD.
  • CON-5: Time source. The mapping MUST name the clock that stamped the values (DEVICE, GATEWAY, NETWORK_SERVER or CONNECTOR), and each observation MUST reference the TimeQuality of that clock (§5.4).
  • CON-6: Transport and codec. Every output MUST name the binding and its version, the payload codec and the digest of the decoder, and they MUST be those of the mapping it applied.
  • CON-7: Raw evidence. Every output MUST carry the digest of the native payload as received, its link metadata and any device signature with the result of checking it. The payload itself MUST be kept only when the mapping's policy allows it, as a NativeEnvelope.
  • CON-8: Connector as agent. A connector MUST sign its output and MUST appear in the output's provenance as the software agent of the activity that generated each observation (§5.6).
  • CON-9: Sequence. Where the native protocol carries a sequence number or counter, every output that produces observations MUST carry it, and a jump (modulo the counter's wrap) MUST produce a missing-data record naming the missing range. Nothing is filled in.
  • CON-10: Golden messages. A binding MUST publish golden native messages with their expected outputs both ways (messages a connector accepts, with the output it gives, and claimed outputs it must not give), and the mapping MUST list the golden messages it was tested against with their digests.

Patches

The edits acceptance would apply. They are in the protocol repository at the pinned commit and are not served on this site.

FileSize (bytes)
patches/binding-sparkplug.patch66995
patches/cases-invariants.patch24554
patches/registers.patch2204
patches/schemas-fixtures.patch127157
patches/spec.patch4193

Proposal text

Field Value
Status DRAFT
Function observe (§5.5); no new function (the register keeps exactly twelve). A connector is part of Observe
Affects §4.2 (core objects), §5.5 (sub-list “Connectors”, CON-1 to CON-10); new schemas connector-mapping and connector-output with fixtures both ways; registers/functions.yaml (observe objects); registers/relations.yaml (row EXT-MQTT gains schemas, profile and the binding folder); registers/implements-edges.json regenerated; new binding bindings/sparkplug/; schemas/asyncapi/obsp-field.asyncapi.yaml (three Sparkplug channels); new cases CT-NODE-071 to CT-NODE-075
Protocol version obsp/0.1
Relates to OIP-0001 and OIP-0005 (no overlapping lines: every one of their patches still applies with these applied). An observed-property register (obsp:prop:<name>) is being proposed separately; this proposal uses only ids that match its pattern and does not create it
Last call 30 days (revision of an existing function) unless the editors rule otherwise; see Open questions

Problem

Section 5.5 says a node “MAY also speak LoRaWAN, OPC UA or vendor buses through a connector”, and §6 names MQTT 5 with Sparkplug B as the field transport, but nothing says what a connector must do. Today a connector can turn a native message into an observation by any rule: it can invent a property name for a field it does not understand, call a value good when the source said nothing about its quality, stamp it with an unknown clock, drop a gap in the native sequence without trace, and leave no evidence of the bytes it decoded or of the decoder it used. A consumer then cannot tell a measured value from a guessed one, and a verifier cannot replay the translation.

Every field technology has its own identifier, quality, time and sequence conventions (LoRaWAN, OPC UA, LwM2M, WIGOS, FDSN, AIS, ADS-B, Sparkplug). The protocol must map to them, never replace them, and must hold every connector to the same contract so that the evidence chain of §5.6 does not break at the edge.

Change

Normative text (added to §5.5 as a sub-list “Connectors”)

A connector turns the native messages of a field technology into protocol records. It is part of Observe, not a function of its own. A connector is described by a signed ConnectorMapping and records what it made of each native message in a ConnectorOutput; a binding (bindings/<id>/) fixes the mapping for one technology. MQTT 5 with Sparkplug B, the field transport of §6, is carried by the binding bindings/sparkplug/.

  1. CON-1 Source identity. A connector MUST resolve the native identifier of every source (LoRaWAN DevEUI, OPC UA NodeId, LwM2M endpoint name, WIGOS station identifier, FDSN network, station, location and channel code, MMSI, ICAO 24-bit address, Sparkplug group, edge node and device) to an observer UNI through a signed ConnectorMapping. A message from a source the mapping does not resolve MUST NOT produce an observation.
  2. CON-2 Platform class. The mapping MUST state for each source whether its platform is FIXED or MOBILE; a mobile platform MUST name its trajectory source.
  3. CON-3 Fields. Every native field the connector converts MUST map to a registered observed property (obsp:prop:<name>) and a UCUM unit. A native field the mapping does not map MUST be carried in the output’s extensions (obsp.unmapped) as received and MUST NOT be mapped to a property by guess.
  4. CON-4 Quality. Native quality and status codes (for example Sparkplug quality properties, OPC UA status codes, QARTOD flags) MUST map to the quality flags of §5.6 by a table in the mapping. A code the table does not list, or a value with no native code, MUST NOT be flagged GOOD.
  5. CON-5 Time source. The mapping MUST name the clock that stamped the values (DEVICE, GATEWAY, NETWORK_SERVER or CONNECTOR), and each observation MUST reference the TimeQuality of that clock (§5.4).
  6. CON-6 Transport and codec. Every output MUST name the binding and its version, the payload codec and the digest of the decoder, and they MUST be those of the mapping it applied.
  7. CON-7 Raw evidence. Every output MUST carry the digest of the native payload as received, its link metadata and any device signature with the result of checking it. The payload itself MUST be kept only when the mapping’s policy allows it, as a NativeEnvelope.
  8. CON-8 Connector as agent. A connector MUST sign its output and MUST appear in the output’s provenance as the software agent of the activity that generated each observation (§5.6).
  9. CON-9 Sequence. Where the native protocol carries a sequence number or counter, every output that produces observations MUST carry it, and a jump (modulo the counter’s wrap) MUST produce a missing-data record naming the missing range. Nothing is filled in.
  10. CON-10 Golden messages. A binding MUST publish golden native messages with their expected outputs both ways (messages a connector accepts, with the output it gives, and claimed outputs it must not give), and the mapping MUST list the golden messages it was tested against with their digests.

§4.2: add the row “ConnectorMapping, ConnectorOutput | connector-mapping, connector-output | Observe”. §6 is not edited: its Data (field) row already names MQTT 5 with Sparkplug B and connectors; the new sub-list points at the binding. (OIP-0001 and OIP-0005 both edit the lines around that row; leaving it alone keeps the three proposals independent.)

Why two new schemas and not an extension of native-envelope

native-envelope already exists and is reused, not duplicated. It is the acquisition record of native content: source release, distribution, acquisition request, tenant and workspace, rights state, correction state and the storage object that holds the bytes. Those fields describe a retained payload, not a translation, and most of them have no value for a field message that is decoded and dropped. The connector contract needs two other things:

  • a mapping that is stable across millions of messages, versioned and signed once (CON-1 to CON-6, CON-9, CON-10): connector-mapping;
  • a per-message result that names that mapping version and records the translation (CON-3, CON-6 to CON-9): connector-output.

Extending native-envelope with the field map, quality table and per-message results would make every envelope carry the mapping again and would force acquisition fields onto messages that are never retained. Instead connector-output carries the payload digest always and, only when the mapping’s rawPolicy allows the payload to be kept, a nativeEnvelopeRef to the NativeEnvelope that holds it (CON-7). The two objects meet at that reference; neither repeats the other’s fields.

Contract: connector-mapping (schemaVersion 3.1.0)

Property Required Shape
schemaVersion, apiVersion, kind, protocolVersion yes 3.1.0, obsp/connector-mapping/v3.1, ConnectorMapping, obsp/0.1
mappingUni, version, issuedAt yes UNI, record version, date-time
issuer yes {role, uni} (protocol role, never a name)
binding yes {id, version} (binding folder id, semantic version)
codec yes {name, mediaType}
decoderDigest yes Digest
sources yes, min 1 {nativeId {scheme, value}, observerUni, sensorPassportRef?, platform {class FIXED or MOBILE, trajectorySource when MOBILE}}; schemes LORAWAN_DEVEUI, OPCUA_NODEID, LWM2M_ENDPOINT, WIGOS_STATION_ID, FDSN_NSLC, MMSI, ICAO_24BIT, SPARKPLUG (patterns for DevEUI, MMSI, ICAO and Sparkplug)
fields yes, min 1 {nativeField, observedProperty (^obsp:prop:[a-z0-9_]+$), unit (UCUM), resultType, conversion?}
quality yes {scheme SPARKPLUG_QUALITY, OPCUA_STATUS, QARTOD or NONE, nativeQualityField, testCode, testVersion, rows [{native, flag}], otherwise NOT_CHECKED or SUSPECT}
timeSource yes {stampedBy DEVICE, GATEWAY, NETWORK_SERVER or CONNECTOR, clockUni, nativeTimeField?}
sequence yes {scheme SPARKPLUG_SEQ, FRAME_COUNTER, MONOTONIC_COUNTER or NONE, modulo, scope}
rawPolicy yes {retainPayload, policyDigest}
goldens yes, min 2 {uri, digest, expect ACCEPT or REJECT}, at least one of each
signature yes as correction-notice
extensions no namespaced bag

Contract: connector-output (schemaVersion 3.1.0)

Property Required Shape
schemaVersion, apiVersion, kind, protocolVersion yes 3.1.0, obsp/connector-output/v3.1, ConnectorOutput, obsp/0.1
outputUni, receivedAt, recordedAt yes UNI, date-time
mappingRef yes {uni, version, digest} of the mapping applied
connector yes {agentUni, bindingId, bindingVersion, codec, decoderDigest}
source yes {nativeId {scheme, value}, observerUni}
native yes {messageType, channel?}
sequence when the mapping counts and the output has observations (invariant) {stream, value, reset}
raw yes {payloadDigest, payloadLength, retained, nativeEnvelopeRef (exactly when retained), link {transport, ...}, deviceSignature? {scheme, digest, checkResult}}
observations yes [{nativeField, observationRef {uni, digest}, nativeQuality?}]
missingData yes (may be empty) [{reason SEQUENCE_GAP, NODE_DEATH, DEVICE_DEATH or HOST_OFFLINE, observerUni, fromSequence, toSequence, count (for SEQUENCE_GAP), from, to}]
provenanceRef yes {uni, digest} of a provenance bundle
signature yes as correction-notice
extensions no namespaced bag; obsp.unmapped is [{nativeField, value, nativeType, reason NOT_IN_MAPPING, TRANSIENT or UNSUPPORTED_TYPE}]

Invariants (suite, sdk/python/src/obsp/conformance.py, unit tests in sdk/python/tests/test_obsp.py):

  • connector-mapping-resolves: the output names a mapping in the set by UNI, version and digest; its native id is in the mapping and resolves to the observer it states; binding id, version, codec and decoder digest are present and are the mapping’s; a mapping maps no native field and no native id twice.
  • connector-unmapped-not-in-result: every observation comes from a field the mapping maps, and the referenced observation record has the mapping’s property, unit and the resolved observer; an unmapped field is never in a result; a field marked NOT_IN_MAPPING is not one the mapping maps.
  • connector-quality-and-time: each observation carries the flag the quality table gives its native code (the otherwise flag when the code is absent or unlisted) with the table’s test code and version, and references a TimeQuality of the clock the mapping names.
  • connector-evidence-and-agent: a payload is retained only where the policy allows; the provenance bundle names the connector as a software agent associated with the activity that generated every observation.
  • connector-sequence-gaps: on each counted stream, a jump modulo the wrap is answered by exactly one SEQUENCE_GAP record naming the missing range; no gap record where there is no gap; a reset (Sparkplug NBIRTH) restarts the count.

Binding bindings/sparkplug/ (status proposed)

PROFILE.md, binding.yaml (requirements BND-SPARKPLUG-01 to -15), the artefacts mapping.yaml (topics, payload and metric elements, datatypes and elements not mapped, each with its clause of Sparkplug 3.0.0 / ISO/IEC 20237:2023, every clause checked: not checked) and connector-mapping.json (a connector-mapping record with the golden digests), four positive and six negative examples (JSON renderings of decoded Sparkplug payloads with their expected outputs), and tests/test_sparkplug_binding.py, which derives each positive example’s expected output from the message and the mapping, shows that each negative example breaks exactly the requirement it names, and checks the golden digests. The binding covers the topic namespace spBv1.0/<group_id>/<message_type>/<edge_node_id>[/<device_id>], NBIRTH, NDATA, DBIRTH and DDATA (converted), NDEATH and DDEATH (missing-data records; NDEATH only when its bdSeq matches the current NBIRTH), STATE (never converted), NCMD and DCMD (never published but for a rebirth request the policy allows), metric datatypes to result types, the quality property, seq 0 to 255 with wrap per edge node, and is_null, is_transient and is_historical.

Registers

  • registers/functions.yaml: observe objects gain connector-mapping and connector-output.
  • registers/relations.yaml: the existing row EXT-MQTT (“MQTT 5 and Sparkplug B”) gains the Sparkplug edition, the schemas, the profile OBSP-NODE and artefacts: [bindings/sparkplug/]. A separate row was not added: the edge count of implements-edges.json would change and conflict with OIP-0005, and the existing row already states the relation. implements-edges.json is regenerated (41 edges, unchanged count).

AsyncAPI reconciliation

schemas/asyncapi/obsp-field.asyncapi.yaml already reads NBIRTH, NDEATH, DBIRTH and DDATA on spBv1.0/... and says the node maps Sparkplug telemetry to ObservationRecord. Nothing in it is contradicted. The binding patch adds what the binding reads and the contract lacked: the channels sparkplugNodeData (NDATA), sparkplugDeviceDeath (DDEATH) and sparkplugHostState (spBv1.0/STATE/{hostId}, with the parameter hostId and a JSON payload {online, timestamp}), their receive operations, a note in the description that the mapping is bindings/sparkplug/ and that the connector publishes no NCMD or DCMD, and x-obsp-mapping on the Sparkplug payload message. NCMD and DCMD stay out of the contract.

Compatibility

Additive: two new objects, a new binding, three new AsyncAPI channels and new cases. No existing document changes meaning. observe gains two objects. The OBSP-NODE example set gains the connector records; the OBSP-NODE negative set gains them too and fails one more case (CT-NODE-072, because its time quality is missing), and the SDK test that lists the failing cases is updated. tests/test_validate.py checks the demo binding alone (the shipped bindings are removed from its copy), so it no longer depends on how many bindings ship.

Tests

Requirement Case Kind
CON-1, CON-2, CON-3, CON-6 CT-NODE-071 schema + invariants connector-mapping-resolves, connector-unmapped-not-in-result
CON-4, CON-5 CT-NODE-072 invariant connector-quality-and-time (with time-quality)
CON-7, CON-8 CT-NODE-073 invariant connector-evidence-and-agent (with provenance)
CON-9 CT-NODE-074 invariant connector-sequence-gaps
CON-10 CT-NODE-075 manual (golden messages both ways; no command published), attested in the OBSP-NODE example set
BND-SPARKPLUG-01 to -15 CT-NODE-071 to CT-NODE-075 binding examples (validator group bindings, tests/test_sparkplug_binding.py)

The case numbers 071 to 075 leave the numbers below free for other drafts that add OBSP-NODE cases at the same time.

Positive fixtures: connector-mapping.sparkplug.valid, connector-mapping.mobile.valid (an MMSI source on a mobile platform, no quality scheme, no sequence), connector-output.valid, connector-output.sequence-gap.valid.

Negative fixtures, one broken rule each: connector-mapping.missing-decoder-digest (CON-6), .unregistered-property-id (CON-3), .non-ucum-unit (CON-3), .mobile-without-trajectory (CON-2), .goldens-accept-only (CON-10), .quality-otherwise-good (CON-4), .unknown-native-scheme (CON-1), .unsigned (CON-1); connector-output.missing-decoder-digest (CON-6), .missing-payload-digest (CON-7), .retained-without-native-envelope (CON-7), .unsigned (CON-8), .sequence-gap-without-range (CON-9), .unmapped-field-at-top-level (CON-3). Rules JSON Schema cannot express (unmapped field never in a result, sequence gap yields a record, decoder digest equal to the mapping’s, quality by table, time from the named clock, connector in provenance) are invariants with unit tests that fail on one broken input each.

Open questions

  1. Sparkplug edition: is ISO/IEC 20237:2023 the same text as Sparkplug 3.0.0, and are the section numbers cited in the binding right? Not checked against the published texts.
  2. Observed property register: the ids used (obsp:prop:air_temperature, obsp:prop:relative_humidity) follow the pattern of the register proposed separately; CON-3 says “registered”, and a suite check that each id is in that register can only be added once it exists.
  3. Source quality as a test: a flag set from a native quality code is written with the local test code LOCAL.sparkplug.SOURCE_QUALITY. Should the controlled test-code vocabulary of quality-flag gain a code for “quality reported by the source” instead?
  4. Int64 and UInt64 values beyond 2^53: string results, or a typed big-integer result?
  5. Profiles: the connector cases apply to OBSP-NODE. A node that speaks the protocol natively has no connector, and the suite has no way yet to mark invariant cases not applicable; should the cases move to an optional connector overlay, like OBSP-SOV?
  6. Rebirth requests: may a connector ask an edge node to rebirth after a gap (a command on the field plane), and under which receipted policy (P4)?
  7. Native identifier schemes: the list is closed. Further schemes (for example a DOI-based dataset id or a vendor bus address) would each need an OIP; is that the intended weight?
  8. Last call: revision (30 days) or new capability (90 days)?

Acceptance needs appointed editors and a last-call window. Until then this proposal stays at DRAFT and no connector object exists in the protocol.

Draft folder

The proposal and, under patches/, the exact edits acceptance would make. Nothing here changes the protocol until the editors accept the proposal and its patches are applied in the same change. The patches are made against the current tree and touch no line that OIP-0001 or OIP-0005 edits or uses as context, so every patch of those drafts still applies with these applied.

File What it changes on acceptance
OIP-0007.md the proposal
patches/spec.patch §4.2 row connector-mapping, connector-output; §5.5 sub-list “Connectors” (CON-1 to CON-10)
patches/schemas-fixtures.patch connector-mapping and connector-output schemas; four positive and fourteen negative fixtures; the connector records (mapping, two outputs, three observation records, provenance) in the OBSP-NODE example set and in its negative set, whose README says so
patches/cases-invariants.patch invariants connector-mapping-resolves, connector-unmapped-not-in-result, connector-quality-and-time, connector-evidence-and-agent, connector-sequence-gaps with unit tests; cases CT-NODE-071 to CT-NODE-075 and the attestation for the manual case; the SDK test that lists the failing cases of the negative set
patches/binding-sparkplug.patch bindings/sparkplug/ (profile, manifest, mapping.yaml, connector-mapping.json, four positive and six negative examples), tests/test_sparkplug_binding.py, the AsyncAPI channels NDATA, DDEATH and STATE, and the demo-binding helper of tests/test_validate.py made independent of the shipped bindings
patches/registers.patch observe objects gain connector-mapping and connector-output; row EXT-MQTT gains schemas, profile and artefacts: [bindings/sparkplug/]; implements-edges.json regenerated (41 edges)

Apply all five patches together (in any order): the registers name the schemas and the binding folder, and the binding names the cases. Acceptance removes patches/.

Check that every patch still applies to the current tree: python3 -m unittest tests.test_validate -k draft_patches.