cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
603
Views
5
Helpful
2
Replies

Can we augment a pattern to an existing leaf ?

spudukko
Cisco Employee
Cisco Employee

Lets say i have a leaf  A of type string without any pattern.  Can i augment a pattern to that leaf from another yang ?  This would involve modification of type behavior.

 

Container start{

leaf A{

  type string ;

}

 

}

 

Lets say i want to add the following pattern to the leaf A

 

          pattern

          '([0-9a-fA-F])*';

 

2 Replies 2

vleijon
Cisco Employee
Cisco Employee
You have three main options for changing another yang module: annotation modules (tailf:annotate), augmentation and deviation modules. The first two allow only compatible changes, and your change is a non-compatible change.

For this reason I suggest looking into deviation modules, here is an introduction: https://yumaworks.freshdesk.com/support/solutions/articles/1000256520-how-do-i-define-yang-annotation-or-deviation-modules- for yanger the flag is –deviation-module.

Thanks for replying.