2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.parser.spi;
10 import io.netty.buffer.ByteBuf;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlriBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlriBuilder;
18 * Common interface for NLRI parser implementation.
20 public interface NlriParser {
23 * Parse MP UN_REACH NLRI from buffer.
25 * @param nlri Encoded unreachabel NLRI in ByteBuf.
26 * @param builder MP UNREACH NLRI builder.
27 * @throws BGPParsingException
29 void parseNlri(@Nonnull ByteBuf nlri, @Nonnull MpUnreachNlriBuilder builder) throws BGPParsingException;
32 * Parse MP REACH NLRI from buffer.
34 * @param nlri Encoded reachable NLRI in ByteBuf.
35 * @param builder MP REACH NLRI builder.
36 * @throws BGPParsingException
38 void parseNlri(@Nonnull ByteBuf nlri, @Nonnull MpReachNlriBuilder builder) throws BGPParsingException;
41 * Invokes {@link #parseNlri(ByteBuf, MpReachNlriBuilder)}, so the constraint is omitted. Override for specific parser behavior.
43 * @param nlri Encoded reachable NLRI in ByteBuf.
44 * @param builder MP REACH NLRI builder.
45 * @param constraint Peer specific constraints.
46 * @throws BGPParsingException
48 default void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpReachNlriBuilder builder, @Nullable final PeerSpecificParserConstraint constraint)
49 throws BGPParsingException {
50 parseNlri(nlri, builder);
54 * Invokes {@link #parseNlri(ByteBuf, MpUnreachNlriBuilder)}, so the constraint is omitted. Override for specific parser behavior.
56 * @param nlri Encoded unreachable NLRI in ByteBuf.
57 * @param builder MP UNREACH NLRI builder.
58 * @param constraint Peer specific constraints.
59 * @throws BGPParsingException
61 default void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpUnreachNlriBuilder builder, @Nullable final PeerSpecificParserConstraint constraint)
62 throws BGPParsingException {
63 parseNlri(nlri, builder);