Skip to content

Commit edd0945

Browse files
authored
Fix device type and add cluster in DEVICE_NEIGHBOR_METADATA yang model (#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 <[email protected]>
1 parent 03fd204 commit edd0945

File tree

6 files changed

+22
-55
lines changed

6 files changed

+22
-55
lines changed

src/sonic-config-engine/tests/simple-sample-graph-case.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@
348348
<a:IPPrefix>10.7.0.196/26</a:IPPrefix>
349349
</ManagementAddress>
350350
<Hostname>switch2-t0</Hostname>
351+
<ClusterName>DB5PrdApp11</ClusterName>
351352
<HwSku>Force10-S6000</HwSku>
352353
</Device>
353354
<Device i:type="LeafRouter">
@@ -359,7 +360,8 @@
359360
<DeviceLocation i:nil="true"/>
360361
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
361362
<a:IPPrefix>10.7.0.196/26</a:IPPrefix>
362-
</ManagementAddress>
363+
</ManagementAddress>
364+
<ClusterName>DB5PrdApp11</ClusterName>
363365
<HwSku>Force10-S6000</HwSku>
364366
</Device>
365367
<Device i:type="SmartCable">

src/sonic-config-engine/tests/test_minigraph_case.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ def test_minigraph_neighbor_metadata(self):
209209

210210
expected_table = {
211211
'switch2-t0': {
212+
'cluster': 'DB5PrdApp11',
212213
'lo_addr': '25.1.1.10/32',
213214
'mgmt_addr': '10.7.0.196/26',
214215
'hwsku': 'Force10-S6000',
@@ -228,7 +229,8 @@ def test_minigraph_neighbor_metadata(self):
228229
'hwsku': 'server-sku',
229230
'type': 'Server'
230231
},
231-
'switch-01t1': {
232+
'switch-01t1': {
233+
'cluster': 'DB5PrdApp11',
232234
'lo_addr': '10.1.0.186/32',
233235
'deployment_id': '2',
234236
'hwsku': 'Force10-S6000',

src/sonic-yang-models/doc/Configuration.md

+2
Original file line numberDiff line numberDiff line change
@@ -842,12 +842,14 @@ instance is supported in SONiC.
842842
{
843843
"DEVICE_NEIGHBOR_METADATA": {
844844
"ARISTA01T1": {
845+
"cluster": "AAA00PrdStr00",
845846
"lo_addr": "None",
846847
"mgmt_addr": "10.11.150.45",
847848
"hwsku": "Arista-VM",
848849
"type": "LeafRouter"
849850
},
850851
"ARISTA02T1": {
852+
"cluster": "AAA00PrdStr00",
851853
"lo_addr": "None",
852854
"mgmt_addr": "10.11.150.46",
853855
"hwsku": "Arista-VM",

src/sonic-yang-models/tests/yang_model_tests/tests/device_neighbor_metadata.json

-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
"DEVICE_NEIGHBOR_METADATA_TABLE": {
33
"desc": "DEVICE_NEIGHBOR_METADATA_TABLE config pattern."
44
},
5-
"DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN": {
6-
"desc": "DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN pattern failure.",
7-
"eStrKey" : "Pattern"
8-
},
9-
"DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN": {
10-
"desc": "DEVICE_NEIGHBOR_METADATA correct value for Type field"
11-
},
12-
"DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN_BMC": {
13-
"desc": "DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN pattern failure with IncorrectTypeBmc.",
14-
"eStrKey" : "Pattern"
15-
},
165
"DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN_BMC": {
176
"desc": "DEVICE_NEIGHBOR_METADATA correct value for type field for Bmc"
187
},

src/sonic-yang-models/tests/yang_model_tests/tests_config/device_neighbor_metadata.json

+8-39
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,4 @@
11
{
2-
"DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN": {
3-
"sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": {
4-
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
5-
"DEVICE_NEIGHBOR_METADATA_LIST": [
6-
{
7-
"name": "Ethernet116",
8-
"hwsku": "Arista",
9-
"type": "ToRrouter"
10-
}
11-
]
12-
}
13-
}
14-
},
15-
"DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN": {
16-
"sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": {
17-
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
18-
"DEVICE_NEIGHBOR_METADATA_LIST": [
19-
{
20-
"name": "Ethernet116",
21-
"hwsku": "Arista",
22-
"type": "BackEndToRRouter"
23-
}
24-
]
25-
}
26-
}
27-
},
28-
"DEVICE_NEIGHBOR_METADATA_TYPE_INCORRECT_PATTERN_BMC": {
29-
"sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": {
30-
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
31-
"DEVICE_NEIGHBOR_METADATA_LIST": [
32-
{
33-
"name": "Ethernet116",
34-
"hwsku": "DUMMY_BMC_SKU",
35-
"type": "IncorrectTypeBmc"
36-
}
37-
]
38-
}
39-
}
40-
},
412
"DEVICE_NEIGHBOR_METADATA_TYPE_CORRECT_PATTERN_BMC": {
423
"sonic-device_neighbor_metadata:sonic-device_neighbor_metadata": {
434
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
@@ -69,6 +30,7 @@
6930
"sonic-device_neighbor_metadata:DEVICE_NEIGHBOR_METADATA": {
7031
"DEVICE_NEIGHBOR_METADATA_LIST": [
7132
{
33+
"cluster": "AAA00PrdStr00",
7234
"lo_addr": "25.77.193.11/32",
7335
"mgmt_addr": "0.0.0.0/0",
7436
"name": "dccsw01.nw",
@@ -77,6 +39,7 @@
7739
"deployment_id": "1"
7840
},
7941
{
42+
"cluster": "AAA00PrdStr00",
8043
"lo_addr": "0.0.0.0/0",
8144
"mgmt_addr": "10.11.150.46/26",
8245
"name": "dccsw02.nw",
@@ -85,6 +48,7 @@
8548
"deployment_id": "1"
8649
},
8750
{
51+
"cluster": "AAA00PrdStr00",
8852
"lo_addr_v6": "2a04:5555:40:a709::2/126",
8953
"mgmt_addr": "10.11.150.47/26",
9054
"name": "dccsw03.nw",
@@ -93,33 +57,38 @@
9357
"deployment_id": "1"
9458
},
9559
{
60+
"cluster": "AAA00PrdStr00",
9661
"name": "dccsw04.nw",
9762
"mgmt_addr_v6": "2a04:5555:40:a708::2/126",
9863
"hwsku": "Arista",
9964
"type": "LeafRouter",
10065
"deployment_id": "1"
10166
},
10267
{
68+
"cluster": "AAA00PrdStr00",
10369
"name": "dccsw05.nw",
10470
"hwsku": "Arista",
10571
"type": "LeafRouter",
10672
"deployment_id": "1"
10773
},
10874
{
75+
"cluster": "AAA00PrdStr00",
10976
"lo_addr_v6": "2a04:5555:40:a710::2/126",
11077
"name": "dccsw06.nw",
11178
"hwsku": "Arista",
11279
"type": "LeafRouter",
11380
"deployment_id": "1"
11481
},
11582
{
83+
"cluster": "AAA00PrdStr00",
11684
"lo_addr": "25.77.193.11/32",
11785
"name": "dccsw07.nw",
11886
"hwsku": "Arista",
11987
"type": "LeafRouter",
12088
"deployment_id": "1"
12189
},
12290
{
91+
"cluster": "AAA00PrdStr00",
12392
"mgmt_addr": "10.11.150.48/26",
12493
"name": "dccsw08.nw",
12594
"hwsku": "Arista",

src/sonic-yang-models/yang-models/sonic-device_neighbor_metadata.yang

+6-3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ module sonic-device_neighbor_metadata {
4040
}
4141
}
4242

43+
leaf cluster {
44+
description "The switch is a member of this cluster";
45+
type string;
46+
}
47+
4348
leaf hwsku {
4449
type stypes:hwsku;
4550
}
@@ -82,9 +87,7 @@ module sonic-device_neighbor_metadata {
8287

8388
leaf type {
8489
description "Network element type";
85-
type string {
86-
pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|Asic|Supervior|MgmtToRRouter|MgmtLeafRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR|BmcMgmtToRRouter|Server|Bmc|MiniPower|SmartCable|Ixia|not-provisioned";
87-
}
90+
type string;
8891
}
8992

9093
leaf deployment_id {

0 commit comments

Comments
 (0)