OC Routing Policy
Packages:
- openconfig-routing-policy..yang
- openconfig-network-instance-policy..yang
Creating IPv4 Prefix Lists
Creating IPv4 Prefix Lists
Request:
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target><running/></target>
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<defined-sets>
<prefix-sets>
<prefix-set>
<prefix-set-name>pfx1</prefix-set-name>
<prefixes>
<prefix>
<ip-prefix>1.1.1.0/24</ip-prefix>
<masklength-range>24..25</masklength-range>
<config>
<ip-prefix xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="create">1.1.1.0/24</ip-prefix>
<masklength-range xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="create">24..25</masklength-range>
</config>
</prefix>
</prefixes>
</prefix-set>
</prefix-sets>
</defined-sets>
</routing-policy>
</config>
</edit-config>
</rpc>
Container: Routing-policy/defined-sets/Prefix-sets
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
ip prefix-list ANY_pfx1 seq 5 permit 1.1.1.0/24 le 25
ip prefix-list INVERT_pfx1 seq 5 deny 1.1.1.0/24 le 25
ip prefix-list INVERT_pfx1 seq 4294967294 permit 0.0.0.0/0 le 32
Deleting a Specific Prefix List Sequence
Deleting a Specific Prefix List Sequence
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<defined-sets>
<prefix-sets>
<prefix-set>
<prefix-set-name>pfx1</prefix-set-name>
<prefixes>
<prefix xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete">
<ip-prefix>1.1.1.0/24</ip-prefix>
<masklength-range>24..25</masklength-range>
<config>
<ip-prefix>1.1.1.0/24</ip-prefix>
<masklength-range>24..25</masklength-range>
</config>
</prefix>
</prefixes>
</prefix-set>
</prefix-sets>
</defined-sets>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
no ip prefix-list ANY_pfx1 seq 5 permit 1.1.1.0/24 le 25
no ip prefix-list INVERT_pfx1 seq 5 deny 1.1.1.0/24 le 25
no ip prefix-list INVERT_pfx1 seq 4294967294 permit 0.0.0.0/0 le 32
Deleting All Sequences of a Prefix List
Deleting All Sequences of a Prefix List
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<defined-sets>
<prefix-sets>
<prefix-set xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete">
<prefix-set-name>pfx100</prefix-set-name>
</prefix-set>
</prefix-sets>
</defined-sets>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
no ip prefix-list ANY_pfx100
no ip prefix-list INVERT_pfx100
Replacing Prefix Lists
Replacing Prefix Lists
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<defined-sets>
<prefix-sets xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="replace">
<prefix-set>
<prefix-set-name>pfx3</prefix-set-name>
<prefixes>
<prefix>
<ip-prefix>1.2.2.1/24</ip-prefix>
<masklength-range>24..26</masklength-range>
<config>
<ip-prefix>1.2.2.1/24</ip-prefix>
<masklength-range>24..26</masklength-range>
</config>
</prefix>
</prefixes>
</prefix-set>
</prefix-sets>
</defined-sets>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
no ip prefix-list ANY_pfx1 seq 5 permit 100.1.1.0/24 le 26
no ip prefix-list INVERT_pfx1 seq 5 deny 100.1.1.0/24 le 26
no ip prefix-list INVERT_pfx1 seq 4294967294 permit 0.0.0.0/0 le 32
ip prefix-list ANY_pfx3 seq 5 permit 1.2.2.0/24 le 26
ip prefix-list INVERT_pfx3 seq 5 deny 1.2.2.0/24 le 26
ip prefix-list INVERT_pfx3 seq 4294967294 permit 0.0.0.0/0 le 32
Creating a Route Map Sequence
Creating a Route Map Sequence
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol1</name>
<statements>
<statement>
<name>10</name>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
** Container:** Routing-policy/policy-definitions
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol1 permit 10
Deleting a Route-Map Sequence
Deleting a Route-Map Sequence
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol1</name>
<statements>
<statement xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete">
<name>10</name>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
no Route-map pol1 permit 10
Creating a Route Map Sequence with a Set Tag
Creating a Route Map Sequence with a Set Tag
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol2</name>
<statements>
<statement>
<name>10</name>
<actions>
<igp-actions>
<config>
<set-tag>100</set-tag>
</config>
</igp-actions>
</actions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol2 permit 10
set tag 100
Deleting Set Tag from Route Map
Deleting Set Tag from Route Map
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol2</name>
<statements>
<statement>
<name>10</name>
<actions>
<igp-actions>
<config>
<set-tag xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete">100</set-tag>
</config>
</igp-actions>
</actions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol2 permit 10
no set tag 100
Deleting a Route Map
Deleting a Route Map
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete">
<name>pol2</name>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
no Route-map pol2
Creating a Route Map with Match Source Protocol
Creating a Route Map with Match Source Protocol
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol1</name>
<statements>
<statement>
<name>10</name>
<conditions>
<match-protocol-instance xmlns="http://openconfig.net/yang/network-instance/policy">
<config>
<protocol-identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:BGP</protocol-identifier>
<protocol-name>10</protocol-name>
</config>
</match-protocol-instance>
</conditions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol1 permit 10
match source-protocol bgp-10
Replacing a Route Map with a Different Match Source Protocol
Replacing a Route Map with a Different Match Source Protocol
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol1</name>
<statements>
<statement>
<name>10</name>
<conditions>
<match-protocol-instance xmlns="http://openconfig.net/yang/network-instance/policy">
<config>
<protocol-identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="replace">oc-pol-types:OSPF</protocol-identifier>
<protocol-name xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="replace">20</protocol-name>
</config>
</match-protocol-instance>
</conditions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol1 permit 10
no match source-protocol bgp-10
match source-protocol ospf-20
Deleting a Match Source Protocol
Deleting a Match Source Protocol
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol1</name>
<statements>
<statement>
<name>10</name>
<conditions>
<match-protocol-instance xmlns="http://openconfig.net/yang/network-instance/policy" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete">
<config>
<protocol-identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:OSPF</protocol-identifier>
<protocol-name>20</protocol-name>
</config>
</match-protocol-instance>
</conditions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol1 permit 10
no match source-protocol ospf-20
Creating a Route Map with Match Prefix Set
Creating a Route Map with Match Prefix Set
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol3</name>
<statements>
<statement>
<name>10</name>
<conditions>
<match-prefix-set>
<config>
<prefix-set>pfx100</prefix-set>
<match-set-options>ANY</match-set-options>
</config>
</match-prefix-set>
</conditions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol3 permit 10
match ip address prefix-list ANY_pfx100
Replacing a Route Map with a Different Match Prefix Set
Replacing a Route Map with a Different Match Prefix Set
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol3</name>
<statements>
<statement>
<name>10</name>
<conditions>
<match-prefix-set>
<config>
<prefix-set>pfx100</prefix-set>
<match-set-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="replace">INVERT</match-set-options>
</config>
</match-prefix-set>
</conditions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol3 permit 10
no match ip address prefix-list ANY_pfx100
match ip address prefix-list INVERT_pfx100
Deleting a Match Prefix Set
Deleting a Match Prefix Set
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol3</name>
<statements>
<statement>
<name>10</name>
<conditions>
<match-prefix-set xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete">
<config>
<prefix-set>pfx100</prefix-set>
<match-set-options>INVERT</match-set-options>
</config>
</match-prefix-set>
</conditions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol3 permit 10
no match ip address prefix-list INVERT_pfx100
Replacing a Set Tag from a Route Map
Replacing a Set Tag from a Route Map
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol2</name>
<statements>
<statement>
<name>10</name>
<actions>
<igp-actions>
<config>
<set-tag xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="replace">50</set-tag>
</config>
</igp-actions>
</actions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol2 permit 10
no set tag 100
set tag 50
Getting the Route Map Configuration
Getting the Route Map Configuration
Request:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<get-config>
<source>
<running/>
</source>
<filter>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy"/>
</filter>
</get-config>
</rpc>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
show run rpm
Configuring an IPv4 Prefix List
Configuring an IPv4 Prefix List
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<defined-sets>
<prefix-sets>
<prefix-set>
<name>pfx_new</name>
<config>
<name>pfx_new</name>
<mode>IPV4</mode>
</config>
<prefixes>
<prefix>
<ip-prefix>1.1.1.0/24</ip-prefix>
<masklength-range>24..32</masklength-range>
</prefix>
<prefix>
<ip-prefix>2.2.2.0/24</ip-prefix>
<masklength-range>26..28</masklength-range>
</prefix>
<prefix>
<ip-prefix>3.3.3.0/24</ip-prefix>
<masklength-range>28..0</masklength-range>
</prefix>
</prefixes>
</prefix-set>
</prefix-sets>
</defined-sets>
</routing-policy>
</config>
</edit-config>
</rpc>
Note: This example was added in Release 9.3(5).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
ip prefix-list ANY_pfx_new seq 5 permit 1.1.1.0/24 le 32
ip prefix-list ANY_pfx_new seq 10 permit 2.2.2.0/24 ge 26 le 28
ip prefix-list ANY_pfx_new seq 15 permit 3.3.3.0/24 ge 28
ip prefix-list INVERT_pfx_new seq 5 deny 1.1.1.0/24 le 32
ip prefix-list INVERT_pfx_new seq 10 deny 2.2.2.0/24 ge 26 le 28
ip prefix-list INVERT_pfx_new seq 15 deny 3.3.3.0/24 ge 28
ip prefix-list INVERT_pfx_new seq 4294967294 permit 0.0.0.0/0 le 32
Configuring an IPv6 Prefix List
Configuring an IPv6 Prefix List
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<defined-sets>
<prefix-sets>
<prefix-set>
<name>pfx_v6_new</name>
<config>
<name>pfx_v6_new</name>
<mode>IPV6</mode>
</config>
<prefixes>
<prefix>
<ip-prefix>1001::0/96</ip-prefix>
<masklength-range>96..128</masklength-range>
</prefix>
<prefix>
<ip-prefix>1002::0/96</ip-prefix>
<masklength-range>98..120</masklength-range>
</prefix>
<prefix>
<ip-prefix>1003::0/96</ip-prefix>
<masklength-range>100..0</masklength-range>
</prefix>
</prefixes>
</prefix-set>
</prefix-sets>
</defined-sets>
</routing-policy>
</config>
</edit-config>
</rpc>
Note: This example was added in Release 9.3(5).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
ipv6 prefix-list ANY_pfx_v6_new seq 5 permit 1001::/96 le 128
ipv6 prefix-list ANY_pfx_v6_new seq 10 permit 1002::/96 ge 98 le 120
ipv6 prefix-list ANY_pfx_v6_new seq 15 permit 1003::/96 ge 100
ipv6 prefix-list INVERT_pfx_v6_new seq 5 deny 1001::/96 le 128
ipv6 prefix-list INVERT_pfx_v6_new seq 10 deny 1002::/96 ge 98 le 120
ipv6 prefix-list INVERT_pfx_v6_new seq 15 deny 1003::/96 ge 100
ipv6 prefix-list INVERT_pfx_v6_new seq 4294967294 permit 0::/0 le 128
Configuring a Subinterface Match
Configuring a Subinterface Match
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol_mat_int</name>
<statements>
<statement>
<name>10</name>
<conditions>
<match-interface>
<config>
<interface>eth1/1</interface>
<subinterface>1</subinterface>
</config>
</match-interface>
</conditions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
Note: This example was added in Release 9.3(5).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol_mat_int permit 10
match interface Ethernet1/1.1
Configuring a Interface Match
Configuring a Interface Match
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol_mat_int1</name>
<statements>
<statement>
<name>10</name>
<conditions>
<match-interface>
<config>
<interface>eth1/1</interface>
</config>
</match-interface>
</conditions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
Note: This example was added in Release 9.3(5).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol_mat_int1 permit 10
match interface Ethernet1/1
Configuring Route-Map Permit
Configuring Route-Map Permit
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol_allow</name>
<statements>
<statement>
<name>10</name>
<actions>
<config>
<policy-result>ACCEPT_ROUTE</policy-result>
</config>
</actions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
Note:
- Even without
<policy-result>
, the default value isACCEPT_ROUTE
. - This example was added in Release 9.3(5).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol_allow permit 10
Configuring Route-Map Deny
Configuring Route-Map Deny
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy">
<policy-definitions>
<policy-definition>
<name>pol_deny</name>
<statements>
<statement>
<name>10</name>
<actions>
<config>
<policy-result>REJECT_ROUTE</policy-result>
</config>
</actions>
</statement>
</statements>
</policy-definition>
</policy-definitions>
</routing-policy>
</config>
</edit-config>
</rpc>
Note: This example was added in Release 9.3(5).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right.
route-map pol_deny deny 10