Bug-6562: Support add-path in base BGP NLRI
[bgpcep.git] / bgp / parser-spi / src / main / java / org / opendaylight / protocol / bgp / parser / spi / NlriRegistry.java
index 65f72a188a01ec7e93887c6c82f0b3f4fcfd915e..4bb014b0930a6b7207674457c6cd02bd5ffb172f 100644 (file)
@@ -8,14 +8,53 @@
 package org.opendaylight.protocol.bgp.parser.spi;
 
 import io.netty.buffer.ByteBuf;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpReachNlri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpUnreachNlri;
 
+/**
+ * The codec registry for BGP NLRI, offers
+ * services for NLRI encoding/decoding.
+ *
+ */
 public interface NlriRegistry {
-    MpReachNlri parseMpReach(final ByteBuf buffer) throws BGPParsingException;
-    MpUnreachNlri parseMpUnreach(final ByteBuf buffer) throws BGPParsingException;
-    void serializeMpReach(final MpReachNlri mpReachNlri,final ByteBuf byteAggregator);
-    void serializeMpUnReach(final MpUnreachNlri mpUnreachNlri,final ByteBuf byteAggregator);
+    /**
+     * Decode MP REACH NLRI Attribute.
+     * @param buffer Input buffer.
+     * @param constraint Peer specific constraint.
+     * @return Parsed reach NLRI.
+     * @throws BGPParsingException
+     */
+    @Nonnull MpReachNlri parseMpReach(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
+
+    /**
+     * Decode MP REACH NLRI Attribute.
+     * @param buffer Input buffer.
+     * @param constraint Peer specific constraint.
+     * @return Parsed unreach NLRI.
+     * @throws BGPParsingException
+     */
+    @Nonnull MpUnreachNlri parseMpUnreach(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
+
+    /**
+     * Encode BGP MP REACH NLRI Attribute.
+     * @param mpReachNlri Input reach NLRI.
+     * @param byteAggregator Output buffer.
+     */
+    void serializeMpReach(@Nonnull MpReachNlri mpReachNlri, @Nonnull ByteBuf byteAggregator);
+
+    /**
+     * Encode BGP MP UNREACH NLRI Attribute.
+     * @param mpUnreachNlri Input unreach NLRI.
+     * @param byteAggregator Output buffer.
+     */
+    void serializeMpUnReach(@Nonnull MpUnreachNlri mpUnreachNlri, @Nonnull ByteBuf byteAggregator);
+
+    /**
+     * Get all available NLRI encoders.
+     * @return Iterable of NLRI serializers.
+     */
     Iterable<NlriSerializer> getSerializers();
 }