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

default values don't show up in datastores #111

Closed
shmuelnatan opened this issue Jun 17, 2020 · 2 comments
Closed

default values don't show up in datastores #111

shmuelnatan opened this issue Jun 17, 2020 · 2 comments
Labels

Comments

@shmuelnatan
Copy link
Contributor

I added some default values to my yang module. I then brought up the server with the new module, and sent a GET_CONFIG command (by using the cli chow command). I was expecting to see the default values in the datastores, but they were all empty.
My Yang module is the following:
module t { leaf r { type uint32; default 22; } }
According to the RFC 7950 (page 74), the default value of this leaf needs to be at least in the candidate datastore after sending a GET_CONFIG command to the server.
Quote:
The default value of a leaf is the value that the server uses if the leaf does not exist in the data tree.

@olofhagsand
Copy link
Member

I can cofirm that the default value is not set in the case when appearing in a top-level leaf, or transitively from the top-level, and in that respect clixon does not comply to the RFC.
In other cases it should work.
But a note, the RFC uses the following phrasing:

When the default value is in use, the server MUST operationally
behave as if the leaf was present in the data tree with the default
value as its value.

The way clixon does this is by populating not explicitly set default values when loading the datastore to the server in memory - the datastore itself does not contain default values. On GET and GET-CONFIG, the default values therefore are reported, but not in the datastore itself. One reason for this is to reduce the datastore size, another is to cope with the situation that the default value is changed: If it is changed, the server would have no way to know if the value in the datastore was explicitly set, or whether it is the previous default value as set by the server.

olofhagsand added a commit that referenced this issue Aug 6, 2020
  * Enforcing RFC 7950 Sec 7.6.1 means unassigned top-level leafs (or leafs under non-presence containers) are assigned default values.
* NACM default behaviour is read-only (empty configs are dead-lockedd)
  * This applies if NACM is loaded and `CLICON_NACM_MODE` is `internal`
* Fixed: [default values don't show up in datastores #111](#111)
@olofhagsand
Copy link
Member

When fixing this, some YANG default values kicked in which were not set before. This may affect YANG models in general that have top-level defaults, so please note this change.
NACM RFC8341 is a specific case that uses defaults on the top-level to set default access. Previously, when the top level default were not assigned, NACM was by default disabled. But now, if you have loaded the NACM YANG, and set NACM to internal mode: NACM default is now enabled with read/exec permit, and write deny.
This means that an empty config can never be changed by ordinary means, essentially a deadlock.
Workarounds:

  • Always create full NACM config on startup
  • Change config with the NACM "recovery user"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants