Skip to content

[action] [PR:22074] [YANG] sonic-neigh.yang need support portchannel #22095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/sonic-yang-models/tests/yang_model_tests/tests/neigh.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@

"NEIGH_INVALID_VLAN": {
"desc": "Load NEIGH missing VLAN",
"eStr": ["does not satisfy the constraint"]
"eStrKey": "InvalidValue",
"eStr": ["port"]
},

"VALID_NEIGH_PORTCHANNEL": {
"desc": "Load valid PORTCHANNEL"
},

"NEIGH_INVALID_PORTCHANNEL": {
"desc": "Load NEIGH missing PORTCHANNEL",
"eStrKey": "InvalidValue",
"eStr": ["port"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"sonic-neigh:NEIGH": {
"NEIGH_LIST": [
{
"vlan": "Vlan1000",
"port": "Vlan1000",
"neighbor": "100.1.1.3",
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
},
{
"vlan": "Vlan1000",
"port": "Vlan1000",
"neighbor": "100.1.1.4",
"family": "IPv4"
}
Expand All @@ -42,7 +42,7 @@
"sonic-neigh:NEIGH": {
"NEIGH_LIST": [
{
"vlan": "Vlan1000",
"port": "Vlan1000",
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
}
Expand All @@ -56,18 +56,73 @@
"sonic-neigh:NEIGH": {
"NEIGH_LIST": [
{
"vlan": "INVALIDVlan",
"port": "INVALIDVlan",
"neighbor": "100.1.1.3",
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
},
{
"vlan": "Vlan1000",
"port": "Vlan1000",
"neighbor": "100.1.1.4",
"family": "IPv4"
}
]
}
}
},

"VALID_NEIGH_PORTCHANNEL": {
"sonic-neigh:sonic-neigh": {
"sonic-neigh:NEIGH": {
"NEIGH_LIST": [
{
"port": "PortChannel1024",
"neighbor": "100.1.1.3",
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
},
{
"port": "PortChannel1024",
"neighbor": "100.1.1.4",
"family": "IPv4"
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"name": "PortChannel1024"
}
]
}
}
},

"NEIGH_INVALID_PORTCHANNEL": {
"sonic-neigh:sonic-neigh": {
"sonic-neigh:NEIGH": {
"NEIGH_LIST": [
{
"port": "PortChannel10",
"neighbor": "100.1.1.3",
"neigh": "00:02:02:03:04:05",
"family": "IPv4"
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"name": "PortChannel11"
}
]
}
}
}
}
27 changes: 17 additions & 10 deletions src/sonic-yang-models/yang-models/sonic-neigh.yang
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module sonic-neigh {
prefix yang;
}

import sonic-portchannel {
prefix lag;
}
// TODO: Uncomment the following lines when sonic-vlan.yang is available
// import sonic-vlan {
// prefix svlan;
Expand All @@ -29,18 +32,22 @@ module sonic-neigh {
container NEIGH {
description "NEIGH configuration";
list NEIGH_LIST {
key "vlan neighbor";
key "port neighbor";

leaf vlan {
// TODO: Remove the following lines when sonic-vlan.yang is available
description "Neighbor Vlan interface ex. Vlan1000";
type string {
pattern "Vlan[0-9]+";
leaf port {
description "Neighbor interface ex. Vlan1000, PortChannel1024";
type union {
type leafref {
path /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name;
}
type string {
pattern "Vlan[0-9]+";
}
// TODO: Uncomment the following lines when sonic-vlan.yang is available
// type leafref {
// path "/svlan:sonic-vlan/svlan:VLAN/svlan:VLAN_LIST/svlan:name";
// }
}
// TODO: Uncomment the following lines when sonic-vlan.yang is available
// type leafref {
// path "/svlan:sonic-vlan/svlan:VLAN/svlan:VLAN_LIST/svlan:name";
// }
}

leaf neighbor {
Expand Down
Loading