Skip to content

Commit

Permalink
Fix device type and add cluster in DEVICE_NEIGHBOR_METADATA yang model (
Browse files Browse the repository at this point in the history
#17049) (#17251)

Why I did it
The current DEVICE_NEIGHBOR_METADATA yang model has two issues that would block GCU operation when it checks if the current config aligns with the YANG model:

Missing cluster field in YANG
Incomplete set of device type. The device type in YANG model doesn't include all the device type.
Work item tracking
Microsoft ADO (number only): 25577813
How I did it
Add cluster field in DEVICE_NEIGHBOR_METADATA YANG model.
Change device type to string.
Fix the UT test accordingly.
How to verify it
Build the image and verify the unit tests passed.

Signed-off-by: zitingguo-ms <zitingguo@microsoft.com>
  • Loading branch information
Gfrom2016 authored Nov 28, 2023
1 parent 03fd204 commit edd0945
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 55 deletions.
4 changes: 3 additions & 1 deletion src/sonic-config-engine/tests/simple-sample-graph-case.xml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
<a:IPPrefix>10.7.0.196/26</a:IPPrefix>
</ManagementAddress>
<Hostname>switch2-t0</Hostname>
<ClusterName>DB5PrdApp11</ClusterName>
<HwSku>Force10-S6000</HwSku>
</Device>
<Device i:type="LeafRouter">
Expand All @@ -359,7 +360,8 @@
<DeviceLocation i:nil="true"/>
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>10.7.0.196/26</a:IPPrefix>
</ManagementAddress>
</ManagementAddress>
<ClusterName>DB5PrdApp11</ClusterName>
<HwSku>Force10-S6000</HwSku>
</Device>
<Device i:type="SmartCable">
Expand Down
4 changes: 3 additions & 1 deletion src/sonic-config-engine/tests/test_minigraph_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def test_minigraph_neighbor_metadata(self):

expected_table = {
'switch2-t0': {
'cluster': 'DB5PrdApp11',
'lo_addr': '25.1.1.10/32',
'mgmt_addr': '10.7.0.196/26',
'hwsku': 'Force10-S6000',
Expand All @@ -228,7 +229,8 @@ def test_minigraph_neighbor_metadata(self):
'hwsku': 'server-sku',
'type': 'Server'
},
'switch-01t1': {
'switch-01t1': {
'cluster': 'DB5PrdApp11',
'lo_addr': '10.1.0.186/32',
'deployment_id': '2',
'hwsku': 'Force10-S6000',
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,12 +842,14 @@ instance is supported in SONiC.
{
"DEVICE_NEIGHBOR_METADATA": {
"ARISTA01T1": {
"cluster": "AAA00PrdStr00",
"lo_addr": "None",
"mgmt_addr": "10.11.150.45",
"hwsku": "Arista-VM",
"type": "LeafRouter"
},
"ARISTA02T1": {
"cluster": "AAA00PrdStr00",
"lo_addr": "None",
"mgmt_addr": "10.11.150.46",
"hwsku": "Arista-VM",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
"DEVICE_NEIGHBOR_METADATA_TABLE": {
"desc": "DEVICE_NEIGHBOR_METADATA_TABLE config pattern."
},
"DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN": {
"desc": "DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN pattern failure.",
"eStrKey" : "Pattern"
},
"DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN": {
"desc": "DEVICE_NEIGHBOR_METADATA correct value for Type field"
},
"DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN_BMC": {
"desc": "DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN pattern failure with IncorrectTypeBmc.",
"eStrKey" : "Pattern"
},
"DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN_BMC": {
"desc": "DEVICE_NEIGHBOR_METADATA correct value for type field for Bmc"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,4 @@
{
"DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN": {
"sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": {
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
"DEVICE_NEIGHBOR_METADATA_LIST": [
{
"name": "Ethernet116",
"hwsku": "Arista",
"type": "ToRrouter"
}
]
}
}
},
"DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN": {
"sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": {
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
"DEVICE_NEIGHBOR_METADATA_LIST": [
{
"name": "Ethernet116",
"hwsku": "Arista",
"type": "BackEndToRRouter"
}
]
}
}
},
"DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN_BMC": {
"sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": {
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
"DEVICE_NEIGHBOR_METADATA_LIST": [
{
"name": "Ethernet116",
"hwsku": "DUMMY_BMC_SKU",
"type": "IncorrectTypeBmc"
}
]
}
}
},
"DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN_BMC": {
"sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": {
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
Expand Down Expand Up @@ -69,6 +30,7 @@
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
"DEVICE_NEIGHBOR_METADATA_LIST": [
{
"cluster": "AAA00PrdStr00",
"lo_addr": "25.77.193.11/32",
"mgmt_addr": "0.0.0.0/0",
"name": "dccsw01.nw",
Expand All @@ -77,6 +39,7 @@
"deployment_id": "1"
},
{
"cluster": "AAA00PrdStr00",
"lo_addr": "0.0.0.0/0",
"mgmt_addr": "10.11.150.46/26",
"name": "dccsw02.nw",
Expand All @@ -85,6 +48,7 @@
"deployment_id": "1"
},
{
"cluster": "AAA00PrdStr00",
"lo_addr_v6": "2a04:5555:40:a709::2/126",
"mgmt_addr": "10.11.150.47/26",
"name": "dccsw03.nw",
Expand All @@ -93,33 +57,38 @@
"deployment_id": "1"
},
{
"cluster": "AAA00PrdStr00",
"name": "dccsw04.nw",
"mgmt_addr_v6": "2a04:5555:40:a708::2/126",
"hwsku": "Arista",
"type": "LeafRouter",
"deployment_id": "1"
},
{
"cluster": "AAA00PrdStr00",
"name": "dccsw05.nw",
"hwsku": "Arista",
"type": "LeafRouter",
"deployment_id": "1"
},
{
"cluster": "AAA00PrdStr00",
"lo_addr_v6": "2a04:5555:40:a710::2/126",
"name": "dccsw06.nw",
"hwsku": "Arista",
"type": "LeafRouter",
"deployment_id": "1"
},
{
"cluster": "AAA00PrdStr00",
"lo_addr": "25.77.193.11/32",
"name": "dccsw07.nw",
"hwsku": "Arista",
"type": "LeafRouter",
"deployment_id": "1"
},
{
"cluster": "AAA00PrdStr00",
"mgmt_addr": "10.11.150.48/26",
"name": "dccsw08.nw",
"hwsku": "Arista",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ module sonic-device_neighbor_metadata {
}
}

leaf cluster {
description "The switch is a member of this cluster";
type string;
}

leaf hwsku {
type stypes:hwsku;
}
Expand Down Expand Up @@ -82,9 +87,7 @@ module sonic-device_neighbor_metadata {

leaf type {
description "Network element type";
type string {
pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|Asic|Supervior|MgmtToRRouter|MgmtLeafRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR|BmcMgmtToRRouter|Server|Bmc|MiniPower|SmartCable|Ixia|not-provisioned";
}
type string;
}

leaf deployment_id {
Expand Down

0 comments on commit edd0945

Please sign in to comment.