@Override protected byte[] readPceId(final ByteBuf buffer) { return ByteArray.readBytes(buffer, PCE128_ID_F_LENGTH); }
@Override protected byte[] readPceId(final ByteBuf buffer) { return ByteArray.readBytes(buffer, PCE_ID_F_LENGTH); }
/** * Helper method missing from netty ByteBuf methods. Directly returns all readable bytes from buffer as byte array. * Adjusts reader index of the buffer by length of readable bytes in the buffer. * * @param buffer byteBuf from which the bytes are going to be taken * @return byte array */ public static byte[] readAllBytes(final ByteBuf buffer) { return readBytes(buffer, buffer.readableBytes()); }
/** * Reads from ByteBuf buffer and converts bytes to Ipv6Address. * * @param buffer containing Ipv6 address, starting at reader index * @return Ipv6Address */ public static Ipv6Address addressForByteBuf(final ByteBuf buffer) { return IetfInetUtil.INSTANCE.ipv6AddressFor(ByteArray.readBytes(buffer, IPV6_LENGTH)); }
/** * Reads from ByteBuf buffer and converts bytes to Ipv4Address. * * @param buffer containing Ipv4 address, starting at reader index * @return Ipv4Address */ public static Ipv4Address addressForByteBuf(final ByteBuf buffer) { return IetfInetUtil.INSTANCE.ipv4AddressFor(ByteArray.readBytes(buffer, IP4_LENGTH)); }
private static void parseExtendedRouteTags(final List<ExtendedRouteTag> exRouteTags, final ByteBuf value) { while (value.isReadable()) { final ExtendedRouteTag exRouteTag = new ExtendedRouteTag(ByteArray.readBytes(value, EXTENDED_ROUTE_TAG_LENGTH)); exRouteTags.add(exRouteTag); LOG.debug("Parsed Extended Route Tag: {}", exRouteTag); } }
private static void parseRouteTags(final List<RouteTag> routeTags, final ByteBuf value) { while (value.isReadable()) { final RouteTag routeTag = new RouteTag(ByteArray.readBytes(value, ROUTE_TAG_LENGTH)); routeTags.add(routeTag); LOG.debug("Parsed Route Tag: {}", routeTag); } }
static Ipv6Prefix parseIpv6Prefix(final ByteBuf nlri) { final int bitLength = nlri.readUnsignedByte(); nlri.readUnsignedByte(); // FIXME: this does not look right if bitLenght % Byte.SIZE != 0 return Ipv6Util.prefixForBytes(ByteArray.readBytes(nlri, bitLength / Byte.SIZE), bitLength); } }
@Override public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException { buffer.skipBytes(AS_TRANS_LENGTH); final LinkBandwidthExtendedCommunity lb = new LinkBandwidthExtendedCommunityBuilder() .setBandwidth(new Bandwidth(ByteArray.readBytes(buffer, BANDWIDTH_SIZE))) .build(); return new LinkBandwidthCaseBuilder().setLinkBandwidthExtendedCommunity(lb).build(); }
@Override public Esi parseEsi(final ByteBuf body) { return new ArbitraryCaseBuilder().setArbitrary(new ArbitraryBuilder().setArbitrary(ByteArray.readBytes(body, ARBITRARY_LENGTH)).build()).build(); } }
@Override public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException { final MacAddress mac = IetfYangUtil.INSTANCE.macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH)); return new EsImportRouteExtendedCommunityCaseBuilder().setEsImportRouteExtendedCommunity( new EsImportRouteExtendedCommunityBuilder().setEsImport(mac).build()).build(); }
@Override public Esi parseEsi(final ByteBuf buffer) { final MacAutoGenerated t3 = new MacAutoGeneratedBuilder() .setSystemMacAddress(IetfYangUtil.INSTANCE.macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH))) .setLocalDiscriminator(new Uint24(Long.valueOf(buffer.readUnsignedMedium()))).build(); return new MacAutoGeneratedCaseBuilder().setMacAutoGenerated(t3).build(); } }
@Override public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException { return new Inet4SpecificExtendedCommunityCaseBuilder().setInet4SpecificExtendedCommunity( new Inet4SpecificExtendedCommunityBuilder().setGlobalAdministrator( Ipv4Util.addressForByteBuf(buffer)).setLocalAdministrator( ByteArray.readBytes(buffer, INET_LOCAL_ADMIN_LENGTH)).build()).build(); }
@Override public Esi parseEsi(final ByteBuf buffer) { final LanAutoGenerated t2 = new LanAutoGeneratedBuilder() .setRootBridgeMacAddress(IetfYangUtil.INSTANCE.macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH))) .setRootBridgePriority(buffer.readUnsignedShort()).build(); return new LanAutoGeneratedCaseBuilder().setLanAutoGenerated(t2).build(); } }
@Override public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException { final AsSpecificExtendedCommunity asSpecific = new AsSpecificExtendedCommunityBuilder() .setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort())) .setLocalAdministrator(ByteArray.readBytes(buffer, AS_LOCAL_ADMIN_LENGTH)) .build(); return new AsSpecificExtendedCommunityCaseBuilder().setAsSpecificExtendedCommunity(asSpecific).build(); }
@Override public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException { final RouteTargetExtendedCommunity targetTarget = new RouteTargetExtendedCommunityBuilder() .setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort())) .setLocalAdministrator(ByteArray.readBytes(buffer, AS_LOCAL_ADMIN_LENGTH)) .build(); return new RouteTargetExtendedCommunityCaseBuilder().setRouteTargetExtendedCommunity(targetTarget).build(); }
@Override public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException { final RouteOriginExtendedCommunity targetOrigin = new RouteOriginExtendedCommunityBuilder() .setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort())) .setLocalAdministrator(ByteArray.readBytes(buffer, AS_LOCAL_ADMIN_LENGTH)) .build(); return new RouteOriginExtendedCommunityCaseBuilder().setRouteOriginExtendedCommunity(targetOrigin).build(); }
@Override public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException { final ShortAsNumber as1 = new ShortAsNumber((long) buffer.readUnsignedShort()); final byte[] byteValue = ByteArray.readBytes(buffer, TRAFFIC_RATE_SIZE); return new RedirectExtendedCommunityCaseBuilder().setRedirectExtendedCommunity( new RedirectExtendedCommunityBuilder() .setGlobalAdministrator(as1) .setLocalAdministrator(byteValue) .build()).build(); } }
@Override public Esi parseEsi(final ByteBuf buffer) { final LacpAutoGenerated t1 = new LacpAutoGeneratedBuilder() .setCeLacpMacAddress(IetfYangUtil.INSTANCE.macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH))) .setCeLacpPortKey(buffer.readUnsignedShort()) .build(); return new LacpAutoGeneratedCaseBuilder().setLacpAutoGenerated(t1).build(); } }
@Override public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException { final ShortAsNumber as = new ShortAsNumber((long) buffer.readUnsignedShort()); final Bandwidth value = new Bandwidth(ByteArray.readBytes(buffer, TRAFFIC_RATE_SIZE)); return new TrafficRateExtendedCommunityCaseBuilder().setTrafficRateExtendedCommunity( new TrafficRateExtendedCommunityBuilder() .setInformativeAs(as) .setLocalAdministrator(value) .build()).build(); }