use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.
the class PacketOutInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 01 00 00 00 01 00 00 28 00 00 00 00 00 00 00 11 00 08 00 19 00 00 00 12 00 08 00 00 00 00 00 12 " + "00 08 00 00 00 00 00 12 00 08 00 00 00 00 00 12 00 08 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 10 " + "11 12 13 14");
PacketOutInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong buffer Id", 256L, deserializedMessage.getBufferId().longValue());
Assert.assertEquals("Wrong In Port", new PortNumber(256L), deserializedMessage.getInPort());
Assert.assertEquals("Wrong Numbers of actions", createAction(), deserializedMessage.getAction());
byte[] data = ByteBufUtils.hexStringToBytes("00 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14");
Assert.assertArrayEquals("Wrong data", data, deserializedMessage.getData());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.
the class GetQueueConfigInputMessageFactoryTest method testGetQueueConfigInputMessage.
/**
* Testing of {@link GetQueueConfigInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testGetQueueConfigInputMessage() throws Exception {
GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setPort(new PortNumber(0x00010203L));
GetQueueConfigInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
getQueueFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, GET_QUEUE_CONFIG_INPUT_MESSAGE_CODE_TYPE, 16);
Assert.assertEquals("Wrong port", 0x00010203, out.readUnsignedInt());
out.skipBytes(PADDING_IN_QUEUE_CONFIG_INPUT_MESSAGE);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.
the class PortConvertor method convert.
@Override
public PortModInput convert(Port source, VersionConvertorData data) {
PortConfig config = maskPortConfigFields(source.getConfiguration());
PortConfigV10 configV10 = maskPortConfigV10Fields(source.getConfiguration());
PortModInputBuilder portModInputBuilder = new PortModInputBuilder();
portModInputBuilder.setAdvertise(getPortFeatures(source.getAdvertisedFeatures()));
portModInputBuilder.setPortNo(new PortNumber(OpenflowPortsUtil.getProtocolPortNumber(OpenflowVersion.get(data.getVersion()), source.getPortNumber())));
portModInputBuilder.setConfig(config);
portModInputBuilder.setMask(MoreObjects.firstNonNull(maskPortConfigFields(source.getMask()), new PortConfig(true, true, true, true)));
portModInputBuilder.setHwAddress(new MacAddress(source.getHardwareAddress()));
portModInputBuilder.setVersion(data.getVersion());
portModInputBuilder.setConfigV10(configV10);
portModInputBuilder.setMaskV10(MoreObjects.firstNonNull(maskPortConfigV10Fields(source.getMask()), new PortConfigV10(true, true, true, true, true, true, true)));
portModInputBuilder.setAdvertiseV10(getPortFeaturesV10(source.getAdvertisedFeatures()));
return portModInputBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.
the class SalToOfOutputActionCase method process.
@Nonnull
@Override
public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
final OutputAction outputAction = source.getOutputAction();
final OutputActionBuilder outputBuilder = new OutputActionBuilder();
if (outputAction.getMaxLength() != null) {
outputBuilder.setMaxLength(outputAction.getMaxLength());
} else {
outputBuilder.setMaxLength(0);
}
final OpenflowVersion version = OpenflowVersion.get(data.getVersion());
final String nodeConnectorId = outputAction.getOutputNodeConnector().getValue();
final Long portNumber = InventoryDataServiceUtil.portNumberfromNodeConnectorId(version, nodeConnectorId);
if (OpenflowPortsUtil.checkPortValidity(version, portNumber)) {
outputBuilder.setPort(new PortNumber(portNumber));
} else {
LOG.error("Invalid Port specified {} for Output Action for OF version: {}", portNumber, version);
}
return Optional.of(new ActionBuilder().setActionChoice(new OutputActionCaseBuilder().setOutputAction(outputBuilder.build()).build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.
the class PacketOutConvertorTest method buildActionForNullTransmitPacketInputAction.
private static List<Action> buildActionForNullTransmitPacketInputAction(final NodeConnectorKey nodeConKey, final short version) {
PortNumber outPort = getPortNumber(nodeConKey, version);
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder outputActionCaseBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder outputActionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder();
outputActionBuilder.setPort(outPort);
outputActionBuilder.setMaxLength(0xffff);
outputActionCaseBuilder.setOutputAction(outputActionBuilder.build());
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(outputActionCaseBuilder.build());
List<Action> actions = new ArrayList<>();
actions.add(actionBuilder.build());
return actions;
}
Aggregations