+ return;
+ }
+
+ final DeviceFlowRegistry flowRegistry = deviceContext.getDeviceFlowRegistry();
+ final FlowDescriptor flowDescriptor;
+ final FlowRef flowRef = input.getFlowRef();
+ if (flowRef != null) {
+ final Uint8 tableId = input.getTableId();
+ final FlowId flowId = flowRef.getValue().firstKeyOf(Flow.class).getId();
+ flowDescriptor = FlowDescriptorFactory.create(tableId, flowId);
+
+ // FIXME: this looks like an atomic operation
+ flowRegistry.appendHistoryFlow(flowId, tableId, FlowGroupStatus.ADDED);
+ flowRegistry.storeDescriptor(flowRegistryKey, flowDescriptor);
+ } else {
+ // FIXME: this looks like an atomic operation
+ flowRegistry.store(flowRegistryKey);
+ flowDescriptor = flowRegistry.retrieveDescriptor(flowRegistryKey);
+ }
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Flow add with id={} finished without error", flowDescriptor.getFlowId().getValue());