use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class GroupModInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 02 03 00 00 00 01 00 00 10 00 0a 00 " + "00 00 41 00 00 00 16 00 00 00 00");
GroupModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
// Test Message
Assert.assertEquals("Wrong command", GroupModCommand.forValue(2), deserializedMessage.getCommand());
Assert.assertEquals("Wrong type", GroupType.forValue(3), deserializedMessage.getType());
Assert.assertEquals("Wrong group id", new GroupId(256L), deserializedMessage.getGroupId());
BucketsList bucket = deserializedMessage.getBucketsList().get(0);
Assert.assertEquals("Wrong weight", 10, bucket.getWeight().intValue());
Assert.assertEquals("Wrong watch port", new PortNumber(65L), bucket.getWatchPort());
Assert.assertEquals("Wrong watch group", 22L, bucket.getWatchGroup().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyGroupFeaturesTest method testMultipartReplyGroupFeatures2.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
* (with different group types and capabilities).
*/
@Test
public void testMultipartReplyGroupFeatures2() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 08 00 01 00 00 00 00 " + // types
"00 00 00 00 " + // capabilities
"00 00 00 00 " + // max groups
"00 00 00 01 " + // max groups
"00 00 00 02 " + // max groups
"00 00 00 03 " + // max groups
"00 00 00 04 " + // actions bitmap (all actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupFeaturesCase messageCase = (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());
Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false), message.getCapabilities());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class BarrierReplyMessageFactoryTest method testVersions.
/**
* Testing of {@link BarrierReplyMessageFactory} for correct header version.
*/
@Test
public void testVersions() {
List<Byte> versions = new ArrayList<>(Arrays.asList(EncodeConstants.OF13_VERSION_ID, EncodeConstants.OF14_VERSION_ID, EncodeConstants.OF15_VERSION_ID));
ByteBuf bb = BufferHelper.buildBuffer();
testHeaderVersions(versions, bb);
// OFP v1.0 need to be tested separately cause of different message type value
messageCodeKey = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 19, BarrierOutput.class);
testHeaderVersions(Collections.singletonList(EncodeConstants.OF10_VERSION_ID), bb);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class SalBundleServiceImpl method addBundleMessages.
@Override
public Future<RpcResult<Void>> addBundleMessages(AddBundleMessagesInput input) {
final List<ListenableFuture<RpcResult<Void>>> partialResults = new ArrayList<>();
final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
final BundleAddMessageSalBuilder bundleAddMessageBuilder = new BundleAddMessageSalBuilder();
final SalAddMessageDataBuilder dataBuilder = new SalAddMessageDataBuilder();
experimenterInputBuilder.setNode(input.getNode());
dataBuilder.setNode(input.getNode());
dataBuilder.setBundleId(input.getBundleId());
dataBuilder.setFlags(input.getFlags());
dataBuilder.setBundleProperty(input.getBundleProperty());
for (Message message : input.getMessages().getMessage()) {
dataBuilder.setBundleInnerMessage(message.getBundleInnerMessage());
experimenterInputBuilder.setExperimenterMessageOfChoice(bundleAddMessageBuilder.setSalAddMessageData(dataBuilder.build()).build());
ListenableFuture<RpcResult<Void>> res = JdkFutureAdapters.listenInPoolThread(experimenterMessageService.sendExperimenter(experimenterInputBuilder.build()));
partialResults.add(res);
}
return processResults(partialResults);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class AllMeterConfigStatsService method transformToNotification.
@Override
public MeterConfigStatsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
MeterConfigStatsUpdatedBuilder message = new MeterConfigStatsUpdatedBuilder();
message.setId(getDeviceInfo().getNodeId());
message.setMoreReplies(Boolean.FALSE);
message.setTransactionId(emulatedTxId);
message.setMeterConfigStats(new ArrayList<>());
for (MultipartReply mpReply : result) {
MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase) mpReply.getMultipartReplyBody();
MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
meterConfigStatsList.ifPresent(meterConfigStats -> message.getMeterConfigStats().addAll(meterConfigStats));
}
return message.build();
}
Aggregations