cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
586
Views
10
Helpful
3
Replies

additional fields to device-groups

Hi all,

we would like to add some customer fields to device groups such as realm and systems and some others, i assume devices groups has its own yang model some where.

 

1 is this a valid approach where we just add new leaf's to that yang model

2 where is the file that i would need to edit for device groups 

 

Thanks

Regards

Yale

1 ACCEPTED SOLUTION

Accepted Solutions
yfherzog
Cisco Employee

Hi,

 

You don't actually need to modify the YANG module itself for that.

You should use the augment statement from your own file in order to extend sections of the data model written in other files.

 

This is a good practice, but some care needs to be taken in order to keep the validity of existing nodes.

 

You should be able to add a block similar to the one below to your YANG module (haven't tested it):

 

  import tailf-ncs {
    prefix ncs;
  }

  augment /ncs:devices/ncs:device-group {
    leaf realm {
      ...
    }
    list system {
      ...
    }
  }

Yftach

 

View solution in original post

3 REPLIES 3
yfherzog
Cisco Employee

Hi,

 

You don't actually need to modify the YANG module itself for that.

You should use the augment statement from your own file in order to extend sections of the data model written in other files.

 

This is a good practice, but some care needs to be taken in order to keep the validity of existing nodes.

 

You should be able to add a block similar to the one below to your YANG module (haven't tested it):

 

  import tailf-ncs {
    prefix ncs;
  }

  augment /ncs:devices/ncs:device-group {
    leaf realm {
      ...
    }
    list system {
      ...
    }
  }

Yftach

 

View solution in original post

Hi, when you say my own yang file which file would that be ? that yang file that is part of a service ?? Thanks Regards Yale

It's up to you.

It can be inside a service package that you already have, or inside another dedicated package, or inside some sort of common-library package where you'd keep additional generic stuff (YANG, code, etc.).

It all depends on what makes most sense for your solution.