Time Management
This section describes the configuration model of time management and provides examples of XML packets.
Data Model
The configuration model file matching time management is ietf-system.yang.
Object |
Description |
Value | Remarks |
---|---|---|---|
/ietf-system:system/clock/timezone/timezone-utc-offset/timezone-utc-offset |
Indicates the time zone offset. |
The value is an integer in the range from -720 to 840, in minutes. |
N/A |
/ietf-system:set-current-datetime/current-datetime |
Indicates the current time on the device. |
The value is in any of the following formats:
|
N/A |
/ietf-system:system/clock/ huawei-system:daylight/daylight-name |
Indicates the name of the DST time zone. |
The value is a string of 1 to 32 case-sensitive characters without spaces. |
N/A |
/ietf-system:system/clock/ huawei-system:daylight/start-time/hour |
Indicates the DST start time. |
The start time is in 24-hour format HH:MM.
|
N/A |
/ietf-system:system/clock/ huawei-system:daylight/start-time/week-start |
Indicates the week in the DST start month. |
The value is of the enumerated type:
|
|
/ietf-system:system/clock/ huawei-system:daylight/start-time/day-start |
Indicates a day of the week in the start month. |
The value is of the enumerated type:
|
|
/ietf-system:system/clock/ huawei-system:daylight/start-time/month-start |
Indicates the start month. |
The value is of the enumerated type:
|
|
/ietf-system:system/clock/ huawei-system:daylight/start-time/month |
Indicates the DST start date. |
The start date is in the format MM-DD.
|
The week-start, day-start, and month-start objects are mutually exclusive with the month object. You can set either the week-start, day-start, and month-start objects or the month object. |
/ietf-system:system/clock/ huawei-system:daylight/end-time/hour |
Indicates the DST end time. |
The end time is in 24-hour format HH:MM.
|
N/A |
/ietf-system:system/clock/ huawei-system:daylight/end-time/week-start |
Indicates the week in the end month. |
The value is of the enumerated type:
|
|
/ietf-system:system/clock/ huawei-system:daylight/end-time/day-start |
Indicates a day of the week in the end month. |
The value is of the enumerated type:
|
|
/ietf-system:system/clock/ huawei-system:daylight/end-time/month-start |
Indicates the end month. |
The value is of the enumerated type:
|
|
/ietf-system:system/clock/ huawei-system:daylight/end-time/month |
Indicates the DST end date. |
The end date is in the format MM-DD.
|
|
/ietf-system:system/clock/ huawei-system:daylight/repeating-offset |
Indicates the DST offset. |
The offset is in 24-hour format HH:MM.
|
The DST offset must be less than or equal to 2 hours. Otherwise, an error is reported. |
/ietf-system:system/clock/huawei-system:daylight/year-start |
Indicates the start year. |
Format: YYYY YYYY indicates the year. The value is an integer in the range from 2000 to 2099. |
|
/ietf-system:system/clock/ huawei-system:daylight/year-end |
Indicates the end year. |
Format: YYYY YYYY indicates the year. The value is an integer in the range from 2000 to 2099. |
Configuring the System Time Zone
This section describes how to configure the timezone using the create480 method.
Operation |
XPATH |
---|---|
edit-config:create |
/ietf-system:system/clock/timezone/timezone-utc-offset/timezone-utc-offset |
Data requirement
Item |
Data |
Description |
---|---|---|
Timezone offset |
480 minutes. |
Indicates the timezone GMT+08:00. |
Request example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="39" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <sys:system xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system"> <sys:clock> <sys:timezone-utc-offset>480</sys:timezone-utc-offset> </sys:clock> </sys:system> </config> </edit-config> </rpc>
Response example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="39"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="40"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error </rpc-reply>
Configuring the System Date and Time
This section provides a sample of configuring the system date and time using the rpc method.
Operation |
XPATH |
---|---|
rpc |
/ietf-system:set-current-datetime/current-datetime |
Data Requirements
Item |
Data |
Description |
---|---|---|
System data and time |
2000-01-01T00:00:00-12:00 |
Set the system date and time to 2000-01-01 12:00:00. |
Request Example
<?xml version="1.0" encoding="UTF-8"?> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="6fa5610f-6adf-11e7-8676-879e0ca0e2bd"> <sys:set-current-datetime xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system"> <sys:current-datetime>2000-01-01T00:00:00-12:00</sys:current-datetime> </sys:set-current-datetime> </rpc>
Response Example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="6fa5610f-6adf-11e7-8676-879e0ca0e2bd"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="40"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>
Configuring DST
This section provides a sample of configuring DST using the create method.
Operation |
XPATH |
---|---|
Config |
/ietf-system:system/clock/ huawei-system:daylight |
Data Requirements
Item |
Data |
Description |
---|---|---|
Name of the DST time zone |
summer |
Set the name of the DST time zone to summer. |
DST start time |
01:00 |
Set the start time to 01:00. |
DST start month |
Mar |
Set the DST start month to March. |
Week of the DST start time in the DST start month |
second |
Set the week of the DST start time to the second week in the DST start month. |
Day in the week of the DST start time |
Sun |
Set the day in the week of the DST start time to Sunday. |
DST end date |
11-10 |
Set the DST end date to November 10. |
DST end time |
01:00 |
Set the DST end time to 01:00. |
DST offset |
01:00 |
Set the DST offset to 1 hour. |
DST start year |
2008 |
Set the DST start year to 2008. |
DST end year |
2088 |
Set the DST end year to 2088. |
Request Example
<?xml version="1.0" encoding="utf-8"?> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id=""> <edit-config> <target> <running/> </target> <config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <sys:system xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system"> <sys:clock nc:operation="merge"> <hw-system:daylight xmlns:hw-system="urn:huawei:params:xml:ns:yang:huawei-system"> <hw-system:daylight-name>summer</hw-system:daylight-name> <hw-system:start-time> <hw-system:hour>01:00</hw-system:hour> <hw-system:week-start>second</hw-system:week-start> <hw-system:day-start>Sun</hw-system:day-start> <hw-system:month-start>Mar</hw-system:month-start> </hw-system:start-time> <hw-system:end-time> <hw-system:hour>01:00</hw-system:hour> <hw-system:month>11-10</hw-system:month> </hw-system:end-time> <hw-system:repeating-offset>01:00</hw-system:repeating-offset> <hw-system:year-start>2008</hw-system:year-start> <hw-system:year-end>2088</hw-system:year-end> </hw-system:daylight> </sys:clock> </sys:system> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<?xml version="1.0" encoding="utf-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="46"> <ok/> </rpc-reply>
Sample of failed response
<?xml version="1.0" encoding="utf-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="25"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message>week-start,day-start,month-start must be configured together.</error-message> <error-info>Error on node /ietf-system:system/clock/huawei-system:daylight</error-info> </rpc-error> </rpc-reply>