This article gives more information about the "Link encapsulation type is not valid for device type" error message that is seen on interfaces due to which configuration may fail, and provides a solution to correct the problem.
Example
set interfaces xe-0/0/9 flexible-vlan-tagging
set interfaces xe-0/0/9 mtu 9192
set interfaces xe-0/0/9 gigether-options no-flow-control
set interfaces xe-0/0/9 unit 616 encapsulation vlan-bridge
set interfaces xe-0/0/9 unit 616 vlan-id 616
The following error message is seen when the above configuration is committed:
[edit]
lab@juniper# commit check
Dec 04 10:52:04
[edit interfaces xe-0/0/9]
'unit 616'
Link encapsulation type is not valid for device type |<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<|
error: configuration check-out failed
The reason for the error is incorrect encapsulation configuration for an interface that is supposed to be an L2 interface.
Flexible Ethernet Services is a type of encapsulation that enables a physical interface to support different types of Ethernet encapsulations at the logical interface level, which helps resolve the error.
To resolve the above problem, include the following statement:
set interfaces xe-0/0/9 encapsulation flexible-ethernet-services
Now configuration commit succeeds as shown below:
[edit]
lab@juniper# commit check
Dec 04 11:08:38
configuration check succeeds
lab@juniper> show interfaces xe-0/0/9 terse
Dec 04 11:09:22
Interface Admin Link Proto Local Remote
xe-0/0/9 up up
xe-0/0/9.616 up up eth-switch
xe-0/0/9.32767 up up multiservice