MPLS

Manage XGS4 MPLS

MPLS

MPLS VPNs (VPWS, VPLS, L3), label switching, tunnel initiators, EXP maps and MPLS multicast groups. The built-in help starts with “Only for XGS4 devices”.

All words before the Key=<value> arguments must be written out in full; case does not matter. A missing word prints MPLS_CLI: Error: Missing arg after <word>. The built-in help shows mpls tunnel switch del; only del is accepted there, not delete. On chips without MPLS support the commands fail with “Feature unavailable”. Trident 3 is not one of them: the lookups reach the MPLS tables, and on a SONiC switch, which has no MPLS configuration, they fail with Entry not found or Invalid parameter because the VPN or map named does not exist.

mpls vpn show, mpls expmap show and mpls options are safe. All other commands create or delete MPLS hardware state behind SONiC’s back.

Warning

mpls init and mpls cleanup reset or tear down the SDK’s MPLS module underneath syncd. Do not use them on a production switch.

MPLS_cint脚本实现 (MPLS via CINT and diag commands) shows a complete VPWS/VPLS session (mpls init, mpls vpn create, mpls vpn port add, mpls tunnel init set, mpls tunnel switch add, mpls tunnel l2 add) on an older XGS chip, not Trident 3.

Hardware-validated — List the option and flag names the other sub-commands accept

drivshell> mpls options Type=PortMatch
     Port                       0x00000002
     PortVlan                   0x00000003
     PortVlanStacked            0x00000005
     Label                      0x00000007
     LabelPort                  0x00000008
     LabelVlan                  0x00000009
mpls init

Initialise the MPLS module. On failure it prints MPLS_CLI: Error: bcm_mpls_init failed, <reason>.

Unvalidated

drivshell> mpls init
mpls cleanup

Tear down the MPLS module. Do not use it on a production switch.

Unvalidated

drivshell> mpls cleanup
mpls options Type=<PORT | PortMatch | MplsSwitch | MplsEgressLabel>

Print the symbolic names accepted for port flags, port-match criteria, label-switch options and egress-label options. Safe.

Hardware-validated

drivshell> mpls options Type=MplsSwitch
  LookupInnerLabel           0x00000001
  CouNTed                    0x00000002
  IntPriSet                  0x00000004
  IntPriMap                  0x00000008
  ColorMap                   0x00000010
  OUTerEXP                   0x00000020
  OUTerTTL                   0x00000040
  INnerEXP                   0x00000080
  INnerTTL                   0x00000100
  TTLDECrement               0x00000200
mpls vpn create <vpws | l3 | vpls> VPN=<vpn_id> [BcastGroup=<bcast_id>]

Create a VPWS, L3 or VPLS VPN. BcastGroup applies to VPLS.

Unvalidated

drivshell> mpls vpn create vpws VPN=0x3000
mpls vpn destroy VPN=<vpn_id>

Delete a VPN.

Unvalidated

drivshell> mpls vpn destroy VPN=0x3000
mpls vpn show VPN=<vpn_id>

Show a VPN and its ports: a VPN id=0x…, Ports :<n> line, then per port MPLS Port ID, Egress Tunnel If, flags, match_vlan, mpls_label and more. Safe. For a VPN that does not exist it prints VPN id=0x…, Ports :0 and then MPLS_CLI: Error: bcm_mpls_vpn_id_get failed, Entry not found, as in the example.

Hardware-validated

drivshell> mpls vpn show VPN=0x3000
VPN id=0x00003000, Ports :0
MPLS_CLI: Error: bcm_mpls_vpn_id_get failed, Entry not found

Failed to execute the diagnostic command. Error: Operation failed.
mpls vpn port add VPN=<vpn_id> Port=<port> PortMatch=<pm> [IntfFlaGs=<flags>] [VCInitLabel=<label>] [EgrLabelOptions=<opt>] [VCTermLabel=<label>] [Vlan=<vid>] [EgrTTL=<ttl>] [QoSMapID=<id>] [ServiceVID=<vid>] [ServiceTPID=<tpid>] [IntfCLass=<n>] [EXPMapPtr=<ptr>] [IntPRI=<pri>] [InnerVLAN=<vid>] [MTU=<n>] [EgrObj=<egr>]

Add an access or network port to a VPN. PortMatch and IntfFlaGs take the names listed by mpls options.

Unvalidated

drivshell> mpls vpn port add vpn=0x3000 portmatch=portvlan port=0x800000b vlan=21 IntfFlaGs=CouNTed
mpls vpn port delete VPN=<vpn_id> MplsPort=<mpls_port_id>

Remove an MPLS port from a VPN.

Unvalidated

drivshell> mpls vpn port delete VPN=0x3000 MplsPort=0x18000001
mpls tunnel init set EgrTunnelLabel=<label> EgrLabelOptions=<opt> EgrTTL=<ttl> INtf=<intf_id>

Set the MPLS tunnel (label push) on an L3 interface. mpls tunnel init clear INtf=<intf_id> removes it.

Unvalidated

drivshell> mpls tunnel init set EgrTunnelLabel=0x999 EgrLabelOptions=1 EgrTTL=44 INtf=10
mpls tunnel switch add ACTion=<act> IngLabel=<label> [SwitchOptions=<opt>] [Port=<gport>] [EXPMapPtr=<ptr>] [IntPRI=<pri>] [IngInnerLabel=<label>] [IngIntf=<intf>] [EgrLabel=<label>] [EgrLabelOptions=<opt>] [EgrLabelTTL=<ttl>] [EgrLabelEXP=<exp>] [EgrObject=<egr>] [VPN=<vpn_id>]

Add an incoming-label (ILM) entry: what to do with packets carrying IngLabel.

Unvalidated

drivshell> mpls tunnel switch add action=2 IngLabel=0x111 vpn=0x3001
mpls tunnel switch del IngLabel=<label>

Delete an incoming-label entry. Write del; delete is not accepted here.

Unvalidated

drivshell> mpls tunnel switch del IngLabel=0x111
mpls tunnel l2 add Mac=<mac> Vlan=<vid>

Add an L2 station entry so that MPLS packets to Mac on Vlan are terminated.

Unvalidated

drivshell> mpls tunnel l2 add mac=00:00:00:00:00:10 vlan=23
mpls expmap show [ing | egr] ExpMapID=<id> PRIority=<pri>

Show one entry of an EXP map. The other expmap forms are create [ing|egr] ExpMapID=<id>, destroy [ing|egr] ExpMapID=<id> and set [ing|egr] ExpMapID=<id> PRIority=<pri> Color=<color> PKtPriority=<pri> EXP=<exp> PKtCfi=<cfi>, which change the map. show is safe. For a map that does not exist, show fails with MPLS_CLI: Error: bcm_mpls_exp_map_get failed, Invalid parameter, as in the example.

Hardware-validated

drivshell> mpls expmap show egr ExpMapID=1 PRIority=0
MPLS_CLI: Error: bcm_mpls_exp_map_get failed, Invalid parameter

Failed to execute the diagnostic command. Error: Operation failed.
mpls mcast group create [l2 | vpls] McastGroup=<mcast_group>

Create a multicast group. The other forms are mcast group delete McastGroup=<id>, mcast group port add|delete McastGroup=<id> MplsPort=<mpls_port_id> and mcast group addr McastGroup=<id> Mac=<mac> VPN=<vpn_id>.

Unvalidated

drivshell> mpls mcast group create vpls McastGroup=6

Built-in help

Only for XGS4 devices.
      mpls init
            - Init MPLS software system.
      mpls cleanup
            - Detach MPLS software system.
      mpls vpn create vpws VPN=<vpn_id>
            - Create VPWS vpn with given id.
      mpls vpn create l3 VPN=<vpn_id>
            - Create L3 vpn with given id.
      mpls vpn create vpls VPN=<vpn_id> BcastGroup=<bcast_id>
            - Create VPLS vpn with given id  and broadcast group.
      mpls vpn port add VPN=<vpn_id> Port=<port> PortMatch=<pm>
                        IntfFlaGs=<flags> VCInitLabel=<vcinit_label>
                        EgrLabelOptions=<labelopt>
                        VCTermLabel=<vcterm_label> Vlan=<vlan>
                        EgrTTL=<egress_ttl> QoSMapID=<qos_map_id>
                        ServiceVID=<vlan> ServiceTPID=<tpid>
                        IntfCLass=<val> EXPMapPtr=<exp_ptr> IntPRI=<pri>
                        InnerVLAN=<vid> MTU=<val>EgrObj=<egress_obj_id>
            - Add a port to VPN.
      mpls vpn port delete VPN=<vpn_id> MplsPort=<mpls_port_id>
            - Delete an MPLS port from vpn.
      mpls vpn destroy VPN=<vpn_id>
            - Destroy a vpn.
      mpls vpn show VPN=<vpn_id>
            - Show VPN info.
      mpls tunnel init set EgrTunnelLabel=<egr_tun_label>
                           EgrLabelOptions=<egr_label_opt>
                           EgrTTL=<egre_ttl> INtf=<intf_id>
            - Initiate tunnel.
      mpls tunnel init clear INtf=<intf_id>
            - Clear tunnel.
      mpls tunnel switch add SwitchOptions=<label_switch_opt>
                             ACTion=<act> Port=<gport>
                             EXPMapPtr=<exp_ptr> IntPRI=<pri>
                             IngLabel=<label> IngInnerLabel=<inner_label>
                             IngIntf=<ingress_interface>
                             EgrLabel=<egr_label>
                             EgrLabelOptions=<labelopt> EgrLabelTTL=<ttl>
                             EgrLabelEXP=<exp>
                             EgrObject=<egr_object_id> VPN=<vpn_id>
            - Add ILM for ingress label.
      mpls tunnel switch del IngLabel=<label>
            - Delete ILM.
      mpls tunnel l2 add Mac=<mac> Vlan=<vlan>
            - Add L2 address for MPLS lookup.
      mpls expmap create [ing|egr] ExpMapID=<id>
            - Create EXP map.
      mpls expmap destroy [ing|egr] ExpMapID=<id>
            - Delete EXP map.
      mpls expmap set [ing|egr] ExpMapID=<expid> PRIority=<pri>
                                Color=<color> PKtPriority=<pri>
                                EXP=<exp> PKtCfi=<cfi>
            - Set exp map.
      mpls expmap show [ing|egr] ExpMapID=<expid> PRIority=<pri>
            - Show exp map.
      mpls mcast group create [l2|vpls] McastGroup=<mcast_group>
            - Create a multicast group.
      mpls mcast group delete McastGroup=<mcast_group>
            - Delete a multicast group.
      mpls mcast group port add McastGroup=<mcast_type_id>
                                MplsPort=<mpls_port_id>
            - Add MPLS port to multicast group.
      mpls mcast group port delete  McastGroup=<mcast_type_id>
                                    MplsPort=<mpls_port_id>
            - Delete MPLS port from multicast group
      mpls mcast group addr McastGroup=<mcast_type_id>
                            Mac=<mcast mac> VPN=<vpn_type_id>
            - Add multicast group Mac address.
      mpls options Type=[PORT|PortMatch|MplsSwitch|MplsEgressLabel]
            - List various options/flags used in mpls commands.

Further reading

SDK-6.5.20 HSDK Getting Started Guide (GS-SDK6520-R), plus SDK-6.5.20/21/22 Release Notes (RN-SDK65xx-R), MPLS_cint脚本实现 (MPLS via CINT and diag commands).