From 0a9b84adcd1da88f0735cc2ba3380f9f41fade51 Mon Sep 17 00:00:00 2001 From: Xincun Li <147451452+xincunli-sonic@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:29:55 -0700 Subject: [PATCH] [YANG]: Add Yang model support for Multi ASIC port and device_metadata (#18444) ### Why I did it In Multi ASIC scenario, 1. PORT configuration table requires `coreId`, `corePortId` and `numVoq`: ```json { "PORT": { "Ethernet0": { "index": "0", "lanes": "101,102", "description": "fortyGigE1/1/1", "mtu": "9100", "alias": "fortyGigE1/1/1", "speed": "40000", "link_training": "off", "laser_freq": "191300", "tx_power": "-27.3", "dom_polling": "enabled", "coreId": "1", "corePortId": "1", "numVoq": "8" }, "Ethernet1": { "index": "1", "lanes": "103,104", "description": "fortyGigE1/1/2", "mtu": "9100", "alias": "fortyGigE1/1/2", "admin_status": "up", "speed": "40000", "link_training": "on", "laser_freq": "191300", "tx_power": "-27.3", "dom_polling": "enabled", "coreId": "0", "corePortId": "14", "numVoq": "8" }, "Ethernet63": { "index": "63", "lanes": "87,88", "description": "fortyGigE1/4/16", "mtu": "9100", "alias": "fortyGigE1/4/16", "speed": "40000", "laser_freq": "191300", "tx_power": "-27.3", "dom_polling": "disabled", "coreId": "0", "corePortId": "15", "numVoq": "8" } } } ``` 2. DEVICE_METADATA configuration table requires `asic_id`: ```json { "DEVICE_METADATA": { "localhost": { "asic_id": "06:00.0", "asic_name": "asic0", "hwsku": "Force10-S6100", "default_bgp_status": "up", "docker_routing_config_mode": "unified", "hostname": "sonic-s6100-01", "platform": "x86_64-dell_s6100_c2538-r0", "mac": "4c:76:25:f4:70:82", "default_pfcwd_status": "disable", "bgp_asn": "65100", "deployment_id": "1", "type": "ToRRouter", "bgp_adv_lo_prefix_as_128" : "true", "buffer_model": "traditional", "yang_config_validation": "disable", "rack_mgmt_map": "dummy_value", "timezome": "Europe/Kiev" } } } ``` ##### Work item tracking - Microsoft ADO **(number only)**: 27252814, 27253157 #### How I did it 1. Added `coreId`, `corePortId` and `numVoq` field to CONFIG_DB PORT table. 2. Added `asic_id` and `asic_name` field to CONFIG_DB DEVICE_METADATA table. --- src/sonic-yang-models/doc/Configuration.md | 21 +++++-- .../tests/files/sample_config_db.json | 12 +++- .../tests/device_metadata.json | 6 ++ .../tests/yang_model_tests/tests/port.json | 9 +++ .../tests_config/device_metadata.json | 28 +++++++++ .../yang_model_tests/tests_config/port.json | 60 +++++++++++++++++++ .../yang-models/sonic-device_metadata.yang | 7 +++ .../yang-models/sonic-port.yang | 27 ++++++++- 8 files changed, 161 insertions(+), 9 deletions(-) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 886277d26f7c..2ffbba945f8b 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -85,7 +85,7 @@ Table of Contents * [LOGGER](#logger) * [WRED_PROFILE](#wred_profile) * [PASSWORD_HARDENING](#password_hardening) - * [SSH_SERVER](#ssh_server) + * [SSH_SERVER](#ssh_server) * [SYSTEM_DEFAULTS table](#systemdefaults-table) * [RADIUS](#radius) * [Static DNS](#static-dns) @@ -942,6 +942,8 @@ instance is supported in SONiC. { "DEVICE_METADATA": { "localhost": { + "asic_id": "06:00.0", + "asic_name": "asic0", "hwsku": "Force10-S6100", "default_bgp_status": "up", "docker_routing_config_mode": "unified", @@ -1210,7 +1212,7 @@ The FG_NHG_PREFIX table provides the FG_NHG_PREFIX for which FG behavior is desi ### Hash -Generic hash allows user to configure various aspects of hashing algorithm. +Generic hash allows user to configure various aspects of hashing algorithm. The configuration is applied globally for each ECMP and LAG on a switch. ***ECMP/LAG HASH*** @@ -1808,7 +1810,10 @@ optional attributes. "link_training": "off", "laser_freq": "191300", "tx_power": "-27.3", - "dom_polling": "enabled" + "dom_polling": "enabled", + "coreId": "1", + "corePortId": "1", + "numVoq": "8" }, "Ethernet1": { "index": "1", @@ -1821,7 +1826,10 @@ optional attributes. "link_training": "on", "laser_freq": "191300", "tx_power": "-27.3", - "dom_polling": "enabled" + "dom_polling": "enabled", + "coreId": "0", + "corePortId": "14", + "numVoq": "8" }, "Ethernet63": { "index": "63", @@ -1832,7 +1840,10 @@ optional attributes. "speed": "40000", "laser_freq": "191300", "tx_power": "-27.3", - "dom_polling": "disabled" + "dom_polling": "disabled", + "coreId": "0", + "corePortId": "15", + "numVoq": "8" } } } diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 9522d4247d29..47c0e3ec910c 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -351,6 +351,7 @@ "DEVICE_METADATA": { "localhost": { "type": "ToRRouter", + "asic_id": "06:00.0", "mac": "00:11:22:33:dd:5a", "hostname": "asw.dc", "bgp_asn": "64850", @@ -565,6 +566,9 @@ "PORT": { "Ethernet0": { "alias": "Eth1/1", + "coreId": "1", + "corePortId": "1", + "numVoq": "8", "lanes": "65", "description": "", "speed": "11100", @@ -581,6 +585,9 @@ }, "Ethernet1": { "alias": "Eth1/2", + "coreId": "1", + "corePortId": "1", + "numVoq": "8", "lanes": "66", "description": "", "speed": "11100", @@ -596,6 +603,9 @@ }, "Ethernet2": { "alias": "Eth1/3", + "coreId": "1", + "corePortId": "1", + "numVoq": "8", "lanes": "67", "description": "", "speed": "11100", @@ -1702,7 +1712,7 @@ "ip_range": [ "10.1.0.0/24" ], - "name": "BGPSentinel", + "name": "BGPSentinel", "src_address": "10.1.0.32" }, "BGPSentinelV6": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index 141d8b5c8230..1542407f5f3a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -2,6 +2,12 @@ "DEV_META_DEV_NEIGH_VERSION_TABLE": { "desc": "DEVICE_METADATA DEVICE_NEIGHBOR VERSION TABLE." }, + "DEVICE_METADATA_ASIC_ID": { + "desc": "DEVICE_METADATA ASIC ID." + }, + "DEVICE_METADATA_ASIC_NAME": { + "desc": "DEVICE_METADATA ASIC NAME." + }, "DEVICE_METADATA_DEFAULT_BGP_STATUS": { "desc": "DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.", "eStrKey" : "Verify", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json index a6656b832815..b35f9fd2231f 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json @@ -60,6 +60,15 @@ "PORT_VALID_TYPE_TEST": { "desc": "PORT_VALID_TYPE_TEST no failure." }, + "PORT_COREID_TYPE_TEST": { + "desc": "PORT_COREID_TYPE_TEST no failure." + }, + "PORT_COREPORTID_TYPE_TEST": { + "desc": "PORT_COREPORTID_TYPE_TEST no failure." + }, + "PORT_NUMVOQ_TYPE_TEST": { + "desc": "PORT_NUMVOQ_TYPE_TEST no failure." + }, "PORT_INVALID_TYPE_TEST": { "desc": "PORT_INVALID_TYPE_TEST InvalidValue condition failure.", "eStrKey" : "InvalidValue", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index 941077205df6..0c33f93b668c 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -11,6 +11,34 @@ } } }, + "DEVICE_METADATA_ASIC_ID": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "DUT-CSW", + "asic_id": "06:00.0", + "asic_name": "asic0", + "platform": "Stone-DX010" + } + } + } + }, + "DEVICE_METADATA_ASIC_NAME": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "DUT-CSW", + "asic_id": "06:00.0", + "asic_name": "asic0", + "platform": "Stone-DX010" + } + } + } + }, "DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE": { "sonic-device_metadata:sonic-device_metadata": { "sonic-device_metadata:DEVICE_METADATA": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json index 77f70c57bd94..562aaf56c4a1 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json @@ -278,6 +278,66 @@ } }, + "PORT_COREID_TYPE_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "coreId": "1", + "corePortId": "1", + "numVoq": "8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "interface_type": "CR4" + } + ] + } + } + }, + + "PORT_COREPORTID_TYPE_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "coreId": "1", + "corePortId": "1", + "numVoq": "8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "interface_type": "CR4" + } + ] + } + } + }, + + "PORT_NUMVOQ_TYPE_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "coreId": "1", + "corePortId": "1", + "numVoq": "8", + "lanes": "65", + "speed": 25000, + "autoneg": "on", + "interface_type": "CR4" + } + ] + } + } + }, + "PORT_INVALID_TYPE_TEST": { "sonic-port:sonic-port": { "sonic-port:PORT": { diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 7226b02e53e2..dce3db1541e8 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -40,6 +40,13 @@ module sonic-device_metadata { type stypes:hwsku; } + leaf asic_id { + type string { + length 1..16; + } + description "asic_id is unique identifier of the asic used by SAI for initialization."; + } + leaf default_bgp_status { type enumeration { enum up; diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index ec2ea947ae46..2036a1f2fdbe 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -39,6 +39,27 @@ module sonic-port{ } } + leaf numVoq { + description "The number of virtual output queue supportted on this port."; + type string { + length 1..16; + } + } + + leaf coreId { + description "The ASIC core where the port belongs to."; + type string { + length 1..16; + } + } + + leaf corePortId { + description "The ASIC core port for this port."; + type string { + length 1..16; + } + } + leaf alias { type string { length 1..128; @@ -51,7 +72,7 @@ module sonic-port{ length 1..128; } } - + leaf mode { description "SwitchPort Modes possible values are routed|access|trunk. Default value for mode is routed"; type stypes:switchport_mode; @@ -172,8 +193,8 @@ module sonic-port{ leaf tpid { description "This leaf describes the possible TPID value that can be configured - to the specified port if the HW supports TPID configuration. The possible - values are 0x8100, 0x9100, 0x9200, 0x88a8, and 0x88A8"; + to the specified port if the HW supports TPID configuration. The possible + values are 0x8100, 0x9100, 0x9200, 0x88a8, and 0x88A8"; type stypes:tpid_type; }