Skip to content

Layered config phase 6: layer typing and ownership, the firewall layered, and an effective view checked against the composed modules - #12

Merged
nbarrett-anet merged 33 commits into
mainfrom
intent-refactor-07
Nov 25, 2026
Merged

nbarrett-anet merged 33 commits into
mainfrom
intent-refactor-07

Conversation

@nbarrett-anet

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

Copy link
Copy Markdown
Collaborator

Summary

Configuration models are now typed by layer: an edge's own values, a profile's values, what the edge uses (the effective view) and what the VCO composes for the edge are distinct types. The firewall is the first module converted. Each of its module-level values on an edge is owned, inherited or local, and a patch on an inherited value starts from what the profile has. state.effective shows every value the edge uses with where it comes from, and pipeline.compare_effective(state) checks that view against the VCO's composed modules.

Layers and ownership (pyvelo.core)

  • Layer-parametrized models. Layered[L] with L one of Edge, Profile, Effective, Composed. A field declares its kind: Inheritable, EdgeOnly, ProfileOnly, Additive or Unconverted. field_kind() is the one place that reads a kind; the field readers, the merge engine and the save computation see through it. kind_default() gives defaults for non-Inheritable fields.
  • Owned[T] is an edge's hold on an inheritable value: stored, is_local, local, and the intents set_local, inherit, localize. The encodings are ByPresence (the edge stores the key or inherits) and ByFlag (an override flag). An Owned or a Resolved in a condition raises TypeError, naming what to read instead, because an object is always true.
  • Coupled groups. MemberOf / OwnedGroup / GroupHandle: the members of a group change owner together. An edit through one member that would split the group raises GroupOwnershipError, with the patch form to send instead.
  • The effective view. effective_view and effective_dump give each value as a Resolved with its origin (EDGE, PROFILE or FACTORY, a display default) and its source.
  • A field validator that would see an Owned is refused at class creation. model_copy refuses an update that would replace who owns an edge value. A constructed profile or composed model reads a missing Inheritable as its display default.

The firewall

  • FirewallData[L] and its segments, rules and services are layered. The module-level values have no flag: the edge stores a key or inherits it. They fall into three groups (stateful, network_protection, atp), and the profile template's display defaults fill values neither layer stores.
  • A patch on an inherited value copies the profile's value (or the display default) and applies the edit, so the whole value becomes the edge's own and shows in plan(). null makes the edge inherit again. A value made local from the profile carries none of the profile's server-assigned IDs (ruleLogicalId).
  • An outbound rule models hostedLoggingEnabled and syslogForwardingEnabled (absent unless read or set).
  • The outbound match writes the VCO's vlan_type key, not vlanType.

Configuration reads and writes

  • Containers, module rows and the composed read are typed per layer. get_configuration returns the layer's type. get_configuration_modules(..., layer=) reads the composed modules.
  • A firewall insert that asks for its row back must name the layer, and is refused before it is sent if it doesn't. An update answered with a row it cannot read raises LayerUnknownError, which carries the row.

compare_effective

  • It reads edge/getEdgeConfigurationModules for the converted modules (the firewall), reads the profile again so a profile change since the load is not a finding, and compares by wire path and value.

  • Six categories, three of them findings: differs, client_only, server_only (findings); factory, ignored, unconverted (information). Segments the composer omits (not in use on the edge) are ignored with that reason. Secrets are ignored and shown as ***. A module the VCO composes as null raises ComposedModuleError.

  • Composer security keys are confirmed, not ignored. When a rule names a security service group, the composer adds urlCategoryFiltering, urlReputationFiltering and atp_action. compare_effective reads the enterprise's security objects (four enterprise/getSecurityObjects reads, only when a rule names a group) and expects:

    • the two URL keys: the data of the objects the group names;
    • atp_action: built from the group's IDPS object.

    A missing group or object puts its reason on the affected key only.

  • EFFECTIVE_IGNORES is empty.

Behaviour changes

  • Firewall values on an edge are Owned, so reading one gives .stored / .local / .is_local, not the bare value. state.effective.firewall.<field>.value is what the edge uses.
  • A patch on an inherited firewall value now copies the profile's value into the edge (and into the insert, for an edge with no firewall row) instead of starting empty.
  • A patch that would split a coupled group's ownership raises GroupOwnershipError.
  • New exceptions: GroupOwnershipError, ComposedModuleError, LayerUnknownError.
  • make_firewall_module and make_firewall_segment build an edge-layer object unless given layer=Profile.
  • compare_effective sends no encryptKeys, which the VCO may refuse.
  • compare_effective needs read access to security objects on edges whose rules name a group.

Known gaps (follow-ups)

  • Unconverted firewall parts: inbound, inboundV6, a segment's firewall_logging_enabled and etm. The comparison reports them as unconverted.
  • Assumptions resting on one sample:
    • atp_enabled is true whenever the group names an IDPS object.
    • No expectation exists for a maliciousIpFiltering object, since none was seen; a key the composer adds for one shows as server_only.
  • Security objects are read once per edge. A whole-VCO audit should read them once per enterprise; that needs a security_objects= argument once a bulk caller exists.
  • The security-key check isn't limited to the firewall. It must be gated on the firewall module when QoS converts.
  • Carried to the next phase:
    • clear_server_owned does not descend into an Owned.
    • An edge layer with a ByFlag(inherit_as=<lambda>) does not pickle.
    • same_state compares each side at its own level.
    • Secret detection below a dict[K, Model] in the comparison.
    • QoS vlan_type.
    • Segment-placeholder binding.
    • A plan warning for presence_wins.
  • Encrypted secrets. Values prefixed {ENCRYPTED} need a short design (an opt-in decrypt through enterprise/decodeEnterpriseKey, kept out of plans and errors) before device settings or WAN convert. The firewall holds none.

Test plan

  • scripts/check.sh on Python 3.14: ruff clean, basedpyright 0 errors, pytest 6717 passed / 2 skipped.
  • The same suite on Python 3.13: it passed (exit 0).
  • Live, read-only: compare_effective on the lab's edges with a profile gives 0 findings, with an empty ignore list (tests/integration/test_effective_live.py).
  • Eleven tasks and a two-task follow-up, each with a review and fix rounds, then whole-branch reviews, fix waves and scoped re-reviews.
  • The live write suite has not been run on this branch.

@nbarrett-anet
nbarrett-anet added this pull request to stack #7 November 24, 2026 22:50
@nbarrett-anet nbarrett-anet changed the title intent refactor 07 Layered config phase 6: layer typing and ownership, the firewall layered, and an effective view checked against the composed modules Nov 24, 2026
@nbarrett-anet
nbarrett-anet force-pushed the intent-refactor-07 branch 5 times, most recently from 81bddfd to aa8b5cb Compare November 25, 2026 03:38
Base automatically changed from intent-refactor-06 to main November 25, 2026 03:43
…d per layer; the firewall models are layered
… coupled groups, with the profile template's display defaults
…empty list is equal only where the view builds it
@nbarrett-anet
nbarrett-anet merged commit 000e5a5 into main Nov 25, 2026
3 checks passed
@nbarrett-anet
nbarrett-anet deleted the intent-refactor-07 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