clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
216 stars 72 forks source link

ietf-netconf-notification@2008-07-01.yang validation problem #62

Closed dcornejo closed 5 years ago

dcornejo commented 5 years ago

the type statements at lines 122 & 129 are missing the yang: prefix which breaks validating.

the latest revision of this file seems to be ietf-netconf-notifications@2012-02-06.yang, but this file bears little resemblance to the version supplied.

i can't find a source for the supplied version, so i don't know if this is an error in the source or in the clixon repo. a fix to the supplied version is trivially to add "yang:" to add the date-and-time types, but since this is in ietf namespace, in theory the latest version should be used.

olofhagsand commented 5 years ago

Thanks for putting attention on this. But no, ietf-netconf-notification@2008-07-01.yang in the clixon repo is an effort to recreate RFC5277 create-subscription and the types around that. RFC5277 does not contain a Yang model, just XML schema, so the yang model was manually created from the RFC. ietf-notifications@2012-02-06.yang on the other hand, (eg https://github.com/YangModels/yang/blob/master/standard/ietf/RFC/ietf-netconf-notifications@2012-02-06.yang) is RFC 6470, so is a completely different yang model. The confusion is that they are names (almost) the same. I see Cisco has the original RFC5277 at, for example https://github.com/YangModels/yang/blob/master/vendor/cisco/xr/651/notifications.yang. There is a relatively recent model at draft-ietf-netconf-rfc5277bis-01 which is modeled by Cisco in for example https://github.com/YangModels/yang/blob/master/vendor/cisco/xe/1681/ietf-event-notifications.yang where create-subscription is still defined. There are also new rpc:s for subscribed-notifications. So there are a number of different options: 1) keep the original (maybe rename it for avoiding similar confusion) 2) Use cisco's "notification.yang" (I would want to have a proper source though) 3) Upgrade to draft-ietf-netconf-rfc5277bis-01. I have no idea how much work that is. 4) Follow the more recent work,eg at https://github.com/netconf-wg/rfc5277bis for subscribed-notifications. But there I think create-subscription is obsolete. 5) someting else?

dcornejo commented 5 years ago

name confusion noted.

the simplest change is to fix two instances of date-and-time types that are missing the yang: prefix and should be yang:date-and-time (see patch below)

yangval-patch.txt

olofhagsand commented 5 years ago

This opened up some other issues:

  1. clixon hardcoded some yang types such as date-and-time, ipv4-address, etc. thus bypassing the yang date-and-time regexp. This has now been removed.
  2. cligen didnt properly support time-zone designators (eg 'Z' or +01:00). CLIgen now supports it.
  3. cligen uses posix regex while yang uses XSD. It differs in some aspects. A translator function has been added.
olofhagsand commented 5 years ago

Note that the yang module has been renamed: ietf-netconf-notifications -> clixon-rfc5277.

dcornejo commented 5 years ago

thank you!