I have a presence container in yang file, do anyone have an example for json payload and template?
The yang is like:
container protocol {
presence "Indicates a protocol node is configured.";
description "Transport Protocol configuration";
must "(tcp and not(grpc)) or " +
"(grpc and not(tcp))";
container tcp {
presence "Indicates a tcp node is configured.";
description "tcp";
}
container grpc {
presence "Indicates a grpc node is configured.";
description "grpc";
container no-tls {
presence "Indicates a no-tls node is configured.";
description "no tls";
}
}
}
I also have a version that use leaf instead of presence container.
container protocol {
leaf protocol-type {
type enumeration {
enum tcp;
enum "grpc no-tls";
}
}
}
For the leaf version, the json may like:
{
'protocol':'tcp'
}
and the template is like:
<tcp when="{$PROTOCOL = 'tcp'}"/>
How to do this for the presence container?