Skip to content

Commit 7fc5471

Browse files
committed
YANG sonic-interface: add missing mac_addr leaf
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)
1 parent 96d7461 commit 7fc5471

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

src/sonic-yang-models/tests/yang_model_tests/tests/interface.json

+7
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,12 @@
2929
"INTERFACE_INVALID_ENABLE_IPV6_LINK_LOCAL": {
3030
"desc": "Enable the ipv6 link-local as true.",
3131
"eStr": "Invalid value \"true\" in \"ipv6_use_link_local_only\" element."
32+
},
33+
"INTERFACE_MAC_ADDR": {
34+
"desc": "Set administrator-provided interface mac address."
35+
},
36+
"INTERFACE_INVALID_MAC_ADDR": {
37+
"desc": "Set invalid interface mac address.",
38+
"eStr": "Invalid value \"badaddr\" in \"mac_addr\" element."
3239
}
3340
}

src/sonic-yang-models/tests/yang_model_tests/tests_config/interface.json

+58
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,63 @@
274274
]
275275
}
276276
}
277+
},
278+
"INTERFACE_MAC_ADDR": {
279+
"sonic-interface:sonic-interface": {
280+
"sonic-interface:INTERFACE": {
281+
"INTERFACE_LIST": [
282+
{
283+
"name": "Ethernet8",
284+
"mac_addr": "02:26:9b:73:c1:1a"
285+
}
286+
]
287+
}
288+
},
289+
"sonic-port:sonic-port": {
290+
"sonic-port:PORT": {
291+
"PORT_LIST": [
292+
{
293+
"admin_status": "up",
294+
"alias": "eth8",
295+
"description": "Ethernet8",
296+
"fec": "rs",
297+
"lanes": "65",
298+
"mtu": 9000,
299+
"name": "Ethernet8",
300+
"speed": 25000,
301+
"mode":"trunk"
302+
}
303+
]
304+
}
305+
}
306+
},
307+
"INTERFACE_INVALID_MAC_ADDR": {
308+
"sonic-interface:sonic-interface": {
309+
"sonic-interface:INTERFACE": {
310+
"INTERFACE_LIST": [
311+
{
312+
"name": "Ethernet8",
313+
"mac_addr": "badaddr"
314+
}
315+
]
316+
}
317+
},
318+
"sonic-port:sonic-port": {
319+
"sonic-port:PORT": {
320+
"PORT_LIST": [
321+
{
322+
"admin_status": "up",
323+
"alias": "eth8",
324+
"description": "Ethernet8",
325+
"fec": "rs",
326+
"lanes": "65",
327+
"mtu": 9000,
328+
"name": "Ethernet8",
329+
"speed": 25000,
330+
"mode":"trunk"
331+
}
332+
]
333+
}
334+
}
277335
}
278336
}

src/sonic-yang-models/yang-models/sonic-interface.yang

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ module sonic-interface {
55
namespace "http://github.com/sonic-net/sonic-interface";
66
prefix intf;
77

8+
import ietf-yang-types {
9+
prefix yang;
10+
}
11+
812
import sonic-types {
913
prefix stypes;
1014
}
@@ -81,6 +85,11 @@ module sonic-interface {
8185
default disable;
8286
}
8387

88+
leaf mac_addr {
89+
description "Assign Administrator-provided MAC address to Interface";
90+
type yang:mac-address;
91+
}
92+
8493
leaf loopback_action {
8594
description "Packet action when a packet ingress and gets routed on the same IP interface";
8695
type stypes:loopback_action;

0 commit comments

Comments
 (0)