Skip to content

CVL does not enforce YANG mandatory field validation on OP_CREATE (sonic-mgmt-common #210) #2283

Description

@MrSa3dola

Summary

Cross-posting from sonic-mgmt-common#210 for broader visibility.

CVL's ValidateEditConfig() does not enforce mandatory true YANG fields
on OP_CREATE operations. Entries with missing mandatory fields are silently
accepted and written to CONFIG_DB.

Impact

Affects all sonic YANG models that use mandatory true — not just sonic-acl.

Root Cause (already identified)

Three layers all bypass this validation:

  1. YGOT validation is skipped for sonic models (translib/request_binder.go:127)
  2. lyd_check_mandatory_tree is commented out in libyang (yparser.go:59)
  3. No OP_CREATE mandatory check exists in cvl/cvl_api.go
    (only OP_DELETE has it)

Full details & reproduction steps

--> sonic-net/sonic-mgmt-common#210

Status

A fix has been implemented locally. Waiting for maintainer confirmation
on the intended design before opening a PR in sonic-mgmt-common.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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