Segment Routing Flexible Algorithm (Flex-Algo) will provide easy way of calculating different paths with different type of constraints. It will allow us to define our own algorithm. This new algorithm can still be minimizing IGP metric but it can also be minimizing TE metric, minimizing delay metric (new metric definition added to IGP), avoiding some links or some nodes, using some affinities etc..
The simplest example for Flex-Algo usage is dual-plane networks. Here is an example;
Algo 0: Shortest path to the destination
Algo 128: Shortest path to the destination
Algo 129: Shortest path to the destination
(It seems like all algortihms are same but not all nodes will support all algorithm)
![](http://www.fabricplane.com/wp-content/uploads/2020/08/Flex-Algo-1-1.png)
In the topology;
All Nodes Participating in Algo 0
Node 0,1,2,3,4,9 are participating in Algo 128, Minimize IGP Metric
Node 0,5,6,7,8,9 are participating in Algo 129, Minimize IGP Metric
Let’s assume that, Node 9 advertises 3 Prefix SID for 3 Algo.
- 16009 for Algo 0
- 128009 for Algo 128
- 129009 for Algo 129
Let’s look at the data plane from the Node3 perspective;
For Algo 0:
Incoming Active Segment: 16009 (assuming same SRGB is used) Operation: Continue (Keep 16009 or POP if PHP is enabled) Egress Interface: The interface towards to Node9
For Algo 128:
Incoming Active Segment: 128009 (assuming same SRGB is used) Operation: Continue (Keep 128009 or POP if PHP is enabled) Egress Interface: The interface towards to Node9
But, there will not be any data plane installation for Algo129. In fact, according to Node3 point of view, even Node7 advertise the Prefix SID 129009, it will not be accepted because it is not a locally defined Algo.
We can think like we have now 3 different logical topology for every algo;
Algo 0 topology will include every node and every link. Algo 128 and Algo 129 topologies are below;
![](http://www.fabricplane.com/wp-content/uploads/2020/08/Flex-Algo-2-1.png)
From Node0,
- if you push 16009 Prefix SID as an MPLS label on to the packet it will be sent shortest path to destination and calculation will be done between all nodes and links;
- if you push 128009 Prefix SID as an MPLS label on to the packet it will be sent shortest path to destination and calculation will be done over Topology 128;
- if you push 129009 Prefix SID as an MPLS label on to the packet it will be sent shortest path to destination and calculation will be done over Topology 129;