Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement clock CLI #7

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"buffer_model": {% if default_buffer_model == "dynamic" %}"dynamic"{% else %}"traditional"{% endif %},
{%- if include_p4rt == "y" %}"synchronous_mode":"enable",{% endif %}
"default_bgp_status": {% if shutdown_bgp_on_start == "y" %}"down"{% else %}"up"{% endif %},
"default_pfcwd_status": {% if enable_pfcwd_on_start == "y" %}"enable"{% else %}"disable"{% endif %}
"default_pfcwd_status": {% if enable_pfcwd_on_start == "y" %}"enable"{% else %}"disable"{% endif %},
"timezone": "Etc/UTC"
}
},
"CRM": {
Expand Down
3 changes: 2 additions & 1 deletion src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,8 @@ instance is supported in SONiC.
"type": "ToRRouter",
"bgp_adv_lo_prefix_as_128" : "true",
"buffer_model": "traditional",
"yang_config_validation": "disable"
"yang_config_validation": "disable",
"timezome": "Europe/Kiev"
}
}
}
Expand Down
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 @@ -357,7 +357,8 @@
"sub_role": "FrontEnd",
"dhcp_server": "disabled",
"bgp_adv_lo_prefix_as_128": "true",
"yang_config_validation": "disable"
"yang_config_validation": "disable",
"timezone": "Europe/Kiev"
}
},
"VLAN": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@
},
"DEVICE_METADATA_ADVERTISE_LO_PREFIX_AS_128": {
"desc": "Verifying advertising lo prefix as /128."
},
"DEVICE_METADATA_VALID_TIMEZONE": {
"desc": "Verifying valid timezone value"
},
"DEVICE_METADATA_INVALID_TIMEZONE": {
"desc": "Verifying invalid timezone value",
"eStrKey": "Range"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -332,5 +332,23 @@
}
}
}
},
"DEVICE_METADATA_VALID_TIMEZONE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"timezone": "Etc/UTC"
}
}
}
},
"DEVICE_METADATA_INVALID_TIMEZONE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"timezone": ""
}
}
}
}
}
9 changes: 9 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 @@ -204,6 +204,15 @@ module sonic-device_metadata {
description "Advertise Loopback0 interface IPv6 /128 subnet address as it is with set to true.
By default SONiC advertises /128 subnet prefix in Loopback0 as /64 subnet route";
}

leaf timezone {
type stypes:timezone-name-type {
length 1..255;
}
default "Etc/UTC";
description "The TZ database name to use for the system, such as 'Europe/Stockholm'.";
reference "IANA Time Zone Database http://www.iana.org/time-zones";
}
}
/* end of container localhost */
}
Expand Down
13 changes: 13 additions & 0 deletions src/sonic-yang-models/yang-templates/sonic-types.yang.j2
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,19 @@ module sonic-types {
}
}

typedef timezone-name-type {
type string;
description
"A time zone name as used by the Time Zone Database,
sometimes referred to as the 'Olson Database'.

The exact set of valid values is an implementation-specific
matter. Client discovery of the exact set of time zone names
for a particular server is out of scope.";
reference
"BCP 175: Procedures for Maintaining the Time Zone Database";
}

{% if yang_model_type == "cvl" %}
/* Required for CVL */
container operation {
Expand Down