So this is a short post. I'm studying for the JNCIP-SP and I found very interesting that although l2circuits / Martini PWs need the VLANs at both ends to match, this disappears from the LDP label mapping if there's outer-vlan-map swap present

PE configs

 1fabrizzio@PE01# show interfaces ge-0/0/4.150     
 2encapsulation vlan-ccc;
 3vlan-id 150;
 4
 5fabrizzio@PE01# show protocols l2circuit neighbor 10.254.0.12 interface ge-0/0/4.150 
 6virtual-circuit-id 2;
 7
 8fabrizzio@PE03# show interfaces ge-0/0/3.200 
 9encapsulation vlan-ccc;
10vlan-id 200;
11input-vlan-map {
12    swap;
13    vlan-id 150;
14}
15output-vlan-map swap;
16
17fabrizzio@PE03# show protocols l2circuit neighbor 10.254.0.10 interface ge-0/0/3.200 
18virtual-circuit-id 2;

This does work just fine because PE03 is doing the job of the VLAN swapping in both directions.

 1fabrizzio@PE01> show l2circuit connections interface ge-0/0/4.150 | find Nei 
 2Neighbor: 10.254.0.12 
 3    Interface                 Type  St     Time last up          # Up trans
 4    ge-0/0/4.150(vc 2)        rmt   Up     Jun 15 09:01:54 2024           1
 5      Remote PE: 10.254.0.12, Negotiated control-word: Yes (Null)
 6      Incoming label: 299968, Outgoing label: 299968
 7      Negotiated PW status TLV: No
 8      Local interface: ge-0/0/4.150, Status: Up, Encapsulation: VLAN
 9      Flow Label Transmit: No, Flow Label Receive: No
10
11fabrizzio@PE03> show l2circuit connections interface ge-0/0/3.200 | find Nei   
12Neighbor: 10.254.0.10 
13    Interface                 Type  St     Time last up          # Up trans
14    ge-0/0/3.200(vc 2)        rmt   Up     Jun 15 08:19:26 2024           1
15      Remote PE: 10.254.0.10, Negotiated control-word: Yes (Null)
16      Incoming label: 299968, Outgoing label: 299968
17      Negotiated PW status TLV: No
18      Local interface: ge-0/0/3.200, Status: Up, Encapsulation: VLAN
19      Flow Label Transmit: No, Flow Label Receive: No

LDP database

I have two Martini PWs built between these PEs.

 1fabrizzio@PE01> show ldp database session 10.254.0.12 extensive l2circuit    
 2Input label database, 10.254.0.10:0--10.254.0.12:0
 3Labels received: 14
 4  Label     Prefix
 5 299952      L2CKT CtrlWord VLAN VC 1
 6            MTU: 1982 Requested VLAN ID: 100 Flow Label T Bit: 1 Flow Label R Bit: 1
 7            State: Active
 8            Age: 59:44
 9            VCCV Control Channel types:
10                PWE3 control word 
11                MPLS router alert label 
12                MPLS PW label with TTL=1 
13            VCCV Control Verification types:
14                LSP ping 
15                BFD with PW-ACH-encapsulation for Fault Detection 
16                BFD with IP/UDP-encapsulation for Fault Detection 
17  Label     Prefix
18 299968      L2CKT CtrlWord VLAN VC 2
19            MTU: 1982 Flow Label T Bit: 0 Flow Label R Bit: 0
20            State: Active
21            Age: 50:13
22            VCCV Control Channel types:
23                PWE3 control word 
24                MPLS router alert label 
25                MPLS PW label with TTL=1 
26            VCCV Control Verification types:
27                LSP ping 
28                BFD with PW-ACH-encapsulation for Fault Detection 
29                BFD with IP/UDP-encapsulation for Fault Detection 
30
31Output label database, 10.254.0.10:0--10.254.0.12:0
32Labels advertised: 14
33  Label     Prefix
34 299952      L2CKT CtrlWord VLAN VC 1
35            MTU: 1982 Requested VLAN ID: 100
36            PW status code: 0x0
37            Flow Label T Bit: 1 Flow Label R Bit: 1
38            State: Active
39            Age: 1:04:01
40            VCCV Control Channel types:
41                PWE3 control word 
42                MPLS router alert label 
43                MPLS PW label with TTL=1 
44            VCCV Control Verification types:
45                LSP ping 
46                BFD with PW-ACH-encapsulation for Fault Detection 
47                BFD with IP/UDP-encapsulation for Fault Detection 
48  Label     Prefix
49 299968      L2CKT CtrlWord VLAN VC 2
50            MTU: 1982 Requested VLAN ID: 150 Flow Label T Bit: 0 Flow Label R Bit: 0 <<<<<<<<<<<<<<<
51            State: Active
52            Age: 50:51
53            VCCV Control Channel types: 
54                PWE3 control word 
55                MPLS router alert label 
56                MPLS PW label with TTL=1 
57            VCCV Control Verification types:
58                LSP ping 
59                BFD with PW-ACH-encapsulation for Fault Detection 
60                BFD with IP/UDP-encapsulation for Fault Detection

The interesting part is that as seen right now, the label mapping PE01 receives from PE03 (label 299968) doesn't contain any requested VLAN ID. The mapping sent from PE01 to PE03 (same label 299968) does request the VLAN 150.

Adding output-vlan-map swap

Added on PE01 side

1fabrizzio@PE01# show interfaces ge-0/0/4.150 
2encapsulation vlan-ccc;
3vlan-id 150;
4output-vlan-map swap;

Now PE01 doesn't request any VLAN :)

 1fabrizzio@PE01> show ldp database session 10.254.0.12 extensive l2circuit    
 2Input label database, 10.254.0.10:0--10.254.0.12:0
 3Labels received: 14
 4  Label     Prefix
 5 299952      L2CKT CtrlWord VLAN VC 1
 6            MTU: 1982 Requested VLAN ID: 100 Flow Label T Bit: 1 Flow Label R Bit: 1
 7            State: Active
 8            Age: 1:03:03
 9            VCCV Control Channel types:
10                PWE3 control word 
11                MPLS router alert label 
12                MPLS PW label with TTL=1 
13            VCCV Control Verification types:
14                LSP ping 
15                BFD with PW-ACH-encapsulation for Fault Detection 
16                BFD with IP/UDP-encapsulation for Fault Detection 
17  Label     Prefix
18 299968      L2CKT CtrlWord VLAN VC 2
19            MTU: 1982 Flow Label T Bit: 0 Flow Label R Bit: 0
20            State: Active
21            Age: 53:32
22            VCCV Control Channel types:
23                PWE3 control word 
24                MPLS router alert label 
25                MPLS PW label with TTL=1 
26            VCCV Control Verification types:
27                LSP ping 
28                BFD with PW-ACH-encapsulation for Fault Detection 
29                BFD with IP/UDP-encapsulation for Fault Detection 
30
31Output label database, 10.254.0.10:0--10.254.0.12:0
32Labels advertised: 14
33  Label     Prefix
34 299952      L2CKT CtrlWord VLAN VC 1
35            MTU: 1982 Requested VLAN ID: 100
36            PW status code: 0x0
37            Flow Label T Bit: 1 Flow Label R Bit: 1
38            State: Active
39            Age: 1:07:20
40            VCCV Control Channel types:
41                PWE3 control word 
42                MPLS router alert label 
43                MPLS PW label with TTL=1 
44            VCCV Control Verification types:
45                LSP ping 
46                BFD with PW-ACH-encapsulation for Fault Detection 
47                BFD with IP/UDP-encapsulation for Fault Detection 
48  Label     Prefix
49 299968      L2CKT CtrlWord VLAN VC 2
50            MTU: 1982 Flow Label T Bit: 0 Flow Label R Bit: 0 <<<<<<<<<<<<<<<
51            State: Active
52            Age: 54:10
53            VCCV Control Channel types: 
54                PWE3 control word 
55                MPLS router alert label 
56                MPLS PW label with TTL=1 
57            VCCV Control Verification types:
58                LSP ping 
59                BFD with PW-ACH-encapsulation for Fault Detection 
60                BFD with IP/UDP-encapsulation for Fault Detection

I just found this interesting.