cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

How to make sure IP is unique in a simple service to configure IP

179
Views
0
Helpful
2
Comments
Cisco Employee

Hi,

 

I have a simple service to configure an IP under loopback interface, but how do I delete the IP, if the one I am going to configure is pre-existing on another interface or at least give a warning that this IP is already in use?

 

Here is my yang file - 

 

module colour {
namespace "http://com/example/colour";
prefix colour;

import ietf-inet-types {
prefix inet;
}
import tailf-ncs {
prefix ncs;
}
import tailf-common {
prefix tailf;
}
list colour {
key name;

leaf name {
type string;
}

uses ncs:service-data;
ncs:servicepoint "colour";

leaf colour {
tailf:info "Select the Colour for SLA";
type enumeration {
enum BLUE;
enum GREEN;
enum RED;
}
}

leaf intf {
tailf:info "Select Loopback Interface number";
type enumeration {
enum 101;
enum 102;
enum 103;
}
}
leaf ip_address {
tailf:info "Select IP Address";
type enumeration {
enum 11.1.1.1;
enum 11.1.1.100;
enum 11.1.1.200;
}
}
}
}

2 Comments
Beginner

Hello,

I think this request needs python maapi intervention, you need to parse all the interfaces and check if any of them have ip address the same as the service is trying to configure. Then, in python, you can make your decision either fail and exit or just raise a log warning.

 

Cisco Employee

Thank you for giving me this hint. I had a brief look, it is not a simple logic that I could easily implement in the current YANG file. Looks like it is going to complicate my current service. Probably for now, I will just let the user know that they have to take care of this duplicate IP manually.