project-arlo / sonic-mgmt-framework

SONiC Management Framework
Other
5 stars 15 forks source link

CVL custom validation function hooks needs to supported #231

Open rvasanthm opened 5 years ago

rvasanthm commented 5 years ago

Use cases:

  1. Based on the interface type create and delete requests need to be controlled.
  2. IP address overlap or duplicate check needs to be done across all interface IP tables while configuring for an interface.

Slack discussion: Kwan Kim 11:14 AM @Partha Dutta @Ravi Kumar Vasanthm Thanks Partha. I think we need more parameters.

Partha Dutta Oct 21st at 8:21 PM @Ravi Kumar Vasanthm It looks like that following must expression can impose this constraint in sonic-interface.yang. Please let me know your opinion. leaf ip_prefix { mandatory true; type inet:ip-prefix; must "(/cmn:operation/cmn:operation != 'CREATE') or count(/sonic-interface/INTERFACE/INTERFACE_IPADDR_LIST[ip_prefix=current()]) = 1" { error-message "IP address has already been configured."; } }

(edited) 2 replies

Ravi Kumar Vasanthm 9 days ago @Partha Dutta This check covers only is this IP address assigned/configured in the system. But it doesn't check the network address overlap based on the netmask/prefix configured on interfaces. Please check golang net package method which checks the network overlap cases. func (n *IPNet) Contains(ip IP) bool

Ravi Kumar Vasanthm 9 days ago If current address should not overlap and also we need to consider checking all the IP address tables in config DB (INTERFACE,MGMT_INTERFACE, PORTFCHANNEL_XX, VLANS_XXX)

bhavini-gada commented 5 years ago

@dutta-partha - Any updates here ?

dutta-partha commented 4 years ago

Custom validation support is available, you may implement network overlap checking using it.