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 committed Apr 26, 2024
1 parent e497c3c commit 3f36abf
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 5 deletions.
17 changes: 14 additions & 3 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,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 @@ -1375,7 +1377,10 @@ optional attributes.
"speed": "40000",
"link_training": "off",
"laser_freq": "191300",
"tx_power": "-27.3"
"tx_power": "-27.3",
"coreId": "1",
"corePortId": "1",
"numVoq": "8"
},
"Ethernet1": {
"index": "1",
Expand All @@ -1387,7 +1392,10 @@ optional attributes.
"speed": "40000",
"link_training": "on",
"laser_freq": "191300",
"tx_power": "-27.3"
"tx_power": "-27.3",
"coreId": "0",
"corePortId": "14",
"numVoq": "8"
},
"Ethernet63": {
"index": "63",
Expand All @@ -1397,7 +1405,10 @@ optional attributes.
"alias": "fortyGigE1/4/16",
"speed": "40000",
"laser_freq": "191300",
"tx_power": "-27.3"
"tx_power": "-27.3",
"coreId": "0",
"corePortId": "15",
"numVoq": "8"
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,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 @@ -449,6 +450,9 @@
"PORT": {
"Ethernet0": {
"alias": "Eth1/1",
"coreId": "1",
"corePortId": "1",
"numVoq": "8",
"lanes": "65",
"description": "",
"speed": "11100",
Expand All @@ -464,6 +468,9 @@
},
"Ethernet1": {
"alias": "Eth1/2",
"coreId": "1",
"corePortId": "1",
"numVoq": "8",
"lanes": "66",
"description": "",
"speed": "11100",
Expand All @@ -478,6 +485,9 @@
},
"Ethernet2": {
"alias": "Eth1/3",
"coreId": "1",
"corePortId": "1",
"numVoq": "8",
"lanes": "67",
"description": "",
"speed": "11100",
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 @@ -49,6 +49,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 @@ -226,6 +226,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
25 changes: 23 additions & 2 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 Down Expand Up @@ -163,8 +184,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 3f36abf

Please sign in to comment.