Class AbstractFlowspecNlriParser
- java.lang.Object
-
- org.opendaylight.protocol.bgp.flowspec.AbstractFlowspecNlriParser
-
- All Implemented Interfaces:
NlriParser
,NlriSerializer
- Direct Known Subclasses:
AbstractFlowspecL3vpnNlriParser
,SimpleFlowspecIpv4NlriParser
,SimpleFlowspecIpv6NlriParser
public abstract class AbstractFlowspecNlriParser extends Object implements NlriParser, NlriSerializer
-
-
Field Summary
Fields Modifier and Type Field Description static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier
DEST_PREFIX_NID
protected SimpleFlowspecTypeRegistry
flowspecTypeRegistry
static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier
OP_NID
static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier
SOURCE_PREFIX_NID
static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier
VALUE_NID
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractFlowspecNlriParser(SimpleFlowspecTypeRegistry flowspecTypeRegistry)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract DestinationType
createAdvertizedRoutesDestinationType(Object @NonNull [] nlriFields, @Nullable PathId pathId)
Create advertized destination type.abstract DestinationType
createWithdrawnDestinationType(Object @NonNull [] nlriFields, @Nullable PathId pathId)
Create withdrawn destination type.List<Flowspec>
extractFlowspec(org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode<?> route)
abstract void
extractSpecificFlowspec(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode fsType, FlowspecBuilder fsBuilder)
protected Object @NonNull []
parseNlri(@NonNull io.netty.buffer.ByteBuf nlri)
Override this function to parse additional NLRI fields.void
parseNlri(@NonNull io.netty.buffer.ByteBuf nlri, @NonNull MpReachNlriBuilder builder, PeerSpecificParserConstraint constraint)
Parse MP UN_REACH NLRI from buffer.void
parseNlri(@NonNull io.netty.buffer.ByteBuf nlri, @NonNull MpUnreachNlriBuilder builder, PeerSpecificParserConstraint constraint)
Parse MP UN_REACH NLRI from buffer.protected List<Flowspec>
parseNlriFlowspecList(@NonNull io.netty.buffer.ByteBuf nlri)
Parses Flowspec NLRI into list of Flowspec.static int
readNlriLength(@NonNull io.netty.buffer.ByteBuf nlri)
protected static @Nullable PathId
readPathId(@NonNull io.netty.buffer.ByteBuf nlri, Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi, PeerSpecificParserConstraint constraint)
void
serializeAttribute(Attributes pathAttributes, io.netty.buffer.ByteBuf byteAggregator)
protected abstract void
serializeMpReachNlri(DestinationType dstType, io.netty.buffer.ByteBuf byteAggregator)
protected abstract void
serializeMpUnreachNlri(DestinationType dstType, io.netty.buffer.ByteBuf byteAggregator)
protected void
serializeNlri(Object @NonNull [] nlriFields, @NonNull io.netty.buffer.ByteBuf buffer)
protected void
serializeNlri(Object @NonNull [] nlriFields, @Nullable PathId pathId, @NonNull io.netty.buffer.ByteBuf buffer)
Serializes Flowspec NLRI to ByteBuf.protected void
serializeNlri(List<Flowspec> flowspecList, @NonNull io.netty.buffer.ByteBuf buffer)
protected String
stringNlri(List<Flowspec> flows)
String
stringNlri(org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode<?> flowspec)
protected abstract void
stringSpecificFSNlriType(FlowspecType value, StringBuilder buffer)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opendaylight.protocol.bgp.parser.spi.NlriParser
convertMpReachToMpUnReach
-
-
-
-
Field Detail
-
DEST_PREFIX_NID
public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier DEST_PREFIX_NID
-
SOURCE_PREFIX_NID
public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier SOURCE_PREFIX_NID
-
OP_NID
public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier OP_NID
-
VALUE_NID
public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier VALUE_NID
-
flowspecTypeRegistry
protected final SimpleFlowspecTypeRegistry flowspecTypeRegistry
-
-
Constructor Detail
-
AbstractFlowspecNlriParser
protected AbstractFlowspecNlriParser(SimpleFlowspecTypeRegistry flowspecTypeRegistry)
-
-
Method Detail
-
serializeMpReachNlri
protected abstract void serializeMpReachNlri(DestinationType dstType, io.netty.buffer.ByteBuf byteAggregator)
-
serializeMpUnreachNlri
protected abstract void serializeMpUnreachNlri(DestinationType dstType, io.netty.buffer.ByteBuf byteAggregator)
-
extractSpecificFlowspec
public abstract void extractSpecificFlowspec(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode fsType, FlowspecBuilder fsBuilder)
-
stringSpecificFSNlriType
protected abstract void stringSpecificFSNlriType(FlowspecType value, StringBuilder buffer)
-
createWithdrawnDestinationType
public abstract DestinationType createWithdrawnDestinationType(Object @NonNull [] nlriFields, @Nullable PathId pathId)
Create withdrawn destination type.- Parameters:
nlriFields
- a list of NLRI fields to be included in the destination typepathId
- associated path id with given NLRI- Returns:
- created destination type
-
createAdvertizedRoutesDestinationType
public abstract DestinationType createAdvertizedRoutesDestinationType(Object @NonNull [] nlriFields, @Nullable PathId pathId)
Create advertized destination type.- Parameters:
nlriFields
- a list of NLRI fields to be included in the destination typepathId
- associated path id with given NLRI- Returns:
- created destination type
-
serializeAttribute
public final void serializeAttribute(Attributes pathAttributes, io.netty.buffer.ByteBuf byteAggregator)
- Specified by:
serializeAttribute
in interfaceNlriSerializer
-
serializeNlri
protected void serializeNlri(Object @NonNull [] nlriFields, @NonNull io.netty.buffer.ByteBuf buffer)
-
serializeNlri
protected final void serializeNlri(List<Flowspec> flowspecList, @NonNull io.netty.buffer.ByteBuf buffer)
-
serializeNlri
protected final void serializeNlri(Object @NonNull [] nlriFields, @Nullable PathId pathId, @NonNull io.netty.buffer.ByteBuf buffer)
Serializes Flowspec NLRI to ByteBuf.- Parameters:
nlriFields
- NLRI fields to be serializedpathId
- path IDbuffer
- where flowspec NLRI will be serialized
-
stringNlri
public String stringNlri(org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode<?> flowspec)
-
extractFlowspec
public final List<Flowspec> extractFlowspec(org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode<?> route)
-
readNlriLength
public static int readNlriLength(@NonNull io.netty.buffer.ByteBuf nlri)
-
parseNlriFlowspecList
protected final List<Flowspec> parseNlriFlowspecList(@NonNull io.netty.buffer.ByteBuf nlri)
Parses Flowspec NLRI into list of Flowspec.- Parameters:
nlri
- byte representation of NLRI which will be parsed- Returns:
- list of Flowspec
-
parseNlri
protected Object @NonNull [] parseNlri(@NonNull io.netty.buffer.ByteBuf nlri) throws BGPParsingException
Override this function to parse additional NLRI fields.- Parameters:
nlri
- NLRI buffer- Returns:
- Parsed additional fields
- Throws:
BGPParsingException
-
parseNlri
public final void parseNlri(@NonNull io.netty.buffer.ByteBuf nlri, @NonNull MpReachNlriBuilder builder, PeerSpecificParserConstraint constraint) throws BGPParsingException
Description copied from interface:NlriParser
Parse MP UN_REACH NLRI from buffer.- Specified by:
parseNlri
in interfaceNlriParser
- Parameters:
nlri
- Encoded reachable NLRI in ByteBuf.builder
- MP REACH NLRI builder.constraint
- Peer specific constraints.- Throws:
BGPParsingException
- exception.
-
parseNlri
public final void parseNlri(@NonNull io.netty.buffer.ByteBuf nlri, @NonNull MpUnreachNlriBuilder builder, PeerSpecificParserConstraint constraint) throws BGPParsingException
Description copied from interface:NlriParser
Parse MP UN_REACH NLRI from buffer.- Specified by:
parseNlri
in interfaceNlriParser
- Parameters:
nlri
- Encoded unreachable NLRI in ByteBuf.builder
- MP UNREACH NLRI builder.constraint
- Peer specific constraints.- Throws:
BGPParsingException
- exception.
-
readPathId
protected static @Nullable PathId readPathId(@NonNull io.netty.buffer.ByteBuf nlri, Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi, PeerSpecificParserConstraint constraint)
-
-