Skip to content

Cover Enterprise SONiC tables in the YANG model set #2258

@berendt

Description

@berendt

Background

The SONiC ConfigDB validator (osism/tasks/conductor/sonic/validator.py) generates Pydantic schemas from the YANG models shipped in files/sonic/yang_models/. That directory currently mirrors the Community SONiC YANG tree (sonic-net/sonic-buildimage/src/sonic-yang-models/yang-models).

When validating real configs, the validator emits warnings of the form:

[WARN]  xxxxxx: No YANG schema for table 'SNMP_SERVER_USER' (validation skipped)

for 26 ConfigDB tables. Per the design in #2253, these are reported as warnings (not errors), but they leave a real coverage gap: rows in those tables are never schema-checked.

Why those tables are missing

The 26 tables fall into three groups:

1. Modeled in Enterprise SONiC (Broadcom/Dell), not in Community.
The Enterprise SONiC YANG tree (mirrored e.g. in oceans1908/dell-yang-model and oceans1908/sonic-yang) ships top-level container declarations for these tables in dedicated sonic-*.yang files that have no Community counterpart:

ConfigDB table(s) Enterprise YANG file
SWITCH (top-level) sonic-switch.yang
COREDUMP sonic-coredump.yang
HARDWARE sonic-hardware.yang
LOOPBACK (separate from LOOPBACK_INTERFACE) sonic-loopback.yang
SNMP_SERVER, SNMP_SERVER_USER, SNMP_SERVER_VIEW, SNMP_SERVER_GROUP, SNMP_SERVER_PARAMS, SNMP_SERVER_TARGET, SNMP_SERVER_GROUP_USER, SNMP_SERVER_GROUP_ACCESS, SNMP_SERVER_GROUP_MEMBER, SNMP_SERVER_GROUP_PARAMS, SNMP_SERVER_GROUP_TARGET sonic-snmp.yang (Enterprise variant — distinct from the Community file of the same name, which only models SNMP/SNMP_COMMUNITY/SNMP_USER/SNMP_AGENT_ADDRESS_CONFIG)
SSHD_COMMON sonic-ssh-common.yang
NEIGH_GLOBAL sonic-neighbor.yang
POLICY_TABLE, POLICY_BINDING_TABLE, POLICY_SECTIONS_TABLE, CLASSIFIER_TABLE sonic-flow-based-services.yang
BREAKOUT_PORTS sonic-port-breakout.yang (Community ships only BREAKOUT_CFG)
ECMP_LOADSHARE_TABLE_IPV4, ECMP_LOADSHARE_TABLE_IPV6 sonic-loadshare-mode.yang (also models _SEED/_RH/_OFFSET/_INGRESS_PORT/_ROCE/_UDF)

That's 24 of the 26 warnings.

2. No native sonic-* container in any tree.

  • BGP_GLOBALS_ROUTE_ADVERTISE — only appears as a sonic-ext:table-name annotation on an OpenConfig path (oc-bgp-evpn-ext:route-advertise-list) in openconfig-network-instance-annot.yang. There is no native sonic-* YANG container for this ConfigDB table.

3. Not modeled anywhere we found.

  • HOST_FEATURE — neither Community nor Enterprise trees contain a container declaration for this table. Likely a newer or internal addition.

Proposed approach

1. Vendor the missing Enterprise SONiC YANG files into files/sonic/yang_models/.

Add the 9 distinct Enterprise YANGs listed above. The Enterprise sonic-snmp.yang collides on filename with the Community version — rename one (e.g. sonic-snmp-server.yang for the Enterprise variant) or merge the containers, and document the choice in tools/sonic_yang_to_pydantic.py.

Source of truth: pick a single upstream reference (e.g. a tagged Broadcom EnterpriseSONiC release or the most recent oceans1908/dell-yang-model snapshot) and record commit / version in a files/sonic/yang_models/SOURCES.md so future refreshes are reproducible.

2. Verify the generator handles them.

tools/sonic_yang_to_pydantic.py should pick up the new files automatically. Re-run it and commit the regenerated osism/tasks/conductor/sonic/_generated/_schemas.py. Sanity-check that no new YANG construct (grouping, typedef, augment) trips the generator — if it does, extend the generator before vendoring.

3. Confirm the validator now covers the warned tables.

Re-run the validator against the config that produced the warnings above and confirm the 24 entries disappear from the warning list and become real schema checks (passing or failing on actual content).

4. Document the two residual gaps.

For HOST_FEATURE and BGP_GLOBALS_ROUTE_ADVERTISE, keep the warning behavior and add a brief note (in the validator docstring or the SOURCES.md) explaining there is no upstream YANG to vendor.

Acceptance criteria

  • The 9 Enterprise SONiC YANG files (or merged equivalents) are committed under files/sonic/yang_models/.
  • The source / version of the vendored Enterprise YANGs is recorded in a tracked file.
  • tools/sonic_yang_to_pydantic.py regenerates _schemas.py cleanly with the expanded set.
  • Validating a real config no longer warns for the 24 tables in group 1; only HOST_FEATURE and BGP_GLOBALS_ROUTE_ADVERTISE remain as No YANG schema warnings.
  • No regression on existing schema-level checks for tables already covered by the Community YANGs.

Out of scope

  • Authoring custom YANG for HOST_FEATURE / BGP_GLOBALS_ROUTE_ADVERTISE (would diverge from upstream).
  • Cross-table leafref enforcement — tracked separately in Cross-table leafref validation in SONiC config validator #2252.
  • Reconciling differences where Community and Enterprise model the same table differently (e.g. SNMP-related tables): the goal here is additive coverage, not replacement.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions