The MPLS Topology Server maps the VRFs of a unicast L3VPN to the appropriate LSPs, and then creates a LayeredOver relationship from the VPN to which the VRFs belong to the LSPs.
A VRF and a peer VRF are mapped to an LSP if:
The PE device that is hosted by the VRF is the source device for the LSP.
The PE device that is hosted by the peer VRF is the destination device for the LSP.
If multiple LSPs exist between the two PEs, the VRF and the peer are mapped to the first found LSP that matches the criteria. This algorithm results in the mapping of both the VRF and the peer to a pair of LSPs, where the one LSP is incoming and the other is outgoing.
To map VRFs to LSPs, the MPLS Topology Server traverses VRF VPNPeer relationships, VRF HostedBy relationships, and LSP Source relationships, and compares LSP identifiers (LSP IDs) with PE device addresses.