Hi Ildar,
If I understand your query correctly, I believe you are trying to perform VLAN rewrite. Please correct me if I have understood this wrongly.
Please check "Stacking a vlan tag" in the below document helps you:
https://www.juniper.net/documentation/en_US/junos/topics/topic-map/tagged-vlans.html
You can check the below for example configuration for translation:
https://www.juniper.net/documentation/en_US/junos/topics/example/layer-2-bulk-configuration-example-vlan-translation-with-lists-example-mx-solutions.html
Also, please refer to this old discussion. I am pasting the link below. It should help you:
https://forums.juniper.net/t5/Ethernet-Switching/Vlan-translation-on-MX/td-p/312880
The output of a working VLAN mapping:
user@host> show interfaces ae5.2
Logical interface ae5.2 (Index 345) (SNMP ifIndex 582)
Flags: SNMP-Traps 0x24004000 VLAN-Tag [ 0x8100.2 ] In(swap-push .5 0x0000.4) Out(pop-swap .2)
Encapsulation: VLAN-Bridge
Statistics Packets pps Bytes bps
Bundle:
Input : 1293839 424 131971384 346792
Output: 1293838 424 131971350 346792
Protocol bridge, MTU: 1522
Hope this helps 🙂
Please mark "Accepted Solution" if this helps you.
Kudos are always appreciated 🙂