Class ReachTlvParser
- java.lang.Object
-
- org.opendaylight.protocol.bgp.linkstate.impl.tlvs.ReachTlvParser
-
- All Implemented Interfaces:
LinkstateTlvParser<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix>
,LinkstateTlvParser.LinkstateTlvSerializer<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix>
public final class ReachTlvParser extends Object implements LinkstateTlvParser.LinkstateTlvSerializer<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix>, LinkstateTlvParser<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opendaylight.protocol.bgp.linkstate.spi.LinkstateTlvParser
LinkstateTlvParser.LinkstateTlvSerializer<T>
-
-
Field Summary
Fields Modifier and Type Field Description static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier
IP_REACH_NID
static org.opendaylight.yangtools.yang.common.QName
IP_REACHABILITY_QNAME
-
Constructor Summary
Constructors Constructor Description ReachTlvParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.opendaylight.yangtools.yang.common.QName
getTlvQName()
int
getType()
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix
parseTlvBody(io.netty.buffer.ByteBuf value)
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix
serializeModel(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode prefixDesc)
void
serializeTlvBody(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix tlv, io.netty.buffer.ByteBuf body)
-
-
-
Method Detail
-
parseTlvBody
public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix parseTlvBody(io.netty.buffer.ByteBuf value)
IP Reachability TLV serves to convey both an IPV4 or an IPV6 prefix as per RFC7752 Section 3.2.3.2. However, the Length of the IP Reachability TLV could not be used to distinguish the two types of prefixes as it will be the same: for example
byteBuffer == [24][192][168][01]
could be parsed as IPv4 prefix192.168.1.0/24
or as IPv6 prefixc0a8:100::/24
.Thus, we could just verify if the length is greater than 4 bytes. In this case, it is certain that the prefix is IPv6. For a length less than or equal to 4 bytes, the parser assumes that the prefix is IPv4. In addition, the probability that an IS-IS domain advertises an IPv6 prefix with a length lower than /32 is very low.
- Specified by:
parseTlvBody
in interfaceLinkstateTlvParser<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix>
-
getTlvQName
public org.opendaylight.yangtools.yang.common.QName getTlvQName()
- Specified by:
getTlvQName
in interfaceLinkstateTlvParser<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix>
-
serializeTlvBody
public void serializeTlvBody(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix tlv, io.netty.buffer.ByteBuf body)
- Specified by:
serializeTlvBody
in interfaceLinkstateTlvParser.LinkstateTlvSerializer<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix>
-
getType
public int getType()
- Specified by:
getType
in interfaceLinkstateTlvParser.LinkstateTlvSerializer<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix>
-
serializeModel
public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix serializeModel(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode prefixDesc)
-
-