#
Routing Policy
#
URL
frinx-openconfig-routing-policy:routing-policy/policy-definitions/policy-definition=?content=nonconfig
#
OPENCONFIG YANG
{
"frinx-openconfig-routing-policy:policy-definition": [
{
"name": "",
"config": {
"name": ""
},
"statements": {
"statement": [
{
"name": "",
"frinx-cisco-routing-policy-extension:tags": {
"tag": [
{
"name": ,
"config": {
"name":
}
}
]
},
"config": {
"name": "",
"frinx-cisco-routing-policy-extension:set-operation": "",
"frinx-cisco-routing-policy-extension:ip-prefix-list": [
"ip_prefix_list_member_1",
"ip_prefix_list_member_2",
"ip_prefix_list_member_3"
],
"frinx-cisco-routing-policy-extension:ipv6-prefix-list": ""
},
"conditions": {
"config": {
"call-policy": ,
"install-protocol-eq":
},
"match-prefix-set": {
"config": {
"prefix-set": "",
"match-set-options": ""
}
},
"frinx-openconfig-bgp-policy:bgp-conditions": {
"as-path-length": {
"config": {
"operator": "",
"value": ""
}
},
"match-community-set": {
"config": {
"community-set": "",
"match-set-options": ""
}
},
"match-as-path-set": {
"config": {
"as-path-set": "",
"match-set-options": ""
}
}
},
"match-protocol-instance": {
"config": {
"protocol-identifier": "",
"protocol-name": ""
}
}
},
"actions": {
"config": {
"policy-result":
},
"frinx-openconfig-bgp-policy:bgp-actions": {
"config": {
"set-local-pref": ,
"set-next-hop": ,
"set-med": ,
"set-route-origin": "EGP|IGP|INCOMPLETE"
},
"set-community": {
"config": {
"method": "REFERENCE|INLINE",
"options": ""
},
"reference": {
"config": {
"community-set-ref": ""
}
},
"inline": {
"config": {
"communities": [
,
]
}
}
},
"set-as-path-prepend": {
"config": {
"asn": "",
"repeat-n": ""
}
}
},
"ospf-actions": {
"set-metric": {
"config": {
"metric":
}
}
}
}
}
]
}
}
]
}
frinx-openconfig-routing-policy:routing-policy/defined-sets/prefix-sets/prefix-set=?content=nonconfig
{
"prefix-set": [
{
"name": "",
"config": {
"name": ""
},
"prefixes": {
"prefix": [
{
"ip-prefix": "/",
"masklength-range": "",
"config": {
"ip-prefix": "/",
"masklength-range": "",
"frinx-cisco-routing-policy-extension:sequence-id": ,
"frinx-cisco-routing-policy-extension:operation": "",
"frinx-cisco-routing-policy-extension:minimum-prefix-length": ,
"frinx-cisco-routing-policy-extension:maximum-prefix-length":
}
}
]
}
}
]
}
frinx-openconfig-routing-policy:routing-policy/defined-sets/bgp-defined-sets/community-sets/community-set=?content=nonconfig
{
"community-set": [
{
"community-set-name": "",
"config": {
"community-set-name": "",
"community-member": [
"cset_member1",
"cset_member2",
"cset_member3"
],
"frinx-openconfig-bgp-policy-extension:community-member-deny": [
"cset_deny_member1",
"cset_deny_member2",
"cset_deny_member3"
]
}
}
]
}
frinx-openconfig-routing-policy:routing-policy/defined-sets/bgp-defined-sets/as-path-sets/as-path-set=
{
"as-path-set": [
{
"as-path-set-name": "",
"config": {
"as-path-set-name": "",
"as-path-set-member": [
"aset_member1",
"aset_member2",
"aset_member3"
]
}
}
]
}
#
OS Configuration Commands
#
Cisco IOS 12, IOS 15, IOS XE 15, IOS XE 16, IOS XE 17
ip prefix-list seq / ge le
permit is a conversion of set to frinx-cisco-routing-policy-extension:PERMIT
deny is a conversion of set to frinx-cisco-routing-policy-extension:DENY
ip community-list standard ip community-list expanded
permit is a conversion of set to community-member
deny is a conversion of set to frinx-openconfig-bgp-policy-extension:community-member-deny
route-map set local-preference set as-path prepend match ip address prefix-list match tag match ipv6 address prefix-list set origin match community set community (no-export, no-advertise, )
permit is a conversion of set to frinx-cisco-routing-policy-extension:PERMIT
deny is a conversion of set to frinx-cisco-routing-policy-extension:DENY
set community (no-export) is a conversion of set to frinx-openconfig-bgp-types:NO_EXPORT
set community (no-advertise) is a conversion of set to frinx-openconfig-bgp-types:NO_ADVERTISE
*match tag * is a tag element in match clause set to frinx-cisco-routing-policy-extension:tags
#
Cisco IOS XR 5.3.4, IOS XR 6.6.2
#
CLI
prefix-set / [] end-set community-set , , end-set as-path-set ios-regex '_$', ios-regex '_$', ios-regex '_$' end-set route-policy if [not] destination in / and as-path length le|ge|eq / and community match-any|match-every / and [not] as-path in then drop done pass apply set local-preference set next-hop set med set community set community (no-export, no-advertise, local-as, ) prepend as-path endif end-policy
is parsed from .
- If is "exact", then is not set.
- If matches to pattern of .. , then is set as "le ge ".
*destination in * is a conversion of set to ANY
*not destination in * is a conversion of set to INVERT
as-path length le is a conversion of set to frinx-openconfig-policy-types:ATTRIBUTE_LE
as-path length ge is a conversion of set to frinx-openconfig-policy-types:ATTRIBUTE_GE
as-path length eq is a conversion of set to frinx-openconfig-policy-types:ATTRIBUTE_EQ
community match-any is a conversion of set to ANY
community match-every is a conversion of set to ALL
drop is a conversion of set to REJECT_ROUTE
done is a conversion of set to ACCEPT_ROUTE
pass is a conversion of set to PASS_ROUTE
set community (no-export) is a conversion of set to frinx-openconfig-bgp-types:NO_EXPORT
set community (no-advertise) is a conversion of set to frinx-openconfig-bgp-types:NO_ADVERTISE
set community (local-as) is a conversion of set to frinx-openconfig-bgp-types:NO_EXPORT_SUBCONFED
*as-path in * is a conversion of set to ANY
*not as-path in * is a conversion of set to INVERT
#
Examples
route-policy route_policy_1 set next-hop apply route_subpolicy_1 end-policy
{
"policy-definition": [
{
"name": "route_policy_1",
"config": {
"name": "route_policy_1"
},
"statements": {
"statement": [
{
"name": "statement_1",
"config": {
"name": "statement_1"
},
"conditions": {
"config": {
"call-policy": route_subpolicy_1
}
},
"actions": {
"frinx-openconfig-bgp-policy:bgp-actions": {
"config": {
"set-next-hop":
}
}
}
}
]
}
}
]
}
route-policy route_policy_2 if as-path length ge 100 then drop elseif destination in pset_name then set med 10 set local-preference 15 set community cset_name [additive] done elseif as-path in aset_name then set med 20 done else set local-preference 15 done endif end-policy
{
"policy-definition": [
{
"name": "route_policy_2",
"config": {
"name": "route_policy_2"
},
"statements": {
"statement": [
{
"name": "statement_1",
"config": {
"name": "statement_1"
},
"conditions": {
"frinx-openconfig-bgp-policy:bgp-conditions": {
"as-path-length": {
"config": {
"operator": "ATTRIBUTE_GE",
"value": "100"
}
}
}
},
"actions": {
"config": {
"policy-result": "REJECT_ROUTE"
}
}
},
{
"name": "statement_2",
"config": {
"name": "statement_2"
},
"conditions": {
"match-prefix-set": {
"config": {
"prefix-set": "pset_name",
"match-set-options": "ANY"
}
}
},
"actions": {
"config": {
"policy-result": "ACCEPT_ROUTE"
},
"frinx-openconfig-bgp-policy:bgp-actions": {
"config": {
"set-local-pref": 15,
"set-med": 10
},
"set-community": {
"config": {
"method": "INLINE",
"options": "ADD|REMOVE|REPLACE"
},
"inline": {
"config": {
"communities": "123:333"
}
}
}
}
}
},
{
"name": "statement_3",
"config": {
"name": "statement_3"
},
"conditions": {
"frinx-openconfig-bgp-policy:bgp-conditions": {
"as-path-set": {
"config": {
"as-path-set": "aset_name",
"match-set-options": "ANY"
}
}
}
},
"actions": {
"config": {
"policy-result": "ACCEPT_ROUTE"
},
"frinx-openconfig-bgp-policy:bgp-actions": {
"config": {
"set-med": 20
}
}
}
},
{
"name": "statement_4",
"config": {
"name": "statement_4"
},
"actions": {
"config": {
"policy-result": "ACCEPT_ROUTE"
},
"frinx-openconfig-bgp-policy:bgp-actions": {
"config": {
"set-local-pref": 15
}
}
}
}
]
}
}
]
}
route-policy route_policy_3 if destination in pset_name then drop elseif community match-any cset_name then set med 1 prepend as-path 123 3 done elseif destination in pset_name and as-path in aset_name then set med 2 done else set med 3 done endif end-policy
{
"policy-definition": [
{
"name": "route_policy_4",
"config": {
"name": "route_policy_4"
},
"statements": {
"statement": [
{
"name": "statement_1",
"config": {
"name": "statement_1"
},
"conditions": {
"match-prefix-set": {
"config": {
"prefix-set": "pset_name",
"match-set-options": "ANY"
}
}
},
"actions": {
"config": {
"policy-result": "REJECT_ROUTE"
}
}
},
{
"name": "statement_2",
"config": {
"name": "statement_2"
},
"conditions": {
"frinx-openconfig-bgp-policy:bgp-conditions": {
"match-community-set": {
"config": {
"community-set": "cset_name",
"match-set-options": "ANY"
}
}
}
},
"actions": {
"config": {
"policy-result": "ACCEPT_ROUTE"
},
"frinx-openconfig-bgp-policy:bgp-actions": {
"config": {
"set-med": 1
},
"set-as-path-prepend": {
"config": {
"asn": 123,
"repeat-n": 3
}
}
}
}
},
{
"name": "statement_3",
"config": {
"name": "statement_3"
},
"conditions": {
"match-prefix-set": {
"config": {
"prefix-set": "pset_name",
"match-set-options": "ANY"
}
},
"frinx-openconfig-bgp-policy:bgp-conditions": {
"as-path-set": {
"config": {
"as-path-set": "aset_name",
"match-set-options": "ANY"
}
}
}
},
"actions": {
"config": {
"policy-result": "ACCEPT_ROUTE"
},
"frinx-openconfig-bgp-policy:bgp-actions": {
"config": {
"set-med": 2
}
}
}
},
{
"name": "statement_4",
"config": {
"name": "statement_4"
},
"actions": {
"config": {
"policy-result": "ACCEPT_ROUTE"
},
"frinx-openconfig-bgp-policy:bgp-actions": {
"config": {
"set-med": 3
}
}
}
}
]
}
}
]
}
route-policy route_policy_4 if destination in pset_name then pass endif end-policy
{
"policy-definition": [
{
"name": "route_policy_4",
"config": {
"name": "route_policy_4"
},
"statements": {
"statement": [
{
"name": "1",
"config": {
"name": "1"
},
"conditions": {
"match-prefix-set": {
"config": {
"match-set-options": "ANY",
"prefix-set": "pset_name"
}
}
},
"actions": {
"config": {
"policy-result": "PASS_ROUTE"
}
}
}
]
}
}
]
}
#
Junos 14.1X53-D40.8
#
CLI
set policy-options policy-statement term from instance set policy-options policy-statement term then
set policy-options policy-statement term from protocol set policy-options policy-statement term then metric set policy-options policy-statement term then
#
Examples
set policy-options policy-statement IMPORT term 1 from instance master set policy-options policy-statement IMPORT term 1 then accept
{
"policy-definition": [
{
"config": {
"name": "IMPORT"
},
"name": "IMPORT",
"statements": {
"statement": [
{
"name": "1",
"config": {
"name": "1"
},
"conditions": {
"frinx-openconfig-network-instance-policy:match-protocol-instance": {
"config": {
"protocol-name": "master"
}
}
},
"actions": {
"config": {
"policy-result": "ACCEPT_ROUTE"
}
}
}
]
}
}
]
}
set policy-options policy-statement OUT-FIL term 1 from protocol direct set policy-options policy-statement OUT-FIL term 1 then metric 100 set policy-options policy-statement OUT-FIL term 1 then accept
{
"policy-definition": [
{
"name": "OUT-FIL",
"config": {
"name": "OUT-FIL"
},
"statements": {
"statement": [
{
"name": "1",
"config": {
"name": "1"
},
"conditions": {
"frinx-openconfig-network-instance-policy:match-protocol-instance": {
"config": {
"protocol-identifier": "frinx-openconfig-policy-types:DIRECTLY_CONNECTED"
}
}
},
"actions": {
"config": {
"policy-result": "ACCEPT_ROUTE"
},
"frinx-openconfig-ospf-policy:ospf-actions": {
"set-metric": {
"config": {
"metric": 100
}
}
}
}
}
]
}
}
]
}