Skip to content

Commit 7a06ef0

Browse files
committed
[yang] interface: add missing mac_addr leaf (sonic-net#20968)
Why I did it YANG configuration verification fails during config replace. How I did it mac_addr support was added in the INTERFACE, PORTCHANNEL_INTERFACE, and VLAN_INTERFACE tables by sonic-net/sonic-swss#814 in 2020 but the YANG models were never updated to reflect that change. Updated yang model to reflect change. How to verify it Add mac_addr to the various INTERFACE tables then run config replace and it succeeds. Tested branch (Please provide the tested image version) master as of 20241109 Description for the changelog YANG INTERFACE: add missing mac_addr leaf Link to config_db schema for YANG module changes There is no actual INTERFACE section in the docs (there probably should be). A picture of a cute animal (not mandatory but encouraged) Fixes sonic-net#14253
1 parent e9215e4 commit 7a06ef0

File tree

11 files changed

+579
-165
lines changed

11 files changed

+579
-165
lines changed

src/sonic-yang-models/doc/Configuration.md

+182-161
Original file line numberDiff line numberDiff line change
@@ -4,102 +4,98 @@
44
Table of Contents
55
=================
66

7-
* [Introduction](#introduction)
8-
* [Configuration](#configuration)
9-
* [<strong>Config Load and Save</strong>](#config-load-and-save)
10-
11-
* [Incremental Configuration](#incremental-configuration)
12-
* [<strong>Redis and Json Schema</strong>](#redis-and-json-schema)
13-
14-
* [ACL and Mirroring](#acl-and-mirroring)
15-
* [BGP BBR](#bgp-bbr)
16-
* [ASIC SDK health event](#asic-sdk-health-event)
17-
* [BGP Device Global](#bgp-device-global)
18-
* [BGP Sessions](#bgp-sessions)
19-
* [BUFFER_PG](#buffer_pg)
20-
* [Buffer pool](#buffer-pool)
21-
* [Buffer profile](#buffer-profile)
22-
* [Buffer queue](#buffer-queue)
23-
* [Buffer port ingress profile list](#buffer-port-ingress-profile-list)
24-
* [Buffer port egress profile list](#buffer-port-egress-profile-list)
25-
* [Cable length](#cable-length)
26-
* [Chassis module](#chassis-module)
27-
* [COPP_TABLE](#copp_table)
28-
* [Console](#console)
29-
* [CRM](#crm)
30-
* [CRM DASH](#crm-dash)
31-
* [Data Plane L3 Interfaces](#data-plane-l3-interfaces)
32-
* [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER)
33-
* [Device Metadata](#device-metadata)
34-
* [Device neighbor metada](#device-neighbor-metada)
35-
* [DHCP_RELAY](#dhcp_relay)
36-
* [DHCP Server IPV4](#dhcp_server_ipv4)
37-
* [BMP](#bmp)
38-
* [DSCP_TO_TC_MAP](#dscp_to_tc_map)
39-
* [FG_NHG](#fg_nhg)
40-
* [FG_NHG_MEMBER](#fg_nhg_member)
41-
* [FG_NHG_PREFIX](#fg_nhg_prefix)
42-
* [FABRIC_MONITOR](#fabric-monitor)
43-
* [FABRIC_PORT](#fabric-port)
44-
* [FLEX_COUNTER_TABLE](#flex_counter_table)
45-
* [GRPCCLIENT](#grpcclient)
46-
* [Hash](#hash)
47-
* [IPv6 Link-local] (#ipv6-link-local)
48-
* [KDUMP](#kdump)
49-
* [Kubernetes Master](#kubernetes-master)
50-
* [L2 Neighbors](#l2-neighbors)
51-
* [Loopback Interface](#loopback-interface)
52-
* [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN)
53-
* [Memory Statistics](#memory-statistics)
54-
* [Management Interface](#management-interface)
55-
* [Management port](#management-port)
56-
* [Management VRF](#management-vrf)
57-
* [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue)
58-
* [MUX_CABLE](#mux_cable)
59-
* [MUX_LINKMGR](#mux_linkmgr)
60-
* [NEIGH](#neigh)
61-
* [NTP Global Configuration](#ntp-global-configuration)
62-
* [NTP Servers](#ntp-servers)
63-
* [Peer Switch](#peer-switch)
64-
* [Policer](#policer)
65-
* [Port](#port)
66-
* [Port Channel](#port-channel)
67-
* [Portchannel member](#portchannel-member)
68-
* [Scheduler](#scheduler)
69-
* [Port QoS Map](#port-qos-map)
70-
* [Queue](#queue)
71-
* [Syslog Global Configuration](#syslog-global-configuration)
72-
* [Syslog Servers](#syslog-servers)
73-
* [Sflow](#sflow)
74-
* [Restapi](#restapi)
75-
* [System Port](#system-port)
76-
* [Tacplus Server](#tacplus-server)
77-
* [TC to Priority group map](#tc-to-priority-group-map)
78-
* [TC to Queue map](#tc-to-queue-map)
79-
* [Telemetry](#telemetry)
80-
* [Telemetry client](#telemetry-client)
81-
* [Tunnel](#tunnel)
82-
* [Versions](#versions)
83-
* [VLAN](#vlan)
84-
* [VLAN_MEMBER](#vlan_member)
85-
* [VNET](#vnet)
86-
* [VOQ Inband Interface](#voq-inband-interface)
87-
* [VXLAN](#vxlan)
88-
* [Virtual router](#virtual-router)
89-
* [LOGGER](#logger)
90-
* [WRED_PROFILE](#wred_profile)
91-
* [XCVRD_LOG](#xcvrd_log)
92-
* [PASSWORD_HARDENING](#password_hardening)
93-
* [SSH_SERVER](#ssh_server)
94-
* [SUBNET_DECAP](#subnet_decap)
95-
* [SYSTEM_DEFAULTS table](#systemdefaults-table)
96-
* [RADIUS](#radius)
97-
* [Static DNS](#static-dns)
98-
* [ASIC_SENSORS](#asic_sensors)
99-
* [For Developers](#for-developers)
100-
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
101-
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
102-
7+
* [Introduction](#introduction)
8+
* [Configuration](#configuration)
9+
* [<strong>Config Load and Save</strong>](#config-load-and-save)
10+
* [Incremental Configuration](#incremental-configuration)
11+
* [<strong>Redis and Json Schema</strong>](#redis-and-json-schema)
12+
* [ACL and Mirroring](#acl-and-mirroring)
13+
* [BGP BBR](#bgp-bbr)
14+
* [ASIC SDK health event](#asic-sdk-health-event)
15+
* [BGP Device Global](#bgp-device-global)
16+
* [BGP Sessions](#bgp-sessions)
17+
* [BUFFER_PG](#buffer_pg)
18+
* [Buffer pool](#buffer-pool)
19+
* [Buffer profile](#buffer-profile)
20+
* [Buffer queue](#buffer-queue)
21+
* [Buffer port ingress profile list](#buffer-port-ingress-profile-list)
22+
* [Buffer port egress profile list](#buffer-port-egress-profile-list)
23+
* [Cable length](#cable-length)
24+
* [Chassis module](#chassis-module)
25+
* [COPP_TABLE](#copp_table)
26+
* [Console](#console)
27+
* [CRM](#crm)
28+
* [CRM DASH](#crm-dash)
29+
* [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER)
30+
* [Device Metadata](#device-metadata)
31+
* [Device neighbor metada](#device-neighbor-metada)
32+
* [DHCP_RELAY](#dhcp_relay)
33+
* [DHCP Server IPV4](#dhcp_server_ipv4)
34+
* [BMP](#bmp)
35+
* [DSCP_TO_TC_MAP](#dscp_to_tc_map)
36+
* [FG_NHG](#fg_nhg)
37+
* [FG_NHG_MEMBER](#fg_nhg_member)
38+
* [FG_NHG_PREFIX](#fg_nhg_prefix)
39+
* [FABRIC_MONITOR](#fabric-monitor)
40+
* [FABRIC_PORT](#fabric-port)
41+
* [FLEX_COUNTER_TABLE](#flex_counter_table)
42+
* [GRPCCLIENT](#grpcclient)
43+
* [Hash](#hash)
44+
* [KDUMP](#kdump)
45+
* [Kubernetes Master](#kubernetes-master)
46+
* [L2 Neighbors](#l2-neighbors)
47+
* [L3 Interfaces](#l3-interfaces)
48+
* [Loopback Interface](#loopback-interface)
49+
* [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN)
50+
* [Memory Statistics](#memory-statistics)
51+
* [Management Interface](#management-interface)
52+
* [Management port](#management-port)
53+
* [Management VRF](#management-vrf)
54+
* [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue)
55+
* [MUX_CABLE](#mux_cable)
56+
* [MUX_LINKMGR](#mux_linkmgr)
57+
* [NEIGH](#neigh)
58+
* [NTP Global Configuration](#ntp-global-configuration)
59+
* [NTP Servers](#ntp-servers)
60+
* [Peer Switch](#peer-switch)
61+
* [Policer](#policer)
62+
* [Port](#port)
63+
* [Port Channel](#port-channel)
64+
* [Portchannel member](#portchannel-member)
65+
* [Scheduler](#scheduler)
66+
* [Port QoS Map](#port-qos-map)
67+
* [Queue](#queue)
68+
* [Syslog Global Configuration](#syslog-global-configuration)
69+
* [Syslog Servers](#syslog-servers)
70+
* [Sflow](#sflow)
71+
* [Restapi](#restapi)
72+
* [System Port](#system-port)
73+
* [Tacplus Server](#tacplus-server)
74+
* [TC to Priority group map](#tc-to-priority-group-map)
75+
* [TC to Queue map](#tc-to-queue-map)
76+
* [Telemetry](#telemetry)
77+
* [Telemetry client](#telemetry-client)
78+
* [Tunnel](#tunnel)
79+
* [Versions](#versions)
80+
* [VLAN](#vlan)
81+
* [VLAN_MEMBER](#vlan_member)
82+
* [VNET](#vnet)
83+
* [VOQ Inband Interface](#voq-inband-interface)
84+
* [VXLAN](#vxlan)
85+
* [Virtual router](#virtual-router)
86+
* [LOGGER](#logger)
87+
* [WRED_PROFILE](#wred_profile)
88+
* [XCVRD_LOG](#xcvrd_log)
89+
* [PASSWORD_HARDENING](#password_hardening)
90+
* [SSH_SERVER](#ssh_server)
91+
* [SUBNET_DECAP](#subnet_decap)
92+
* [SYSTEM_DEFAULTS table](#systemdefaults-table)
93+
* [RADIUS](#radius)
94+
* [Static DNS](#static-dns)
95+
* [ASIC_SENSORS](#asic_sensors)
96+
* [For Developers](#for-developers)
97+
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
98+
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
10399

104100

105101
# Introduction
@@ -930,47 +926,6 @@ It currently allows user to administratively bring down a line-card or fabric-ca
930926
}
931927
```
932928

933-
### Data Plane L3 Interfaces
934-
935-
IP configuration for data plane are defined in **INTERFACE**, **VLAN_SUB_INTERFACE**,
936-
**PORTCHANNEL_INTERFACE** and **VLAN_INTERFACE** table. The objects
937-
in all four tables have the interface (could be physical port, port
938-
channel, vlan or vlan sub interface) that IP address is attached to as first-level key, and
939-
IP prefix as second-level key. IP interface address objects don't have any attributes.
940-
IP interface attributes, resides in those tables as well, key is the interface name
941-
and value is a list of field-values representing the interface attributes, e.g. loopback action.
942-
943-
```
944-
{
945-
"INTERFACE": {
946-
"Ethernet0|10.0.0.0/31": {},
947-
"Ethernet4|10.0.0.2/31": {},
948-
"Ethernet8|10.0.0.4/31": {}
949-
"Ethernet8": {
950-
"loopback_action": "drop"
951-
}
952-
},
953-
954-
"PORTCHANNEL_INTERFACE": {
955-
"PortChannel01|10.0.0.56/31": {},
956-
"PortChannel01|FC00::71/126": {},
957-
"PortChannel02|10.0.0.58/31": {},
958-
"PortChannel02|FC00::75/126": {}
959-
},
960-
961-
"VLAN_INTERFACE": {
962-
"Vlan1000|192.168.0.1/27": {}
963-
},
964-
965-
"VLAN_SUB_INTERFACE": {
966-
"Ethernet4.1|10.0.0.2/31": {},
967-
"Ethernet4.1": {
968-
"loopback_action": "drop"
969-
}
970-
}
971-
}
972-
```
973-
974929

975930
### DEFAULT_LOSSLESS_BUFFER_PARAMETER
976931

@@ -1341,30 +1296,6 @@ The configuration is applied globally for each ECMP and LAG on a switch.
13411296
}
13421297
```
13431298

1344-
### IPv6 Link-local
1345-
```
1346-
{
1347-
"INTERFACE": {
1348-
"Ethernet8": {
1349-
"ipv6_use_link_local_only": "disable"
1350-
}
1351-
},
1352-
1353-
"PORTCHANNEL_INTERFACE": {
1354-
"PortChannel01": {
1355-
"ipv6_use_link_local_only": "enable"
1356-
}
1357-
},
1358-
1359-
"VLAN_INTERFACE": {
1360-
"Vlan1000": {
1361-
"ipv6_use_link_local_only": "enable"
1362-
}
1363-
}
1364-
}
1365-
1366-
```
1367-
13681299
### KDUMP
13691300

13701301
```
@@ -1449,6 +1380,96 @@ loopback address can also be defined.
14491380
}
14501381
```
14511382

1383+
### L3 Interfaces
1384+
1385+
Configuration for L3 data plane interfaces are defined in the `INTERFACE`,
1386+
`VLAN_INTERFACE`, `VLAN_SUB_INTERFACE` and `PORTCHANNEL_INTERFACE` tables,
1387+
respectively.
1388+
1389+
The objects in all four tables have the interface as the key with the following
1390+
required patterns:
1391+
- `INTERFACE`: Any valid port name from the `PORT` table. Typically `Ethernet{0-999}`.
1392+
- `VLAN_INTERFACE`: `Vlan{1-4095}`
1393+
- `PORTCHANNEL_INTERFACE`: `PortChannel{0-9999}`
1394+
- `VLAN_SUB_INTERFACE`: Any valid `INTERFACE` or `PORTCHANNEL_INTERFACE` name followed by a `.` and a number between 1 and 4094. E.g. `Ethernet1.4`
1395+
1396+
1397+
These tables have a number of shared attributes as described below:
1398+
* `vrf_name`: Valid VRF name from the `VRF` table. Default: `default`
1399+
* `nat_zone`: NAT Zone for this interface. `0..3`
1400+
* `mpls`: Enable/disable MPLS routing for the interface. `enable` or `disable`. Default `disable`.
1401+
* `ipv6_use_link_local_only`: Enable/Disable IPv6 link local address on interface. `enable` or `disable`. Default `disable`.
1402+
* `mac_addr`: Assign administrator-provided MAC address to Interface. If not specified will use the system MAC (same for all interfaces). Not applicable to `VLAN_SUB_INTERFACE` as it will use the parent interface's mac address.
1403+
* `loopback_action`: Packet action when a packet ingress and gets routed on the same IP interface. `drop` or `forward`.
1404+
1405+
1406+
```json
1407+
1408+
{
1409+
"INTERFACE": {
1410+
"Ethernet0": {
1411+
"ipv6_use_link_local_only": "enable",
1412+
"mac_addr": "12:34:56:78:90:ab"
1413+
},
1414+
"Ethernet1": {
1415+
"loopback_action": "drop"
1416+
}
1417+
},
1418+
"VLAN_INTERFACE": {
1419+
"Vlan201": {
1420+
"vrf_name": "red",
1421+
"mac_addr": "AB:CD:EF:12:34:56"
1422+
}
1423+
},
1424+
"PORTCHANNEL_INTERFACE": {
1425+
"PortChannel101": {
1426+
"mac_addr": "1c:23:a8:56:de:2f"
1427+
}
1428+
},
1429+
"VLAN_SUB_INTERFACE": {
1430+
"Ethernet0.555": {
1431+
"vrf_name": "Blue",
1432+
"vlan": "555"
1433+
}
1434+
}
1435+
}
1436+
```
1437+
1438+
#### Assigning IP addresses to L3 Interfaces
1439+
1440+
The interface name and IP prefix act as multi-level key for the interface
1441+
objects. The IP prefixes are stored in the same tables as the interface
1442+
attributes: `INTERFACE`, `VLAN_INTERFACE`, `VLAN_SUB_INTERFACE` and `PORTCHANNEL_INTERFACE`.
1443+
1444+
In the example below we will show one interface with attributes for clarity,
1445+
but otherwise this is simply an example of how IP addresses may be configured.
1446+
1447+
```json
1448+
{
1449+
"INTERFACE": {
1450+
"Ethernet0": {
1451+
"ipv6_use_link_local_only": "enable",
1452+
"mac_addr": "12:34:56:78:90:ab"
1453+
},
1454+
"Ethernet0|10.0.0.0/31": {},
1455+
"Ethernet4|10.0.0.2/31": {},
1456+
"Ethernet8|10.0.0.4/31": {},
1457+
},
1458+
"PORTCHANNEL_INTERFACE": {
1459+
"PortChannel01|10.0.0.56/31": {},
1460+
"PortChannel01|FC00::71/126": {},
1461+
"PortChannel02|10.0.0.58/31": {},
1462+
"PortChannel02|FC00::75/126": {}
1463+
},
1464+
"VLAN_INTERFACE": {
1465+
"Vlan1000|192.168.0.1/27": {}
1466+
},
1467+
"VLAN_SUB_INTERFACE": {
1468+
"Ethernet4.1|10.0.0.2/31": {}
1469+
}
1470+
}
1471+
```
1472+
14521473
### Loopback Interface
14531474

14541475
Loopback interface configuration lies in **LOOPBACK_INTERFACE** table

0 commit comments

Comments
 (0)