Skip to content

Commit

Permalink
kamel: YANG sonic-interface: add missing mac_addr leaf (PR sonic-net#…
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
bradh352 authored and bluecmd committed Dec 28, 2024
1 parent c91fd47 commit cb4849e
Show file tree
Hide file tree
Showing 10 changed files with 397 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
"PortChannel0003": {
"nat_zone": "1",
"loopback_action": "drop",
"ipv6_use_link_local_only": "enable"
"ipv6_use_link_local_only": "enable",
"mac_addr": "02:26:9b:73:c1:1a"
},
"PortChannel0004": {"vrf_name": "Vrf_blue"},
"PortChannel42|10.1.0.1/31": {},
Expand All @@ -144,7 +145,8 @@
"Vlan111": {
"nat_zone": "0",
"loopback_action": "forward",
"ipv6_use_link_local_only": "disable"
"ipv6_use_link_local_only": "disable",
"mac_addr": "02:ab:cd:ef:12:34"
},
"Vlan777": {},
"Vlan111|2a04:5555:45:6709::1/64": {
Expand Down Expand Up @@ -1194,7 +1196,8 @@
"Ethernet18": {
"nat_zone": "1",
"loopback_action": "forward",
"ipv6_use_link_local_only": "enable"
"ipv6_use_link_local_only": "enable",
"mac_addr": "12:34:56:78:90:ab"
},
"Ethernet112|2a04:5555:40:a709::2/126": {
"scope": "global",
Expand Down
10 changes: 10 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/interface.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,15 @@
"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_UPPER_MAC_ADDR": {
"desc": "Set UPPERCASE 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 @@ -85,5 +85,15 @@
"PORTCHANNEL_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."
},
"PORTCHANNEL_INTERFACE_MAC_ADDR": {
"desc": "Set administrator-provided interface mac address."
},
"PORTCHANNEL_INTERFACE_UPPER_MAC_ADDR": {
"desc": "Set UPPERCASE administrator-provided interface mac address."
},
"PORTCHANNEL_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)."
}
}
10 changes: 10 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@
"desc": "Enable the ipv6 link-local as true.",
"eStr": "Invalid value \"true\" in \"ipv6_use_link_local_only\" element."
},
"VLAN_INTERFACE_MAC_ADDR": {
"desc": "Set administrator-provided interface mac address."
},
"VLAN_INTERFACE_UPPER_MAC_ADDR": {
"desc": "Set UPPERCASE administrator-provided interface mac address."
},
"VLAN_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)."
},
"VLAN_MEMBERS_WITHOUT_CREATING_VLAN":{
"desc": "Vlan members without Creating Vlan",
"eStrKey": "LeafRef"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,92 @@
]
}
}
},
"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_UPPER_MAC_ADDR": {
"sonic-interface:sonic-interface": {
"sonic-interface:INTERFACE": {
"INTERFACE_LIST": [
{
"name": "Ethernet8",
"mac_addr": "02:AB:CD:EF:12:34"
}
]
}
},
"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"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -535,5 +535,122 @@
]
}
}
},
"PORTCHANNEL_INTERFACE_MAC_ADDR": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "65",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000,
"mode": "routed"
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"min_links": "1",
"mtu": "9100",
"name": "PortChannel0001",
"mode": "routed"
}
]
},
"sonic-portchannel:PORTCHANNEL_INTERFACE": {
"PORTCHANNEL_INTERFACE_LIST": [
{
"name": "PortChannel0001",
"mac_addr": "02:26:9b:73:c1:1a"
}
]
}
}
},
"PORTCHANNEL_INTERFACE_UPPER_MAC_ADDR": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "65",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000,
"mode": "routed"
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"min_links": "1",
"mtu": "9100",
"name": "PortChannel0001",
"mode": "routed"
}
]
},
"sonic-portchannel:PORTCHANNEL_INTERFACE": {
"PORTCHANNEL_INTERFACE_LIST": [
{
"name": "PortChannel0001",
"mac_addr": "02:AB:CD:EF:12:34"
}
]
}
}
},
"PORTCHANNEL_INTERFACE_INVALID_MAC_ADDR": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "65",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000,
"mode": "routed"
}
]
}
},
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"min_links": "1",
"mtu": "9100",
"name": "PortChannel0001",
"mode": "routed"
}
]
},
"sonic-portchannel:PORTCHANNEL_INTERFACE": {
"PORTCHANNEL_INTERFACE_LIST": [
{
"name": "PortChannel0001",
"mac_addr": "badaddr"
}
]
}
}
}
}
Loading

0 comments on commit cb4849e

Please sign in to comment.