Skip to content

Commit

Permalink
[YANG]: Add Yang model support for Multi ASIC port and device_metadata (
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
xincunli-sonic authored and pull[bot] committed Nov 21, 2024
1 parent 53e6ee9 commit 0a9b84a
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 9 deletions.
21 changes: 16 additions & 5 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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***
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -565,6 +566,9 @@
"PORT": {
"Ethernet0": {
"alias": "Eth1/1",
"coreId": "1",
"corePortId": "1",
"numVoq": "8",
"lanes": "65",
"description": "",
"speed": "11100",
Expand All @@ -581,6 +585,9 @@
},
"Ethernet1": {
"alias": "Eth1/2",
"coreId": "1",
"corePortId": "1",
"numVoq": "8",
"lanes": "66",
"description": "",
"speed": "11100",
Expand All @@ -596,6 +603,9 @@
},
"Ethernet2": {
"alias": "Eth1/3",
"coreId": "1",
"corePortId": "1",
"numVoq": "8",
"lanes": "67",
"description": "",
"speed": "11100",
Expand Down Expand Up @@ -1702,7 +1712,7 @@
"ip_range": [
"10.1.0.0/24"
],
"name": "BGPSentinel",
"name": "BGPSentinel",
"src_address": "10.1.0.32"
},
"BGPSentinelV6": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/port.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 7 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-device_metadata.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 24 additions & 3 deletions src/sonic-yang-models/yang-models/sonic-port.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 0a9b84a

Please sign in to comment.