[yang] add NEIGH yang model (#14521)

#### Why I did it
Yang model for NEIGH table was missing
Fixed https://github.com/sonic-net/sonic-buildimage/issues/13971

#### How I did it
added sonic-neigh.yang model

#### How to verify it
make buildimage

#### Description for the changelog
Adding NEIGH yang model
This commit is contained in:
Nikola Dancejic 2023-04-20 17:39:41 -07:00 committed by GitHub
parent 737c42d47d
commit d4a5c4781b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 181 additions and 1 deletions

View File

@ -43,7 +43,8 @@ Table of Contents
* [Management port](#management-port)
* [Management VRF](#management-vrf)
* [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue)
* [MUX_CABLE](#muxcable)
* [MUX_CABLE](#mux_cable)
* [NEIGH](#neigh)
* [NTP Global Configuration](#ntp-global-configuration)
* [NTP and SYSLOG servers](#ntp-and-syslog-servers)
* [Peer Switch](#peer-switch)
@ -1293,6 +1294,32 @@ The **MUX_CABLE** table is used for dualtor interface configuration. The `cable_
}
```
### NEIGH
The **NEIGH** table is used to keep track of resolved and static neighbors.
Resolve case:
```
{
"NEIGH": {
"Vlan100|100.1.1.3": {
"family": "IPv4"
}
}
}
```
Static Nbr:
```
{
"NEIGH": {
"Vlan100|100.1.1.5": {
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
}
}
}
```
### NTP Global Configuration
These configuration options are used to modify the way that

View File

@ -132,6 +132,7 @@ setup(
'./yang-models/sonic-mirror-session.yang',
'./yang-models/sonic-mpls-tc-map.yang',
'./yang-models/sonic-mux-cable.yang',
'./yang-models/sonic-neigh.yang',
'./yang-models/sonic-ntp.yang',
'./yang-models/sonic-nat.yang',
'./yang-models/sonic-nvgre-tunnel.yang',

View File

@ -2097,6 +2097,15 @@
}
},
"NEIGH": {
"Vlan100|100.1.1.3": {
"family": "IPv4"
},
"Vlan100|100.1.1.5": {
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
}
},
"POLICER": {
"everflow_static_policer": {

View File

@ -0,0 +1,15 @@
{
"VALID_NEIGH": {
"desc": "Load valid neighbors"
},
"NEIGH_MISSING_IP": {
"desc": "Load NEIGH missing IP address",
"eStr": ["Invalid JSON data"]
},
"NEIGH_INVALID_VLAN": {
"desc": "Load NEIGH missing VLAN",
"eStr": ["does not satisfy the constraint"]
}
}

View File

@ -0,0 +1,73 @@
{
"VALID_NEIGH": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan1000"
}
]
}
},
"sonic-neigh:sonic-neigh": {
"sonic-neigh:NEIGH": {
"NEIGH_LIST": [
{
"vlan": "Vlan1000",
"neighbor": "100.1.1.3",
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
},
{
"vlan": "Vlan1000",
"neighbor": "100.1.1.4",
"family": "IPv4"
}
]
}
}
},
"NEIGH_MISSING_IPV4": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan1000"
}
]
}
},
"sonic-neigh:sonic-neigh": {
"sonic-neigh:NEIGH": {
"NEIGH_LIST": [
{
"vlan": "Vlan1000",
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
}
]
}
}
},
"NEIGH_INVALID_VLAN": {
"sonic-neigh:sonic-neigh": {
"sonic-neigh:NEIGH": {
"NEIGH_LIST": [
{
"vlan": "INVALIDVlan",
"neighbor": "100.1.1.3",
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
},
{
"vlan": "Vlan1000",
"neighbor": "100.1.1.4",
"family": "IPv4"
}
]
}
}
}
}

View File

@ -0,0 +1,55 @@
module sonic-neigh {
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-neigh";
prefix neigh;
import ietf-inet-types {
prefix inet;
}
import ietf-yang-types {
prefix yang;
}
organization "SONiC";
contact "SONiC";
description "NEIGH YANG Module for SONiC OS";
revision 2023-03-31 {
description "Initial Revision";
}
container sonic-neigh {
container NEIGH {
description "NEIGH configuration";
list NEIGH_LIST {
key "vlan neighbor";
leaf vlan {
description "Neighbor Vlan interface ex. Vlan1000";
type string {
pattern "Vlan[0-9]+";
}
}
leaf neighbor {
description "Neighbor IP address ex. 100.1.1.3";
type inet:ip-address;
}
leaf neigh {
description "Neighbor MAC address";
type yang:mac-address;
}
leaf family {
description "IP family of Neighbor address";
type string {
pattern "IPv4|IPV4|IPv6|IPV6";
}
}
}
}
}
}