Subject: [netmod] Comparing address families in must statement

From: Dean Bogdanovic <[email-masked]>
Date: Tue, 30 Sep 2014 15:05:56 +0000

Hi,

I'm trying to figure out a must statement, where entries have to be in the same address family. Here is the example below

  import ietf-inet-types {
    prefix "types";    
  }
  
  import ietf-acl {
    prefix "ietf-acl";
  }

  augment "/ietf-acl:access-list/ietf-acl:access-list-entries/ietf-acl:matches" {
   choice route-prefix{
     description "Define route filter match criteria";
     case range {
       container range {
        leaf lower_bound {
	      type types:ip-prefix;
             mandatory true;
	  }
	  leaf upper_bound {
	      type types:ip-prefix;
	      must "if lower_bound address family current() != upper_bound address family"
	      error-message "The upper_bound value has to be the same address family as lower_bound"
	      mandatory true;
	  }
	}
     }
 }

Trying to find out if there is ability to extract the pattern constraints from a type and then apply it. Or something like type.pattern() so something like ip:ip-prefix.pattern(current())

thx

Dean

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 30 Sep 2014 17:27:50 +0200

Hi Dean,

> I'm trying to figure out a must statement, where entries have to be in the same address family. Here is the example below

Such a constraint is used in the ietf-routing module, see the definition of “default-rib”. I am not sure though that this is what you want.

> Trying to find out if there is ability to extract the pattern constraints from a type and then apply it. Or something like type.pattern() so something like ip:ip-prefix.pattern(current())

One of the XPath extension functions proposed for YANG 1.1 is re-match, see the expired draft

http://tools.ietf.org/html/draft-bjorklund-netmod-yang-xpath-extensions-00#section-4.5

I am not sure why you need to extract type patterns and apply them in XPath expressions but this in not possible in YANG 1.0 and won’t be in 1.1 either.

Lada

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

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

---

From: Dean Bogdanovic <[email-masked]>
Date: Tue, 30 Sep 2014 18:47:52 +0000

Lada,

Thank you for the reply. Re-match function would be nice to have, but as it is not coming, will model it differently. 

Dean

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 1 Oct 2014 08:48:35 +0200

> Thank you for the reply. Re-match function would be nice to have, but as it is not coming, will model it differently.

Oh, the fact that Martin’s draft has expired doesn’t mean these new XPath functions are gone - they should appear in YANG 1.1, see issue Y20:

https://svn.tools.ietf.org/svn/wg/netmod/yang-1.1/issues.html#sec-20

However, you have to use YANG 1.0 for the time being anyway.

Lada