use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsDataBuilder in project openflowplugin by opendaylight.
the class FlowStatsMultipartWriter method storeStatistics.
@Override
public void storeStatistics(final FlowAndStatisticsMapList statistics, final boolean withParents) {
statistics.getFlowAndStatisticsMapList().forEach(stat -> {
final FlowBuilder flow = new FlowBuilder(stat).addAugmentation(FlowStatisticsData.class, new FlowStatisticsDataBuilder().setFlowStatistics(new FlowStatisticsBuilder(stat).build()).build());
final FlowRegistryKey flowRegistryKey = FlowRegistryKeyFactory.create(version, flow.build());
registry.getDeviceFlowRegistry().store(flowRegistryKey);
final FlowDescriptor flowDescriptor = registry.getDeviceFlowRegistry().retrieveDescriptor(flowRegistryKey);
if (Objects.nonNull(flowDescriptor)) {
final FlowKey key = new FlowKey(flowDescriptor.getFlowId());
writeToTransaction(getInstanceIdentifier().augmentation(FlowCapableNode.class).child(Table.class, new TableKey(stat.getTableId())).child(Flow.class, key), flow.setId(key.getId()).setKey(key).build(), withParents);
}
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsDataBuilder in project openflowplugin by opendaylight.
the class AbstractFlowDirectStatisticsService method generateFlowId.
/**
* Get flow ID from #{@link org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry} or
* create alien ID.
* @param flowStatistics flow statistics
* @return generated flow ID
*/
protected FlowId generateFlowId(FlowAndStatisticsMapList flowStatistics) {
final FlowStatisticsDataBuilder flowStatisticsDataBld = new FlowStatisticsDataBuilder().setFlowStatistics(new FlowStatisticsBuilder(flowStatistics).build());
final FlowBuilder flowBuilder = new FlowBuilder(flowStatistics).addAugmentation(FlowStatisticsData.class, flowStatisticsDataBld.build());
final FlowRegistryKey flowRegistryKey = FlowRegistryKeyFactory.create(getVersion(), flowBuilder.build());
getDeviceRegistry().getDeviceFlowRegistry().store(flowRegistryKey);
return getDeviceRegistry().getDeviceFlowRegistry().retrieveDescriptor(flowRegistryKey).getFlowId();
}
Aggregations