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

How to keep devices IP address unique in NSO device manager ?

Hello,

I want to ask how to keep devices IP address unique in NSO device manager ? In other words I want to prevent users from adding devices that have IP address already present in Cisco NSO device manager.

Thanks in advance.

1 Accepted Solution

Accepted Solutions

You cannot (at least should not) modify the device model.

 

What you want to do here Is to add custom validation. There are many ways of doing this, the easiest way is perhaps a policy. The following works but I should warn you that it is fairly inefficient, so don't use it with large numbers of devices:

policy rule unique-address
 foreach         /devices/device
 expr            "count(/ncs:devices/device[name != current()/name][address = current()/address]) = 0"
 warning-message "Addresses must be unique for {name}"
!

View solution in original post

3 Replies 3

erdemk
Level 1
Level 1

experts in this community can you give you a firm answer on that.

as a novice user, from my experience, i can tell you what i do.. i think there is no such check or parameter to enable this check in nso as there is only one key for devices list and it is device_name.. so i run daily script to check if there are such conditions, and then take necessary actions..

Thank you for your reply erdemk.

I thought of manipulating the YANG model of devices to guarantee uniqueness of IP address but I don't know if this is possible or how can we do it.

You cannot (at least should not) modify the device model.

 

What you want to do here Is to add custom validation. There are many ways of doing this, the easiest way is perhaps a policy. The following works but I should warn you that it is fairly inefficient, so don't use it with large numbers of devices:

policy rule unique-address
 foreach         /devices/device
 expr            "count(/ncs:devices/device[name != current()/name][address = current()/address]) = 0"
 warning-message "Addresses must be unique for {name}"
!