Skip to content

Layered config phase 7: QoS layered, its cosMapping flag warned of, and QoS checked against the composed module - #13

Merged
nbarrett-anet merged 11 commits into
mainfrom
intent-refactor-08
Nov 25, 2026
Merged

nbarrett-anet merged 11 commits into
mainfrom
intent-refactor-08

Conversation

@nbarrett-anet

@nbarrett-anet nbarrett-anet commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

QoS is the second module converted to layered configuration, on the same terms as the firewall:

  • On an edge, each module value and each segment's cosMapping is owned. It is either inherited from the profile or the edge's own.
  • A segment's rules add the edge's entries to the profile's.
  • state.effective.qos shows what the edge uses and where each value comes from.
  • compare_effective checks QoS against the VCO's composed module.

QoS models

  • QosData[L], QosSegment[L] and QosConfigurationModule[L] are typed by layer. The module rows and the composed read are typed per layer too.
  • Module values:
    • serviceRateLimit and qoe are Inheritable by presence: the edge stores the key or inherits it. A value neither layer stores shows the profile template's display default.
    • qosClientConnector is Inheritable, with display default None.
  • A segment's cosMapping is Inheritable with its override flag (ByFlag("override", presence_wins=True)). This follows the VCO's rule: an edge object that is present wins whatever its flag.
  • Lists:
    • A segment's rules are Additive: the edge's entries come ahead of the profile's.
    • defaults are ProfileOnly: an edge segment holds none, and a write keeps the raw ones.
  • webProxy is Unconverted.
  • A rule's SLA writes the VCO's lossPct key, not loss_pct. Before this fix, a new or edited rule was written with the wrong key.

Ownership (pyvelo.core)

  • Segment placeholders. A segment the edge doesn't store yet, created after load (by a patch or segment()), is bound to the profile's segment, so its values inherit and can be localized. bind_new_item and bind_profile_layers are shared with the firewall.
  • Server IDs. A value made local from the profile carries no server-assigned ID, even inside an Owned or a field kind (clear_server_owned now descends into both).
  • localize() under presence_wins. When the edge already stores the object with its flag off, localize() keeps that object and turns the flag on. It no longer copies the profile's. A patch into such an object changes only what it names.
  • Refused patches:
    • A patch that names a ByFlag flag key is refused. The message names set_local() / inherit() and gives the JSON patch that inherits.
    • An edge patch on a ProfileOnly field such as defaults is refused with PatchError.
  • effective_dump leaves out a profile-only field the profile doesn't store, where it used to crash.

Plan warnings

plan() gives a PlanWarning("flag_off_in_use", ...) for an edge cosMapping whose flag is false or absent, since the VCO uses that object anyway. The warning gives both ways out:

  • inherit: null;
  • keep: localize(), or {"segments": {"Voice": {"cosMapping": {}}}}.

An unrelated edit keeps the warning.

compare_effective

  • The converted modules are ("firewall", "QOS"). QoS has no unmodelled keys.
  • Security objects are read only for the firewall, as the security keys belong to its rules.

Testing support

ModuleStore.add_configuration raises ValueError for a module ID that another configuration already holds.

Behaviour changes

  • QoS values on an edge are Owned. Reading one gives .stored / .local / .is_local. state.effective.qos.<field>.value is what the edge uses.
  • A patch on an inherited QoS value copies the profile's value (or the display default) and applies the edit.
  • CosMapping.override is no longer set directly. Use set_local() / inherit() / localize(), or a patch.
  • An edge patch of a segment's defaults raises PatchError.

Known gaps (follow-ups)

  • Waiting on a design decision: localize() under presence_wins keeps the stored edge object. This assumes "the value the effective view would show" governs, not "the profile value". Device settings will need the same answer.
  • Not yet checked on a live edge:
    • An edge-stored null qosClientConnector. No layer on the test VCO stores one, so the null-over-profile reading is pinned only by a unit test.
    • The vlan_type / vlanType wire key. None of 115 stored rules carries either key, so the key is unchanged.
    • QosClientConnector is still a loose model.
  • Stale docstrings. A few docstrings still say localize() always copies from the profile.
  • Carried to the next phase:
    • Pickling a ByFlag(inherit_as=<lambda>) edge layer.
    • same_state compares each side at its own level.
    • Secret detection below a dict[K, Model].

Test plan

  • scripts/check.sh on Python 3.13 (the supported floor, as in CI): ruff clean, basedpyright 0 errors, pytest 6793 passed / 2 skipped.
  • The suite again in a freshly synced venv: it passed (exit 0).
  • Live, read-only: compare_effective on the test VCO's edges with a profile gives 0 QoS findings, down from 6 before the lossPct fix.
  • Seven tasks, each with a review and fix rounds, then a whole-branch review, a fix wave and a scoped re-review.
  • The live write suite has not been run on this branch.

@nbarrett-anet
nbarrett-anet added this pull request to stack #7 November 25, 2026 01:50
@nbarrett-anet nbarrett-anet changed the title intent refactor 08 Layered config phase 7: QoS layered, its cosMapping flag warned of, and QoS checked against the composed module Nov 25, 2026
@nbarrett-anet
nbarrett-anet force-pushed the intent-refactor-08 branch 6 times, most recently from 653ce3b to 83a5698 Compare November 25, 2026 03:43
Base automatically changed from intent-refactor-07 to main November 25, 2026 03:46
…e's segment, and a copy made local carries no server ID inside a kind or an Owned
… local, rules are additive and defaults the profile's, with the template's display defaults
…nherits, and effective_dump leaves out a field its layer lacks
… and the warning gives the patch that keeps it

Owned.localize on a present edge object whose flag is off or absent, at a
field the backend composer reads by presence, turns its flag on and changes
no value, so a patch into it changes only what it names. The flag_off_in_use
message says the flag may be absent and gives the keep patch beside localize().
…olds, and QoS pins an edge's null client connector over a profile block
@nbarrett-anet
nbarrett-anet merged commit 51ce7ba into main Nov 25, 2026
3 checks passed
@nbarrett-anet
nbarrett-anet deleted the intent-refactor-08 branch November 25, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant