Time Range Management
If some services or functions need to be started at intervals or periodically, time ranges can be configured. This section describes the configuration model of time range management and provides examples of XML packets.
Data Model
The configuration model file for time range management is huawei-time-range.yang.
Object |
Description |
Value |
Remarks |
---|---|---|---|
/huawei-time-range:time-ranges/time-range/name |
Indicates the name of a time range. |
The value is a string of 1 to 32 case-sensitive characters without spaces and must begin with a letter. In addition, the word all cannot be specified as a time range name. |
N/A |
/huawei-time-range:time-ranges/time-range/vsys |
Indicates the vsys name. |
The value is a string of 1 to 31 characters. |
N/A |
/huawei-time-range:time-ranges/time-range/period-time/start |
Indicates the start time of the time range. |
The value is in the format of hh:mm:ss.
|
N/A |
/huawei-time-range:time-ranges/time-range/period-time/end |
Indicates the end time of the time range. |
The value is in the format of hh:mm:ss.
|
The end time must be later than the start time. |
/huawei-time-range:time-ranges/time-range/period-time/weekday |
Indicates the validity period of the time range. |
The value is the enumerated type and case-sensitive. The options include sunday, monday, tuesday, wednesday, thursday, friday, and saturday. |
N/A |
/huawei-time-range:time-ranges/time-range/absolute-time/start |
Indicates the start time in a day. |
It is a UTC time in the format of YYYY-MM-DD hh:mm:ss.
|
N/A |
/huawei-time-range:time-ranges/time-range/absolute-time/end |
Indicates the end time in a day. |
It is a UTC time in the format of YYYY-MM-DD hh:mm:ss.
|
The end time must be later than the start time. If no end time is configured, the device uses the allowed maximum value. |
Configuring a Time Range
This section describes how to configure, modify, and delete a time range using the edit-config method.
Operation |
XPATH |
---|---|
edit-config:create edit-config:replace edit-config:delete |
|
Data Requirement 1: Creating Time Range test
Item |
Data |
Description |
---|---|---|
Time range name |
test |
Create a time range named test. |
Start time of the time range |
8:00:00 |
Set the start time of the time range to 8:00:00. |
End time of the time range |
17:30:00 |
Set the end time of the time range to 17:30:00. |
Validity period |
wednesday |
Configure the ACL rule to take effect on every Wednesday. |
Start time in a day |
2013-11-11T11:11:11+08:00 |
Set the start time in a day to 2013-11-11T11:11:11+08:00. |
End time in a day |
2017-11-11T11:11:11+08:00 |
Set the end time in a day to 2017-11-11T11:11:11+08:00. |
Request example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <hw-time-range:time-ranges xmlns:hw-time-range="urn:huawei:params:xml:ns:yang:huawei-time-range"> <hw-time-range:time-range> <hw-time-range:vsys>public</hw-time-range:vsys> <hw-time-range:name>test</hw-time-range:name> <hw-time-range:period-time> <hw-time-range:start>8:00:00</hw-time-range:start> <hw-time-range:end>17:30:00</hw-time-range:end> <hw-time-range:weekday>wednesday</hw-time-range:weekday> <hw-time-range:weekday>thursday</hw-time-range:weekday> </hw-time-range:period-time> <hw-time-range:absolute-time> <hw-time-range:start>2013-11-11T11:11:11+08:00</hw-time-range:start> <hw-time-range:end>2017-11-11T11:11:11+08:00</hw-time-range:end> </hw-time-range:absolute-time> </hw-time-range:time-range> </hw-time-range:time-ranges> </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="3"> <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="3"> <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>
Data Requirement 2: Modifying the Validity Period of the Time Range test
The following provides only the item to be modified. For other items, see data requirement 1.
Item |
Data |
Description |
---|---|---|
Validity period |
thursday |
Modify the validity period from Wednesday to Thursday. |
Request example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <hw-time-range:time-ranges xmlns:hw-time-range="urn:huawei:params:xml:ns:yang:huawei-time-range"> <hw-time-range:time-range> <hw-time-range:vsys>public</hw-time-range:vsys> <hw-time-range:name>test</hw-time-range:name> <hw-time-range:period-time> <hw-time-range:start>8:00:00</hw-time-range:start> <hw-time-range:end>17:30:00</hw-time-range:end> <hw-time-range:weekday xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">thursday</hw-time-range:weekday> </hw-time-range:period-time> <hw-time-range:absolute-time> <hw-time-range:start>2013-11-11T11:11:11+08:00</hw-time-range:start> <hw-time-range:end>2017-11-11T11:11:11+08:00</hw-time-range:end> </hw-time-range:absolute-time> </hw-time-range:time-range> </hw-time-range:time-ranges> </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="3"> <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>
Data Requirement 3: Deleting Time Range test
The following provides only the item to be modified. For other items, see data requirement 1.
Item |
Data |
Description |
---|---|---|
Time range name |
test |
N/A |
Request example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="3" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <hw-time-range:time-ranges xmlns:hw-time-range="urn:huawei:params:xml:ns:yang:huawei-time-range"> <hw-time-range:time-range xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete"> <hw-time-range:vsys>public</hw-time-range:vsys> <hw-time-range:name>test</hw-time-range:name> <hw-time-range:period-time> <hw-time-range:start>8:00:00</hw-time-range:start> <hw-time-range:end>17:30:00</hw-time-range:end> <hw-time-range:weekday>thursday</hw-time-range:weekday> </hw-time-range:period-time> <hw-time-range:absolute-time> <hw-time-range:start>2013-11-11T11:11:11+08:00</hw-time-range:start> <hw-time-range:end>2017-11-11T11:11:11+08:00</hw-time-range:end> </hw-time-range:absolute-time> </hw-time-range:time-range> </hw-time-range:time-ranges> </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="3"> <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="42"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>edit operation failed.</error-message> </rpc-error> </rpc-reply>