Example usage for io.netty.buffer Unpooled copyInt

List of usage examples for io.netty.buffer Unpooled copyInt

Introduction

In this page you can find the example usage for io.netty.buffer Unpooled copyInt.

Prototype

public static ByteBuf copyInt(int... values) 

Source Link

Document

Create a big-endian buffer that holds a sequence of the specified 32-bit integers.

Usage

From source file:org.opendaylight.protocol.bgp.linkstate.nlri.NodeNlriParser.java

License:Open Source License

static void serializeNodeIdentifier(
        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.NodeIdentifier descriptors,
        final ByteBuf buffer) {
    if (descriptors.getAsNumber() != null) {
        TlvUtil.writeTLV(AS_NUMBER,//w  w  w . j  a va  2 s  .  c  o  m
                Unpooled.copyInt(UnsignedInteger.valueOf(descriptors.getAsNumber().getValue()).intValue()),
                buffer);
    }
    if (descriptors.getDomainId() != null) {
        TlvUtil.writeTLV(BGP_LS_ID,
                Unpooled.copyInt(UnsignedInteger.valueOf(descriptors.getDomainId().getValue()).intValue()),
                buffer);
    }
    if (descriptors.getAreaId() != null) {
        TlvUtil.writeTLV(AREA_ID,
                Unpooled.copyInt(UnsignedInteger.valueOf(descriptors.getAreaId().getValue()).intValue()),
                buffer);
    }
    if (descriptors.getCRouterIdentifier() != null) {
        final ByteBuf routerIdBuf = Unpooled.buffer();
        serializeRouterId(descriptors.getCRouterIdentifier(), routerIdBuf);
        TlvUtil.writeTLV(IGP_ROUTER_ID, routerIdBuf, buffer);
    }
}

From source file:org.opendaylight.protocol.bgp.linkstate.nlri.NodeNlriParser.java

License:Open Source License

static void serializeEpeNodeDescriptors(final EpeNodeDescriptors epends, final ByteBuf buffer) {
    if (epends.getBgpRouterId() != null) {
        TlvUtil.writeTLV(BGP_ROUTER_ID, Ipv4Util.byteBufForAddress(epends.getBgpRouterId()), buffer);
    }/*from   w w  w  . java2  s .  com*/
    if (epends.getMemberAsn() != null) {
        TlvUtil.writeTLV(MEMBER_AS_NUMBER,
                Unpooled.copyInt(UnsignedInteger.valueOf(epends.getMemberAsn().getValue()).intValue()), buffer);
    }
}

From source file:org.opendaylight.protocol.bgp.parser.impl.message.open.As4CapabilityHandler.java

License:Open Source License

private static ByteBuf putAS4BytesParameterValue(final As4BytesCapability param) {
    return Unpooled.copyInt(param.getAsNumber().getValue().intValue());
}

From source file:org.opendaylight.protocol.bgp.parser.impl.message.update.LocalPreferenceAttributeParser.java

License:Open Source License

@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
    Preconditions.checkArgument(attribute instanceof Attributes,
            "Attribute parameter is not a PathAttribute object.");
    final LocalPref lp = ((Attributes) attribute).getLocalPref();
    if (lp == null) {
        return;// w  w w . ja v a2s. co m
    }
    AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE, Unpooled.copyInt(lp.getPref().intValue()),
            byteAggregator);
}

From source file:org.opendaylight.protocol.bgp.parser.impl.message.update.MultiExitDiscriminatorAttributeParser.java

License:Open Source License

@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
    Preconditions.checkArgument(attribute instanceof Attributes,
            "Attribute parameter is not a PathAttribute object.");
    final MultiExitDisc multiExitDisc = ((Attributes) attribute).getMultiExitDisc();
    if (multiExitDisc == null) {
        return;//from   ww  w. j ava  2 s . c o m
    }
    AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE,
            Unpooled.copyInt(multiExitDisc.getMed().intValue()), byteAggregator);
}

From source file:org.opendaylight.protocol.concepts.BandwidthTest.java

License:Open Source License

@Before
public void setUp() {
    this.b1 = new Bandwidth(Unpooled.copyInt(1000).array());
    this.b2 = new Bandwidth(Unpooled.copyInt(2000).array());
    this.b3 = new Bandwidth(Unpooled.copyInt(2000).array());
    this.b4 = new Bandwidth(Unpooled.copyInt(100).array());
}