Policy Operational Commands

Policy Show Commands

Viewing Policy Server Statistics

The show policy statistics policy-server command lets you view detailed policy statistics on the policy server. The filter options let you specify a particular policy or client context to view detailed statistics, including configuration time, compile time, compilation status, and client-context subscription details.

Syntax:

show policy statistics <bd>
show policy statistics <bd> app-key <app-key>
show policy statistics <bd> app-key <app-key> detail
show policy statistics <bd> app-key <app-key> policy-name <policy-name>
show policy statistics <bd> app-key <app-key> policy-name <policy-name> detail
show policy statistics <bd> detail
show policy statistics <bd> policy-name <policy-name>
show policy statistics <bd> policy-name <policy-name> detail
show policy statistics policy-server
show policy statistics policy-server detail
show policy statistics policy-server <bd>
show policy statistics policy-server <bd> client-context <client-context>
show policy statistics policy-server <bd> client-context <client-context> detail
show policy statistics policy-server <bd> client-context <client-context> policy-name <policy-name>
show policy statistics policy-server <bd> client-context <client-context> policy-name <policy-name> detail
show policy statistics policy-server <bd> detail
show policy statistics policy-server <bd> policy-name <policy-name>
show policy statistics policy-server <bd> policy-name <policy-name> client-context <client-context>
show policy statistics policy-server <bd> policy-name <policy-name> client-context <client-context> detail
show policy statistics policy-server <bd> policy-name <policy-name> detail
show policy statistics policy-server policy-name <policy-name>
show policy statistics policy-server policy-name <policy-name> detail

Option Description

detail

Displays detailed information for the policy server.

<bd>

Specifies the name of the brick daemon. For example, bgp.appd.1

<app-key>

Specifies the application-specific policy context.

policy-server detail

Displays detailed statistics for all policies on the policy server.

policy-name <name>

Displays statistics for a specific policy.

policy-name <name> detail

Displays detailed statistics for a specific policy.

client-context <context>

Displays statistics for a specific client-context.

client-context <context> detail

Displays detailed statistics for a specific client-context.

The example below shows the statistics for all policies on the policy server.

supervisor@rtbrick.net: cfg>  show policy statistics policy-server
Policy Code Generation Statistics:

 Policy Name: v4_labeled_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:20 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:21 GMT +0000 2026
  Compilation Status : success

 Policy Name: v4_mvpn
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:14 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:14 GMT +0000 2026
  Compilation Status : success

 Policy Name: v4_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:21 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:21 GMT +0000 2026
  Compilation Status : success

 Policy Name: v4_vrf_blue_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:21 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:22 GMT +0000 2026
  Compilation Status : success

 Policy Name: v6_labeled_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:22 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:23 GMT +0000 2026
  Compilation Status : success

 Policy Name: v6_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:23 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:24 GMT +0000 2026
  Compilation Status : success
<...>

The example below shows the detailed statistics for all policies on the policy server, including the path to the compiled policy library.

supervisor@rtbrick.net: cfg> show policy statistics policy-server detail
Policy Code Generation Statistics:

 Policy Name: v4_labeled_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:20 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:21 GMT +0000 2026
  Compilation Status : success
  Path               : /usr/share/rtbrick/libpolicy/libs/v4_labeled_unicast_prefixs.so

 Policy Name: v4_mvpn
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:14 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:14 GMT +0000 2026
  Compilation Status : success
  Path               : /usr/share/rtbrick/libpolicy/libs/v4_mvpn.so

 Policy Name: v4_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:21 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:21 GMT +0000 2026
  Compilation Status : success
  Path               : /usr/share/rtbrick/libpolicy/libs/v4_unicast_prefixs.so

 Policy Name: v4_vrf_blue_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:21 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:22 GMT +0000 2026
  Compilation Status : success
  Path               : /usr/share/rtbrick/libpolicy/libs/v4_vrf_blue_unicast_prefixs.so

<...>

The example below shows the detailed statistics for a specific policy daemon, including client-context subscription details.

supervisor@rtbrick.net: cfg> show policy statistics policy-server bgp.appd.1
Policy Code Generation Statistics:

 Policy Name: v4_labeled_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:20 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:21 GMT +0000 2026
  Compilation Status : success
  Client-contexts:
   Client-context     : export.default.PE2.ipv4.labeled-unicast
    Subscription Time : Tue Apr 28 07:13:10 GMT +0000 2026
    Notification Time : Tue Apr 28 07:13:24 GMT +0000 2026

 Policy Name: v4_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:21 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:21 GMT +0000 2026
  Compilation Status : success
  Client-contexts:
   Client-context     : export.default.PE2.ipv4.unicast
    Subscription Time : Tue Apr 28 07:13:10 GMT +0000 2026
    Notification Time : Tue Apr 28 07:13:24 GMT +0000 2026

 Policy Name: v6_labeled_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:22 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:23 GMT +0000 2026
  Compilation Status : success
  Client-contexts:
   Client-context     : export.default.PE2.ipv6.labeled-unicast
    Subscription Time : Tue Apr 28 07:13:10 GMT +0000 2026
    Notification Time : Tue Apr 28 07:13:24 GMT +0000 2026

The example below shows the detailed statistics for a specific policy and client-context, including subscription and notification times.

supervisor@rtbrick.net: cfg> show policy statistics policy-server bgp.appd.1 policy-name v4_labeled_unicast_prefixs
Policy Code Generation Statistics:

 Policy Name: v4_labeled_unicast_prefixs
  Configuration Time : Tue Apr 28 07:13:10 GMT +0000 2026
  Compile Start Time : Tue Apr 28 07:13:20 GMT +0000 2026
  Compile End Time   : Tue Apr 28 07:13:21 GMT +0000 2026
  Compilation Status : success
  Client-contexts:
   Client-context     : export.default.PE2.ipv4.labeled-unicast
    Subscription Time : Tue Apr 28 07:13:10 GMT +0000 2026
    Notification Time : Tue Apr 28 07:13:24 GMT +0000 2026

Policy Clear Commands

Clearing Policy Statistics

The clear policy statistics command removes statistics data for specified brick daemons, application keys, or policies.

Syntax:

clear policy statistics <bd>
clear policy statistics <bd> app-key <app-key>
clear policy statistics <bd> app-key <app-key> policy-name <policy-name>
clear policy statistics <bd> policy-name <policy-name>
clear policy statistics policy-server
clear policy statistics policy-server policy-name <policy-name>

Option Description

<bd>

Specifies the name of the brick daemon. For example, bgp.appd.1

<app-key>

Specifies the application-specific policy context.

policy-name <name>

Specifies the name of the policy.

The following example shows how to clear the statistics for a specific policy on the policy server:

supervisor@rtbrick.net: cfg> clear policy statistics policy-server policy-name BGP_EXPORT_POLICY

Policy Test

You can use the policy test feature to test a policy before attaching it to a protocol or an instance.

Perform the following tasks:

  • Step 1: Identify the brick daemon that will process the policy and the table to which the policy will be applied.

  • Step 2: Execute the 'test policy run' command.

Example: Testing a BGP VPN export policy

supervisor@leaf1: op> test policy run bgp.appd.1 policy-name VPN_V4_EXPORT table default.bgp.rib-in.import.ipv4.vpn-unicast
  • Step 3: View the test results.

The policy test feature will create two result tables. The result table ending with ".policy.permit" will show all objects permitted by the policy, the one ending with ".policy.deny" will show all objects denied by the policy.

Example: Viewing the result tables

supervisor@leaf1: op> show datastore bgp.appd.1 table default.bgp.rib-in.import.ipv4.vpn-unicast.policy.permit
<...>
supervisor@leaf1: op> show datastore bgp.appd.1 table default.bgp.rib-in.import.ipv4.vpn-unicast.policy.deny
<...>
  • Step 4: Clear the result tables

You can clear the result tables using the 'test policy clear' command. Apply the clear command to the same table for which you have run the policy test.

Example: Clearing the result tables

supervisor@leaf1: op> test policy clear bgp.appd.1 policy-name VPN_V4_EXPORT table default.bgp.rib-in.import.ipv4.vpn-unicast