Skip to content

Commit

Permalink
Merge pull request #351 from xincunli-sonic/xincun/cherrypick-18444-a…
Browse files Browse the repository at this point in the history
…nd-18704

[YANG]: Add Yang model support for Multi ASIC port and device_metadata
  • Loading branch information
gechiang authored Apr 27, 2024
2 parents e497c3c + 879cd74 commit b976280
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreId corePortId numVoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet0 6,7 Ethernet1/1 1 Ext 100000 Eth0 0 1 8
Ethernet4 2,3 Ethernet2/1 2 Ext 100000 Eth4 0 2 8
Ethernet8 4,5 Ethernet3/1 3 Ext 100000 Eth8 0 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreId corePortId numVoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet0 72,73,74,75 Ethernet1/1 1 Ext 100000 Eth0 1 1 8
Ethernet8 80,81,82,83 Ethernet2/1 2 Ext 100000 Eth8 1 2 8
Ethernet16 88,89,90,91 Ethernet3/1 3 Ext 100000 Eth16 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreId corePortId numVoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet144 72,73,74,75 Ethernet19/1 19 Ext 100000 Eth0 1 1 8
Ethernet152 80,81,82,83 Ethernet20/1 20 Ext 100000 Eth8 1 2 8
Ethernet160 88,89,90,91 Ethernet21/1 21 Ext 100000 Eth16 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreId corePortId numVoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet0 72,73,74,75 Ethernet1/1 1 Ext 100000 Eth0 1 1 8
Ethernet4 76,77,78,79 Ethernet1/5 1 Ext 100000 Eth4 1 2 8
Ethernet8 80,81,82,83 Ethernet2/1 2 Ext 100000 Eth8 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreId corePortId numVoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet144 72,73,74,75 Ethernet19/1 19 Ext 100000 Eth144 1 1 8
Ethernet148 76,77,78,79 Ethernet19/5 19 Ext 100000 Eth148 1 2 8
Ethernet152 80,81,82,83 Ethernet20/1 20 Ext 100000 Eth152 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreId corePortId numVoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet0 72,73,74,75,76,77,78,79 Ethernet1/1 1 Ext 400000 Eth0 1 1 8
Ethernet8 80,81,82,83,84,85,86,87 Ethernet2/1 2 Ext 400000 Eth8 1 2 8
Ethernet16 88,89,90,91,92,93,94,95 Ethernet3/1 3 Ext 400000 Eth16 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreId corePortId numVoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet144 72,73,74,75,76,77,78,79 Ethernet19/1 19 Ext 400000 Eth0 1 1 8
Ethernet152 80,81,82,83,84,85,86,87 Ethernet20/1 20 Ext 400000 Eth8 1 2 8
Ethernet160 88,89,90,91,92,93,94,95 Ethernet21/1 21 Ext 400000 Eth16 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreid coreportid numvoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet0 72,73,74,75 Ethernet1/1 1 Ext 100000 Eth0 1 1 8
Ethernet8 80,81,82,83 Ethernet2/1 2 Ext 100000 Eth8 1 2 8
Ethernet16 88,89,90,91 Ethernet3/1 3 Ext 100000 Eth16 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreid coreportid numvoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet144 72,73,74,75 Ethernet19/1 19 Ext 100000 Eth0 1 1 8
Ethernet152 80,81,82,83 Ethernet20/1 20 Ext 100000 Eth8 1 2 8
Ethernet160 88,89,90,91 Ethernet21/1 21 Ext 100000 Eth16 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreid coreportid numvoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet0 72,73,74,75,76,77,78,79 Ethernet1/1 1 Ext 400000 Eth0 1 1 8
Ethernet8 80,81,82,83,84,85,86,87 Ethernet2/1 2 Ext 400000 Eth8 1 2 8
Ethernet16 88,89,90,91,92,93,94,95 Ethernet3/1 3 Ext 400000 Eth16 1 3 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index role speed asic_port_name coreid coreportid numvoq
# name lanes alias index role speed asic_port_name core_id core_port_id num_voq
Ethernet144 72,73,74,75,76,77,78,79 Ethernet19/1 19 Ext 400000 Eth0 1 1 8
Ethernet152 80,81,82,83,84,85,86,87 Ethernet20/1 20 Ext 400000 Eth8 1 2 8
Ethernet160 88,89,90,91,92,93,94,95 Ethernet21/1 21 Ext 400000 Eth16 1 3 8
Expand Down
24 changes: 12 additions & 12 deletions dockers/docker-macsec/cli-plugin-tests/config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"PORT|Ethernet0": {
"alias": "Ethernet1/1",
"asic_port_name": "Eth0-ASIC0",
"coreid": "1",
"coreportid": "1",
"core_id": "1",
"core_port_id": "1",
"description": "Ethernet1/1",
"index": "1",
"lanes": "72,73,74,75,76,77,78,79",
"macsec": "macsec_profile",
"mtu": "9100",
"numvoq": "8",
"num_voq": "8",
"pfc_asym": "off",
"role": "Ext",
"speed": "400000",
Expand All @@ -27,14 +27,14 @@
"PORT|Ethernet1": {
"alias": "Ethernet2/1",
"asic_port_name": "Eth0-ASIC0",
"coreid": "1",
"coreportid": "1",
"core_id": "1",
"core_port_id": "1",
"description": "Ethernet2/1",
"index": "1",
"lanes": "72,73,74,75,76,77,78,79",
"macsec": "macsec_profile",
"mtu": "9100",
"numvoq": "8",
"num_voq": "8",
"pfc_asym": "off",
"role": "Ext",
"speed": "400000",
Expand All @@ -43,14 +43,14 @@
"PORT|Ethernet4": {
"alias": "Ethernet5/1",
"asic_port_name": "Eth0-ASIC0",
"coreid": "1",
"coreportid": "1",
"core_id": "1",
"core_port_id": "1",
"description": "Ethernet5/1",
"index": "1",
"lanes": "72,73,74,75,76,77,78,79",
"macsec": "macsec_profile",
"mtu": "9100",
"numvoq": "8",
"num_voq": "8",
"pfc_asym": "off",
"role": "Ext",
"speed": "400000",
Expand All @@ -59,14 +59,14 @@
"PORT|Ethernet5": {
"alias": "Ethernet6/1",
"asic_port_name": "Eth0-ASIC0",
"coreid": "1",
"coreportid": "1",
"core_id": "1",
"core_port_id": "1",
"description": "Ethernet6/1",
"index": "1",
"lanes": "72,73,74,75,76,77,78,79",
"macsec": "macsec_profile",
"mtu": "9100",
"numvoq": "8",
"num_voq": "8",
"pfc_asym": "off",
"role": "Ext",
"speed": "400000",
Expand Down
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",
"core_id": "1",
"core_port_id": "1",
"num_voq": "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",
"core_id": "0",
"core_port_id": "14",
"num_voq": "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",
"core_id": "0",
"core_port_id": "15",
"num_voq": "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",
"core_id": "1",
"core_port_id": "1",
"num_voq": "8",
"lanes": "65",
"description": "",
"speed": "11100",
Expand All @@ -464,6 +468,9 @@
},
"Ethernet1": {
"alias": "Eth1/2",
"core_id": "1",
"core_port_id": "1",
"num_voq": "8",
"lanes": "66",
"description": "",
"speed": "11100",
Expand All @@ -478,6 +485,9 @@
},
"Ethernet2": {
"alias": "Eth1/3",
"core_id": "1",
"core_port_id": "1",
"num_voq": "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",
"core_id": "1",
"core_port_id": "1",
"num_voq": "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",
"core_id": "2",
"core_port_id": "2",
"num_voq": "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",
"core_id": "3",
"core_port_id": "3",
"num_voq": "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
Loading

0 comments on commit b976280

Please sign in to comment.