vpp/test/vpp_mpls_tunnel_interface.py
Neale Ranns 0f26c5a013 MPLS Mcast
1 - interface-DPO
        Used in the Data-plane to change a packet's input interface
 2 - MPLS multicast FIB entry
        Same as a unicast entry but it links to a replicate not a load-balance DPO
 3 - Multicast MPLS tunnel
        Update MPLS tunnels to use a FIB path-list to describe the endpoint[s]. Use the path-list to generate the forwarding chain (DPOs) to link to .
 4 - Resolve a path via a local label (of an mLDP LSP)
        For IP multicast entries to use an LSP in the replication list, we need to decribe the 'resolve-via-label' where the label is that of a multicast LSP.
 5 - MPLS disposition path sets RPF-ID
        For a interface-less LSP (i.e. mLDP not RSVP-TE) at the tail of the LSP we still need to perform an RPF check. An MPLS disposition DPO performs the MPLS pop validation checks and sets the RPF-ID in the packet.
 6 - RPF check with per-entry RPF-ID
       An RPF-ID is used instead of a real interface SW if index in the case the IP traffic arrives from an LSP that does not have an associated interface.

Change-Id: Ib92e177be919147bafeb599729abf3d1abc2f4b3
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-04-07 09:12:12 +00:00

47 lines
1.5 KiB
Python

from vpp_interface import VppInterface
from vpp_ip_route import VppRoutePath
import socket
class VppMPLSTunnelInterface(VppInterface):
"""
VPP MPLS Tunnel interface
"""
def __init__(self, test, paths, is_multicast=0):
""" Create MPLS Tunnel interface """
self._sw_if_index = 0
super(VppMPLSTunnelInterface, self).__init__(test)
self._test = test
self.t_paths = paths
self.is_multicast = is_multicast
def add_vpp_config(self):
self._sw_if_index = 0xffffffff
for path in self.t_paths:
reply = self.test.vapi.mpls_tunnel_add_del(
self._sw_if_index,
1, # IPv4 next-hop
path.nh_addr,
path.nh_itf,
path.nh_table_id,
path.weight,
next_hop_out_label_stack=path.nh_labels,
next_hop_n_out_labels=len(path.nh_labels),
is_multicast=self.is_multicast)
self._sw_if_index = reply.sw_if_index
def remove_vpp_config(self):
for path in self.t_paths:
reply = self.test.vapi.mpls_tunnel_add_del(
self.sw_if_index,
1, # IPv4 next-hop
path.nh_addr,
path.nh_itf,
path.nh_table_id,
path.weight,
next_hop_out_label_stack=path.nh_labels,
next_hop_n_out_labels=len(path.nh_labels),
is_add=0)