cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
262
Views
1
Helpful
1
Replies
Cisco Employee

How to program the LDP

I'm working on an PoC for ASR9K. And would like to demonstrate how to program the MPLS-te tunnel.

First thing first, I want to know how to program the LDP like the CLI below?? any sample config??

I saw there is a Cisco_IOS_XR_mpls_ldp_oper module and Cisco_IOS_XR_mpls_ldp_cfg module but donno how to use it...

example:

router ospf 1000

log adjacency changes

network point-to-point

area 10

  mpls traffic-eng                  <<<<<

  interface Loopback0

   passive enable

  !

  interface GigabitEthernet0/0/0/0

   cost 1

   mpls ldp sync                  <<<<<

  !

  interface GigabitEthernet0/0/0/1

   cost 1

   mpls ldp sync

  !

!

mpls traffic-eng router-id Loopback0

!

mpls ldp                                 <<<<<<

router-id 10.1.11.1

interface GigabitEthernet0/0/0/0

!

interface GigabitEthernet0/0/0/1

!

interface GigabitEthernet0/0/0/2

!

Everyone's tags (2)
1 REPLY 1
Highlighted
Cisco Employee

Re: How to program the LDP

Here's sample to construct "mpls ldp" config and mpls ldp sync under ospf:

def config_ospf(provider, keys, router_info, ospf):

..

..

..

                 name_scope = area_area_id.name_scopes.NameScope()

                 name_scope.interface_name = interface_name

                 if interface_ospf_ldp=="Y":

                    name_scope.ldp_sync=True    <<<<<

def config_mplsldp(provider, keys, router_info, mplsldp):

    lines=read_interface_files()

    connected_router=router_info[12]

    interface_mpls_ldp_config=mplsldp.default_vrf.interfaces.Interface()

    for line in lines:

        p=line.split(",")

        if p[0]==connected_router:

           # Create router_id

           interface_name=p[1]

           ipv4addr, netmask = cidr_to_netmask(p[2])

           interface_mpls_ldp=p[7]

           if interface_name=="Loopback0":

               mplsldp.default_vrf.global_.router_id=ipv4addr

           else:

              if interface_mpls_ldp=="Y":

                  interface_mpls_ldp_config.interface_name=interface_name

                  interface_mpls_ldp_config.enable=Empty()

                  mplsldp.default_vrf.interfaces.interface.append(interface_mpls_ldp_config)

           mplsldp.enable=Empty()

           # create configuration on NETCONF device

           crud.create(provider, mplsldp)