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 Dec 24, 2024
1 parent 95a1250 commit 05eb6be
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": "Value \"badaddr\" does not satisfy the constraint \"[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}\" (range, length, or pattern)."
}
}
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 05eb6be

Please sign in to comment.