feat(network): 802.1Qcw YANG/NETCONF export of synthesized GCL (REQ-TSN-EXPORT-YANG-001)#293
Merged
Conversation
…SN-EXPORT-YANG-001) Add GateSchedule::to_qcw_yang(port_name) — serialize a synthesized 802.1Qbv gate schedule (the output of synthesize_gcl, REQ-TSN-SYNTH-QBV-BASE-001) as an ieee802-dot1q-sched (802.1Qcw) YANG instance document in NETCONF XML. This is the deployable artifact a TSN switch consumes via edit-config — completing the ingest→synthesize→EXPORT story a real TSN tool sells, not just a network-calculus bound. Each GateWindow maps to one <gate-control-entry> (operation-name=set-gate-states, time-interval-value = duration in ns, gate-states-value = the allowed-CoS bitmask, closed guard emits mask 0); the cycle maps to admin-cycle-time = cycle_ps/1e12 s. Hand-emitted XML, NO new dependency (the to_gcl_blob precedent); xml_escape guards the port name. Node structure follows the ieee802-dot1q-sched module (cross-checked against the published module text: no sgs-params wrapper, no admin-control-list-length leaf, gate-states-value a sibling of operation-name). The document is DELIBERATELY SIMPLIFIED and not yet schema-valid — the gate-parameter-table sits directly under interfaces/interface rather than the 802.1Qcw bridge-port mount, and operation-name uses a bare set-gate-states identityref with no module-prefixed value. No YANG validator was run; full pyang/yanglint validation (bridge-port mount + prefixed identityref) and a CQF/Qch export path are noted follow-ups, not claimed here. Self-certifying oracle (5 tests): pinned golden snapshot, one entry per window, Σ time-interval-value == cycle, mask fidelity incl. the closed guard, round-trip from a real synthesize_gcl output, and port-name escaping. 139 spar-network lib tests pass; mutants on the new code 4/4 caught. The kill-gate (premature without a synthesis target) is cleared by the v0.20.0 GateSchedule producer. REQ-TSN-EXPORT-YANG-001: proposed→implemented, pulled forward v0.21.0→v0.20.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rivet verification gate✅ 20/20 passed
Filter: Failed artifacts(none) Updated automatically by |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What
Adds
GateSchedule::to_qcw_yang(port_name) -> String— serializes a synthesized 802.1Qbv gate schedule (the output ofsynthesize_gcl, REQ-TSN-SYNTH-QBV-BASE-001) as anieee802-dot1q-sched(802.1Qcw) YANG instance document in NETCONF XML. This is the deployable artifact a TSN switch consumes viaedit-config— completing the ingest → synthesize → export story a real TSN tool sells (tsnkit/Slate/RTaW/PEGASE emit configs, not just bounds).Each
GateWindow→ one<gate-control-entry>(operation-name=set-gate-states,time-interval-value= duration ns,gate-states-value= allowed-CoS bitmask; closed guard emits mask 0). Cycle →admin-cycle-time=cycle_ps / 1e12s. Hand-emitted XML, no new dependency (theto_gcl_blobprecedent);xml_escapeguards the port name.Scope honesty
Node structure cross-checked against the published
ieee802-dot1q-schedmodule text (nosgs-paramswrapper, noadmin-control-list-lengthleaf,gate-states-valuea sibling ofoperation-name). The document is deliberately simplified and not yet schema-valid —gate-parameter-tablesits directly underinterfaces/interfacerather than the 802.1Qcw bridge-port mount, andoperation-nameuses a bareset-gate-statesidentityref. No YANG validator was run. Concrete follow-ups (not claimed here): the bridge-port mount + prefixed identityref to pass pyang/yanglint, and a CQF/Qch export path.The kill-gate ("premature if no synthesis target consumes the export") is cleared by the v0.20.0
GateScheduleproducer.Oracle (5 tests)
Pinned golden snapshot · one entry per window · Σ
time-interval-value== cycle · mask fidelity incl. the closed guard · round-trip from a realsynthesize_gcloutput · port-name escaping. 139 spar-network lib tests pass;cargo mutantson the new code: 4/4 caught, 0 survivors. fmt + clippy clean.Traceability
REQ-TSN-EXPORT-YANG-001:proposed → implemented, pulled forwardv0.21.0 → v0.20.0.TEST-TSN-EXPORT-YANGadded (satisfies).Falsification
If
to_qcw_yangemitted a document whose entry count, interval sum, or per-window masks diverged from the sourceGateSchedule, or drifted from the pinned golden snapshot, the oracle tests fail.🤖 Generated with Claude Code