Skip to content

Commit

Permalink
[yang]: Update yang models to support 'cluster' (sonic-net#10597)
Browse files Browse the repository at this point in the history
Why I did it
Minigraph parser added a new field 'cluster' to device_metadata, and then yang validation is blocked.

How I did it
Add 'cluster' to device_metadata yang models.

How to verify it
Run UT for sonc-yang-models.
Use minigraph parser to generate ConfigDB schema and run yang validation.

Signed-off-by: Gang Lv [email protected]
  • Loading branch information
ganglyu authored Apr 21, 2022
1 parent 0526ff9 commit a459739
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"DEV_META_DEV_NEIGH_VERSION_TABLE": {
"desc": "DEVICE_METADATA DEVICE_NEIGHBOR VERSION TABLE."
"desc": "DEVICE_METADATA DEVICE_NEIGHBOR VERSION TABLE."
},
"DEVICE_METADATA_DEFAULT_BGP_STATUS": {
"desc": "DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:default_bgp_status",
"value": "up"
}
"desc": "DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:default_bgp_status",
"value": "up"
}
},
"DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE": {
"desc": "DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:docker_routing_config_mode",
"value": "unified"
}
"desc": "DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:docker_routing_config_mode",
"value": "unified"
}
},
"DEVICE_METADATA_DEFAULT_PFCWD_STATUS": {
"desc": "DEVICE_METADATA DEFAULT VALUE FOR PFCWD FIELD.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:default_pfcwd_status",
"value": "disable"
}
"desc": "DEVICE_METADATA DEFAULT VALUE FOR PFCWD FIELD.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:default_pfcwd_status",
"value": "disable"
}
},
"DEVICE_METADATA_TYPE_INCORRECT_PATTERN": {
"desc": "DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.",
"eStrKey" : "Pattern"
"desc": "DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.",
"eStrKey" : "Pattern"
},
"DEVICE_METADATA_TYPE_CORRECT_PATTERN": {
"desc": "DEVICE_METADATA correct value for Type field"
Expand Down Expand Up @@ -73,26 +73,29 @@
"DEVICE_METADATA_RESOURCE_TYPE_CONFIG": {
"desc": "Verifying resource type configuration."
},
"DEVICE_METADATA_VALID_SUBTYPE": {
"desc": "Verifying valid subtype value"
},
"DEVICE_METADATA_INVALID_SUBTYPE": {
"desc": "Verifying invalid subtype value",
"eStrKey": "Pattern"
},
"DEVICE_METADATA_VALID_PEER_SWITCH": {
"desc": "Verifying valid peer switch hostname"
},
"DEVICE_METADATA_INVALID_PEER_SWITCH": {
"desc": "Verifying test fails with hostname that is too long",
"eStrKey": "Range"
},
"DEVICE_METADATA_VALID_STORAGE_DEVICE": {
"desc": "Verifying valid storage device value"
},
"DEVICE_METADATA_INVALID_STORAGE_DEVICE": {
"desc": "Verifying invalid storage device value",
"eStrKey": "InvalidValue"
"DEVICE_METADATA_VALID_CLUSTER": {
"desc": "Verifying valid cluster configuration."
},
"DEVICE_METADATA_VALID_SUBTYPE": {
"desc": "Verifying valid subtype value"
},
"DEVICE_METADATA_INVALID_SUBTYPE": {
"desc": "Verifying invalid subtype value",
"eStrKey": "Pattern"
},
"DEVICE_METADATA_VALID_PEER_SWITCH": {
"desc": "Verifying valid peer switch hostname"
},
"DEVICE_METADATA_INVALID_PEER_SWITCH": {
"desc": "Verifying test fails with hostname that is too long",
"eStrKey": "Range"
},
"DEVICE_METADATA_VALID_STORAGE_DEVICE": {
"desc": "Verifying valid storage device value"
},
"DEVICE_METADATA_INVALID_STORAGE_DEVICE": {
"desc": "Verifying invalid storage device value",
"eStrKey": "InvalidValue"
},
"DEVICE_METADATA_VALID_DHCP_SERVER": {
"desc": "Verifying dhcp_server configuration."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@
}
}
},
"DEVICE_METADATA_VALID_CLUSTER": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"cluster": "AAA00PrdStr00"
}
}
}
},
"DEVICE_METADATA_VALID_SUBTYPE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
Expand Down
5 changes: 5 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 @@ -135,6 +135,11 @@ module sonic-device_metadata {
type string;
}

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

leaf subtype {
type string {
pattern "DualToR";
Expand Down

0 comments on commit a459739

Please sign in to comment.