Hi Martin, 

On 8/8/18, 7:31 AM, "Martin Bjorklund" <[email protected]> wrote:

    "Acee Lindem (acee)" <[email protected]> wrote:
    > Thanks Martin - see inline. 
    > 
    > On 8/8/18, 3:43 AM, "Martin Bjorklund" <[email protected]> wrote:
    > 
    >     Hi,
    >     
    >     "Acee Lindem \(acee\)" <[email protected]> wrote:
    >     > Is it possible to indicate that choice statement must be specified
    >     > in a YANG 1.1 “must” clause w/o specifying every case?
    >     
    >     Do you mean that you to ensure that a case is always configured?  If
    >     so, mark the choice as "mandatory true".  It can't be done with an
    >     XPath expression.
    > 
    > It's not that easy since at the least the choice or another leaf
    > must be specified.
    
    Maybe you can share the model (or a simplified version) in order to
    illustrate the problem?

This is from one of the Cisco IOS-XE native models available on GitHub - 
https://github.com/YangModels/yang/tree/master/vendor/cisco/xe/1691

+--rw service* [name]
       +--rw name                     string
       +--rw description?             string
       +--rw group-object?            string
       +--rw (protocol-choice)?
          +--:(protocol-number-case)
          |  +--rw protocol-number?   uint8
          +--:(protocol-name-case)
             +--rw ahp?               empty
             +--rw eigrp?             empty
             +--rw esp?               empty
             +--rw gre?               empty
             +--rw icmp!
             |  +--rw port-number?            uint8
             |  +--rw alternate-address?      empty
             |  +--rw conversion-error?       empty
             |  +--rw echo?                   empty
             |  +--rw echo-reply?             empty
             |  +--rw information-reply?      empty
             |  +--rw information-request?    empty
             |  +--rw mask-reply?             empty
             |  +--rw mask-request?           empty
             |  +--rw mobile-redirect?        empty
             |  +--rw parameter-problem?      empty
             |  +--rw redirect?               empty
             |  +--rw router-advertisement?   empty
             |  +--rw router-solicitation?    empty
             |  +--rw source-quench?          empty
             |  +--rw time-exceeded?          empty
             |  +--rw timestamp-reply?        empty
             |  +--rw timestamp-request?      empty
             |  +--rw traceroute?             empty
             |  +--rw unreachable?            empty
             +--rw igmp?              empty
             +--rw ip?                empty
             +--rw ipinip?            empty
             +--rw nos?               empty
             +--rw ospf?              empty
             +--rw pcp?               empty
             +--rw pim?               empty
             +--rw tcp!
             |  +--rw tcp-port-list* [tcp-port]
             |     +--rw tcp-port        ios-types:acl-tcp-port-type
             |     +--rw operator?       enumeration
             |     +--rw max-tcp-port?   ios-types:acl-tcp-port-type
             +--rw tcp-udp!
             |  +--rw udp-port-list* [udp-port]
             |     +--rw udp-port        ios-types:acl-udp-port-type
             |     +--rw operator?       enumeration
             |     +--rw max-udp-port?   ios-types:acl-udp-port-type
             +--rw udp!
                +--rw udp-port-list* [udp-port]
                   +--rw udp-port        ios-types:acl-udp-port-type
                   +--rw operator?       enumeration
                   +--rw max-udp-port?   ios-types:acl-udp-port-type

Prior to YANG I certainly didn't have a lot of experience with Xpath. However, 
I had to learn thru trial and error that protocol-choice, protocol-number-case, 
and protocol-name-case are not part of the Xpath. I guess RFC 7950 section 7.9 
does indicate that these two statements are not present in the data tree but it 
wasn't obvious to me that this also means it isn't in the Xpath.

Thanks,
Acee 

    
    
    
    /martin
    
    
    > I found that the choice and case identifiers are
    > not part of the Xpath. Even after rereading some sections of
    > RFC7950, this wasn't intuitive.
    > 
    > Thanks,
    > Acee 
    >     
    >     
    >     /martin
    >     
    >     
    >     
    >     > Similarly, it is there a way specify that a container cannot be 
empty in “must” clause?
    >     > Thanks,
    >     > Acee
    >     
    > 
    

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to