Subject: [netmod] interfaces-cfg - if-type

From: Martin Bjorklund <[email-masked]>
Date: Thu, 28 Jul 2011 08:50:06 -0400 (EDT)

Hi,

We talked about changing the 'type' leaf from an enumeration to an
identityref, in order to make it extensible.  Unfortunately, this
doesn't work the way we want it to.

This is how we would like to do it:

  module ietf-interfaces {
    ...
    identity interface-type {
      description
        "The base identity from which media-specific interface
         identities are derived.";
    }
    ...
    list interface {
      ...
      leaf type {
        type identityref {
          base interface-type;
        }
        ...
      }
    }
  }

And the IANA module:

  module iana-if-type {
    ...
    import ietf-interfaces {
      prefix if;
    }
    ...
    identity ethernetCsmacd {
      base if:interface-type;
      ...
    }
  } 
    
And then in the media-specific module:

  module ex-ethernet {
    ...
    import iana-if-type {
      prefix ianaift;
    }
    ...
    augment "/if:interfaces/if:interface" {
      when "if:type = 'ianaift:ethernetCsmacd'";

      container ethernet {
        leaf duplex {
            ...
        }
    }
  }

The problem is the "when" expression that makes the augment
conditional based on the type of the interface, and the problem is
that XPath 1.0 does not support qualified names.  So the "when" XPath
expression above doesn't really work in XPath 1.0.  The XPath
evaluator would construct the string value of the "if:type" leaf, and
compare this string value with the literal string
"ianaift:ethernetCsmacd".  It is not clear what the string value of an
identityref is outside of an XML document.

The good news is that I believe we can come up with a general solution
to this problem.  The bad news is that the solution requires a new
YANG module and thus a new document.

In order to avoid this problem, I suggest we keep the current if-type
enumeration.  Since some people already raised their concerns about
using identityrefs, and there is already a mechanism in place for
registering interface types, this seems to be a good solution.

Comments?

/martin

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Thu, 28 Jul 2011 14:53:57 +0200

> registering interface types, this seems to be a good solution.

Speaking as technical contributor, I support keeping the if-type an
enumeration.

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1, 28759 Bremen, Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>

---

From: Ladislav Lhotka <[email-masked]>
Date: Thu, 28 Jul 2011 11:21:04 -0400

> YANG module and thus a new document.

It's even worse: it requires changes to the YANG specification.

> registering interface types, this seems to be a good solution.

Yes, I think it's the best solution in the current state of affairs.

Lada

--
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C