SR-TE Flex-Algo w/ Affinity
Load sr-te.flex-algo.init.cfg
configure
load bootflash:sr-te.flex-algo.init.cfg
commit replace
yConfigure flex algo 128 to use the IGP path but exclude RED links. Configure the R3-R5 link as color RED. Traffic from CE101 to CE107 should then take the path R1-R3-R9-R5-R7.
Answer
#All routers
router isis 1
affinity-map RED bit-position 1
!
flex-algo 128
affinity exclude-any RED
advertise-definition
#R1
segment-routing
traffic-eng
on-demand color 10
dynamic
sid-algorithm 128
#R3
router isis 1
interface GigabitEthernet0/0/0/5
affinity flex-algo RED
#R5 (technically optional)
router isis 1
interface GigabitEthernet0/0/0/3
affinity flex-algo RED
#R7
router isis 1
interface Loopback1
address-family ipv4 unicast
prefix-sid algorithm 128 index 107Explanation
When using link affinity in a flex-algo definition, you must define the affinity and assign affinities to interfaces under the IGP. This is true even if you configured the same affinity under segment-routing traffic-eng.
To start, all routers will define the flex algo and its constraint (avoid RED links). All routers must define the bit mapping for affinity name “RED.”
#All routers
router isis 1
affinity-map RED bit-position 1
!
flex-algo 128
affinity exclude-any RED
advertise-definitionAll routers will advertise the flex algo definition. The bit mapping is 0 index-based, so bit 1 maps to 0x2. The flex algo definition advertisement says to exclude this admin group.

Next, we must define the affinity on R3 and R5 under the IGP.
#R3
router isis 1
interface GigabitEthernet0/0/0/5
affinity flex-algo REDWe must define this under the IGP because the affinity must be advertised as part of an application specific link attribute. The affinity must be linked to the flex-algo application. It is different from the general MPLS-TE link affinity.

As before, we define the ODN policy on R1, and advertise the additional prefix SID for this flex algo on R7.
#R1
segment-routing
traffic-eng
on-demand color 10
dynamic
sid-algorithm 128
#R7
router isis 1
interface Loopback1
address-family ipv4 unicast
prefix-sid algorithm 128 index 107We’ll now color routes from R7:
#R7
extcommunity-set opaque LOW_LATENCY
10
end-set
!
route-policy LOW_LATENCY_ODN
set extcommunity color LOW_LATENCY
end-policy
!
router bgp 100
vrf BLUE
neighbor 192.168.107.107
address-family ipv4 unicast
route-policy LOW_LATENCY_ODN inR1 instantiates the ODN policy, which uses a single label:

A traceroute from CE101 to CE107 confirms the path is correct:

Last updated