cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
734
Views
0
Helpful
1
Replies

How to use presence container in NSO

haoywang
Cisco Employee
Cisco Employee

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?
1 Reply 1

richsun
Cisco Employee
Cisco Employee

Just realized reply may not be relavent, so cleared, wish there were a remove button.