Subject: [netmod] Question about if-feature

From: Hongji Zhao <[email-masked]>
Date: Thu, 17 Jan 2019 06:10:40 +0000

Hi,

I have a question about the usage of import.
In the test-import module I would like to make sure interface name not in the interface list of pim-base.
So I import ietf-pim-base module and design the must statement.

My question is, if the device doesn't support PIM, will it raise error when "import ietf-pim-base"?

Thanks a lot!

module test-import {
namespace "http://example.com/ns/test";
prefix tf;
 import ietf-routing {
  prefix "rt";
}

import ietf-interfaces {
  prefix "if";
}

import ietf-pim-base {
  prefix "pim-base";
}
 container interfaces {
  list interface {
   key "name";
   leaf name {
    type if:interface-ref;

    must "current() != /rt:routing/rt:control-plane-protocols/pim-base:pim/pim-base:interfaces/pim-base:interface/pim-base:name";

   }
  }
}
}

module: ietf-pim-base
  augment /rt:routing/rt:control-plane-protocols:
    +--rw pim!
                   +--rw graceful-restart
       |  +--rw enabled?    boolean
       |  +--rw duration?   uint16
       +--rw address-family* [address-family]
       |  +--rw address-family        identityref
       |  +--rw graceful-restart
                   ...
                   +--rw interfaces
          +--rw interface* [name]
             +--rw name              if:interface-ref
             +--rw address-family* [address-family]

BR/Hongji
赵宏吉

---

From: tom petch <[email-masked]>
Date: Fri, 25 Jan 2019 10:38:35 +0000

----- Original Message -----
From: "Hongji Zhao" <[email-masked]>
Sent: Thursday, January 17, 2019 6:10 AM

> My question is, if the device doesn't support PIM, will it raise error
when "import ietf-pim-base"?

An obvious question to which the answer seems not obvious.

RFC7950 s.5.6.5 says
"   If a server implements a module A that imports a module C without
   specifying the revision date of module C and the server does not
   implement C (e.g., if C only defines some typedefs), the server MUST
   list module C in the "/modules-state/module" list from
   "ietf-yang-library" [RFC7895], and it MUST set the leaf
   "conformance-type" to "import" for this module.
"
so you can find out that the module is not there with NETCONF.

RFC7950 has a lot of MUST which must be followed(!) but the list of
error messages in s.15 is limited and there is nothing there that would
seem to fit (nor is there anything in NETCONF nor would I expect there
to be).

Failing to import what the module tells you to seems like a basic error
and if the server does that, then it might well fail to follow the MUST
I quote above so I would not rely on it.

More generally, YANG is a language and most languages do not specify
error messages, rather they leave it up to the 'compiler' to do what
they think appropriate and communicate that how they think fit.

So, bottom line, check ietf-yang-library but also ask your implementor.

Tom Petch

>     must "current() !=
/rt:routing/rt:control-plane-protocols/pim-base:pim/pim-base:interfaces/
pim-base:interface/pim-base:name";
>              +--rw address-family* [address-family]

------------------------------------------------------------------------
--------

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