Subject: [netmod] Modeling conditional defaults

From: JOEY BOYD <[email-masked]>
Date: Mon, 26 Sep 2016 18:50:50 +0000

Hi all,

I have a question regarding conditional default values. For example, suppose we have this modeled definition of a thing.

container thing {

  leaf a {
    type uint8 {
      range "1..2";
    }
  }

  leaf b {
    type uint8 {
      range "1..100";
    }
  }
}

The 'thing' is described in some underlying standard which states that if 'a' is equal to 1, the default value of 'b' is 50 while if 'a' is equal to 2, the default value of 'b' is 100. Note that all values 1-100 are valid for 'b' regardless of 'a'. We are only discussing defaults. Can such a constraint be modeled? My initial thinking is that it cannot but wanted to query this group to see if it is possible.

Best regards,
Joey

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Mon, 26 Sep 2016 20:57:59 +0200

> The 'thing' is described in some underlying standard which states that if 'a' is equal to 1, the default value of 'b' is 50 while if 'a' is equal to 2, the default value of 'b' is 100. Note that al…

Yes, your thinking is correct - this can't be expressed formally in
YANG. You have to write things down in a description statement.

/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/>