Skip to content

[strict yang] Add YANG based cfg_schema.h to schema.h #1008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

wen587
Copy link

@wen587 wen587 commented Apr 18, 2025

Why I did it

To enable YANG based CFG table generation, the ConfigDB related macro will be generated by YANG model

How I did it

Add gen_cfg_schema.py script to generate cfg_schema.h which will be included in schema.h

Work item tracking
  • Microsoft ADO: 31676863

How to verify it

make deb build

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@wen587 wen587 changed the title Libc6 Automatically generate CFG table by YANG May 20, 2025
@wen587 wen587 changed the title Automatically generate CFG table by YANG [strict yang] Add YANG based cfg_schema.h to schema.h Jun 24, 2025
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@wen587 wen587 marked this pull request as ready for review June 25, 2025 04:32
@wen587
Copy link
Author

wen587 commented Jun 25, 2025

Hi @qiluo-msft and @xincunli-sonic , please help review this PR. This is a fixed version of #984

xincunli-sonic
xincunli-sonic previously approved these changes Jun 26, 2025

#define CFG_HIGH_FREQUENCY_TELEMETRY_PROFILE_TABLE_NAME "HIGH_FREQUENCY_TELEMETRY_PROFILE"
#define CFG_HIGH_FREQUENCY_TELEMETRY_GROUP_TABLE_NAME "HIGH_FREQUENCY_TELEMETRY_GROUP"
Copy link
Contributor

@qiluo-msft qiluo-msft Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the development experience of schema.h file will be changed after this PR. Could you share the design doc? and explain future development experience in design doc? #Closed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @qiluo-msft , please check here: sonic-net/SONiC#2026

The runtime enforcement will be added along the way.

#ifndef CFG_SCHEMA_H
#define CFG_SCHEMA_H

// Macros for table names are autogenerated by gen_cfg_schema.py. Manual update will not be preserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual update will not be preserved.

Is it possible not to source control generated file?

For example, if a new table's yang model is added into sonic-buildimage repo, who will ensure this file up-to-date?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently no. Because there are CFG macros are needed for unit test in swss-common repo, such as logger.
It should be the CFG macro owner to ensure the file up to date.

wen587 added 5 commits July 10, 2025 06:42
rm macro

fail import yang as ly

rm comment

fix CI yangmods

warm
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

4 participants