use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId in project openflowplugin by opendaylight.
the class FlowForwarderTest method removeTest.
@Test
public void removeTest() throws Exception {
Mockito.when(salFlowService.removeFlow(removeFlowInputCpt.capture())).thenReturn(RpcResultBuilder.success(new RemoveFlowOutputBuilder().setTransactionId(new TransactionId(BigInteger.ONE)).build()).buildFuture());
final Flow removeFlow = new FlowBuilder(flow).build();
final Future<RpcResult<RemoveFlowOutput>> removeResult = flowForwarder.remove(flowPath, removeFlow, flowCapableNodePath);
Mockito.verify(salFlowService).removeFlow(Matchers.<RemoveFlowInput>any());
final RemoveFlowInput flowInput = removeFlowInputCpt.getValue();
Assert.assertEquals(2, flowInput.getTableId().shortValue());
Assert.assertEquals(emptyMatch, flowInput.getMatch());
Assert.assertEquals(null, flowInput.getInstructions());
Assert.assertEquals(true, flowInput.isStrict());
final RpcResult<RemoveFlowOutput> removeFlowOutputRpcResult = removeResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(removeFlowOutputRpcResult.isSuccessful());
final RemoveFlowOutput resultValue = removeFlowOutputRpcResult.getResult();
Assert.assertEquals(1, resultValue.getTransactionId().getValue().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId in project openflowplugin by opendaylight.
the class GroupForwarderTest method setUp.
@Before
public void setUp() throws Exception {
groupForwarder = new GroupForwarder(salGroupService);
txId = new TransactionId(BigInteger.ONE);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId in project openflowplugin by opendaylight.
the class TableForwarderTest method setUp.
@Before
public void setUp() throws Exception {
tableForwarder = new TableForwarder(salTableService);
txId = new TransactionId(BigInteger.ONE);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId in project openflowplugin by opendaylight.
the class QueueStatisticsToNotificationTransformer method transformToNotification.
/**
* Transform statistics to notification.
*
* @param mpReplyList raw multipart response from device
* @param deviceInfo device state
* @param ofVersion device version
* @param emulatedTxId emulated transaction Id
* @return notification containing flow stats
*/
public static QueueStatisticsUpdate transformToNotification(final List<MultipartReply> mpReplyList, final DeviceInfo deviceInfo, final OpenflowVersion ofVersion, final TransactionId emulatedTxId) {
QueueStatisticsUpdateBuilder notification = new QueueStatisticsUpdateBuilder();
notification.setId(deviceInfo.getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
notification.setQueueIdAndStatisticsMap(new ArrayList<>());
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyQueueCase caseBody = (MultipartReplyQueueCase) mpReply.getMultipartReplyBody();
MultipartReplyQueue replyBody = caseBody.getMultipartReplyQueue();
for (QueueStats queueStats : replyBody.getQueueStats()) {
QueueIdAndStatisticsMapBuilder statsBuilder = new QueueIdAndStatisticsMapBuilder();
statsBuilder.setNodeConnectorId(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(deviceInfo.getDatapathId(), queueStats.getPortNo(), ofVersion));
statsBuilder.setTransmissionErrors(new Counter64(queueStats.getTxErrors()));
statsBuilder.setTransmittedBytes(new Counter64(queueStats.getTxBytes()));
statsBuilder.setTransmittedPackets(new Counter64(queueStats.getTxPackets()));
DurationBuilder durationBuilder = new DurationBuilder();
durationBuilder.setSecond(new Counter32(queueStats.getDurationSec()));
durationBuilder.setNanosecond(new Counter32(queueStats.getDurationNsec()));
statsBuilder.setDuration(durationBuilder.build());
statsBuilder.setQueueId(new QueueId(queueStats.getQueueId()));
notification.getQueueIdAndStatisticsMap().add(statsBuilder.build());
}
}
return notification.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId 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