libnetconf2 icon indicating copy to clipboard operation
libnetconf2 copied to clipboard

Choice node is missing after edit-config

Open githubzyt opened this issue 4 years ago • 1 comments

We are using ietf-access-control-list module, we met a problem when we upgrade libnetconf to version2. Yang schema link : https://datatracker.ietf.org/doc/html/rfc8519

module: ietf-access-control-list
     +--rw acls
        +--rw acl* [name]
        |  +--rw name    string
        |  +--rw type?   acl-type
        |  +--rw aces
        |     +--rw ace* [name]
        |        +--rw name          string
        |        +--rw matches
        |        |  +--rw (l2)?
        |        |  |  +--:(eth)
        |        |  |     +--rw eth {match-on-eth}?
        |        |  +--rw (l3)?
        |        |  |  +--:(ipv4)
        |        |  |  |  +--rw ipv4 {match-on-ipv4}?
        |        |  |  +--:(ipv6)
        |        |  |     +--rw ipv6 {match-on-ipv6}?
        |        |  +--rw (l4)?
        |        |  |  +--:(tcp)
        |        |  |  |  +--rw tcp {match-on-tcp}?
  1. netopeer2cli edit-config with following xml.
<acls
    xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list">
    <acl>
        <name>stateful_rule</name>
        <aces>
            <ace>
                <name>stateful_accept</name>
                <matches>
                    <tcp/>
                </matches>
                <actions>
                    <forwarding
                        xmlns:acl="urn:ietf:params:xml:ns:yang:ietf-access-control-list">acl:accept
                    </forwarding>
                </actions>
            </ace>
        </aces>
    </acl>
<acls/>
  1. netopeer2cli get-config, <tcp/> is missing

This <tcp/> node exists before upgrading to version2 libnetconf2-2.0.17

githubzyt avatar Dec 22 '21 08:12 githubzyt

In general, this is a result of YANG 1.1 ambiguity and should be fixed in yang-next. The functional difference is the result of a mailing list discussion when one of the conclusions was that the original behavior was not correct (in other words, makes this use-case work but may break some other).

The only fix I can suggest is to make the tcp container presence because, as clearly seen, the container has a meaning of selecting a case. Actually, all the sibling containers should be presence as well for the same reason.

michalvasko avatar Jan 03 '22 10:01 michalvasko