[j-nsp] Time-of-day based traffic conditioning

Phil Shafer phil at juniper.net
Wed Jan 11 02:28:27 EST 2012


Dale Shaw writes:
>Does anyone know of a way to enforce traffic policing or shaping based on
>time of day?

Beginning in 11.3, config groups have a "conditional application"
mechanism, so they are only applied on certain products/models or
at certain time of day ranges.

I'll admit I've never used it, but it's a generic mechanism built
into configuration groups to handle time-of-day-based configuration:

[edit]
cli# show groups tod
when {
    time 02:00 to 03:00;
}
system {
    host-name in-the-maint-window;
}

Annoyingly, I can find no documentation on it, but it's not hidden.
Google("junos configuration groups when") is not helpful.  A snippet
of internal documentation is appended.  If I find more, I'll post it.

I know it uses our getdate() common function, so "2am" == "02:00".

Thanks,
 Phil


--------------
2.3.5 TIME

This identifies, when this particular config-group needs to be applied on the
router. It takes start time and optional end time as values. If end time is
specified, the applied config-group will be removed at the specified end time.
This will happen everyday on the specified time. If start time is relative
time e.g, "11am" and end time is not specified, end time will be taken as EOD.
If start is absolute time, the applied configuration will remain, unless the
config-group start time is modified.

The syntax for specificing the time:

        time <start-time> [to <end-time>];

The time format is yyyy-mm-dd.hh:mm (type time).
(Relative has just hh:mm, if 12 hours clock is used, it is needed to specify
am/pm.)

Example:

groups {
        my-group-1 {
                // Config-group statements
                when {
                        time 11:00 to 15:00;
                }
        }
}

The config-group 'my-group-1' config statements will be applied at 11 AM and
will be removed at 3 PM daily.


More information about the juniper-nsp mailing list