Search in sources :

Example 1 with MldpP2mpLsp

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();
}
Also used : MldpP2mpLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpP2mpLsp) ByteBuf(io.netty.buffer.ByteBuf) PAddressPMulticastGroupUtil.serializeIpAddress(org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PAddressPMulticastGroupUtil.serializeIpAddress) PAddressPMulticastGroupUtil.parseIpAddress(org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PAddressPMulticastGroupUtil.parseIpAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 PAddressPMulticastGroupUtil.parseIpAddress (org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PAddressPMulticastGroupUtil.parseIpAddress)1 PAddressPMulticastGroupUtil.serializeIpAddress (org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PAddressPMulticastGroupUtil.serializeIpAddress)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 MldpP2mpLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpP2mpLsp)1