use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.destination.L3vpnMcastDestinationBuilder in project bgpcep by opendaylight.
the class L3vpnMcastNlriSerializer method extractDest.
static List<L3vpnMcastDestination> extractDest(final ByteBuf nlri, final boolean addPath) {
List<L3vpnMcastDestination> dests = new ArrayList<>();
while (nlri.isReadable()) {
final L3vpnMcastDestinationBuilder builder = new L3vpnMcastDestinationBuilder();
if (addPath) {
builder.setPathId(PathIdUtil.readPathId(nlri));
}
final int length = nlri.readUnsignedByte();
final int initialLength = nlri.readableBytes();
builder.setRouteDistinguisher(RouteDistinguisherUtil.parseRouteDistinguisher(nlri));
if (length == Ipv6Util.IPV6_BITS_LENGTH) {
builder.setPrefix(new IpPrefix(Ipv6Util.prefixForByteBuf(nlri)));
} else {
builder.setPrefix(new IpPrefix(Ipv4Util.prefixForByteBuf(nlri)));
}
dests.add(builder.build());
int readed = initialLength - nlri.readableBytes();
while (readed % 8 != 0) {
nlri.readByte();
readed = initialLength - nlri.readableBytes();
}
}
return dests;
}
Aggregations