use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpP2mpLsp in project bgpcep by opendaylight.
the class MldpP2mpLspParser method serialize.
@Override
public int serialize(final TunnelIdentifier tunnelIdentifier, final ByteBuf buffer) {
Preconditions.checkArgument(tunnelIdentifier instanceof MldpP2mpLsp, "The tunnelIdentifier %s is not RsvpTeP2mpLps type.", tunnelIdentifier);
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.MldpP2mpLsp mldpP2mpLsp = ((MldpP2mpLsp) tunnelIdentifier).getMldpP2mpLsp();
final ByteBuf opaqueValues = Unpooled.buffer();
final int addressFamily = getAddressFamilyValue(mldpP2mpLsp.getAddressFamily());
if (!serializeOpaqueList(mldpP2mpLsp.getOpaqueValue(), opaqueValues) || addressFamily == 0) {
return NO_TUNNEL_INFORMATION_PRESENT;
}
final IpAddress rootNode = mldpP2mpLsp.getRootNodeAddress();
ByteBufWriteUtil.writeUnsignedByte(P2MP_TYPE, buffer);
ByteBufWriteUtil.writeUnsignedShort(addressFamily, buffer);
ByteBufWriteUtil.writeUnsignedByte(getAdressFamilyLength(rootNode), buffer);
serializeIpAddress(rootNode, buffer);
ByteBufWriteUtil.writeUnsignedShort(opaqueValues.readableBytes(), buffer);
buffer.writeBytes(opaqueValues);
return TunnelType.MLDP_P2MP_LSP.getIntValue();
}
Aggregations