Skip to content

Commit

Permalink
YANG sonic-interface: add missing mac_addr leaf
Browse files Browse the repository at this point in the history
mac_addr support was added in the INTERFACES table by
sonic-net/sonic-swss#814 in 2020
but the YANG models were never updated to reflect that change.

Signed-off-by: Brad House (@bradh352)
  • Loading branch information
bradh352 committed Nov 29, 2024
1 parent 96d7461 commit 7fc5471
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,12 @@
"INTERFACE_INVALID_ENABLE_IPV6_LINK_LOCAL": {
"desc": "Enable the ipv6 link-local as true.",
"eStr": "Invalid value \"true\" in \"ipv6_use_link_local_only\" element."
},
"INTERFACE_MAC_ADDR": {
"desc": "Set administrator-provided interface mac address."
},
"INTERFACE_INVALID_MAC_ADDR": {
"desc": "Set invalid interface mac address.",
"eStr": "Invalid value \"badaddr\" in \"mac_addr\" element."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,63 @@
]
}
}
},
"INTERFACE_MAC_ADDR": {
"sonic-interface:sonic-interface": {
"sonic-interface:INTERFACE": {
"INTERFACE_LIST": [
{
"name": "Ethernet8",
"mac_addr": "02:26:9b:73:c1:1a"
}
]
}
},
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth8",
"description": "Ethernet8",
"fec": "rs",
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000,
"mode":"trunk"
}
]
}
}
},
"INTERFACE_INVALID_MAC_ADDR": {
"sonic-interface:sonic-interface": {
"sonic-interface:INTERFACE": {
"INTERFACE_LIST": [
{
"name": "Ethernet8",
"mac_addr": "badaddr"
}
]
}
},
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth8",
"description": "Ethernet8",
"fec": "rs",
"lanes": "65",
"mtu": 9000,
"name": "Ethernet8",
"speed": 25000,
"mode":"trunk"
}
]
}
}
}
}
9 changes: 9 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-interface.yang
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ module sonic-interface {
namespace "http://github.com/sonic-net/sonic-interface";
prefix intf;

import ietf-yang-types {
prefix yang;
}

import sonic-types {
prefix stypes;
}
Expand Down Expand Up @@ -81,6 +85,11 @@ module sonic-interface {
default disable;
}

leaf mac_addr {
description "Assign Administrator-provided MAC address to Interface";
type yang:mac-address;
}

leaf loopback_action {
description "Packet action when a packet ingress and gets routed on the same IP interface";
type stypes:loopback_action;
Expand Down

0 comments on commit 7fc5471

Please sign in to comment.