Skip to content

Commit 7613997

Browse files
bradh352bhouse-nexthop
authored andcommitted
YANG sonic-interface: add missing mac_addr leaf (PR sonic-net#20968)
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 6c99f70 commit 7613997

File tree

10 files changed

+397
-4
lines changed

10 files changed

+397
-4
lines changed

src/sonic-yang-models/tests/files/sample_config_db.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@
134134
"PortChannel0003": {
135135
"nat_zone": "1",
136136
"loopback_action": "drop",
137-
"ipv6_use_link_local_only": "enable"
137+
"ipv6_use_link_local_only": "enable",
138+
"mac_addr": "02:26:9b:73:c1:1a"
138139
},
139140
"PortChannel0004": {"vrf_name": "Vrf_blue"},
140141
"PortChannel42|10.1.0.1/31": {},
@@ -151,7 +152,8 @@
151152
"Vlan111": {
152153
"nat_zone": "0",
153154
"loopback_action": "forward",
154-
"ipv6_use_link_local_only": "disable"
155+
"ipv6_use_link_local_only": "disable",
156+
"mac_addr": "02:ab:cd:ef:12:34"
155157
},
156158
"Vlan777": {},
157159
"Vlan111|2a04:5555:45:6709::1/64": {
@@ -1201,7 +1203,8 @@
12011203
"Ethernet18": {
12021204
"nat_zone": "1",
12031205
"loopback_action": "forward",
1204-
"ipv6_use_link_local_only": "enable"
1206+
"ipv6_use_link_local_only": "enable",
1207+
"mac_addr": "12:34:56:78:90:ab"
12051208
},
12061209
"Ethernet112|2a04:5555:40:a709::2/126": {
12071210
"scope": "global",

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

+10
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,15 @@
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_UPPER_MAC_ADDR": {
37+
"desc": "Set UPPERCASE administrator-provided interface mac address."
38+
},
39+
"INTERFACE_INVALID_MAC_ADDR": {
40+
"desc": "Set invalid interface mac address.",
41+
"eStrKey": "Pattern"
3242
}
3343
}

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

+10
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,15 @@
8585
"PORTCHANNEL_INTERFACE_INVALID_ENABLE_IPV6_LINK_LOCAL": {
8686
"desc": "Enable the ipv6 link-local as true.",
8787
"eStr": "Invalid value \"true\" in \"ipv6_use_link_local_only\" element."
88+
},
89+
"PORTCHANNEL_INTERFACE_MAC_ADDR": {
90+
"desc": "Set administrator-provided interface mac address."
91+
},
92+
"PORTCHANNEL_INTERFACE_UPPER_MAC_ADDR": {
93+
"desc": "Set UPPERCASE administrator-provided interface mac address."
94+
},
95+
"PORTCHANNEL_INTERFACE_INVALID_MAC_ADDR": {
96+
"desc": "Set invalid interface mac address.",
97+
"eStrKey": "Pattern"
8898
}
8999
}

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

+10
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@
9191
"desc": "Enable the ipv6 link-local as true.",
9292
"eStr": "Invalid value \"true\" in \"ipv6_use_link_local_only\" element."
9393
},
94+
"VLAN_INTERFACE_MAC_ADDR": {
95+
"desc": "Set administrator-provided interface mac address."
96+
},
97+
"VLAN_INTERFACE_UPPER_MAC_ADDR": {
98+
"desc": "Set UPPERCASE administrator-provided interface mac address."
99+
},
100+
"VLAN_INTERFACE_INVALID_MAC_ADDR": {
101+
"desc": "Set invalid interface mac address.",
102+
"eStrKey": "Pattern"
103+
},
94104
"VLAN_MEMBERS_WITHOUT_CREATING_VLAN":{
95105
"desc": "Vlan members without Creating Vlan",
96106
"eStrKey": "LeafRef"

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

+87
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,92 @@
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_UPPER_MAC_ADDR": {
308+
"sonic-interface:sonic-interface": {
309+
"sonic-interface:INTERFACE": {
310+
"INTERFACE_LIST": [
311+
{
312+
"name": "Ethernet8",
313+
"mac_addr": "02:AB:CD:EF:12:34"
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+
}
335+
},
336+
"INTERFACE_INVALID_MAC_ADDR": {
337+
"sonic-interface:sonic-interface": {
338+
"sonic-interface:INTERFACE": {
339+
"INTERFACE_LIST": [
340+
{
341+
"name": "Ethernet8",
342+
"mac_addr": "badaddr"
343+
}
344+
]
345+
}
346+
},
347+
"sonic-port:sonic-port": {
348+
"sonic-port:PORT": {
349+
"PORT_LIST": [
350+
{
351+
"admin_status": "up",
352+
"alias": "eth8",
353+
"description": "Ethernet8",
354+
"fec": "rs",
355+
"lanes": "65",
356+
"mtu": 9000,
357+
"name": "Ethernet8",
358+
"speed": 25000,
359+
"mode":"trunk"
360+
}
361+
]
362+
}
363+
}
277364
}
278365
}

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

+117
Original file line numberDiff line numberDiff line change
@@ -535,5 +535,122 @@
535535
]
536536
}
537537
}
538+
},
539+
"PORTCHANNEL_INTERFACE_MAC_ADDR": {
540+
"sonic-port:sonic-port": {
541+
"sonic-port:PORT": {
542+
"PORT_LIST": [
543+
{
544+
"admin_status": "up",
545+
"alias": "eth0",
546+
"description": "Ethernet0",
547+
"lanes": "65",
548+
"mtu": 9000,
549+
"name": "Ethernet0",
550+
"speed": 25000,
551+
"mode": "routed"
552+
}
553+
]
554+
}
555+
},
556+
"sonic-portchannel:sonic-portchannel": {
557+
"sonic-portchannel:PORTCHANNEL": {
558+
"PORTCHANNEL_LIST": [
559+
{
560+
"admin_status": "up",
561+
"min_links": "1",
562+
"mtu": "9100",
563+
"name": "PortChannel0001",
564+
"mode": "routed"
565+
}
566+
]
567+
},
568+
"sonic-portchannel:PORTCHANNEL_INTERFACE": {
569+
"PORTCHANNEL_INTERFACE_LIST": [
570+
{
571+
"name": "PortChannel0001",
572+
"mac_addr": "02:26:9b:73:c1:1a"
573+
}
574+
]
575+
}
576+
}
577+
},
578+
"PORTCHANNEL_INTERFACE_UPPER_MAC_ADDR": {
579+
"sonic-port:sonic-port": {
580+
"sonic-port:PORT": {
581+
"PORT_LIST": [
582+
{
583+
"admin_status": "up",
584+
"alias": "eth0",
585+
"description": "Ethernet0",
586+
"lanes": "65",
587+
"mtu": 9000,
588+
"name": "Ethernet0",
589+
"speed": 25000,
590+
"mode": "routed"
591+
}
592+
]
593+
}
594+
},
595+
"sonic-portchannel:sonic-portchannel": {
596+
"sonic-portchannel:PORTCHANNEL": {
597+
"PORTCHANNEL_LIST": [
598+
{
599+
"admin_status": "up",
600+
"min_links": "1",
601+
"mtu": "9100",
602+
"name": "PortChannel0001",
603+
"mode": "routed"
604+
}
605+
]
606+
},
607+
"sonic-portchannel:PORTCHANNEL_INTERFACE": {
608+
"PORTCHANNEL_INTERFACE_LIST": [
609+
{
610+
"name": "PortChannel0001",
611+
"mac_addr": "02:AB:CD:EF:12:34"
612+
}
613+
]
614+
}
615+
}
616+
},
617+
"PORTCHANNEL_INTERFACE_INVALID_MAC_ADDR": {
618+
"sonic-port:sonic-port": {
619+
"sonic-port:PORT": {
620+
"PORT_LIST": [
621+
{
622+
"admin_status": "up",
623+
"alias": "eth0",
624+
"description": "Ethernet0",
625+
"lanes": "65",
626+
"mtu": 9000,
627+
"name": "Ethernet0",
628+
"speed": 25000,
629+
"mode": "routed"
630+
}
631+
]
632+
}
633+
},
634+
"sonic-portchannel:sonic-portchannel": {
635+
"sonic-portchannel:PORTCHANNEL": {
636+
"PORTCHANNEL_LIST": [
637+
{
638+
"admin_status": "up",
639+
"min_links": "1",
640+
"mtu": "9100",
641+
"name": "PortChannel0001",
642+
"mode": "routed"
643+
}
644+
]
645+
},
646+
"sonic-portchannel:PORTCHANNEL_INTERFACE": {
647+
"PORTCHANNEL_INTERFACE_LIST": [
648+
{
649+
"name": "PortChannel0001",
650+
"mac_addr": "badaddr"
651+
}
652+
]
653+
}
654+
}
538655
}
539656
}

0 commit comments

Comments
 (0)