MPLS TE - Affinity attribute flag assignment best practices
When implementing MPLS traffic engineering, the attribute flags and tunnel affinity configuration allow you to set attributes on interfaces and configure tunnels to either include or exclude specific links based on those attributes. This is also known as link coloring.
The inclusion or exclusion of traffic is achieved using an affinity and a mask that are applied to particular links. These values are compared with the attribute flag to allow or disallow traffic.
An attribute flag is a 32-bits in length. This means that it can be used to define 32 separate properties on a link.
It is best practice to assign a particular attribute to a single bit. For example:
Link type | Binary | Hex |
---|---|---|
Fiber | 0000 0001 | 0x1 |
Satellite | 0000 0010 | 0x2 |
DSL | 0000 0100 | 0x4 |
Link to another country | 0000 1000 | 0x8 |
Encrypted link | 0001 0000 | 0x10 |
It is possible to use multiple flag bits to represent a particular link type like so:
Link type | Binary | Hex |
---|---|---|
Fiber | 0000 0011 | 0x3 |
Satellite | 0000 1100 | 0xC |
DSL | 0011 0000 | 0x30 |
Link to another country | 0100 0000 | 0x40 |
Encrypted link | 1000 0000 | 0x80 |
However, the bits used for each link type must be mutually exclusive. In other words they must not overlap. The following overlapping flags will cause problems:
Link type | Binary | Hex |
---|---|---|
Fiber | 0000 0011 | 0x3 |
Satellite | 0000 1111 | 0xF |
DSL | 0011 1000 | 0x38 |
Link to another country | 0111 0000 | 0x70 |
Encrypted link | 1100 0000 | 0x80 |
In this case, you cannot uniquely identify the link type using the affinity and mask values.