Skip to content
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

YANG Version Control #1

Open
BSpendlove opened this issue Oct 16, 2023 · 0 comments
Open

YANG Version Control #1

BSpendlove opened this issue Oct 16, 2023 · 0 comments
Assignees

Comments

@BSpendlove
Copy link
Member

BSpendlove commented Oct 16, 2023

The current discussion is that we support the latest YANG model version and work backwards but need to ensure editor support and things like intellisense will return the correct model using an editor like VSCode to improve the developer experience.

Folder structure for implementing various versions should follow python naming conventions so for example lets take the openconfig-vlan YANG model. The latest revision as of today is @2023-02-07.

Folder structure example

models/
    openconfig/
        vlan/
            v2023_02_07/
            v2021_07_28/
            v2019_04_16/
            ......etc.......

Building a model from a netdantic user perspective may look a little like this:

from netdantic.models.openconfig import vlan as oc_vlan

vlan = oc_vlan()
vlan.config.vlan_id = 10
vlan.config.name = "VLAN-10"

Automatically the openconfig VLAN model should use the latest YANG version unless specified by a user within the root pydantic model, eg. oc_vlan(vlan_id=10, version="2021-07-28"). This example may not work properly unless we can find a way to ensure the editor uses the correct pydantic class or we can just ensure that if anyone wants to use an earlier YANG model, they explicitly import the class from the version folder and we make sure all the latest models are exposed at the top level so the import statements look clean.

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

No branches or pull requests

2 participants