*/
protected abstract InstanceIdentifier<T> getWildCardPath();
- private boolean preConfigurationCheck(final InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
+ private static boolean preConfigurationCheck(final InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
Preconditions.checkNotNull(nodeConnIdent, "FlowCapableNodeConnector ident can not be null!");
return true;
}
}
}
- private boolean compareInstanceIdentifierTail(final InstanceIdentifier<?> identifier1,
+ private static boolean compareInstanceIdentifierTail(final InstanceIdentifier<?> identifier1,
final InstanceIdentifier<?> identifier2) {
return Iterables.getLast(identifier1.getPathArguments())
.equals(Iterables.getLast(identifier2.getPathArguments()));
return true;
}
- private StaleFlow makeStaleFlow(InstanceIdentifier<Flow> identifier, Flow del,
+ private static StaleFlow makeStaleFlow(InstanceIdentifier<Flow> identifier, Flow del,
InstanceIdentifier<FlowCapableNode> nodeIdent) {
StaleFlowBuilder staleFlowBuilder = new StaleFlowBuilder(del);
return staleFlowBuilder.setId(del.getId()).build();
handleStaleFlowResultFuture(submitFuture);
}
- private void handleStaleFlowResultFuture(FluentFuture<?> submitFuture) {
+ private static void handleStaleFlowResultFuture(FluentFuture<?> submitFuture) {
submitFuture.addCallback(new FutureCallback<Object>() {
@Override
public void onSuccess(Object result) {
}
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
+ private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
.flow.inventory.rev130819.tables.table.StaleFlow> getStaleFlowInstanceIdentifier(
StaleFlow staleFlow, InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(Table.class, new TableKey(staleFlow.getTableId())).child(
}
}
- private boolean compareInstanceIdentifierTail(InstanceIdentifier<?> identifier1,
+ private static boolean compareInstanceIdentifierTail(InstanceIdentifier<?> identifier1,
InstanceIdentifier<?> identifier2) {
return Iterables.getLast(identifier1.getPathArguments())
.equals(Iterables.getLast(identifier2.getPathArguments()));
}
- private BigInteger getDpIdFromPortName(String portName) {
+ private static BigInteger getDpIdFromPortName(String portName) {
String dpId = portName.substring(portName.indexOf(SEPARATOR) + 1, portName.lastIndexOf(SEPARATOR));
return new BigInteger(dpId);
}
private static final AtomicLong BUNDLE_ID = new AtomicLong();
private static final BundleFlags BUNDLE_FLAGS = new BundleFlags(true, true);
- private Map<String, ReconciliationState> reconciliationStates;
+ private final Map<String, ReconciliationState> reconciliationStates;
public FlowNodeReconciliationImpl(final ForwardingRulesManager manager, final DataBroker db,
final String serviceName, final int priority, final ResultState resultState,
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
justification = "https://github.com/spotbugs/spotbugs/issues/811")
- private BigInteger getDpnIdFromNodeName(String nodeName) {
-
+ private static BigInteger getDpnIdFromNodeName(String nodeName) {
String dpId = nodeName.substring(nodeName.lastIndexOf(SEPARATOR) + 1);
return new BigInteger(dpId);
}
handleStaleEntityDeletionResultFuture(submitFuture);
}
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
+ private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
.flow.inventory.rev130819.tables.table.StaleFlow> getStaleFlowInstanceIdentifier(
StaleFlow staleFlow, InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(Table.class, new TableKey(staleFlow.getTableId())).child(
new StaleFlowKey(new FlowId(staleFlow.getId())));
}
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
+ private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
.group.types.rev131018.groups.StaleGroup> getStaleGroupInstanceIdentifier(
StaleGroup staleGroup, InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(StaleGroup.class, new StaleGroupKey(new GroupId(staleGroup.getGroupId())));
}
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
+ private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
.flow.inventory.rev130819.meters.StaleMeter> getStaleMeterInstanceIdentifier(
StaleMeter staleMeter, InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(StaleMeter.class, new StaleMeterKey(new MeterId(staleMeter.getMeterId())));
return futureList;
}
- private void handleStaleEntityDeletionResultFuture(FluentFuture<?> submitFuture) {
+ private static void handleStaleEntityDeletionResultFuture(FluentFuture<?> submitFuture) {
submitFuture.addCallback(new FutureCallback<Object>() {
@Override
public void onSuccess(Object result) {
}, MoreExecutors.directExecutor());
}
- private Flow getDeleteAllFlow() {
- final FlowBuilder flowBuilder = new FlowBuilder();
- flowBuilder.setTableId(OFConstants.OFPTT_ALL);
- return flowBuilder.build();
+ private static Flow getDeleteAllFlow() {
+ return new FlowBuilder().setTableId(OFConstants.OFPTT_ALL).build();
}
- private Group getDeleteAllGroup() {
- final GroupBuilder groupBuilder = new GroupBuilder();
- groupBuilder.setGroupType(GroupTypes.GroupAll);
- groupBuilder.setGroupId(new GroupId(OFConstants.OFPG_ALL));
- return groupBuilder.build();
+ private static Group getDeleteAllGroup() {
+ return new GroupBuilder()
+ .setGroupType(GroupTypes.GroupAll)
+ .setGroupId(new GroupId(OFConstants.OFPG_ALL))
+ .build();
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
justification = "https://github.com/spotbugs/spotbugs/issues/811")
- private Messages createMessages(final NodeRef nodeRef) {
+ private static Messages createMessages(final NodeRef nodeRef) {
final List<Message> messages = new ArrayList<>();
messages.add(new MessageBuilder().setNode(nodeRef)
.setBundleInnerMessage(new BundleRemoveFlowCaseBuilder()
this.forwardingRulesManagerImpl = forwardingRulesManagerImpl;
}
- private Node buildNode(long nodeIid) {
+ private static Node buildNode(long nodeIid) {
NodeId nodeId = new NodeId("openflow:" + nodeIid);
Node nodeDpn = new NodeBuilder().setId(nodeId).withKey(new NodeKey(nodeId)).build();
return nodeDpn;
}
- private StaleGroup makeStaleGroup(InstanceIdentifier<Group> identifier, Group del,
+ private static StaleGroup makeStaleGroup(InstanceIdentifier<Group> identifier, Group del,
InstanceIdentifier<FlowCapableNode> nodeIdent) {
StaleGroupBuilder staleGroupBuilder = new StaleGroupBuilder(del);
return staleGroupBuilder.setGroupId(del.getGroupId()).build();
handleStaleGroupResultFuture(submitFuture);
}
- private void handleStaleGroupResultFuture(FluentFuture<?> submitFuture) {
+ private static void handleStaleGroupResultFuture(FluentFuture<?> submitFuture) {
submitFuture.addCallback(new FutureCallback<Object>() {
@Override
public void onSuccess(Object result) {
LOG.error("Stale Group creation failed", throwable);
}
}, MoreExecutors.directExecutor());
-
}
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.group
+ private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.group
.types.rev131018.groups.StaleGroup> getStaleGroupInstanceIdentifier(
StaleGroup staleGroup, InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(StaleGroup.class, new StaleGroupKey(new GroupId(staleGroup.getGroupId())));
persistStaleMeter(staleMeter, nodeIdent);
}
- private StaleMeter makeStaleMeter(Meter del) {
+ private static StaleMeter makeStaleMeter(Meter del) {
StaleMeterBuilder staleMeterBuilder = new StaleMeterBuilder(del);
return staleMeterBuilder.setMeterId(del.getMeterId()).build();
}
handleStaleMeterResultFuture(submitFuture);
}
- private void handleStaleMeterResultFuture(FluentFuture<?> submitFuture) {
+ private static void handleStaleMeterResultFuture(FluentFuture<?> submitFuture) {
submitFuture.addCallback(new FutureCallback<Object>() {
@Override
public void onSuccess(Object result) {
}, MoreExecutors.directExecutor());
}
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819
+ private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819
.meters.StaleMeter> getStaleMeterInstanceIdentifier(
StaleMeter staleMeter, InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(StaleMeter.class, new StaleMeterKey(new MeterId(staleMeter.getMeterId())));
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.eric.codec.match;
import static org.junit.Assert.assertEquals;
assertEquals(shouldBe, ericHeader.toString());
}
- private long createHeader() {
+ private static long createHeader() {
long result = 0;
int oxmClass = 4096 << 16;
result = result | oxmClass;
result = result | length;
return result;
}
-
}
\ No newline at end of file
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.eric.codec.match;
import static org.junit.Assert.assertEquals;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.oxm.container.match.entry.value.Icmpv6NdOptionsTypeCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.eric.match.rev180730.oxm.container.match.entry.value.Icmpv6NdOptionsTypeCaseValueBuilder;
-
public class Icmpv6NDOptionsTypeCodecTest {
private static final int ERIC_FIELD_CODE = 2;
assertEquals(2, result.getIcmpv6NdOptionsTypeValues().getIcmpv6NdOptionsType().shortValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final Icmpv6NdOptionsTypeCaseValueBuilder caseBuilder = new Icmpv6NdOptionsTypeCaseValueBuilder();
final Icmpv6NdOptionsTypeValuesBuilder valuesBuilder = new Icmpv6NdOptionsTypeValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EricConstants.ERICOXM_OF_EXPERIMENTER_ID);
int fieldMask = ERIC_FIELD_CODE << 1;
message.writeByte(VALUE_LENGTH);
message.writeByte(2);
}
-
}
\ No newline at end of file
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.eric.codec.match;
import static org.junit.Assert.assertEquals;
assertEquals(2, result.getIcmpv6NdReservedValues().getIcmpv6NdReserved().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final Icmpv6NdReservedCaseValueBuilder caseBuilder = new Icmpv6NdReservedCaseValueBuilder();
final Icmpv6NdReservedValuesBuilder valuesBuilder = new Icmpv6NdReservedValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EricConstants.ERICOXM_OF_EXPERIMENTER_ID);
int fieldMask = ERIC_FIELD_CODE << 1;
message.writeByte(fieldMask);
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.nx.codec.action;
import com.google.common.net.InetAddresses;
serializeCtAction(outBuffer,action);
}
- private int getActionLength(final ActionConntrack action) {
+ private static int getActionLength(final ActionConntrack action) {
int length = 0;
List<CtActions> ctActionsList = action.getNxActionConntrack().getCtActions();
if (ctActionsList == null) {
return length;
}
- private int getNatActionLength(final NxActionNat natAction) {
+ private static int getNatActionLength(final NxActionNat natAction) {
int natLength = NX_NAT_LENGTH;
short rangePresent = natAction.getRangePresent().shortValue();
if (0 != (rangePresent & NxActionNatRangePresent.NXNATRANGEIPV4MIN.getIntValue())) {
natLength += SHORT_LENGTH;
}
return natLength;
-
}
- private void serializeCtAction(final ByteBuf outBuffer, final ActionConntrack action) {
+ private static void serializeCtAction(final ByteBuf outBuffer, final ActionConntrack action) {
List<CtActions> ctActionsList = action.getNxActionConntrack().getCtActions();
if (ctActionsList != null) {
for (CtActions ctActions : ctActionsList) {
return actionBuilder.build();
}
- private void deserializeCtAction(final ByteBuf message, final NxActionConntrackBuilder nxActionConntrackBuilder,
- final int ctActionsLength) {
+ private static void deserializeCtAction(final ByteBuf message,
+ final NxActionConntrackBuilder nxActionConntrackBuilder, final int ctActionsLength) {
List<CtActions> ctActionsList = new ArrayList<>();
int processedCtActionsLength = ctActionsLength;
nxActionConntrackBuilder.setCtActions(ctActionsList);
}
- private short deserializeCtHeaderWithoutSubtype(final ByteBuf message) {
+ private static short deserializeCtHeaderWithoutSubtype(final ByteBuf message) {
// size of experimenter type / size of set field code (in case of ct_mark)
message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
// size of length
return length;
}
- private short deserializeCtHeader(final ByteBuf message) {
+ private static short deserializeCtHeader(final ByteBuf message) {
short length = deserializeCtHeaderWithoutSubtype(message);
// subtype
message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
Mockito.verify(deserializer).deserialize(buffer);
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
//size of experiment type
message.writeShort(1);
//size of length
message.writeShort(SUBTYPE);
}
- private void createBufferWithWrongExperimentId(ByteBuf message) {
+ private static void createBufferWithWrongExperimentId(ByteBuf message) {
//size of experiment type
message.writeShort(1);
//size of length
Assert.assertEquals(4, result.getNxActionConntrack().getRecircTable().byteValue());
}
- private Action createAction() {
+ private static Action createAction() {
NxActionConntrackBuilder nxActionConntrackBuilder = new NxActionConntrackBuilder();
nxActionConntrackBuilder.setFlags(1);
return actionBuilder.build();
}
- private Action createActionWithoutCtAction() {
+ private static Action createActionWithoutCtAction() {
NxActionConntrackBuilder nxActionConntrackBuilder = new NxActionConntrackBuilder();
nxActionConntrackBuilder.setFlags(1);
}
- private Action createAction() {
+ private static Action createAction() {
NxActionCtClearBuilder nxActionCtClearBuilder = new NxActionCtClearBuilder();
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
assertFalse(buffer.isReadable());
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
message.writeInt((int) PACKET_TYPE);
}
- private Action createAction() {
+ private static Action createAction() {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
assertFalse(buffer.isReadable());
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
message.writeInt((int) PACKET_TYPE);
}
- private Action createAction() {
+ private static Action createAction() {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
assertEquals(0, buffer.readableBytes());
}
- private Action createAction(Short idleTimeout, Short hardTimeout) {
+ private static Action createAction(Short idleTimeout, Short hardTimeout) {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
return actionBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
@Test
public void deserializeTest() {
- createBufer(buffer);
+ createBuffer(buffer);
action = learnCodec.deserialize(buffer);
ActionLearn result = (ActionLearn) action.getActionChoice();
Assert.assertEquals(0, buffer.readableBytes());
}
-
-
- private Action createAction() {
+ private static Action createAction() {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
return actionBuilder.build();
}
- private List<FlowMods> createFlowMods() {
+ private static List<FlowMods> createFlowMods() {
final List<FlowMods> flowMods = new ArrayList<>();
//length = 14
return flowMods;
}
- private void createBufer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LEARN_HEADER_LEN + 56);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
message.writeShort(10);
}
- private void toFlowModSpecHeader(ByteBuf message, int src, int dst) {
+ private static void toFlowModSpecHeader(ByteBuf message, int src, int dst) {
short value = 0;
short bitNum = 48;
value |= src << 13;
}
- private Action createAction() {
+ private static Action createAction() {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
return actionBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
assertFalse(buffer.isReadable());
}
- private Action createAction(final Uint64 src) {
+ private static Action createAction(final Uint64 src) {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
return actionBuilder.build();
}
- private void createBuffer(final ByteBuf message, final boolean withExpSrc) {
+ private static void createBuffer(final ByteBuf message, final boolean withExpSrc) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
}
- private Action createAction() {
+ private static Action createAction() {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
return actionBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
assertEquals(RegLoad2Codec.SUBTYPE, out.readUnsignedShort());
}
- private Action createAction() {
+ private static Action createAction() {
ExperimenterBuilder experimenterBuilder = new ExperimenterBuilder();
experimenterBuilder.setExperimenter(new ExperimenterId(NiciraConstants.NX_NSH_VENDOR_ID));
ExperimenterIdCaseBuilder expCaseBuilder = new ExperimenterIdCaseBuilder();
assertEquals(0, buffer.readableBytes());
}
- private Action createAction() {
+ private static Action createAction() {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
return actionBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
assertEquals(0, buffer.readableBytes());
}
- private Action createAction(Uint64 src, Uint64 dst) {
+ private static Action createAction(Uint64 src, Uint64 dst) {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
return actionBuilder.build();
}
- private void createBuffer(ByteBuf message, boolean withExpSrc, boolean withExpDst) {
+ private static void createBuffer(ByteBuf message, boolean withExpSrc, boolean withExpDst) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
int length = withExpSrc || withExpDst ? 32 : 24;
message.writeShort(length);
*/
@Test
public void getSubTypeTest2() {
- Byte table = new Byte((byte)1);
- action = createAction(null, table);
+ action = createAction(null, (byte)1);
ActionResubmit actionResubmit = (ActionResubmit) action.getActionChoice();
byte result = resubmitCodec.getSubType(actionResubmit);
assertEquals(0, buffer.readableBytes());
}
- private Action createAction(Short inPort, Byte table) {
+ private static Action createAction(Short inPort, Byte table) {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
return actionBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.nx.codec.match;
import static org.junit.Assert.assertEquals;
assertFalse(buffer.isReadable());
}
-
- private NxExpMatchEntryValue createMatchEntryValue(final Long value, final Long mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(final Long value, final Long mask) {
return new NshcCaseValueBuilder().setNshc(value).setMask(mask).build();
}
- private void writeBuffer(final ByteBuf message, final Long value, final Long mask) {
+ private static void writeBuffer(final ByteBuf message, final Long value, final Long mask) {
message.writeInt(value.intValue());
if (mask != null) {
message.writeInt(mask.intValue());
assertEquals(2, result.getArpOpValues().getValue().shortValue());
}
-
-
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final ArpOpCaseValueBuilder caseBuilder = new ArpOpCaseValueBuilder();
final ArpOpValuesBuilder valuesBuilder = new ArpOpValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final ArpShaCaseValueBuilder caseBuilder = new ArpShaCaseValueBuilder();
final ArpShaValuesBuilder valuesBuilder = new ArpShaValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getArpSpaValues().getValue().shortValue());
}
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final ArpSpaCaseValueBuilder caseBuilder = new ArpSpaCaseValueBuilder();
final ArpSpaValuesBuilder valuesBuilder = new ArpSpaValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(TEST_ADDRESS, result.getArpThaValues().getMacAddress());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final ArpThaCaseValueBuilder caseBuilder = new ArpThaCaseValueBuilder();
final ArpThaValuesBuilder valuesBuilder = new ArpThaValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getArpTpaValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final ArpTpaCaseValueBuilder caseBuilder = new ArpTpaCaseValueBuilder();
final ArpTpaValuesBuilder valuesBuilder = new ArpTpaValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getCtStateValues().getMask().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final CtStateCaseValueBuilder caseBuilder = new CtStateCaseValueBuilder();
final CtStateValuesBuilder valuesBuilder = new CtStateValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getCtTpDstValues().getCtTpDst().shortValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final CtTpDstCaseValueBuilder caseBuilder = new CtTpDstCaseValueBuilder();
final CtTpDstValuesBuilder valuesBuilder = new CtTpDstValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getCtTpSrcValues().getCtTpSrc().shortValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final CtTpSrcCaseValueBuilder caseBuilder = new CtTpSrcCaseValueBuilder();
final CtTpSrcValuesBuilder valuesBuilder = new CtTpSrcValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final CtZoneCaseValueBuilder caseBuilder = new CtZoneCaseValueBuilder();
final CtZoneValuesBuilder valuesBuilder = new CtZoneValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(TEST_ADDRESS, result.getEthDstValues().getMacAddress());
}
-
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final EthDstCaseValueBuilder caseBuilder = new EthDstCaseValueBuilder();
final EthDstValuesBuilder valuesBuilder = new EthDstValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(TEST_ADDRESS, result.getEthSrcValues().getMacAddress());
}
-
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final EthSrcCaseValueBuilder caseBuilder = new EthSrcCaseValueBuilder();
final EthSrcValuesBuilder valuesBuilder = new EthSrcValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getEthTypeValues().getValue().shortValue());
}
-
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final EthTypeCaseValueBuilder caseBuilder = new EthTypeCaseValueBuilder();
final EthTypeValuesBuilder valuesBuilder = new EthTypeValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getIcmpTypeValues().getValue().shortValue());
}
-
-
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final IcmpTypeCaseValueBuilder caseBuilder = new IcmpTypeCaseValueBuilder();
final IcmpTypeValuesBuilder valuesBuilder = new IcmpTypeValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getIpDstValues().getValue().intValue());
}
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final IpDstCaseValueBuilder caseBuilder = new IpDstCaseValueBuilder();
final IpDstValuesBuilder valuesBuilder = new IpDstValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getIpSrcValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final IpSrcCaseValueBuilder caseBuilder = new IpSrcCaseValueBuilder();
final IpSrcValuesBuilder valuesBuilder = new IpSrcValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getIpDstValues().getValue().intValue());
}
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final IpDstCaseValueBuilder caseBuilder = new IpDstCaseValueBuilder();
final IpDstValuesBuilder valuesBuilder = new IpDstValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(2, result.getIpSrcValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final IpSrcCaseValueBuilder caseBuilder = new IpSrcCaseValueBuilder();
final IpSrcValuesBuilder valuesBuilder = new IpSrcValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.nx.codec.match;
import static org.junit.Assert.assertEquals;
assertEquals(false, input.isHasMask());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfMetadata.class);
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
- int fieldMask = (NXM_FIELD_CODE << 1);
+ int fieldMask = NXM_FIELD_CODE << 1;
message.writeByte(fieldMask);
message.writeByte(VALUE_LENGTH);
}
-
}
\ No newline at end of file
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.nx.codec.match;
import static org.junit.Assert.assertEquals;
assertFalse(buffer.isReadable());
}
-
- private NxExpMatchEntryValue createMatchEntryValue(Short value, Short mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(Short value, Short mask) {
NshFlagsValues nshFlagsValues = new NshFlagsValuesBuilder().setNshFlags(value).setMask(mask).build();
return new NshFlagsCaseValueBuilder().setNshFlagsValues(nshFlagsValues).build();
}
- private void writeBuffer(ByteBuf message, Short value, Short mask) {
+ private static void writeBuffer(ByteBuf message, Short value, Short mask) {
message.writeByte(value.intValue());
if (mask != null) {
message.writeByte(mask.intValue());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.nx.codec.match;
import static org.junit.Assert.assertEquals;
assertFalse(buffer.isReadable());
}
- private NxExpMatchEntryValue createMatchEntryValue(Short value) {
+ private static NxExpMatchEntryValue createMatchEntryValue(Short value) {
NshMdtypeValues nshMdtypeValues = new NshMdtypeValuesBuilder().setValue(value).build();
return new NshMdtypeCaseValueBuilder().setNshMdtypeValues(nshMdtypeValues).build();
}
- private void writeBuffer(ByteBuf message, Short value) {
+ private static void writeBuffer(ByteBuf message, Short value) {
message.writeByte(value.intValue());
}
}
\ No newline at end of file
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.nx.codec.match;
import static org.junit.Assert.assertEquals;
assertFalse(buffer.isReadable());
}
- private NxExpMatchEntryValue createMatchEntryValue(Short value) {
+ private static NxExpMatchEntryValue createMatchEntryValue(Short value) {
NshNpValues nshNpValues = new NshNpValuesBuilder().setValue(value).build();
return new NshNpCaseValueBuilder().setNshNpValues(nshNpValues).build();
}
- private void writeBuffer(ByteBuf message, Short value) {
+ private static void writeBuffer(ByteBuf message, Short value) {
message.writeByte(value.intValue());
}
}
\ No newline at end of file
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.nx.codec.match;
import static org.junit.Assert.assertEquals;
assertFalse(buffer.isReadable());
}
-
- private NxExpMatchEntryValue createMatchEntryValue(final Short value, final Short mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(final Short value, final Short mask) {
NshTtlValues nshTtlValues = new NshTtlValuesBuilder().setNshTtl(value).setMask(mask).build();
return new NshTtlCaseValueBuilder().setNshTtlValues(nshTtlValues).build();
}
- private void writeBuffer(final ByteBuf message, final Short value, final Short mask) {
+ private static void writeBuffer(final ByteBuf message, final Short value, final Short mask) {
message.writeByte(value.intValue());
if (mask != null) {
message.writeByte(mask.intValue());
assertFalse(buffer.isReadable());
}
- private NxExpMatchEntryValue createMatchEntryValue(Short value, Short mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(Short value, Short mask) {
NsiValues nsiValues = new NsiValuesBuilder().setNsi(value).setMask(mask).build();
return new NsiCaseValueBuilder().setNsiValues(nsiValues).build();
}
- private void writeBuffer(ByteBuf message, Short value, Short mask) {
+ private static void writeBuffer(ByteBuf message, Short value, Short mask) {
message.writeByte(value.intValue());
if (mask != null) {
message.writeByte(mask.intValue());
assertFalse(buffer.isReadable());
}
-
- private NxExpMatchEntryValue createMatchEntryValue(final Long value, final Long mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(final Long value, final Long mask) {
NspValues nspValues = new NspValuesBuilder().setNsp(value).setMask(mask).build();
return new NspCaseValueBuilder().setNspValues(nspValues).build();
}
- private void writeBuffer(final ByteBuf message, final Long value, final Long mask) {
+ private static void writeBuffer(final ByteBuf message, final Long value, final Long mask) {
message.writeInt(value.intValue());
if (mask != null) {
message.writeInt(mask.intValue());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.nx.codec.match;
import static org.junit.Assert.assertEquals;
assertEquals(2, result.getPktMarkValues().getPktMark().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final PktMarkCaseValueBuilder caseBuilder = new PktMarkCaseValueBuilder();
final PktMarkValuesBuilder valuesBuilder = new PktMarkValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getRegValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final RegCaseValueBuilder caseBuilder = new RegCaseValueBuilder();
final RegValuesBuilder valuesBuilder = new RegValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getRegValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final RegCaseValueBuilder caseBuilder = new RegCaseValueBuilder();
final RegValuesBuilder valuesBuilder = new RegValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getRegValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final RegCaseValueBuilder caseBuilder = new RegCaseValueBuilder();
final RegValuesBuilder valuesBuilder = new RegValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getRegValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final RegCaseValueBuilder caseBuilder = new RegCaseValueBuilder();
final RegValuesBuilder valuesBuilder = new RegValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getRegValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final RegCaseValueBuilder caseBuilder = new RegCaseValueBuilder();
final RegValuesBuilder valuesBuilder = new RegValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getRegValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final RegCaseValueBuilder caseBuilder = new RegCaseValueBuilder();
final RegValuesBuilder valuesBuilder = new RegValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getRegValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final RegCaseValueBuilder caseBuilder = new RegCaseValueBuilder();
final RegValuesBuilder valuesBuilder = new RegValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getRegValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final RegCaseValueBuilder caseBuilder = new RegCaseValueBuilder();
final RegValuesBuilder valuesBuilder = new RegValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(0xffff, result.getTcpDstValues().getMask().shortValue() & 0xffff);
}
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final TcpDstCaseValueBuilder caseBuilder = new TcpDstCaseValueBuilder();
final TcpDstValuesBuilder valuesBuilder = new TcpDstValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(0xffff, result.getTcpSrcValues().getMask().shortValue() & 0xffff);
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final TcpSrcCaseValueBuilder caseBuilder = new TcpSrcCaseValueBuilder();
final TcpSrcValuesBuilder valuesBuilder = new TcpSrcValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(0, result.getTunIdValues().getValue().longValue());
}
-
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final TunIdCaseValueBuilder caseBuilder = new TunIdCaseValueBuilder();
final TunIdValuesBuilder valuesBuilder = new TunIdValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getTunIpv4DstValues().getValue().intValue());
}
-
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final TunIpv4DstCaseValueBuilder caseBuilder = new TunIpv4DstCaseValueBuilder();
final TunIpv4DstValuesBuilder valuesBuilder = new TunIpv4DstValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(1, result.getTunIpv4SrcValues().getValue().intValue());
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final TunIpv4SrcCaseValueBuilder caseBuilder = new TunIpv4SrcCaseValueBuilder();
final TunIpv4SrcValuesBuilder valuesBuilder = new TunIpv4SrcValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_1_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(0xffff, result.getUdpDstValues().getMask().shortValue() & 0xffff);
}
-
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final UdpDstCaseValueBuilder caseBuilder = new UdpDstCaseValueBuilder();
final UdpDstValuesBuilder valuesBuilder = new UdpDstValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
assertEquals(0xffff, result.getUdpSrcValues().getMask().shortValue() & 0xffff);
}
- private MatchEntry createMatchEntry() {
+ private static MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final UdpSrcCaseValueBuilder caseBuilder = new UdpSrcCaseValueBuilder();
final UdpSrcValuesBuilder valuesBuilder = new UdpSrcValuesBuilder();
return matchEntryBuilder.build();
}
- private void createBuffer(ByteBuf message) {
+ private static void createBuffer(ByteBuf message) {
message.writeShort(OxmMatchConstants.NXM_0_CLASS);
int fieldMask = NXM_FIELD_CODE << 1;
grouping flow-and-statistics-map-list {
description "List of flow and statistics map";
list flow-and-statistics-map-list {
- key "flow-id";
leaf flow-id {
type flow-id;
}
if (getClass() != obj.getClass()) {
return false;
}
- ExperimenterIdMeterSubTypeSerializerKey other = (ExperimenterIdMeterSubTypeSerializerKey) obj;
+ ExperimenterIdMeterSubTypeSerializerKey<?> other = (ExperimenterIdMeterSubTypeSerializerKey<?>) obj;
if (meterSubType == null) {
if (other.meterSubType != null) {
return false;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.api.keys;
import org.junit.Assert;
* @author michal.polkorab
*/
public class ActionSerializerKeyTest {
+ private static final Uint32 FORTY_TWO = Uint32.valueOf(42);
+ private static final Uint32 FIFTY_FIVE = Uint32.valueOf(55);
/**
* Test ActionSerializerKey equals and hashCode.
@Test
public void test() {
ActionSerializerKey<CopyTtlInCase> key1 =
- new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 42L);
+ new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, FORTY_TWO);
ActionSerializerKey<?> key2 =
- new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 42L);
+ new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, FORTY_TWO);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, (Uint32) null);
key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, (Uint32) null);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOutCase.class, 42L);
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOutCase.class, FORTY_TWO);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, 55L);
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, FIFTY_FIVE);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
- key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlInCase.class, 55L);
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlInCase.class, FIFTY_FIVE);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
}
*/
@Test
public void testEquals() {
- ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, FORTY_TWO);
ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
- CopyTtlInCase.class, 42L);
+ CopyTtlInCase.class, FORTY_TWO);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
Assert.assertFalse("Wrong equal by actionType", key1.equals(key2));
- key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+ key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, FORTY_TWO);
Assert.assertTrue("Wrong equal by action type", key1.equals(key2));
key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlInCase.class, (Uint32) null);
Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
@Test
public void testToString() {
ActionSerializerKey<CopyTtlInCase> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
- CopyTtlInCase.class, 42L);
+ CopyTtlInCase.class, FORTY_TWO);
Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn"
+ ".opendaylight.openflow.common.action.rev150203.actions.grouping.Action action type:"
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.ExperimenterActionSubType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Unit tests for keys.
@Test
public void testEqualsAndHashcodeOfActionDeserializerKeys() {
ActionSerializerKey<ExperimenterIdCase> actionSerializerKey = new ActionSerializerKey<>(
- EncodeConstants.OF13_VERSION_ID, ExperimenterIdCase.class, 1L);
+ EncodeConstants.OF13_VERSION_ID, ExperimenterIdCase.class, Uint32.ONE);
ExperimenterActionSerializerKey experimenterActionSerializerKey = new ExperimenterActionSerializerKey(
- EncodeConstants.OF13_VERSION_ID, 1L, ExpSubType.class);
+ EncodeConstants.OF13_VERSION_ID, Uint32.ONE, ExpSubType.class);
Assert.assertFalse(actionSerializerKey.equals(experimenterActionSerializerKey));
Assert.assertFalse(experimenterActionSerializerKey.equals(actionSerializerKey));
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
import org.junit.Assert;
* @author michal.polkorab
*/
public class ExperimenterActionSerializerKeyTest {
+ private static final Uint32 FORTY_TWO = Uint32.valueOf(42);
+ private static final Uint32 FIFTY_FIVE = Uint32.valueOf(55);
/**
* Test ExperimenterActionSerializerKey equals and hashCode.
@Test
public void test() {
ExperimenterActionSerializerKey key1 =
- new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, TestSubType.class);
ExperimenterActionSerializerKey key2 =
- new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, TestSubType.class);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, FORTY_TWO, TestSubType.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, (Uint32) null, TestSubType.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FIFTY_FIVE, TestSubType.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FIFTY_FIVE, null);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FIFTY_FIVE, TestSubType2.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
}
public void testEquals() {
ExperimenterActionSerializerKey key1;
ExperimenterActionSerializerKey key2;
- key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, null);
+ key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, null);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
- key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType2.class);
+ key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, TestSubType2.class);
Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
- key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+ key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, FORTY_TWO, TestSubType.class);
Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
}
private interface TestSubType2 extends ExperimenterActionSubType {
// empty class - only used in test for comparation
}
-
-
}
}
}
- private String getSslErrorCause(Throwable cause) {
+ private static String getSslErrorCause(Throwable cause) {
String sslError = null;
- while ((cause != null) && (cause.getCause() != null)) {
+ while (cause != null && cause.getCause() != null) {
sslError = cause.getCause().getMessage();
cause = cause.getCause();
}
return new TableConfig(deprecated);
}
- private MultipartRequestDescCase setDesc(ByteBuf input) {
+ private static MultipartRequestDescCase setDesc(ByteBuf input) {
MultipartRequestDescCaseBuilder caseBuilder = new MultipartRequestDescCaseBuilder();
MultipartRequestDescBuilder descBuilder = new MultipartRequestDescBuilder();
descBuilder.setEmpty(Empty.getInstance());
return caseBuilder.build();
}
- private MultipartRequestPortDescCase setPortDesc(ByteBuf input) {
+ private static MultipartRequestPortDescCase setPortDesc(ByteBuf input) {
MultipartRequestPortDescCaseBuilder caseBuilder = new MultipartRequestPortDescCaseBuilder();
MultipartRequestPortDescBuilder portBuilder = new MultipartRequestPortDescBuilder();
portBuilder.setEmpty(Empty.getInstance());
return caseBuilder.build();
}
- private MultipartRequestPortStatsCase setPortStats(ByteBuf input) {
+ private static MultipartRequestPortStatsCase setPortStats(ByteBuf input) {
MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
portBuilder.setPortNo(input.readUnsignedInt());
return caseBuilder.build();
}
- private MultipartRequestQueueCase setQueue(ByteBuf input) {
+ private static MultipartRequestQueueCase setQueue(ByteBuf input) {
MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();
queueBuilder.setPortNo(input.readUnsignedInt());
return caseBuilder.build();
}
- private MultipartRequestGroupCase setGroup(ByteBuf input) {
+ private static MultipartRequestGroupCase setGroup(ByteBuf input) {
MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
MultipartRequestGroupBuilder groupBuilder = new MultipartRequestGroupBuilder();
groupBuilder.setGroupId(new GroupId(input.readUnsignedInt()));
return caseBuilder.build();
}
- private MultipartRequestGroupDescCase setGroupDesc(ByteBuf input) {
+ private static MultipartRequestGroupDescCase setGroupDesc(ByteBuf input) {
MultipartRequestGroupDescCaseBuilder caseBuilder = new MultipartRequestGroupDescCaseBuilder();
MultipartRequestGroupDescBuilder groupBuilder = new MultipartRequestGroupDescBuilder();
groupBuilder.setEmpty(Empty.getInstance());
return caseBuilder.build();
}
- private MultipartRequestGroupFeaturesCase setGroupFeatures(ByteBuf input) {
+ private static MultipartRequestGroupFeaturesCase setGroupFeatures(ByteBuf input) {
MultipartRequestGroupFeaturesCaseBuilder caseBuilder = new MultipartRequestGroupFeaturesCaseBuilder();
MultipartRequestGroupFeaturesBuilder groupBuilder = new MultipartRequestGroupFeaturesBuilder();
groupBuilder.setEmpty(Empty.getInstance());
return caseBuilder.build();
}
- private MultipartRequestMeterCase setMeter(ByteBuf input) {
+ private static MultipartRequestMeterCase setMeter(ByteBuf input) {
MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder meterBuilder = new MultipartRequestMeterBuilder();
meterBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
return caseBuilder.build();
}
- private MultipartRequestMeterConfigCase setMeterConfig(ByteBuf input) {
+ private static MultipartRequestMeterConfigCase setMeterConfig(ByteBuf input) {
MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
MultipartRequestMeterConfigBuilder meterBuilder = new MultipartRequestMeterConfigBuilder();
meterBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
return caseBuilder.build();
}
- private MultipartRequestMeterFeaturesCase setMeterFeatures(ByteBuf input) {
+ private static MultipartRequestMeterFeaturesCase setMeterFeatures(ByteBuf input) {
MultipartRequestMeterFeaturesCaseBuilder caseBuilder = new MultipartRequestMeterFeaturesCaseBuilder();
MultipartRequestMeterFeaturesBuilder meterBuilder = new MultipartRequestMeterFeaturesBuilder();
meterBuilder.setEmpty(Empty.getInstance());
return caseBuilder.build();
}
- private MultipartRequestTableCase setTable(ByteBuf input) {
+ private static MultipartRequestTableCase setTable(ByteBuf input) {
MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();
MultipartRequestTableBuilder tableBuilder = new MultipartRequestTableBuilder();
tableBuilder.setEmpty(Empty.getInstance());
return caseBuilder.build();
}
- private MultipartRequestExperimenterCase setExperimenter(ByteBuf input) {
+ private static MultipartRequestExperimenterCase setExperimenter(ByteBuf input) {
MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
MultipartRequestExperimenterBuilder experimenterBuilder = new MultipartRequestExperimenterBuilder();
caseBuilder.setMultipartRequestExperimenter(experimenterBuilder.build());
return builder.build();
}
- private MultipartRequestExperimenterCase setExperimenter(ByteBuf input) {
+ private static MultipartRequestExperimenterCase setExperimenter(ByteBuf input) {
MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
MultipartRequestExperimenterBuilder experimenterBuilder = new MultipartRequestExperimenterBuilder();
caseBuilder.setMultipartRequestExperimenter(experimenterBuilder.build());
return caseBuilder.build();
}
- private MultipartRequestQueueCase setQueue(ByteBuf input) {
+ private static MultipartRequestQueueCase setQueue(ByteBuf input) {
final MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();
queueBuilder.setPortNo((long) input.readUnsignedShort());
return caseBuilder.build();
}
- private MultipartRequestPortStatsCase setPortStats(ByteBuf input) {
+ private static MultipartRequestPortStatsCase setPortStats(ByteBuf input) {
MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
portBuilder.setPortNo((long) input.readUnsignedShort());
return caseBuilder.build();
}
- private MultipartRequestTableCase setTable(ByteBuf input) {
+ private static MultipartRequestTableCase setTable(ByteBuf input) {
MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();
MultipartRequestTableBuilder tableBuilder = new MultipartRequestTableBuilder();
tableBuilder.setEmpty(Empty.getInstance());
return caseBuilder.build();
}
- private MultipartRequestDescCase setDesc(ByteBuf input) {
+ private static MultipartRequestDescCase setDesc(ByteBuf input) {
MultipartRequestDescCaseBuilder caseBuilder = new MultipartRequestDescCaseBuilder();
MultipartRequestDescBuilder descBuilder = new MultipartRequestDescBuilder();
descBuilder.setEmpty(Empty.getInstance());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.serialization.action;
import io.netty.buffer.ByteBuf;
@Override
public void serialize(final Action action, final ByteBuf outBuffer) {
super.serialize(action, outBuffer);
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(((SetDlDstCase) action.getActionChoice())
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(((SetDlDstCase) action.getActionChoice())
.getSetDlDstAction().getDlDstAddress()));
outBuffer.writeZero(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.serialization.action;
import io.netty.buffer.ByteBuf;
@Override
public void serialize(final Action action, final ByteBuf outBuffer) {
super.serialize(action, outBuffer);
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(((SetDlSrcCase) action.getActionChoice())
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(((SetDlSrcCase) action.getActionChoice())
.getSetDlSrcAction().getDlSrcAddress()));
outBuffer.writeZero(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);
}
protected int getLength() {
return ActionConstants.LARGER_ACTION_LENGTH;
}
-
}
// TODO: experimenterBody does not have get methods
}
- private void writeFlags(final MultipartRequestFlags flags, final ByteBuf outBuffer) {
+ private static void writeFlags(final MultipartRequestFlags flags, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, flags.isOFPMPFREQMORE());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
return result;
}
- private void writeTableConfig(final TableConfig tableConfig, final ByteBuf outBuffer) {
+ private static void writeTableConfig(final TableConfig tableConfig, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, tableConfig.isOFPTCDEPRECATEDMASK());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeInt(bitmap);
}
- private void serializeMeterFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeMeterFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyMeterFeaturesCase meterFeaturesCase = (MultipartReplyMeterFeaturesCase) body;
MultipartReplyMeterFeatures meterFeatures = meterFeaturesCase.getMultipartReplyMeterFeatures();
outBuffer.writeInt(meterFeatures.getMaxMeter().intValue());
outBuffer.writeZero(METER_FEATURES_PADDING);
}
- private void writeBandTypes(final MeterBandTypeBitmap bandTypes, final ByteBuf outBuffer) {
+ private static void writeBandTypes(final MeterBandTypeBitmap bandTypes, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, bandTypes.isOFPMBTDROP());
map.put(1, bandTypes.isOFPMBTDSCPREMARK());
outBuffer.writeInt(bitmap);
}
- private void serializeMeterConfigBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeMeterConfigBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyMeterConfigCase meterConfigCase = (MultipartReplyMeterConfigCase) body;
MultipartReplyMeterConfig meter = meterConfigCase.getMultipartReplyMeterConfig();
for (MeterConfig meterConfig : meter.getMeterConfig()) {
outBuffer.writeInt(meterBand.getBurstSize().intValue());
}
- private void writeMeterFlags(final MeterFlags flags, final ByteBuf outBuffer) {
+ private static void writeMeterFlags(final MeterFlags flags, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, flags.isOFPMFKBPS());
map.put(1, flags.isOFPMFPKTPS());
outBuffer.writeShort(bitmap);
}
- private void serializeMeterBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeMeterBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyMeterCase meterCase = (MultipartReplyMeterCase) body;
MultipartReplyMeter meter = meterCase.getMultipartReplyMeter();
for (MeterStats meterStats : meter.getMeterStats()) {
}
}
- private void serializeGroupFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeGroupFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyGroupFeaturesCase groupFeaturesCase = (MultipartReplyGroupFeaturesCase) body;
MultipartReplyGroupFeatures groupFeatures = groupFeaturesCase.getMultipartReplyGroupFeatures();
writeGroupTypes(groupFeatures.getTypes(), outBuffer);
}
}
- private void writeActionType(final ActionType action, final ByteBuf outBuffer) {
+ private static void writeActionType(final ActionType action, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, action.isOFPATOUTPUT());
map.put(1, action.isOFPATCOPYTTLOUT());
outBuffer.writeInt(bitmap);
}
- private void writeGroupCapabilities(final GroupCapabilities capabilities, final ByteBuf outBuffer) {
+ private static void writeGroupCapabilities(final GroupCapabilities capabilities, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, capabilities.isOFPGFCSELECTWEIGHT());
map.put(1, capabilities.isOFPGFCSELECTLIVENESS());
outBuffer.writeInt(bitmap);
}
- private void writeGroupTypes(final GroupTypes types, final ByteBuf outBuffer) {
+ private static void writeGroupTypes(final GroupTypes types, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, types.isOFPGTALL());
map.put(1, types.isOFPGTSELECT());
}
}
- private void serializeGroupBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeGroupBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyGroupCase groupCase = (MultipartReplyGroupCase) body;
MultipartReplyGroup group = groupCase.getMultipartReplyGroup();
for (GroupStats groupStats : group.getGroupStats()) {
}
}
- private void serializeQueueBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeQueueBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyQueueCase queueCase = (MultipartReplyQueueCase) body;
MultipartReplyQueue queue = queueCase.getMultipartReplyQueue();
for (QueueStats queueStats : queue.getQueueStats()) {
}
}
- private void serializePortStatsBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializePortStatsBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyPortStatsCase portStatsCase = (MultipartReplyPortStatsCase) body;
MultipartReplyPortStats portStats = portStatsCase.getMultipartReplyPortStats();
for (PortStats portStat : portStats.getPortStats()) {
}
}
- private void serializeTableBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeTableBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyTableCase tableCase = (MultipartReplyTableCase) body;
MultipartReplyTable table = tableCase.getMultipartReplyTable();
for (TableStats tableStats : table.getTableStats()) {
}
}
- private void serializeAggregateBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeAggregateBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyAggregateCase aggregateCase = (MultipartReplyAggregateCase) body;
MultipartReplyAggregate aggregate = aggregateCase.getMultipartReplyAggregate();
outBuffer.writeLong(aggregate.getPacketCount().longValue());
}
}
- private void serializeDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializeDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyDescCase descCase = (MultipartReplyDescCase) body;
MultipartReplyDesc desc = descCase.getMultipartReplyDesc();
write256String(desc.getMfrDesc(), outBuffer);
write256String(desc.getDpDesc(), outBuffer);
}
- private void write256String(final String toWrite, final ByteBuf outBuffer) {
+ private static void write256String(final String toWrite, final ByteBuf outBuffer) {
byte[] nameBytes = toWrite.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 256) {
byte[] nameBytesPadding = new byte[256];
}
}
- private void write32String(final String toWrite, final ByteBuf outBuffer) {
+ private static void write32String(final String toWrite, final ByteBuf outBuffer) {
byte[] nameBytes = toWrite.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 32) {
byte[] nameBytesPadding = new byte[32];
}
}
- private void serializePortDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
+ private static void serializePortDescBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyPortDescCase portCase = (MultipartReplyPortDescCase) body;
MultipartReplyPortDesc portDesc = portCase.getMultipartReplyPortDesc();
for (Ports port : portDesc.getPorts()) {
outBuffer.writeInt(port.getPortNo().intValue()); // Assuming PortNo
// = PortId
outBuffer.writeZero(PORT_DESC_PADDING_1);
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(port.getHwAddr()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(port.getHwAddr()));
outBuffer.writeZero(PORT_DESC_PADDING_2);
writeName(port.getName(), outBuffer);
writePortConfig(port.getConfig(), outBuffer);
}
}
- private void writeName(final String name, final ByteBuf outBuffer) {
+ private static void writeName(final String name, final ByteBuf outBuffer) {
byte[] nameBytes = name.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 16) {
byte[] nameBytesPadding = new byte[16];
} else {
outBuffer.writeBytes(nameBytes);
}
-
}
- private void writePortConfig(final PortConfig config, final ByteBuf outBuffer) {
+ private static void writePortConfig(final PortConfig config, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, config.isPortDown());
map.put(2, config.isNoRecv());
outBuffer.writeInt(bitmap);
}
- private void writePortState(final PortState state, final ByteBuf outBuffer) {
+ private static void writePortState(final PortState state, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, state.isLinkDown());
map.put(1, state.isBlocked());
outBuffer.writeInt(bitmap);
}
- private void writePortFeatures(final PortFeatures features, final ByteBuf outBuffer) {
+ private static void writePortFeatures(final PortFeatures features, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, features.is_10mbHd());
map.put(1, features.is_10mbFd());
outBuffer.writeInt(createActionsV10(message.getActionsV10()));
for (PhyPort port : message.getPhyPort()) {
outBuffer.writeShort(port.getPortNo().intValue());
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(port.getHwAddr()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(port.getHwAddr()));
writeName(port.getName(), outBuffer);
writePortConfig(port.getConfigV10(), outBuffer);
writePortState(port.getStateV10(), outBuffer);
ByteBufUtils.updateOFHeaderLength(outBuffer);
}
- private void writePortFeature(final PortFeaturesV10 feature, final ByteBuf outBuffer) {
+ private static void writePortFeature(final PortFeaturesV10 feature, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, feature.is_10mbHd());
map.put(1, feature.is_10mbFd());
outBuffer.writeInt(bitmap);
}
- private void writePortState(final PortStateV10 state, final ByteBuf outBuffer) {
+ private static void writePortState(final PortStateV10 state, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, state.isLinkDown());
map.put(1, state.isBlocked());
outBuffer.writeInt(bitmap);
}
- private void writePortConfig(final PortConfigV10 config, final ByteBuf outBuffer) {
+ private static void writePortConfig(final PortConfigV10 config, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, config.isPortDown());
map.put(1, config.isNoStp());
}
- private void writeName(final String name, final ByteBuf outBuffer) {
+ private static void writeName(final String name, final ByteBuf outBuffer) {
byte[] nameBytes = name.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 16) {
byte[] nameBytesPadding = new byte[16];
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
import io.netty.buffer.ByteBuf;
public void serialize(final PortModInput message, final ByteBuf outBuffer) {
ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH);
outBuffer.writeShort(message.getPortNo().getValue().intValue());
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(message.getHwAddress()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(message.getHwAddress()));
outBuffer.writeInt(createPortConfigBitmask(message.getConfigV10()));
outBuffer.writeInt(createPortConfigBitmask(message.getMaskV10()));
outBuffer.writeInt(createPortFeaturesBitmask(message.getAdvertiseV10()));
outBuffer.writeByte(message.getReason().getIntValue());
outBuffer.writeZero(PADDING);
outBuffer.writeShort(message.getPortNo().intValue());
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(message.getHwAddr()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(message.getHwAddr()));
writeName(message.getName(), outBuffer);
writePortConfig(message.getConfigV10(), outBuffer);
writePortState(message.getStateV10(), outBuffer);
ByteBufUtils.updateOFHeaderLength(outBuffer);
}
- private void writePortFeature(final PortFeaturesV10 feature, final ByteBuf outBuffer) {
+ private static void writePortFeature(final PortFeaturesV10 feature, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, feature.is_10mbHd());
map.put(1, feature.is_10mbFd());
outBuffer.writeInt(bitmap);
}
- private void writePortState(final PortStateV10 state, final ByteBuf outBuffer) {
+ private static void writePortState(final PortStateV10 state, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, state.isLinkDown());
map.put(1, state.isBlocked());
outBuffer.writeInt(bitmap);
}
- private void writePortConfig(final PortConfigV10 config, final ByteBuf outBuffer) {
+ private static void writePortConfig(final PortConfigV10 config, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, config.isPortDown());
map.put(1, config.isNoStp());
outBuffer.writeInt(bitmap);
}
- private void writeName(final String name, final ByteBuf outBuffer) {
+ private static void writeName(final String name, final ByteBuf outBuffer) {
byte[] nameBytes = name.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 16) {
byte[] nameBytesPadding = new byte[16];
// TODO: experimenterBody does not have get methods
}
- private void serializeQueueBody(MultipartReplyBody body, ByteBuf outBuffer) {
+ private static void serializeQueueBody(MultipartReplyBody body, ByteBuf outBuffer) {
MultipartReplyQueueCase queueCase = (MultipartReplyQueueCase) body;
MultipartReplyQueue queue = queueCase.getMultipartReplyQueue();
for (QueueStats queueStats : queue.getQueueStats()) {
}
}
- private void serializePortStatsBody(MultipartReplyBody body, ByteBuf outBuffer) {
+ private static void serializePortStatsBody(MultipartReplyBody body, ByteBuf outBuffer) {
MultipartReplyPortStatsCase portStatsCase = (MultipartReplyPortStatsCase) body;
MultipartReplyPortStats portStats = portStatsCase.getMultipartReplyPortStats();
for (PortStats portStat : portStats.getPortStats()) {
}
}
- private void serializeTableBody(MultipartReplyBody body, ByteBuf outBuffer) {
+ private static void serializeTableBody(MultipartReplyBody body, ByteBuf outBuffer) {
MultipartReplyTableCase tableCase = (MultipartReplyTableCase) body;
MultipartReplyTable table = tableCase.getMultipartReplyTable();
for (TableStats tableStats : table.getTableStats()) {
}
}
- private void writeFlowWildcardsV10(FlowWildcardsV10 feature, ByteBuf outBuffer) {
+ private static void writeFlowWildcardsV10(FlowWildcardsV10 feature, ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, feature.isINPORT());
map.put(1, feature.isDLVLAN());
outBuffer.writeInt(bitmap);
}
- private void serializeAggregateBody(MultipartReplyBody body, ByteBuf outBuffer) {
+ private static void serializeAggregateBody(MultipartReplyBody body, ByteBuf outBuffer) {
MultipartReplyAggregateCase aggregateCase = (MultipartReplyAggregateCase) body;
MultipartReplyAggregate aggregate = aggregateCase.getMultipartReplyAggregate();
outBuffer.writeLong(aggregate.getPacketCount().longValue());
}
}
- private void writeFlags(MultipartRequestFlags flags, ByteBuf outBuffer) {
+ private static void writeFlags(MultipartRequestFlags flags, ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, flags.isOFPMPFREQMORE());
int bitmap = ByteBufUtils.fillBitMaskFromMap(map);
outBuffer.writeShort(bitmap);
}
- private void serializeDescBody(MultipartReplyBody body, ByteBuf outBuffer) {
+ private static void serializeDescBody(MultipartReplyBody body, ByteBuf outBuffer) {
MultipartReplyDescCase descCase = (MultipartReplyDescCase) body;
MultipartReplyDesc desc = descCase.getMultipartReplyDesc();
write256String(desc.getMfrDesc(), outBuffer);
write256String(desc.getDpDesc(), outBuffer);
}
- private void write256String(String toWrite, ByteBuf outBuffer) {
+ private static void write256String(String toWrite, ByteBuf outBuffer) {
byte[] nameBytes = toWrite.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 256) {
byte[] nameBytesPadding = new byte[256];
}
}
- private void write16String(String toWrite, ByteBuf outBuffer) {
+ private static void write16String(String toWrite, ByteBuf outBuffer) {
byte[] nameBytes = toWrite.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 16) {
byte[] nameBytesPadding = new byte[16];
}
}
- private void write32String(String toWrite, ByteBuf outBuffer) {
+ private static void write32String(String toWrite, ByteBuf outBuffer) {
byte[] nameBytes = toWrite.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 32) {
byte[] nameBytesPadding = new byte[32];
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
import io.netty.buffer.ByteBuf;
ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH);
outBuffer.writeInt(message.getPortNo().getValue().intValue());
outBuffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE_01);
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(message.getHwAddress()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(message.getHwAddress()));
outBuffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE_02);
outBuffer.writeInt(createPortConfigBitmask(message.getConfig()));
outBuffer.writeInt(createPortConfigBitmask(message.getMask()));
outBuffer.writeZero(PADDING);
outBuffer.writeInt(message.getPortNo().intValue());
outBuffer.writeZero(PORT_PADDING_1);
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(message.getHwAddr()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(message.getHwAddr()));
outBuffer.writeZero(PORT_PADDING_2);
writeName(message.getName(), outBuffer);
writePortConfig(message.getConfig(), outBuffer);
ByteBufUtils.updateOFHeaderLength(outBuffer);
}
- private void writePortConfig(final PortConfig config, final ByteBuf outBuffer) {
+ private static void writePortConfig(final PortConfig config, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, config.isPortDown());
map.put(2, config.isNoRecv());
outBuffer.writeInt(bitmap);
}
- private void writeName(final String name, final ByteBuf outBuffer) {
+ private static void writeName(final String name, final ByteBuf outBuffer) {
byte[] nameBytes = name.getBytes(StandardCharsets.UTF_8);
if (nameBytes.length < 16) {
byte[] nameBytesPadding = new byte[16];
} else {
outBuffer.writeBytes(nameBytes);
}
-
}
- private void writePortState(final PortState state, final ByteBuf outBuffer) {
+ private static void writePortState(final PortState state, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, state.isLinkDown());
map.put(1, state.isBlocked());
outBuffer.writeInt(bitmap);
}
- private void writePortFeatures(final PortFeatures features, final ByteBuf outBuffer) {
+ private static void writePortFeatures(final PortFeatures features, final ByteBuf outBuffer) {
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, features.is_10mbHd());
map.put(1, features.is_10mbFd());
ByteBufUtils.updateOFHeaderLength(outBuffer);
}
- private void serializeRateBody(RateQueueProperty body, ByteBuf outBuffer) {
+ private static void serializeRateBody(RateQueueProperty body, ByteBuf outBuffer) {
outBuffer.writeShort(body.getRate().toJava());
outBuffer.writeZero(PROPERTY_RATE_PADDING);
}
- private void serializeExperimenterBody(ExperimenterIdQueueProperty body, ByteBuf outBuffer) {
+ private static void serializeExperimenterBody(ExperimenterIdQueueProperty body, ByteBuf outBuffer) {
// TODO: Experimenter Data is vendor specific that should implement its
// own serializer
outBuffer.writeInt(body.getExperimenter().getValue().intValue());
public abstract class AbstractOxmMacAddressSerializer extends AbstractOxmMatchEntrySerializer {
protected void writeMacAddress(final MacAddress address, final ByteBuf outBuffer) {
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address)); // 48 b + mask [OF 1.3.2 spec]
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(address)); // 48 b + mask [OF 1.3.2 spec]
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.util;
import io.netty.buffer.ByteBuf;
* @author michal.polkorab
*/
public class OF10MatchSerializer implements OFSerializer<MatchV10> {
-
private static final byte PADDING_IN_MATCH = 1;
private static final byte PADDING_IN_MATCH_2 = 2;
private static final byte NW_SRC_SHIFT = 8;
outBuffer.writeInt(encodeWildcards(match.getWildcards(), match.getNwSrcMask().toJava(),
match.getNwDstMask().toJava()));
outBuffer.writeShort(match.getInPort().toJava());
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(match.getDlSrc()));
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(match.getDlDst()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(match.getDlSrc()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(match.getDlDst()));
outBuffer.writeShort(match.getDlVlan().toJava());
outBuffer.writeByte(match.getDlVlanPcp().toJava());
outBuffer.writeZero(PADDING_IN_MATCH);
}
- private List<Instruction> createInstructions() {
+ private static List<Instruction> createInstructions() {
final List<Instruction> instructions = new ArrayList<>();
InstructionBuilder insBuilder = new InstructionBuilder();
GotoTableCaseBuilder goToCaseBuilder = new GotoTableCaseBuilder();
return instructions;
}
- private Match createMatch() {
+ private static Match createMatch() {
MatchBuilder matchBuilder = new MatchBuilder();
matchBuilder.setType(OxmMatchType.class);
final List<MatchEntry> entries = new ArrayList<>();
Assert.assertArrayEquals("Wrong data", data, deserializedMessage.getData());
}
- private List<Action> createAction() {
+ private static List<Action> createAction() {
final List<Action> actions = new ArrayList<>();
ActionBuilder actionBuilder = new ActionBuilder();
PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
actions.add(actionBuilder.build());
return actions;
}
-
}
serializedBuffer.skipBytes(6);
}
- private List<Queues> createQueues() {
+ private static List<Queues> createQueues() {
List<Queues> list = new ArrayList<>();
QueuesBuilder builder = new QueuesBuilder();
builder.setQueueId(new QueueId(1L));
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
import static org.junit.Assert.assertEquals;
assertEquals(packetType, buffer.readUnsignedInt());
}
- private MatchEntry createMatchEntry(long packetType) {
+ private static MatchEntry createMatchEntry(long packetType) {
PacketTypeCase packetTypeCase = new PacketTypeCaseBuilder()
.setPacketType(new PacketTypeBuilder().setPacketType(packetType).build())
.build();
}
}
- private void logErrors(final InetSocketAddress remoteAddress, final RpcResult<EchoOutput> echoReplyValue) {
+ private static void logErrors(final InetSocketAddress remoteAddress, final RpcResult<EchoOutput> echoReplyValue) {
for (RpcError replyError : echoReplyValue.getErrors()) {
Throwable cause = replyError.getCause();
if (LOG.isWarnEnabled()) {
@Override
public void onSslConnectionError(SslConnectionError notification) {
IpAddress ip = null;
- if ((connectionContext.getConnectionAdapter() != null)
- && (connectionContext.getConnectionAdapter().getRemoteAddress() != null)
- && (connectionContext.getConnectionAdapter().getRemoteAddress().getAddress() != null)) {
+ if (connectionContext.getConnectionAdapter() != null
+ && connectionContext.getConnectionAdapter().getRemoteAddress() != null
+ && connectionContext.getConnectionAdapter().getRemoteAddress().getAddress() != null) {
ip = IpAddressBuilder.getDefaultInstance(
connectionContext.getConnectionAdapter().getRemoteAddress().getAddress().getHostAddress());
}
@Override
public void storeStatistics(final FlowAndStatisticsMapList statistics, final boolean withParents) {
- statistics.nonnullFlowAndStatisticsMapList().values()
+ statistics.nonnullFlowAndStatisticsMapList()
.forEach(stat -> {
final FlowBuilder flow = new FlowBuilder(stat)
.addAugmentation(
}
} else if (contextChain.isMastered(mastershipState, false)) {
LOG.info("Role MASTER was granted to device {}", deviceInfo);
+ OF_EVENT_LOG.debug("Master Elected, Node: {}", deviceInfo.getDatapathId());
deviceManager.sendNodeAddedNotification(deviceInfo.getNodeInstanceIdentifier());
}
});
};
}
- private String getDpnIdFromNodeName(final String nodeName) {
+ private static String getDpnIdFromNodeName(final String nodeName) {
return nodeName.substring(nodeName.lastIndexOf(SEPARATOR) + 1);
}
return Optional.empty();
}
- private org.opendaylight.mdsal.eos.binding.api.Entity createNodeEntity(final String nodeId) {
+ private static org.opendaylight.mdsal.eos.binding.api.Entity createNodeEntity(final String nodeId) {
return new org.opendaylight.mdsal.eos.binding.api.Entity(ASYNC_SERVICE_ENTITY_TYPE, nodeId);
}
}
import org.opendaylight.openflowplugin.impl.util.MatchUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyFlowStatsBuilder builder = new MultipartReplyFlowStatsBuilder();
final List<FlowAndStatisticsMapList> items = new ArrayList<>();
- int key = 0;
while (message.readableBytes() > 0) {
final FlowAndStatisticsMapListBuilder itemBuilder = new FlowAndStatisticsMapListBuilder();
.build());
}
- itemBuilder.withKey(new FlowAndStatisticsMapListKey(new FlowId(String.valueOf(key++))));
items.add(itemBuilder.build());
}
.build();
}
- private TableConfig readTableConfig(final ByteBuf message) {
+ private static TableConfig readTableConfig(final ByteBuf message) {
final long input = message.readUnsignedInt();
final boolean deprecated = (input & 3) != 0;
.build();
}
- private List<SetFieldMatch> readMatchFields(final ByteBuf message, final int length) {
+ private static List<SetFieldMatch> readMatchFields(final ByteBuf message, final int length) {
final List<SetFieldMatch> matchFields = new ArrayList<>();
final int startIndex = message.readerIndex();
*/
protected static void writeMacAddress(final MacAddress address, final ByteBuf outBuffer) {
// 48 b + mask [OF 1.3.2 spec]
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(address));
}
/**
outBuffer.writeInt(OpenflowPortsUtil
.getProtocolPortNumber(OpenflowVersion.OF13, message.getPortNumber()).intValue());
outBuffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE_01);
- outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(message.getHardwareAddress()));
+ outBuffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(message.getHardwareAddress()));
outBuffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE_02);
outBuffer.writeInt(createPortConfigBitMask(message.getConfiguration()));
outBuffer.writeInt(MoreObjects
return transform(echoService.handleServiceCall(echoInputBld));
}
- private ListenableFuture<RpcResult<SendEchoOutput>>
+ private static ListenableFuture<RpcResult<SendEchoOutput>>
transform(final ListenableFuture<RpcResult<EchoOutput>> rpcResultListenableFuture) {
return Futures.transform(rpcResultListenableFuture, input -> {
Preconditions.checkNotNull(input, "echoOutput value is never expected to be NULL");
return mdInput.build();
}
- private Port getPortFromInput(final UpdatePortInput input) {
+ private static Port getPortFromInput(final UpdatePortInput input) {
return input.getUpdatedPort().getPort().nonnullPort().values().iterator().next();
}
}
}
@VisibleForTesting
- protected List<Class<? extends MeterBand>> extractSupportedMeterBand(MultipartReplyMeterFeatures replyBody,
+ protected static List<Class<? extends MeterBand>> extractSupportedMeterBand(MultipartReplyMeterFeatures replyBody,
MeterBandTypeBitmap bandTypes) {
List<Class<? extends MeterBand>> supportedMeterBand = new ArrayList<>();
if (bandTypes.isOFPMBTDROP()) {
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
for (final FlowAndStatisticsMapList part : flowAndStatisticsMapLists) {
final FlowId flowId = new FlowId(generateFlowId(part).getValue());
statsList.add(new FlowAndStatisticsMapListBuilder(part)
- .withKey(new FlowAndStatisticsMapListKey(flowId))
.setFlowId(flowId)
.build());
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.multipart.request.flow.stats.FlowStatsBuilder;
.setFlowAndStatisticsMapList(input
.stream()
.flatMap(multipartReply -> ((MultipartReplyFlowStats) multipartReply.getMultipartReplyBody())
- .nonnullFlowAndStatisticsMapList().values()
+ .nonnullFlowAndStatisticsMapList()
.stream())
.map(flowAndStatisticsMapList -> {
final FlowId flowId = new FlowId(generateFlowId(flowAndStatisticsMapList));
return new FlowAndStatisticsMapListBuilder(flowAndStatisticsMapList)
- .withKey(new FlowAndStatisticsMapListKey(flowId))
.setFlowId(flowId)
.build();
})
return Uint8.valueOf(flowRemoved.getTableId().getValue());
}
- private RemovedFlowReason translateReason(final FlowRemoved removedFlow) {
+ private static RemovedFlowReason translateReason(final FlowRemoved removedFlow) {
LOG.debug("--Entering translateReason within FlowRemovedTranslator with reason: {}", removedFlow.getReason());
switch (removedFlow.getReason()) {
case OFPRRIDLETIMEOUT:
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.common;
import org.junit.Assert;
Assert.assertEquals(xid, mpRqInput.getXid().longValue());
}
- private void checkEmptyBody(Class<? extends DataContainer> mpRqBody, Class<? extends
+ private static void checkEmptyBody(Class<? extends DataContainer> mpRqBody, Class<? extends
MultipartRequestBody> expectedMpRqBodyClass) {
Assert.assertTrue(expectedMpRqBodyClass.isAssignableFrom(mpRqBody));
Assert.assertEquals(expectedMpRqBodyClass, mpRqBody);
verify(writeTx).commit();
}
- private ConnectionContext prepareConnectionContext() {
+ private static ConnectionContext prepareConnectionContext() {
final ConnectionContext mockedConnectionContext = mock(ConnectionContext.class);
final FeaturesReply mockedFeaturesReply = mock(FeaturesReply.class);
when(mockedFeaturesReply.getAuxiliaryId()).thenReturn(DUMMY_AUXILIARY_ID);
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
final MacAddress arpSourceHardwareAddressMask = new MacAddress("00:00:00:00:00:00");
writeHeader(in, false);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpSourceHardwareAddress));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(arpSourceHardwareAddress));
assertEquals(arpSourceHardwareAddress.getValue(),
((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceHardwareAddress().getAddress()
assertEquals(0, in.readableBytes());
writeHeader(in, true);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpSourceHardwareAddress));
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpSourceHardwareAddressMask));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(arpSourceHardwareAddress));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(arpSourceHardwareAddressMask));
final ArpSourceHardwareAddress desAddress =
((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceHardwareAddress();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
final MacAddress arpTargetHardwareAddressMask = new MacAddress("00:00:00:00:00:00");
writeHeader(in, false);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpTargetHardwareAddress));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(arpTargetHardwareAddress));
assertEquals(arpTargetHardwareAddress.getValue(),
((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetHardwareAddress().getAddress()
assertEquals(0, in.readableBytes());
writeHeader(in, true);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpTargetHardwareAddress));
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpTargetHardwareAddressMask));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(arpTargetHardwareAddress));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(arpTargetHardwareAddressMask));
final ArpTargetHardwareAddress desAddress =
((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetHardwareAddress();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
final MacAddress ethernetDestinationAddressMask = new MacAddress("00:00:00:00:00:00");
writeHeader(in, false);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ethernetDestinationAddress));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(ethernetDestinationAddress));
assertEquals(ethernetDestinationAddress.getValue(), deserialize(in).getEthernetMatch().getEthernetDestination()
.getAddress().getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ethernetDestinationAddress));
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ethernetDestinationAddressMask));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(ethernetDestinationAddress));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(ethernetDestinationAddressMask));
final EthernetDestination desAddress = deserialize(in).getEthernetMatch().getEthernetDestination();
assertEquals(ethernetDestinationAddress.getValue(), desAddress.getAddress().getValue());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
final MacAddress ethernetSourceAddressMask = new MacAddress("00:00:00:00:00:00");
writeHeader(in, false);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ethernetSourceAddress));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(ethernetSourceAddress));
assertEquals(ethernetSourceAddress.getValue(),
deserialize(in).getEthernetMatch().getEthernetSource().getAddress().getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ethernetSourceAddress));
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ethernetSourceAddressMask));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(ethernetSourceAddress));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(ethernetSourceAddressMask));
final EthernetSource desAddress = deserialize(in).getEthernetMatch().getEthernetSource();
assertEquals(ethernetSourceAddress.getValue(), desAddress.getAddress().getValue());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
final MacAddress address = new MacAddress("00:01:02:03:04:05");
writeHeader(in, false);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(address));
Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(address.getValue(), match.getIpv6NdSll().getValue());
protected int getValueLength() {
return EncodeConstants.MAC_ADDRESS_LENGTH;
}
-
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
final MacAddress address = new MacAddress("00:01:02:03:04:05");
writeHeader(in, false);
- in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
+ in.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(address));
Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(address.getValue(), match.getIpv6NdTll().getValue());
protected int getValueLength() {
return EncodeConstants.MAC_ADDRESS_LENGTH;
}
-
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.protocol.deserialization.messages;
import static org.junit.Assert.assertEquals;
buffer.writeInt(XID);
buffer.writeInt(PORT);
buffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE_1);
- buffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ADDRESS));
+ buffer.writeBytes(IetfYangUtil.INSTANCE.macAddressBytes(ADDRESS));
final int config = ByteBufUtils.fillBitMaskFromMap(ImmutableMap
.<Integer, Boolean>builder()
final MultipartReplyFlowStats reply = (MultipartReplyFlowStats) deserializeMultipart(buffer);
final FlowAndStatisticsMapList flowAndStatisticsMapList =
- reply.nonnullFlowAndStatisticsMapList().values().iterator().next();
+ reply.nonnullFlowAndStatisticsMapList().iterator().next();
assertEquals(TABLE_ID, flowAndStatisticsMapList.getTableId().shortValue());
assertEquals(SECOND, flowAndStatisticsMapList.getDuration().getSecond().getValue().intValue());
assertEquals(NANOSECOND, flowAndStatisticsMapList.getDuration().getNanosecond().getValue().intValue());
assertEquals(XID, message.getXid().intValue());
final FlowAndStatisticsMapList flowAndStatisticsMapList =
- reply.nonnullFlowAndStatisticsMapList().values().iterator().next();
+ reply.nonnullFlowAndStatisticsMapList().iterator().next();
assertEquals(TABLE_ID, flowAndStatisticsMapList.getTableId().shortValue());
assertEquals(SECOND, flowAndStatisticsMapList.getDuration().getSecond().getValue().intValue());
assertEquals(NANOSECOND, flowAndStatisticsMapList.getDuration().getNanosecond().getValue().intValue());
return MultipartType.OFPMPMETERCONFIG.getIntValue();
}
- private void writeCommonAtributes(final ByteBuf buffer) {
+ private static void writeCommonAtributes(final ByteBuf buffer) {
buffer.writeShort(ITEM_LENGTH);
buffer.writeShort(ByteBufUtils.fillBitMask(0,
FLAGS.isMeterKbps(),
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.protocol.deserialization.multipart;
import static org.junit.Assert.assertEquals;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
public class TableFeaturesMatchFieldDeserializerTest {
- private TableFeaturesMatchFieldDeserializer deserializer = new TableFeaturesMatchFieldDeserializer();
+ private final TableFeaturesMatchFieldDeserializer deserializer = new TableFeaturesMatchFieldDeserializer();
@Test
public void deserialize() {
assertEquals(0, buffer.readableBytes());
}
- private void addValues(ByteBuf buffer, int oxmClass, int oxmField) {
+ private static void addValues(ByteBuf buffer, int oxmClass, int oxmField) {
buffer.clear();
buffer.writeShort(oxmClass);
buffer.writeByte(oxmField << 1);
FlowsStatisticsUpdate flowStats = FLOWS_STATISTICS_UPDATE_BUILDER.build();
HashSet<FlowRegistryKey> flowRegistryKeys = new HashSet<>();
- for (FlowAndStatisticsMapList item : flowStats.nonnullFlowAndStatisticsMapList().values()) {
+ for (FlowAndStatisticsMapList item : flowStats.nonnullFlowAndStatisticsMapList()) {
final FlowRegistryKey key1 = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), item);
final FlowRegistryKey key2 = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), item);
flowRegistryKeys.add(key1);
public void testGetHash() {
FlowsStatisticsUpdate flowStats = FLOWS_STATISTICS_UPDATE_BUILDER.build();
- for (FlowAndStatisticsMapList item : flowStats.nonnullFlowAndStatisticsMapList().values()) {
+ for (FlowAndStatisticsMapList item : flowStats.nonnullFlowAndStatisticsMapList()) {
FlowRegistryKey flowRegistryKey = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), item);
FlowRegistryKey lastHash = null;
if (null != lastHash) {
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
flowAndStatisticsMapListBuilder.setMatch(matchBuilder.build());
- flowAndStatisticsMapListBuilder.withKey(new FlowAndStatisticsMapListKey(new FlowId(String.valueOf(index))));
+ flowAndStatisticsMapListBuilder.setFlowId(new FlowId(String.valueOf(index)));
return flowAndStatisticsMapListBuilder;
}
}
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
+import java.util.concurrent.ExecutionException;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.connection.DeviceRequestFailedException;
public void onSuccess(final Object object) {
}
-
};
-
}
@Test
assertEquals(DUMMY_MESSAGE_ILLEGAL_STATE_EXCEPTION, rpcError.getMessage());
}
- private RpcError provideRpcError(final ListenableFuture futureResult) throws InterruptedException,
- java.util.concurrent.ExecutionException {
+ private static RpcError provideRpcError(final ListenableFuture futureResult)
+ throws InterruptedException, ExecutionException {
final Object result = futureResult.get();
assertTrue(result instanceof RpcResult);
RpcResult rpcResult = (RpcResult) result;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.services.batch;
import com.google.common.collect.Lists;
Assert.assertEquals("2", iterator.next().getFlowId().getValue());
}
- private FlatBatchAddFlow createAddFlowBatch(final String flowIdValue) {
+ private static FlatBatchAddFlow createAddFlowBatch(final String flowIdValue) {
return new FlatBatchAddFlowBuilder()
.setFlowId(new FlowId(flowIdValue))
.build();
}
- private FlatBatchRemoveFlow createRemoveFlowBatch(final String flowIdValue) {
+ private static FlatBatchRemoveFlow createRemoveFlowBatch(final String flowIdValue) {
return new FlatBatchRemoveFlowBuilder()
.setFlowId(new FlowId(flowIdValue))
.build();
}
- private FlatBatchUpdateFlow createUpdateFlowBatch(final String flowIdValue) {
+ private static FlatBatchUpdateFlow createUpdateFlowBatch(final String flowIdValue) {
return new FlatBatchUpdateFlowBuilder()
.setFlowId(new FlowId(flowIdValue))
.build();
Assert.assertEquals(0, rpcResult.getResult().nonnullBatchFailure().size());
}
- private BatchFailedFlowsOutput createBatchFailedFlowsOutput(final Integer batchOrder, final String flowIdValue) {
+ private static BatchFailedFlowsOutput createBatchFailedFlowsOutput(final Integer batchOrder,
+ final String flowIdValue) {
return new BatchFailedFlowsOutputBuilder()
.setFlowId(new FlowId(flowIdValue))
.setBatchOrder(batchOrder)
.build();
}
- private BatchFailure createChainFailure(final int batchOrder, final String flowIdValue) {
+ private static BatchFailure createChainFailure(final int batchOrder, final String flowIdValue) {
return new BatchFailureBuilder()
.setBatchOrder(batchOrder)
.setBatchItemIdChoice(new FlatBatchFailureFlowIdCaseBuilder()
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.services.batch;
import com.google.common.collect.Lists;
Assert.assertEquals(2L, iterator.next().getGroupId().getValue().longValue());
}
- private FlatBatchAddGroup createAddGroupBatch(final long groupIdValue) {
+ private static FlatBatchAddGroup createAddGroupBatch(final long groupIdValue) {
return new FlatBatchAddGroupBuilder()
.setGroupId(new GroupId(groupIdValue))
.build();
}
- private FlatBatchRemoveGroup createRemoveGroupBatch(final long groupIdValue) {
+ private static FlatBatchRemoveGroup createRemoveGroupBatch(final long groupIdValue) {
return new FlatBatchRemoveGroupBuilder()
.setGroupId(new GroupId(groupIdValue))
.build();
}
- private FlatBatchUpdateGroup createUpdateGroupBatch(final long groupIdValue) {
+ private static FlatBatchUpdateGroup createUpdateGroupBatch(final long groupIdValue) {
return new FlatBatchUpdateGroupBuilder()
.setOriginalBatchedGroup(new OriginalBatchedGroupBuilder()
.setGroupId(new GroupId(groupIdValue))
Assert.assertEquals(0, rpcResult.getResult().nonnullBatchFailure().size());
}
- private BatchFailedGroupsOutput createBatchFailedGroupsOutput(final Integer batchOrder, final long groupIdValue) {
+ private static BatchFailedGroupsOutput createBatchFailedGroupsOutput(final Integer batchOrder,
+ final long groupIdValue) {
return new BatchFailedGroupsOutputBuilder()
.setGroupId(new GroupId(groupIdValue))
.setBatchOrder(batchOrder)
.build();
}
- private BatchFailure createChainFailure(final int batchOrder, final long groupIdValue) {
+ private static BatchFailure createChainFailure(final int batchOrder, final long groupIdValue) {
return new BatchFailureBuilder()
.setBatchOrder(batchOrder)
.setBatchItemIdChoice(new FlatBatchFailureGroupIdCaseBuilder()
Assert.assertEquals(2L, it.next().getMeterId().getValue().longValue());
}
- private FlatBatchAddMeter createAddMeterBatch(final long groupIdValue) {
+ private static FlatBatchAddMeter createAddMeterBatch(final long groupIdValue) {
return new FlatBatchAddMeterBuilder()
.setMeterId(new MeterId(groupIdValue))
.build();
}
- private FlatBatchRemoveMeter createRemoveMeterBatch(final long groupIdValue) {
+ private static FlatBatchRemoveMeter createRemoveMeterBatch(final long groupIdValue) {
return new FlatBatchRemoveMeterBuilder()
.setMeterId(new MeterId(groupIdValue))
.build();
}
- private FlatBatchUpdateMeter createUpdateMeterBatch(final long groupIdValue) {
+ private static FlatBatchUpdateMeter createUpdateMeterBatch(final long groupIdValue) {
return new FlatBatchUpdateMeterBuilder()
.setOriginalBatchedMeter(new OriginalBatchedMeterBuilder()
.setMeterId(new MeterId(groupIdValue))
Assert.assertEquals(0, rpcResult.getResult().nonnullBatchFailure().size());
}
- private BatchFailedMetersOutput createBatchFailedMetersOutput(final Integer batchOrder, final long groupIdValue) {
+ private static BatchFailedMetersOutput createBatchFailedMetersOutput(final Integer batchOrder,
+ final long groupIdValue) {
return new BatchFailedMetersOutputBuilder()
.setMeterId(new MeterId(groupIdValue))
.setBatchOrder(batchOrder)
.build();
}
- private BatchFailure createChainFailure(final int batchOrder, final long groupIdValue) {
+ private static BatchFailure createChainFailure(final int batchOrder, final long groupIdValue) {
return new BatchFailureBuilder()
.setBatchOrder(batchOrder)
.setBatchItemIdChoice(new FlatBatchFailureMeterIdCaseBuilder()
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.services.sal;
import static org.junit.Assert.assertEquals;
assertEquals(DUMMY_XID_VALUE, setConfigInput.getXid());
}
- private SetConfigInput dummyConfigInput() {
+ private static SetConfigInput dummyConfigInput() {
SetConfigInputBuilder setConfigInputBuilder = new SetConfigInputBuilder();
setConfigInputBuilder.setFlag(DUMMY_FLAG_STR);
setConfigInputBuilder.setMissSearchLength(DUMMY_MISS_SEARCH_LENGTH);
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.services.sal;
import com.google.common.collect.Lists;
return createFlowAddBatch(batchOrder, flowIdValue, 1);
}
- private Batch createFlowAddBatch(final int batchOrder, final String flowIdValue, final int amount) {
+ private static Batch createFlowAddBatch(final int batchOrder, final String flowIdValue, final int amount) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.setBatchChoice(new FlatBatchAddFlowCaseBuilder()
.build();
}
- private List<FlatBatchAddFlow> repeatFlatBatchAddFlowInList(final String flowIdValue, final int amount) {
+ private static List<FlatBatchAddFlow> repeatFlatBatchAddFlowInList(final String flowIdValue, final int amount) {
final List<FlatBatchAddFlow> list = new ArrayList<>();
for (int i = 0; i < amount; i++) {
list.add(new FlatBatchAddFlowBuilder()
return list;
}
- private <T> List<T> repeatInList(final T item, final int amount) {
+ private static <T> List<T> repeatInList(final T item, final int amount) {
final List<T> list = new ArrayList<>();
for (int i = 0; i < amount; i++) {
list.add(item);
return list;
}
- private Batch createFlowRemoveBatch(final int batchOrder, final String flowIdValue) {
+ private static Batch createFlowRemoveBatch(final int batchOrder, final String flowIdValue) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.setBatchChoice(new FlatBatchRemoveFlowCaseBuilder()
.build();
}
- private Batch createFlowUpdateBatch(final int batchOrder, final String flowIdValue) {
+ private static Batch createFlowUpdateBatch(final int batchOrder, final String flowIdValue) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.withKey(new BatchKey(batchOrder))
.build();
}
- private Batch createGroupAddBatch(final int batchOrder, final long groupIdValue) {
+ private static Batch createGroupAddBatch(final int batchOrder, final long groupIdValue) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.setBatchChoice(new FlatBatchAddGroupCaseBuilder()
.build();
}
- private Batch createGroupRemoveBatch(final int batchOrder, final long groupIdValue) {
+ private static Batch createGroupRemoveBatch(final int batchOrder, final long groupIdValue) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.setBatchChoice(new FlatBatchRemoveGroupCaseBuilder()
.build();
}
- private Batch createGroupUpdateBatch(final int batchOrder, final long groupIdValue) {
+ private static Batch createGroupUpdateBatch(final int batchOrder, final long groupIdValue) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.setBatchChoice(new FlatBatchUpdateGroupCaseBuilder()
.build();
}
- private Batch createMeterAddBatch(final int batchOrder, final long groupIdValue) {
+ private static Batch createMeterAddBatch(final int batchOrder, final long groupIdValue) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.setBatchChoice(new FlatBatchAddMeterCaseBuilder()
.build();
}
- private Batch createMeterRemoveBatch(final int batchOrder, final long groupIdValue) {
+ private static Batch createMeterRemoveBatch(final int batchOrder, final long groupIdValue) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.setBatchChoice(new FlatBatchRemoveMeterCaseBuilder()
.build();
}
- private Batch createMeterUpdateBatch(final int batchOrder, final long groupIdValue) {
+ private static Batch createMeterUpdateBatch(final int batchOrder, final long groupIdValue) {
return new BatchBuilder()
.setBatchOrder(batchOrder)
.setBatchChoice(new FlatBatchUpdateMeterCaseBuilder()
.getFlowId().getValue());
}
- private BatchFailure createFlowBatchFailure(final int batchOrder, final String flowIdValue) {
+ private static BatchFailure createFlowBatchFailure(final int batchOrder, final String flowIdValue) {
return new BatchFailureBuilder()
.setBatchOrder(batchOrder)
.setBatchItemIdChoice(new FlatBatchFailureFlowIdCaseBuilder()
.build();
}
- private ProcessFlatBatchOutput createFlatBatchOutput(final BatchFailure... batchFailures) {
+ private static ProcessFlatBatchOutput createFlatBatchOutput(final BatchFailure... batchFailures) {
return new ProcessFlatBatchOutputBuilder()
.setBatchFailure(Lists.newArrayList(batchFailures))
.build();
final OfHeader ofHeader = salPortService.buildRequest(new Xid(DUMMY_XID), dummyUpdatePortInput());
}
- private UpdatePortInput dummyUpdatePortInput() {
+ private static UpdatePortInput dummyUpdatePortInput() {
org.opendaylight.yang.gen.v1.urn
.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder concretePortBuilder
= new org.opendaylight.yang.gen.v1.urn
verify(mockedRequestContextStack).createRequestContext();
}
- private UpdateTableInput prepareUpdateTable() {
+ private static UpdateTableInput prepareUpdateTable() {
UpdateTableInputBuilder updateTableInputBuilder = new UpdateTableInputBuilder();
UpdatedTableBuilder updatedTableBuilder = new UpdatedTableBuilder();
updatedTableBuilder.setTableFeatures(Collections.emptyList());
assertEquals(DUMMY_GROUPS_TYPE,groupDescStat.getGroupType());
}
- private MultipartReplyBody prepareMultipartReplyGroupDesc() {
+ private static MultipartReplyBody prepareMultipartReplyGroupDesc() {
GroupDescBuilder groupDescBuilder = new GroupDescBuilder();
groupDescBuilder.setGroupId(DUMMY_GROUP_ID);
groupDescBuilder.setBucketsList(Collections.emptyList());
return multipartReplyGroupDescCaseBuilder.build();
}
- private MultipartReplyBody prepareMultipartReplyGroup() {
+ private static MultipartReplyBody prepareMultipartReplyGroup() {
GroupStatsBuilder groupStatsBuilder = new GroupStatsBuilder();
groupStatsBuilder.setByteCount(DUMMY_BYTE_COUNT);
groupStatsBuilder.setBucketStats(Collections.emptyList());
return multipartReplyGroupCaseBuilder.build();
}
- private MultipartReplyBody prepareMultipartReplyPortStats() {
+ private static MultipartReplyBody prepareMultipartReplyPortStats() {
PortStatsBuilder dummyPortStatBuilder = new PortStatsBuilder();
dummyPortStatBuilder.setPortNo(DUMMY_PORT_NO);
dummyPortStatBuilder.setRxBytes(DUMMY_RX_BYTES);
}
- private MultipartReplyBody prepareMultipartReplyAggregate() {
+ private static MultipartReplyBody prepareMultipartReplyAggregate() {
MultipartReplyAggregateBuilder multipartReplyAggregateBuilder = new MultipartReplyAggregateBuilder();
multipartReplyAggregateBuilder.setByteCount(DUMMY_BYTE_COUNT);
multipartReplyAggregateBuilder.setPacketCount(DUMMY_PACKET_COUNT);
return multipartReplyAggregateCaseBuilder.build();
}
- private MultipartReplyBody prepareMultipartReplyFlow() {
+ private static MultipartReplyBody prepareMultipartReplyFlow() {
MultipartReplyFlowCaseBuilder multipartReplyFlowCaseBuilder = new MultipartReplyFlowCaseBuilder();
MultipartReplyFlowBuilder multipartReplyFlowBuilder = new MultipartReplyFlowBuilder();
multipartReplyFlowBuilder.setFlowStats(Collections.emptyList());
return multipartReplyFlowCaseBuilder.build();
}
- private MultipartReplyMessage prepareMocks(final DeviceContext mockedDeviceContext,
+ private static MultipartReplyMessage prepareMocks(final DeviceContext mockedDeviceContext,
final MultipartReplyBody multipartReplyBody,
final MultipartType multipartType) {
ConnectionContext mockedConnectionContext = mock(ConnectionContext.class);
return multipartReplyMessage;
}
- private DataContainer validateOutput(final DataContainer dataObject) {
+ private static DataContainer validateOutput(final DataContainer dataObject) {
return dataObject;
}
}
Assert.assertEquals(42, flow.getValue().getTableId().intValue());
}
- private Iterable<FlowsStatisticsUpdate> prepareFlowStatisticsData() {
+ private static Iterable<FlowsStatisticsUpdate> prepareFlowStatisticsData() {
final FlowAndStatisticsMapListBuilder flowAndStatsMapListBld = new FlowAndStatisticsMapListBuilder();
flowAndStatsMapListBld.setTableId((short) 42);
flowAndStatsMapListBld.setMatch(new MatchBuilder().build());
Assert.assertTrue(timeCounter.getAverageTimeBetweenMarks() >= 3);
}
- private void zzz(long length) {
+ private static void zzz(long length) {
try {
Thread.sleep(length);
} catch (InterruptedException e) {
import org.junit.Test;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
-
public class MessageIntelligenceAgencyImplTest {
@Test
"FROM_SWITCH: MSG[String] -> +1 | 1", "TO_SWITCH_ENTERED: MSG[Integer] -> +1 | 1");
}
- private void findExpectedStatistics(final List<String> statisticsInfo, String ... expectedValues) {
+ private static void findExpectedStatistics(final List<String> statisticsInfo, String ... expectedValues) {
for (String expectedValue : expectedValues) {
assertTrue("Expected value " + expectedValue + "wasn't found.",
findValueInStatistics(statisticsInfo, expectedValue));
}
}
- private boolean findValueInStatistics(List<String> statisticsInfo, String expectedValue) {
+ private static boolean findValueInStatistics(List<String> statisticsInfo, String expectedValue) {
for (String pieceOfInfo : statisticsInfo) {
if (pieceOfInfo.equals(expectedValue)) {
return true;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowAndStatisticsMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
final GetFlowStatisticsOutput output = service.buildReply(input, true);
assertTrue(output.nonnullFlowAndStatisticsMapList().size() > 0);
- final FlowAndStatisticsMap stats = output.nonnullFlowAndStatisticsMapList().values().iterator().next();
+ final FlowAndStatisticsMap stats = output.nonnullFlowAndStatisticsMapList().iterator().next();
assertEquals(stats.getTableId(), TABLE_NO);
}
when(stat.getTableId()).thenReturn(TABLE_NO);
when(stat.getMatch()).thenReturn(new MatchBuilder().build());
- final Map<FlowAndStatisticsMapListKey, FlowAndStatisticsMapList> stats
- = Collections.singletonMap(stat.key(), stat);
+ final List<FlowAndStatisticsMapList> stats = Collections.singletonList(stat);
final GetFlowStatisticsOutput output = mock(GetFlowStatisticsOutput.class);
when(output.nonnullFlowAndStatisticsMapList()).thenReturn(stats);
import static org.mockito.Mockito.when;
import java.math.BigInteger;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowAndStatisticsMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReplyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.common.Uint8;
public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsServiceTest {
@Override
public void setUp() {
+ final DeviceFlowRegistry registry = mock(DeviceFlowRegistry.class);
service = new FlowDirectStatisticsService(requestContextStack,
deviceContext,
convertorManager,
multipartWriterProvider);
- final DeviceFlowRegistry registry = mock(DeviceFlowRegistry.class);
when(registry.retrieveDescriptor(any())).thenReturn(FlowDescriptorFactory.create(TABLE_NO, new FlowId("1")));
when(deviceContext.getDeviceFlowRegistry()).thenReturn(registry);
}
final FlowAndStatisticsMapList flowStat = new FlowAndStatisticsMapListBuilder()
.setDuration(new DurationBuilder()
.setSecond(new Counter32(1L))
- .setNanosecond(new Counter32(1L))
+ .setNanosecond(new Counter32(2L))
.build())
- .setTableId(TABLE_NO)
- .setByteCount(new Counter64(BigInteger.ONE))
- .setPacketCount(new Counter64(BigInteger.ONE))
+ .setTableId(Uint8.valueOf(50))
+ .setByteCount(new Counter64(BigInteger.valueOf(7094)))
+ .setPacketCount(new Counter64(BigInteger.valueOf(63)))
+ .setCookie(new FlowCookie(Uint64.valueOf(134419365)))
.setFlags(new FlowModFlags(true, false, false, false, false))
- .setMatch(new MatchBuilder().build())
+ .setMatch(new MatchBuilder().setEthernetMatch(
+ new EthernetMatchBuilder()
+ .setEthernetDestination(
+ new EthernetDestinationBuilder()
+ .setAddress(new MacAddress("fa:16:3e:92:81:45"))
+ .build()).build()).build())
+ .setInstructions(new InstructionsBuilder().build())
+ .setPriority(Uint16.valueOf(20))
.build();
final MultipartReply reply = new MultipartReplyBuilder()
.build())
.build();
- final List<MultipartReply> input = Collections.singletonList(reply);
+ final FlowAndStatisticsMapList flowStat1 = new FlowAndStatisticsMapListBuilder()
+ .setDuration(new DurationBuilder()
+ .setSecond(new Counter32(1L))
+ .setNanosecond(new Counter32(2L))
+ .build())
+ .setTableId(Uint8.valueOf(51))
+ .setByteCount(new Counter64(BigInteger.valueOf(9853)))
+ .setPacketCount(new Counter64(BigInteger.valueOf(99)))
+ .setCookie(new FlowCookie(Uint64.valueOf(134550437)))
+ .setFlags(new FlowModFlags(true, false, false, false, false))
+ .setMatch(new MatchBuilder().setEthernetMatch(
+ new EthernetMatchBuilder()
+ .setEthernetDestination(
+ new EthernetDestinationBuilder()
+ .setAddress(new MacAddress("fa:16:3e:92:81:45"))
+ .build()).build()).build())
+ .setInstructions(new InstructionsBuilder().build())
+ .setPriority(Uint16.valueOf(20))
+ .build();
+
+ final MultipartReply reply1 = new MultipartReplyBuilder()
+ .setMultipartReplyBody(new MultipartReplyFlowStatsBuilder()
+ .setFlowAndStatisticsMapList(Collections.singletonList(flowStat1))
+ .build())
+ .build();
+ final List<MultipartReply> input = new ArrayList<>();
+ input.add(reply);
+ input.add(reply1);
final GetFlowStatisticsOutput output = service.buildReply(input, true);
assertTrue(output.getFlowAndStatisticsMapList().size() > 0);
-
- final FlowAndStatisticsMap stats = output.nonnullFlowAndStatisticsMapList().values().iterator().next();
-
- assertEquals(stats.getTableId(), TABLE_NO);
+ FlowAndStatisticsMap stats = output.nonnullFlowAndStatisticsMapList().iterator().next();
+ assertEquals(Uint8.valueOf(50),stats.getTableId());
+ stats = output.nonnullFlowAndStatisticsMapList().get(1);
+ assertEquals(Uint8.valueOf(51),stats.getTableId());
}
@Override
when(stat.getTableId()).thenReturn(TABLE_NO);
when(stat.getMatch()).thenReturn(new MatchBuilder().build());
- final Map<FlowAndStatisticsMapListKey, FlowAndStatisticsMapList> stats
- = Collections.singletonMap(stat.key(), stat);
+ final List<FlowAndStatisticsMapList> stats
+ = Collections.singletonList(stat);
final GetFlowStatisticsOutput output = mock(GetFlowStatisticsOutput.class);
when(output.nonnullFlowAndStatisticsMapList()).thenReturn(stats);
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.util;
import com.google.common.collect.Lists;
checkSegment(batchPlanSteps.get(index++), BatchStepType.GROUP_UPDATE, 3);
}
- private void checkSegment(final BatchPlanStep planStep, final BatchStepType stepType, final int expected) {
+ private static void checkSegment(final BatchPlanStep planStep, final BatchStepType stepType, final int expected) {
Assert.assertEquals(stepType, planStep.getStepType());
Assert.assertEquals(expected, planStep.getTaskBag().size());
}
.build();
}
- private List<FlatBatchAddGroup> repeatFlatBatchAddGroupIntoList(final int size) {
+ private static List<FlatBatchAddGroup> repeatFlatBatchAddGroupIntoList(final int size) {
final List<FlatBatchAddGroup> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchAddGroupBuilder().withKey(new FlatBatchAddGroupKey(i)).build());
return list;
}
- private List<FlatBatchUpdateGroup> repeatFlatBatchUpdateGroupIntoList(final int size) {
+ private static List<FlatBatchUpdateGroup> repeatFlatBatchUpdateGroupIntoList(final int size) {
final List<FlatBatchUpdateGroup> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchUpdateGroupBuilder().withKey(new FlatBatchUpdateGroupKey(i)).build());
return list;
}
- private List<FlatBatchRemoveGroup> repeatFlatBatchRemoveGroupIntoList(final int size) {
+ private static List<FlatBatchRemoveGroup> repeatFlatBatchRemoveGroupIntoList(final int size) {
final List<FlatBatchRemoveGroup> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchRemoveGroupBuilder().withKey(new FlatBatchRemoveGroupKey(i)).build());
return list;
}
- private List<FlatBatchAddFlow> repeatFlatBatchAddFlowIntoList(final int size) {
+ private static List<FlatBatchAddFlow> repeatFlatBatchAddFlowIntoList(final int size) {
final List<FlatBatchAddFlow> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchAddFlowBuilder().withKey(new FlatBatchAddFlowKey(i)).build());
return list;
}
- private List<FlatBatchUpdateFlow> repeatFlatBatchUpdateFlowIntoList(final int size) {
+ private static List<FlatBatchUpdateFlow> repeatFlatBatchUpdateFlowIntoList(final int size) {
final List<FlatBatchUpdateFlow> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchUpdateFlowBuilder().withKey(new FlatBatchUpdateFlowKey(i)).build());
return list;
}
- private List<FlatBatchRemoveFlow> repeatFlatBatchRemoveFlowIntoList(final int size) {
+ private static List<FlatBatchRemoveFlow> repeatFlatBatchRemoveFlowIntoList(final int size) {
final List<FlatBatchRemoveFlow> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchRemoveFlowBuilder().withKey(new FlatBatchRemoveFlowKey(i)).build());
return list;
}
- private List<FlatBatchAddMeter> repeatFlatBatchAddMeterIntoList(final int size) {
+ private static List<FlatBatchAddMeter> repeatFlatBatchAddMeterIntoList(final int size) {
final List<FlatBatchAddMeter> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchAddMeterBuilder().withKey(new FlatBatchAddMeterKey(i)).build());
return list;
}
- private List<FlatBatchUpdateMeter> repeatFlatBatchUpdateMeterIntoList(final int size) {
+ private static List<FlatBatchUpdateMeter> repeatFlatBatchUpdateMeterIntoList(final int size) {
final List<FlatBatchUpdateMeter> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchUpdateMeterBuilder().withKey(new FlatBatchUpdateMeterKey(i)).build());
return list;
}
- private List<FlatBatchRemoveMeter> repeatFlatBatchRemoveMeterIntoList(final int size) {
+ private static List<FlatBatchRemoveMeter> repeatFlatBatchRemoveMeterIntoList(final int size) {
final List<FlatBatchRemoveMeter> list = new ArrayList<>();
for (int i = 0; i < size; i++) {
list.add(new FlatBatchRemoveMeterBuilder().withKey(new FlatBatchRemoveMeterKey(i)).build());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.util;
import com.google.common.collect.Lists;
checkBatchSuccessOutcomeTransformation(FlowUtil.FLOW_UPDATE_TRANSFORM.apply(input));
}
- private <T extends BatchFlowOutputListGrouping> void checkBatchSuccessOutcomeTransformation(
+ private static <T extends BatchFlowOutputListGrouping> void checkBatchSuccessOutcomeTransformation(
final RpcResult<T> output) {
Assert.assertTrue(output.isSuccessful());
Map<BatchFailedFlowsOutputKey, BatchFailedFlowsOutput> failedFlows
Assert.assertEquals(1, composite.getResult().getBatchFailedFlowsOutput().size());
}
- private RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
+ private static RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
return RpcResultBuilder.<SendBarrierOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
- private RpcResult<AddFlowsBatchOutput> createAddFlowsBatchSuccessOutput() {
+ private static RpcResult<AddFlowsBatchOutput> createAddFlowsBatchSuccessOutput() {
return RpcResultBuilder
.success(new AddFlowsBatchOutputBuilder()
.setBatchFailedFlowsOutput(Collections.emptyList())
.build();
}
- private RpcResult<AddFlowsBatchOutput> createAddFlowsBatchFailureOutcome() {
+ private static RpcResult<AddFlowsBatchOutput> createAddFlowsBatchFailureOutcome() {
final RpcResult<List<BatchFailedFlowsOutput>> batchOutcomeWithError = createBatchOutcomeWithError();
return RpcResultBuilder.<AddFlowsBatchOutput>failed()
.withResult(new AddFlowsBatchOutputBuilder()
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.util;
import static org.junit.Assert.assertEquals;
assertEquals(GROUP_ACTION_BITMAP, groupActionsSupportBitmap.get(0).toJava());
}
- private RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
+ private static RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
return RpcResultBuilder.<SendBarrierOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
- private RpcResult<AddGroupsBatchOutput> createAddGroupsBatchSuccessOutput() {
+ private static RpcResult<AddGroupsBatchOutput> createAddGroupsBatchSuccessOutput() {
return RpcResultBuilder
.success(new AddGroupsBatchOutputBuilder()
.setBatchFailedGroupsOutput(Collections.emptyList())
.build();
}
- private RpcResult<AddGroupsBatchOutput> createAddGroupsBatchFailureOutcome() {
+ private static RpcResult<AddGroupsBatchOutput> createAddGroupsBatchFailureOutcome() {
final RpcResult<List<BatchFailedGroupsOutput>> batchOutcomeWithError = createBatchOutcomeWithError();
return RpcResultBuilder.<AddGroupsBatchOutput>failed()
.withResult(new AddGroupsBatchOutputBuilder()
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.util;
import static org.junit.Assert.assertEquals;
assertEquals(expectedV10Match.build(),emptyV10Match.build());
}
- private MatchV10Builder expectedV10Match() {
+ private static MatchV10Builder expectedV10Match() {
Short zeroShort = Short.valueOf("0");
Integer zeroInteger = 0;
MatchV10Builder matchV10Builder = new MatchV10Builder();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.util;
import com.google.common.base.Function;
Assert.assertEquals(1, output.getResult().get(0).getBatchOrder().intValue());
}
- private org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter createBatchMeter(
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter createBatchMeter(
final MeterId meterId) {
return new MeterBuilder()
.setMeterId(meterId)
Assert.assertEquals(1, composite.getResult().getBatchFailedMetersOutput().size());
}
- private RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
+ private static RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
return RpcResultBuilder.<SendBarrierOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
- private RpcResult<AddMetersBatchOutput> createAddMetersBatchSuccessOutput() {
+ private static RpcResult<AddMetersBatchOutput> createAddMetersBatchSuccessOutput() {
return RpcResultBuilder
.success(new AddMetersBatchOutputBuilder()
.setBatchFailedMetersOutput(Collections.emptyMap())
.build();
}
- private RpcResult<AddMetersBatchOutput> createAddMetersBatchFailureOutcome() {
+ private static RpcResult<AddMetersBatchOutput> createAddMetersBatchFailureOutcome() {
final RpcResult<List<BatchFailedMetersOutput>> batchOutcomeWithError = createBatchOutcomeWithError();
return RpcResultBuilder.<AddMetersBatchOutput>failed()
.withResult(new AddMetersBatchOutputBuilder()