Subject: [netmod] any way to OR if-feature statements?

From: Kent Watsen <[email-masked]>
Date: Tue, 13 Mar 2012 10:52:03 -0700

The cardinality for the if-feature substatement is 0..n and the section 7.18.1 says:

  "In order for a device to implement a feature that is dependent on any
   other features (i.e., the feature has one or more "if-feature" sub-
   statements), the device MUST also implement all the dependant
   features."

Which is an AND, but I want to enable a knob if any one of few features is supported.  
Is there any way to model this in YANG?

Thanks,
Kent

---

From: Andy Bierman <[email-masked]>
Date: Tue, 13 Mar 2012 11:27:51 -0700

> Is there any way to model this in YANG?

You need to make datastore leafs to model each feature-enabled, then use
a when-stmt XPath expression instead of if-feature.

(yangcli XPath has a 'feature-enabled' function to solve this problem:

   when "feature-enabled('foomod', 'feature1') or feature-enabled('barmod', 'feature2')
         or module-enabled('bazmod')";

I will probably add it to the netconfd server at some point.

> Kent

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Tue, 13 Mar 2012 21:55:59 +0100 (CET)

> a when-stmt XPath expression instead of if-feature.

I am not sure this works.  Maybe if you have a mandatory leaf for
this.  Anoter hack is to have a special feature for the OR.  feature
foo-or-bar.

It is very unfortunate we didn't cover this in 6020.

/martin

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 14 Mar 2012 13:00:07 +0100

> It is very unfortunate we didn't cover this in 6020.

I think we badly need to standardize a handful of XPath extension function, otherwise things like features, instance-identifiers etc. are sort of crippled. Could it be an option to extend the charter with it?

Lada

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

-- 
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C