public WriteMetadata build() { return new WriteMetadataImpl(this); }
public WriteMetadataBuilder(WriteMetadata base) { this._metadata = base.getMetadata(); this._metadataMask = base.getMetadataMask(); if (base instanceof WriteMetadataImpl) { WriteMetadataImpl _impl = (WriteMetadataImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
public static WriteMetadataCase createInstructionMetadata(int order, BigInteger metadataVal, BigInteger metadataMask) { WriteMetadataBuilder wmb = new WriteMetadataBuilder(); wmb.setMetadata(metadataVal); wmb.setMetadataMask(metadataMask); WriteMetadataCaseBuilder wmcb = new WriteMetadataCaseBuilder().setWriteMetadata(wmb.build()); return wmcb.build(); }
} else if (currInstructionType instanceof WriteMetadataCase) { builder.setInstruction((new WriteMetadataCaseBuilder() .setWriteMetadata(new WriteMetadataBuilder().build()) .build())); } else if (currInstructionType instanceof WriteActionsCase) {
if (other.getMetadata() != null) { return false; } else if(!_metadata.equals(other.getMetadata())) { return false; if (other.getMetadataMask() != null) { return false; } else if(!_metadataMask.equals(other.getMetadataMask())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private WriteMetadataImpl(WriteMetadataBuilder base) { this._metadata = base.getMetadata(); this._metadataMask = base.getMetadataMask(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadata>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadata>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadata>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadata>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public WriteMetadataBuilder setMetadata(BigInteger value) { if (value != null) { BigInteger _constraint = value; boolean isValidRange = false; for (Range<BigInteger> r : _metadata_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _metadata_range)); } } this._metadata = value; return this; } public static List<Range<BigInteger>> _metadata_range() {
public WriteMetadataBuilder setMetadataMask(BigInteger value) { if (value != null) { BigInteger _constraint = value; boolean isValidRange = false; for (Range<BigInteger> r : _metadataMask_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _metadataMask_range)); } } this._metadataMask = value; return this; } public static List<Range<BigInteger>> _metadataMask_range() {
/** * Set IPv4 Source Address Instructions * @param ib Map InstructionBuilder * @param metaData BigInteger representing the OpenFlow metadata * @param metaDataMask BigInteger representing the OpenFlow metadata mask * @return instructionbuilder with new attributes */ public static InstructionBuilder createMetadataInstructions(InstructionBuilder ib, BigInteger metaData, BigInteger metaDataMask) { WriteMetadataBuilder aab = new WriteMetadataBuilder(); aab.setMetadata(metaData); aab.setMetadataMask(metaDataMask); ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build()); /** * * TODO Determine why the following fails serialization * with a null value. Per the spec it is optional. * The metadata match, the Flowmod works w/o an accompanying mask. * * if (metaDataMask != null) { * aab.setMetadataMask(metaDataMask); * } * */ return ib; }
@Override public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) { WriteMetadata writeMetadata = source.getWriteMetadata(); WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder(); WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder(); writeMetadataBuilder.setMetadata(ByteUtil.convertBigIntegerToNBytes(writeMetadata.getMetadata(), OFConstants.SIZE_OF_LONG_IN_BYTES)); writeMetadataBuilder.setMetadataMask(ByteUtil.convertBigIntegerToNBytes(writeMetadata.getMetadataMask(), OFConstants.SIZE_OF_LONG_IN_BYTES)); writeMetadataCaseBuilder.setWriteMetadata(writeMetadataBuilder.build()); InstructionBuilder instructionBuilder = new InstructionBuilder(); instructionBuilder.setInstructionChoice(writeMetadataCaseBuilder.build()); return Optional.of(instructionBuilder.build()); } }
/** * Set IPv4 Source Address Instructions * @param ib Map InstructionBuilder * @param metaData BigInteger representing the OpenFlow metadata * @param metaDataMask BigInteger representing the OpenFlow metadata mask * @return instructionbuilder with new attributes */ public static InstructionBuilder createMetadataInstructions(InstructionBuilder ib, BigInteger metaData, BigInteger metaDataMask) { WriteMetadataBuilder aab = new WriteMetadataBuilder(); aab.setMetadata(metaData); aab.setMetadataMask(metaDataMask); ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build()); /** * * TODO Determine why the following fails serialization * with a null value. Per the spec it is optional. * The metadata match, the Flowmod works w/o an accompanying mask. * * if (metaDataMask != null) { * aab.setMetadataMask(metaDataMask); * } * */ return ib; }
private static InstructionsBuilder createMetadataInstructions() { final WriteMetadataBuilder aab = new WriteMetadataBuilder(); aab.setMetadata(BigInteger.valueOf(10)); aab.setMetadataMask(BigInteger.valueOf(10)); final InstructionBuilder ib = new InstructionBuilder(); ib.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(aab.build()).build()); // Put our Instruction in a list of Instructions final InstructionsBuilder isb = new InstructionsBuilder(); final List<Instruction> instructions = new ArrayList<Instruction>(); ib.setKey(new InstructionKey(0)); instructions.add(ib.build()); isb.setInstruction(instructions); return isb; }
((org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase) switchInst.getInstructionChoice()); WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder(); WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder(); writeMetadataBuilder.setMetadata(new BigInteger(OFConstants.SIGNUM_UNSIGNED, writeMetadataCase.getWriteMetadata().getMetadata())); writeMetadataBuilder.setMetadataMask(new BigInteger(OFConstants.SIGNUM_UNSIGNED, writeMetadataCase.getWriteMetadata().getMetadataMask())); writeMetadataCaseBuilder.setWriteMetadata(writeMetadataBuilder.build()); salInstruction = writeMetadataCaseBuilder.build(); } else {