Hi Florian,
Florian Kauer <[email protected]> writes:
> Hi,
> I know this is bad timing since Qcw was just published, but - at least with
> libyang - the following YANG data tree that specifies nothing Qcw related is
> no longer valid when just loading the Qcw YANG models:
>
> interface.json:
> {
> "ietf-interfaces:interfaces": {
> "interface": [
> {
> "if-index": 1,
> "name": "eth0",
> "type": "iana-if-type:ethernetCsmacd",
> "oper-status": "down",
> "admin-status": "down",
> "statistics": {
> "discontinuity-time": "2023-12-15T10:04:12.345+00:00"
> }
> }
> ]
> }
> }
>
> yanglint interface.json ieee802-dot1q-sched.yang
> ieee802-dot1q-sched-bridge.yang ieee802-types.yang ieee802-dot1q-types.yang
> ieee802-dot1q-bridge.yang [email protected]
> [email protected]
>
> results into
>
> libyang err : Number of elements in admin-control-list must not be
> greaterthan supported-list-max (Data location
> "/ietf-interfaces:interfaces/interface[name='eth0']/ieee802-dot1q-bridge:bridge-port/ieee802-dot1q-sched-bridge:gate-parameter-table/admin-control-list".)
> libyang err : Number of elements in oper-control-list must not be greaterthan
> supported-list-max (Data location
> "/ietf-interfaces:interfaces/interface[name='eth0']/ieee802-dot1q-bridge:bridge-port/ieee802-dot1q-sched-bridge:gate-parameter-table/oper-control-list".)
> libyang err : admin-cycle-time must not be greater than supported-cycle-max
> (Data location
> "/ietf-interfaces:interfaces/interface[name='eth0']/ieee802-dot1q-bridge:bridge-port/ieee802-dot1q-sched-bridge:gate-parameter-table/admin-cycle-time".)
> libyang err : oper-cycle-time must not be greater than supported-cycle-max
> (Data location
> "/ietf-interfaces:interfaces/interface[name='eth0']/ieee802-dot1q-bridge:bridge-port/ieee802-dot1q-sched-bridge:gate-parameter-table/oper-cycle-time".)
> YANGLINT[E]: Failed to parse input data file "interface.json".
>
> My first expectation was a bug in libyang, but Michal is convinced that
> libyang's behavior is correct in this regard:
> https://github.com/CESNET/libyang/issues/2140
>
> I have not enough experience in YANG to properly argue if either the YANG
> model or libyang needs to be changed, but I don't think we want to force
> every interface to specify a
> /ietf-interfaces:interfaces/interface[name='eth0']/ieee802-dot1q-bridge:bridge-port/ieee802-dot1q-sched-bridge:gate-parameter-table/supported-list-max
> etc. just because the Qcw YANG models are loaded.
>
> I hope I have just a misunderstanding and I am looking forward to your
> responses!
I am afraid I don't have good news. Apparently, the problem is in this "must"
statement:
must
"(count(./gate-control-entry) <= ../supported-list-max)" {
error-message
"Number of elements in admin-control-list must not be greater"+
"than supported-list-max";
}
The Xpath expression can never be true unless the "../supported-list-max" leaf
exists. This is a common XPath trap, it should have been written like so:
"not(count(./gate-control-entry) > ../supported-list-max)"
This would be true also in the case when "../supported-list-max" doesn't exist.
Lada
>
> Greetings,
> Florian
>
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod
--
Ladislav Lhotka <[email protected]>
PGP Key ID: 0xB8F92B08A9F76C67
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod