Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

test policy

Syntax

Description

Test a policy configuration to determine which prefixes match routes in the routing table.

Note:

If you are using the test policy command on a logical system, you must first set the CLI to the logical system context. For example, if you want to test a routing policy that is configured on logical system R2, first run the set cli logical-system R2 command.

Options

policy-name

Name of a policy.

prefix

Destination prefix to match.

Additional Information

All prefixes in the default unicast routing table (inet.0) that match prefixes that are the same as or longer than the specific prefix are processed by the from clause in the specified policy. All prefixes accepted by the policy are displayed. The test policy command evaluates a policy differently from the BGP import process. When testing a policy that contains an interface match condition in the from clause, the test policy command uses the match condition. In contrast, BGP does not use the interface match condition when evaluating the policy against routes learned from internal BGP (IBGP) or external BGP (EGBP) multihop peers.

When testing a policy, you can see the length of time (in microseconds) required to evaluate the policy and the number of times it has been executed by running the show policy policy-name statistics command.

Required Privilege Level

view

Output Fields

For information about output fields, see the output field tables for the show route command, the show route detail command, the show route extensive command, or the show route terse command.

Sample Output

test policy

Release Information

Command introduced before Junos OS Release 7.4.