import static com.google.common.base.Preconditions.checkArgument;
import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeIpv6Address;
-import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeShort;
-import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedShort;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
final Ipv6 ipv6 = ((Ipv6Case) lsp.getAddressFamily()).getIpv6();
checkArgument(ipv6.getIpv6TunnelSenderAddress() != null, "Ipv6TunnelSenderAddress is mandatory.");
writeIpv6Address(ipv6.getIpv6TunnelSenderAddress(), body);
- checkArgument(lsp.getLspId() != null, "LspId is mandatory.");
- writeShort(lsp.getLspId().getValue().shortValue(), body);
- checkArgument(lsp.getTunnelId() != null, "TunnelId is mandatory.");
- writeUnsignedShort(lsp.getTunnelId().getValue(), body);
+
+ final LspId lspId = lsp.getLspId();
+ checkArgument(lspId != null, "LspId is mandatory.");
+ body.writeShort(lspId.getValue().shortValue());
+ final TunnelId tunnelId = lsp.getTunnelId();
+ checkArgument(tunnelId != null, "TunnelId is mandatory.");
+ ByteBufUtils.write(body, tunnelId.getValue());
checkArgument(ipv6.getIpv6ExtendedTunnelId() != null, "Ipv6ExtendedTunnelId is mandatory.");
writeIpv6Address(ipv6.getIpv6ExtendedTunnelId(), body);
checkArgument(ipv6.getIpv6TunnelEndpointAddress() != null, "Ipv6TunnelEndpointAddress is mandatory.");