use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.path.binding.tlv.path.binding.BindingTypeValue in project bgpcep by opendaylight.
the class PathBindingTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof PathBinding, "The TLV must be PathBinding type, but was %s", tlv.getClass());
final PathBinding pTlv = (PathBinding) tlv;
final BindingTypeValue bindingTypeValue = pTlv.getBindingTypeValue();
Preconditions.checkArgument(bindingTypeValue != null, "Missing Binding Value in Path Bidning TLV: %s", pTlv);
final ByteBuf body = Unpooled.buffer(MPLS_BINDING_LENGTH);
final PathBindingTlvCodec codec = BT_SERIALIZERS.get(bindingTypeValue.getImplementedInterface());
Preconditions.checkArgument(codec != null, "Unsupported Path Binding Type: %s", bindingTypeValue.getImplementedInterface());
ByteBufWriteUtil.writeUnsignedShort(codec.getBindingType(), body);
body.writeBytes(codec.serialize(bindingTypeValue));
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.path.binding.tlv.path.binding.BindingTypeValue in project bgpcep by opendaylight.
the class PathBindingTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof PathBinding, "The TLV must be PathBinding type, but was %s", tlv.getClass());
final PathBinding pTlv = (PathBinding) tlv;
final BindingTypeValue bindingTypeValue = pTlv.getBindingTypeValue();
checkArgument(bindingTypeValue != null, "Missing Binding Value in Path Bidning TLV: %s", pTlv);
final ByteBuf body = Unpooled.buffer(MPLS_BINDING_LENGTH);
final PathBindingTlvCodec codec = BT_SERIALIZERS.get(bindingTypeValue.implementedInterface());
checkArgument(codec != null, "Unsupported Path Binding Type: %s", bindingTypeValue.implementedInterface());
codec.writeBinding(body, bindingTypeValue);
TlvUtil.formatTlv(TYPE, body, buffer);
}
Aggregations