Subject: [netmod] Change Default Value

From: Johnson Zhu <[email-masked]>
Date: Mon, 10 Nov 2014 13:14:09 +0000

Hi,

Is that possible to change default value (typedef/leaf) in a separate yang file by using current YANG syntax?
 
Without touching the standard/draft YANG model file, does current YANG syntax offer that capability?

Thanks
/Johnson

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 10 Nov 2014 14:22:58 +0100 (CET)

> syntax offer that capability?

Yes, by using a deviation:

  deviation /x:std-leaf {
    deviate replace {
      default "my-new-default";
    }
  }

(not recommended though; it would be a serious contract violation)

/martin

---

From: Johnson Zhu <[email-masked]>
Date: Mon, 10 Nov 2014 13:30:15 +0000

Hi Matin,

Thank for your quick response. 

I agree with you the deviation is not recommended. Is any other way to achieve this?

Today the device (router/switch) has the different default value, can we eliminate the difference when adopting to YANG model (e.g. YANG has all default defined)?

Thanks
/Johnson

-----Original Message-----
From: Martin Bjorklund [mailto:[email-masked]] 
Sent: Monday, November 10, 2014 9:23 PM
To: Johnson Zhu
Cc: [email-masked]
Subject: Re: [netmod] Change Default Value

  deviation /x:std-leaf {
    deviate replace {

/martin

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 10 Nov 2014 14:41:59 +0100 (CET)

> I agree with you the deviation is not recommended. Is any other way to

No, it is not the deviation that is not recommended; it is the notion
of changing a default value in a standard module.

> Today the device (router/switch) has the different default value, can
> we eliminate the difference when adopting to YANG model (e.g. YANG has
> all default defined)?

I think it would be best to try to keep the YANG contract, so that if
the leaf is not set over NETCONF/YANG, the device behaves as if the
default value is in effect; e.g., by letting the NETCONF server
internally set the YANG default value explicitly.

/martin

---

From: Johnson Zhu <[email-masked]>
Date: Mon, 10 Nov 2014 14:03:43 +0000

hi Martin,

Your two answers are good suggestions. That is all I need for now.

/johnson

发自我的小米手机

Martin Bjorklund <[email-masked]>编写：

/martin