In the IGP based IP networks we have one simple algorithm and it calculates the shortest path to the destination according to planned IGP metric.IGP metric is the only constraint we can assign to the links. We have more with MPLS TE implementations like TE Metric, link admin group, bw etc. The problem with TE, it is creating a lot of state information on routers and it adding another level of complexity.

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..

Flexible-Algorithm is a numeric identifier in the range 128-255 that is associated via provisioning with the Flexible-Algorithm Definition. (0-127 reserved for IANA). There are currently 2 algorithm already defined;

Algo 0: Shortest Path First algorithm based on link metric. Algorithm 0 permits any node to overwrite the SPF path with a different path based on local policy

Algo 1: Shortest Path First algorithm based on link metric. It is identical to Algorithm 0 but algorithm 1 requires that all nodes along the path will use the same SPF routing decision. Local policy must NOT alter the path.

As an administrator, we can use number between 128 and 255 and define any algorithm with any link constraint. Any operator, service provider can define their own algorithm. One operator can say Algo 128 will be used to minimize TE metric and another can say Algo 128 will be used to minimize delay metric.

From the ip address and Prefix-SID perspective; we are not going to need additional loopback or ip address but we will need to define Prefix SID per Algo. Segment Routing implementation will allow us to define multiple Prefix SIDs for same ip address.

Assuming we have an AlgoX (X is any number between 128 and 255).

- Every participating router should be configured with AlgoX
- Participating router may advertise different Prefix SID for AlgoX
- AlgoX should have same definition on all participating nodes.

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)

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 likei 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;

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;