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

how to handle deviate(replace) for a data type #148

Open
abierman opened this issue Feb 3, 2023 · 5 comments
Open

how to handle deviate(replace) for a data type #148

abierman opened this issue Feb 3, 2023 · 5 comments

Comments

@abierman
Copy link
Contributor

abierman commented Feb 3, 2023

deviations allow types to be changed

leaf foo { type int32; }

deviation "/foo" {
   deviate replace {
       type string;
   }
}

The deviation is always in a different YANG module that the changed objects.

The SID file ignores server deviations -- which is correct since the type info is not in the SID file.

In this case the server will send leaf /foo as a string and not an int32.
The client is expected to apply the deviations advertised by the server and expect
a string for leaf /foo and not int32.

This is being done in the wild (much to my protests)

@mcr
Copy link
Collaborator

mcr commented Feb 3, 2023

The deviation is always in a different YANG module that the changed objects.

So, it should get allocations from a different SID range, right?

@abierman
Copy link
Contributor Author

abierman commented Feb 3, 2023

Deviations do not get SID assignments.
They do not change the meaning of any SID assignments.

The YANG to CBOR encoding of a leaf or leaf-list is based on the "effective schema"
which might be a composite of YANG modules and deviations.

To be clear:

  • The static generation of the SID file is not affected.
  • The runtime generation of CBOR-encoded YANG data by a server is affected
  • The YANG library contents from a server are used by a client to determine the schema tree used )done at runtime)

@lemikev
Copy link
Contributor

lemikev commented Feb 3, 2023 via email

@abierman
Copy link
Contributor Author

abierman commented Feb 4, 2023

Actually a deviation module is just another YANG module.
It is allowed to have any statements in it.
Just convention keeps them separate.

The module itself is already getting a SID assignment

@cabo
Copy link
Member

cabo commented Feb 24, 2023

I think I understand the gist of this discussion.
I'm wondering if any changes/additions are needed to the text.
I think I could create some from this thread, but does this belong/need to be in the document?

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

4 participants