ConfD User Community

Restconf option for context in cmdrule


Does cmdrule context supports restconf?

 <context>cli</context>  <== Is only restconf possible here?

Is there any option to hide display for restconf similar to display-when for cli?



Not with a cmdrule, but with a normal data rule.

  <context xmlns="">rest</context>

No “display-when” statement specifically for RESTCONF. Unlike the CLI and WebUI/JSON-RPC interfaces, RESTCONF, and NETCONF, are machine to machine interfaces, so “hiding” data is generally not something you want to do with them.

Hi @cohult

Thanks for the reply.

Could you please suggest alternative for display-when for restconf.


There is none for RESTCONF because it does not make sense to have one for RESTCONF (a machine-to-machine interface). You can use a normal YANG when statement that will affect all northbound interfaces, including RESTCONF.

Hi @cohult

Thanks for prompt reply.

There are few use cases where conditional display is required for some leafs in a container. It is designed in such a way that in those conditions where leaf need to be hidden from all interfaces, but backend process still uses the leaf and configures it.
Using when we are not able to achieve it. I didnt get you on machine-to-machine interfaces. Could you please explain why it is not required here?

We can make it work by adding NACM rules, but it would create issue while loading configuration using rest context.


Display where? A user interface? You should to use the JSON-RPC interface for a (Web)UI. Not RESTCONF.

JSON-RPC(WebUI) and CLI = human-to-machine interfaces, where the human is, for example, a network engineer.

RESTCONF, NETCONF = machine-to-machne interfaces, where the machine is, for example, a management station performing automated service deployment.

Thanks for the reply @cohult.
All i want to know is how to hide few leafs when i do a GET operation through RESTCONF. If that is not supported i am fine with it.

As I wrote previously: