Example usage for io.netty.buffer ByteBuf writeZero

List of usage examples for io.netty.buffer ByteBuf writeZero

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf writeZero.

Prototype

public abstract ByteBuf writeZero(int length);

Source Link

Document

Fills this buffer with NUL (0x00) starting at the current writerIndex and increases the writerIndex by the specified length .

Usage

From source file:org.opendaylight.openflowjava.nx.codec.action.LearnCodecTest.java

License:Open Source License

private void createBufer(ByteBuf message) {
    message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
    message.writeShort(LEARN_HEADER_LEN + 56);
    message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
    message.writeShort(NXAST_LEARN_SUBTYPE);

    message.writeShort(1);/*w  ww  . ja v a2s  .  c  o  m*/
    message.writeShort(2);
    message.writeShort(3);
    message.writeLong(4);
    message.writeShort(5);
    message.writeByte(6);
    message.writeZero(1);
    message.writeShort(7);
    message.writeShort(8);

    toFlowModSpecHeader(message, 0, 0);
    message.writeInt(9);
    message.writeShort(10);
    message.writeInt(11);
    message.writeShort(12);

    toFlowModSpecHeader(message, 0, 1);
    message.writeInt(9);
    message.writeShort(10);
    message.writeInt(11);
    message.writeShort(12);

    toFlowModSpecHeader(message, 1, 1);
    message.writeShort(9);
    message.writeInt(10);
    message.writeShort(11);

    toFlowModSpecHeader(message, 1, 0);
    message.writeShort(9);
    message.writeInt(10);
    message.writeShort(11);

    toFlowModSpecHeader(message, 0, 2);
    message.writeInt(9);
    message.writeShort(10);
}

From source file:org.opendaylight.openflowjava.nx.codec.action.LearnCodecUtil.java

License:Open Source License

static void serializeLearnHeader(final ByteBuf outBuffer, ActionLearn action) {
    outBuffer.writeShort(action.getNxActionLearn().getIdleTimeout().shortValue());
    outBuffer.writeShort(action.getNxActionLearn().getHardTimeout().shortValue());
    outBuffer.writeShort(action.getNxActionLearn().getPriority().shortValue());
    outBuffer.writeLong(action.getNxActionLearn().getCookie().longValue());
    outBuffer.writeShort(action.getNxActionLearn().getFlags().shortValue());
    outBuffer.writeByte(action.getNxActionLearn().getTableId().byteValue());
    outBuffer.writeZero(1);
    outBuffer.writeShort(action.getNxActionLearn().getFinIdleTimeout().shortValue());
    outBuffer.writeShort(action.getNxActionLearn().getFinHardTimeout().shortValue());
}

From source file:org.opendaylight.openflowjava.nx.codec.action.MultipathCodec.java

License:Open Source License

@Override
public void serialize(final Action input, final ByteBuf outBuffer) {
    ActionMultipath action = ((ActionMultipath) input.getActionChoice());
    serializeHeader(LENGTH, NXAST_MULTIPATH_SUBTYPE, outBuffer);

    outBuffer.writeShort(action.getNxActionMultipath().getFields().getIntValue());
    outBuffer.writeShort(action.getNxActionMultipath().getBasis().shortValue());
    outBuffer.writeZero(2);

    outBuffer.writeShort(action.getNxActionMultipath().getAlgorithm().getIntValue());
    outBuffer.writeShort(action.getNxActionMultipath().getMaxLink().shortValue());
    outBuffer.writeInt(action.getNxActionMultipath().getArg().intValue());
    outBuffer.writeZero(2);/*from w  w  w.  j a  va  2s.  c  om*/

    outBuffer.writeShort(action.getNxActionMultipath().getOfsNbits().shortValue());
    outBuffer.writeInt(action.getNxActionMultipath().getDst().intValue());
}

From source file:org.opendaylight.openflowjava.nx.codec.action.MultipathCodecTest.java

License:Open Source License

private void createBuffer(ByteBuf message) {
    message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
    message.writeShort(LENGTH);/*w ww.ja  v  a  2  s  . com*/
    message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
    message.writeShort(NXAST_MULTIPATH_SUBTYPE);

    //FIELDS = OfjNxHashFields.NXHASHFIELDSETHSRC
    message.writeShort(OfjNxHashFields.NXHASHFIELDSETHSRC.getIntValue());
    //BASIS = 1
    message.writeShort(1);
    //place 2 empty bytes
    message.writeZero(2);
    //Algorithm = OfjNxMpAlgorithm.NXMPALGMODULON
    message.writeShort(OfjNxMpAlgorithm.NXMPALGMODULON.getIntValue());
    //MaxLink = 2
    message.writeShort(2);
    //Arg = 3
    message.writeInt(3);
    //place 2 empty bytes
    message.writeZero(2);
    //OfsNbits = 4
    message.writeShort(4);
    //Dst = 5
    message.writeInt(5);
}

From source file:org.opendaylight.openflowjava.nx.codec.action.OutputRegCodec.java

License:Open Source License

@Override
public void serialize(final Action input, final ByteBuf outBuffer) {
    ActionOutputReg action = ((ActionOutputReg) input.getActionChoice());
    serializeHeader(LENGTH, SUBTYPE, outBuffer);
    outBuffer.writeShort(action.getNxActionOutputReg().getNBits().shortValue());
    outBuffer.writeInt(action.getNxActionOutputReg().getSrc().intValue());
    outBuffer.writeShort(action.getNxActionOutputReg().getMaxLen().shortValue());
    outBuffer.writeZero(6);
}

From source file:org.opendaylight.openflowjava.nx.codec.action.OutputRegCodecTest.java

License:Open Source License

private void createBuffer(ByteBuf message) {
    message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
    message.writeShort(LENGTH);//  ww w  . j av  a 2 s.  c  o m
    message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
    message.writeShort(SUBTYPE);

    message.writeShort(1);
    message.writeInt(2);
    message.writeShort(3);
    message.writeZero(PADDING);

}

From source file:org.opendaylight.openflowjava.nx.codec.action.PopNshCodec.java

License:Open Source License

@Override
public void serialize(Action input, ByteBuf outBuffer) {
    ActionPopNsh action = ((ActionPopNsh) input.getActionChoice());
    serializeHeader(LENGTH, NXAST_POP_NSH_SUBTYPE, outBuffer);
    outBuffer.writeZero(padding);
}

From source file:org.opendaylight.openflowjava.nx.codec.action.PushNshCodec.java

License:Open Source License

@Override
public void serialize(Action input, ByteBuf outBuffer) {
    ActionPushNsh action = ((ActionPushNsh) input.getActionChoice());
    serializeHeader(LENGTH, NXAST_PUSH_NSH_SUBTYPE, outBuffer);
    outBuffer.writeZero(padding);
}

From source file:org.opendaylight.openflowjava.nx.codec.action.ResubmitCodec.java

License:Open Source License

@Override
public void serialize(final Action input, final ByteBuf outBuffer) {
    byte table = OFP_TABLE_ALL;
    short inPort = OFP_IN_PORT;

    ActionResubmit action = ((ActionResubmit) input.getActionChoice());
    serializeHeader(LENGTH, getSubType(action), outBuffer);

    if (action.getNxActionResubmit().getInPort() != null) {
        inPort = action.getNxActionResubmit().getInPort().shortValue();
    }/*  www  .jav a 2s  . c om*/
    if (action.getNxActionResubmit().getTable() != null) {
        table = action.getNxActionResubmit().getTable().byteValue();
    }
    outBuffer.writeShort(inPort);
    outBuffer.writeByte(table);
    outBuffer.writeZero(padding);
}

From source file:org.opendaylight.openflowjava.nx.codec.action.ResubmitCodecTest.java

License:Open Source License

private void createBuffer(ByteBuf message) {
    message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
    message.writeShort(LENGTH);//from w w w  .  j  a  va2s.  co m
    message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
    message.writeShort(NXAST_RESUBMIT_TABLE_SUBTYPE);

    message.writeShort(1);
    message.writeByte(2);
    message.writeZero(padding);
}