Skip to content

Commit

Permalink
[yang] Update device_metadata to add dhcp_server (#10382)
Browse files Browse the repository at this point in the history
Why I did it
dhcp_server is introduced, and need to update yang model.

How I did it
Update yang models and add unit test.

How to verify it
Run unit test for sonic-yang-models.

Signed-off-by: Gang Lv ganglv@microsoft.com
  • Loading branch information
ganglyu authored Apr 1, 2022
1 parent 588ed0b commit a8f72e5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@
"switch_id": "2",
"switch_type": "voq",
"max_cores": "8",
"sub_role": "FrondEnd"
"sub_role": "FrondEnd",
"dhcp_server": "disabled"
}
},
"VLAN": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@
},
"DEVICE_METADATA_VALID_SUB_ROLE_CONFIG": {
"desc": "Verifying valid sub_role configuration."
},
"DEVICE_METADATA_VALID_DHCP_SERVER": {
"desc": "Verifying dhcp_server configuration."
},
"DEVICE_METADATA_INVALID_DHCP_SERVER": {
"desc": "Verifying invalid dhcp_server configuration.",
"eStrKey": "InvalidValue"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,23 @@
}
}
}
},
"DEVICE_METADATA_VALID_DHCP_SERVER": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"dhcp_server": "enabled"
}
}
}
},
"DEVICE_METADATA_INVALID_DHCP_SERVER": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"dhcp_server": "invalid"
}
}
}
}
}
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 @@ -183,6 +183,11 @@ module sonic-device_metadata {
type uint8;
description "Maximum number of cores in a VoQ Switch (chassis).";
}

leaf dhcp_server {
type stypes:admin_mode;
description "Indicate whether enable the embedded DHCP server.";
}
}
/* end of container localhost */
}
Expand Down

0 comments on commit a8f72e5

Please sign in to comment.