use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatistics in project openflowplugin by opendaylight.
the class NodeConnectorStatNotificationSupplierImplTest method testCreateChangeEvent.
@Test
public void testCreateChangeEvent() {
final TestData testData = new TestData(createTestConnectorStatPath(), null, createTestConnectorStat(), DataObjectModification.ModificationType.WRITE);
Collection<DataTreeModification<FlowCapableNodeConnectorStatistics>> collection = new ArrayList<>();
collection.add(testData);
notifSupplierImpl.onDataTreeChanged(collection);
verify(notifProviderService, times(1)).publish(Matchers.any(NodeConnectorStatisticsUpdate.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatistics in project openflowplugin by opendaylight.
the class NodeConnectorStatNotificationSupplierImpl method createNotification.
@Override
public NodeConnectorStatisticsUpdate createNotification(final FlowCapableNodeConnectorStatistics flowCapableNodeConnectorStatistics, final InstanceIdentifier<FlowCapableNodeConnectorStatistics> path) {
Preconditions.checkArgument(flowCapableNodeConnectorStatistics != null);
Preconditions.checkArgument(path != null);
final NodeConnectorBuilder ncBuilder = new NodeConnectorBuilder();
final NodeConnectorKey ncKey = path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class);
ncBuilder.setId(ncKey.getId());
ncBuilder.setKey(ncKey);
final NodeConnectorStatisticsUpdateBuilder builder = new NodeConnectorStatisticsUpdateBuilder();
builder.setId(getNodeId(path));
builder.setMoreReplies(Boolean.FALSE);
builder.setNodeConnector(Collections.singletonList(ncBuilder.build()));
builder.setNodeConnectorStatisticsAndPortNumberMap(Collections.singletonList(new NodeConnectorStatisticsAndPortNumberMapBuilder(flowCapableNodeConnectorStatistics).build()));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatistics in project openflowplugin by opendaylight.
the class StatisticsGatheringUtilsTest method testGatherStatistics_nodeConnector.
@Test
public void testGatherStatistics_nodeConnector() throws Exception {
final MultipartType type = MultipartType.OFPMPPORTSTATS;
final PortStatsBuilder portStatsBld = new PortStatsBuilder().setPortNo(11L);
final MultipartReplyPortStatsBuilder mpReplyMeterBld = new MultipartReplyPortStatsBuilder();
mpReplyMeterBld.setPortStats(Lists.newArrayList(portStatsBld.build()));
final MultipartReplyPortStatsCaseBuilder mpReplyMeterCaseBld = new MultipartReplyPortStatsCaseBuilder();
mpReplyMeterCaseBld.setMultipartReplyPortStats(mpReplyMeterBld.build());
final MultipartReply meterStatsUpdated = assembleMPReplyMessage(type, mpReplyMeterCaseBld.build());
final List<MultipartReply> statsData = Collections.singletonList(meterStatsUpdated);
fireAndCheck(type, statsData);
final InstanceIdentifier<FlowCapableNodeConnectorStatistics> portPath = dummyNodePath.child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("openflow:" + DUMMY_NODE_ID_VALUE + ":11"))).augmentation(FlowCapableNodeConnectorStatisticsData.class).child(FlowCapableNodeConnectorStatistics.class);
verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(portPath), Matchers.any(FlowCapableNodeConnectorStatistics.class));
}
Aggregations