List of usage examples for io.netty.buffer ByteBuf writeZero
public abstract ByteBuf writeZero(int length);
From source file:org.opendaylight.protocol.bgp.inet.codec.Ipv6BgpPrefixSidParser.java
License:Open Source License
@Override public void serializeBgpPrefixSidTlv(final BgpPrefixSidTlv tlv, final ByteBuf bytes) { Preconditions.checkArgument(tlv instanceof Ipv6SidTlv, "Incoming TLV is not Ipv6SidTlv"); final Ipv6SidTlv ipv6Tlv = (Ipv6SidTlv) tlv; bytes.writeZero(RESERVED); final BitArray flags = new BitArray(FLAGS_SIZE); flags.set(PROCESS_IPV6_HEADER_FLAG, ipv6Tlv.isProcessIpv6HeadAbility()); flags.toByteBuf(bytes);// w w w. j av a 2 s . c om }
From source file:org.opendaylight.protocol.bgp.l3vpn.AbstractVpnNextHopParserSerializer.java
License:Open Source License
@Override public void serializeNextHop(final CNextHop cNextHop, final ByteBuf byteAggregator) { Preconditions.checkArgument(ipNextHopCaseClazz.isInstance(cNextHop), "cNextHop is not a VPN %s NextHop object.", ipNextHopCaseClazz.getSimpleName()); byteAggregator.writeZero(RouteDistinguisherUtil.RD_LENGTH); NextHopUtil.serializeNextHop(cNextHop, byteAggregator); }
From source file:org.opendaylight.protocol.bgp.labeled.unicast.LabelIndexTlvParser.java
License:Open Source License
@Override public void serializeBgpPrefixSidTlv(final BgpPrefixSidTlv tlv, final ByteBuf valueBuf) { Preconditions.checkArgument(tlv instanceof LuLabelIndexTlv, "Incoming TLV is not LuLabelIndexTlv"); valueBuf.writeZero(RESERVED); valueBuf.writeZero(LABEL_INDEX_FLAGS_BYTES); valueBuf.writeInt(((LuLabelIndexTlv) tlv).getLabelIndexTlv().intValue()); }
From source file:org.opendaylight.protocol.bgp.labeled.unicast.OriginatorSrgbTlvParser.java
License:Open Source License
@Override public void serializeBgpPrefixSidTlv(final BgpPrefixSidTlv tlv, final ByteBuf valueBuf) { Preconditions.checkArgument(tlv instanceof LuOriginatorSrgbTlv, "Incoming TLV is not LuOriginatorSrgbTlv"); final LuOriginatorSrgbTlv luTlv = (LuOriginatorSrgbTlv) tlv; valueBuf.writeZero(ORIGINATOR_FLAGS_BYTES); for (final SrgbValue val : luTlv.getSrgbValue()) { valueBuf.writeMedium(val.getBase().getValue().intValue()); valueBuf.writeMedium(val.getRange().getValue().intValue()); }// w w w. ja v a 2s . c o m }
From source file:org.opendaylight.protocol.bgp.linkstate.attribute.sr.BindingSidLabelParser.java
License:Open Source License
public static void serializeBindingSidAttributes(final Weight weight, final Flags flags, final List<BindingSubTlvs> bindingSubTlvs, final ByteBuf aggregator) { aggregator.writeByte(weight.getValue()); final BitArray bitFlags = serializeBindingSidFlags(flags); bitFlags.toByteBuf(aggregator);//ww w . j a v a 2s. co m aggregator.writeZero(RESERVED_BINDING_SID); serializeBindingSubTlvs(bindingSubTlvs, aggregator); }
From source file:org.opendaylight.protocol.bgp.linkstate.attribute.sr.BindingSidLabelParser.java
License:Open Source License
private static void serializeEroFlags(final ByteBuf buffer, final Boolean loose) { final BitArray flags = new BitArray(FLAGS_SIZE); flags.set(LOOSE, loose);/*from ww w. j ava 2s .co m*/ flags.toByteBuf(buffer); buffer.writeZero(RESERVED_ERO); }
From source file:org.opendaylight.protocol.bgp.linkstate.attribute.sr.RangeTlvParser.java
License:Open Source License
public static void serializeSrRange(final SrRange srRange, final ByteBuf aggregator) { final BitArray flags = new BitArray(FLAGS_SIZE); flags.set(INNER_AREA, srRange.isInterArea()); flags.toByteBuf(aggregator);/*from w w w . jav a2 s . c om*/ aggregator.writeZero(RESERVED); aggregator.writeShort(srRange.getRangeSize()); serializeSubTlvs(aggregator, srRange.getSubTlvs()); }
From source file:org.opendaylight.protocol.bgp.linkstate.attribute.sr.SrLinkAttributesParser.java
License:Open Source License
public static ByteBuf serializeAdjacencySegmentIdentifier(final AdjSidTlv adjSid) { final ByteBuf value = Unpooled.buffer(); final BitArray flags = serializeAdjFlags(adjSid.getFlags(), adjSid.getSidLabelIndex()); flags.toByteBuf(value);//from w w w .j ava2 s .c o m value.writeByte(adjSid.getWeight().getValue()); value.writeZero(RESERVED); value.writeBytes(SidLabelIndexParser.serializeSidValue(adjSid.getSidLabelIndex())); return value; }
From source file:org.opendaylight.protocol.bgp.linkstate.attribute.sr.SrLinkAttributesParser.java
License:Open Source License
public static ByteBuf serializeLanAdjacencySegmentIdentifier(final SrLanAdjIds srLanAdjId) { final ByteBuf value = Unpooled.buffer(); final BitArray flags = serializeAdjFlags(srLanAdjId.getFlags(), srLanAdjId.getSidLabelIndex()); flags.toByteBuf(value);// ww w . j a v a 2 s . c o m value.writeByte(srLanAdjId.getWeight().getValue()); value.writeZero(RESERVED); if (srLanAdjId.getIsoSystemId() != null) { value.writeBytes(srLanAdjId.getIsoSystemId().getValue()); } else if (srLanAdjId.getNeighborId() != null) { value.writeBytes(Ipv4Util.byteBufForAddress(srLanAdjId.getNeighborId())); } value.writeBytes(SidLabelIndexParser.serializeSidValue(srLanAdjId.getSidLabelIndex())); return value; }
From source file:org.opendaylight.protocol.bgp.linkstate.attribute.sr.SrNodeAttributesParser.java
License:Open Source License
public static void serializeSrCapabilities(final SrCapabilities caps, final ByteBuf buffer) { final BitArray bs = new BitArray(FLAGS_SIZE); bs.set(MPLS_IPV4, caps.isMplsIpv4()); bs.set(MPLS_IPV6, caps.isMplsIpv6()); bs.set(SR_IPV6, caps.isSrIpv6());/*from ww w . jav a 2s . c o m*/ bs.toByteBuf(buffer); buffer.writeZero(RESERVERED); buffer.writeMedium(caps.getRangeSize().intValue()); TlvUtil.writeTLV(SidLabelIndexParser.SID_TYPE, SidLabelIndexParser.serializeSidValue(caps.getSidLabelIndex()), buffer); }