@Override
        public void notify(FlowTableBatchEvent event) {
            final FlowTableBatchRequest request = event.subject();
            switch (event.type()) {
            case BATCH_OPERATION_REQUESTED:
                // Request has been forwarded to MASTER Node, and was
                request.ops().stream().forEach(
                        op -> {
                            switch (op.operator()) {
                                case ADD:
                                    post(new FlowTableEvent(FlowTableEvent.Type.TABLE_ADD_REQUESTED,
                                                           op.target()));
                                    break;
                                case REMOVE:
                                    post(new FlowTableEvent(FlowTableEvent.Type.TABLE_REMOVE_REQUESTED,
                                                           op.target()));
                                    break;
                                case MODIFY:
                                    //TODO: do something here when the time comes.
                                    break;
                                default:
                                    log.warn("Unknown flow operation operator: {}", op.operator());
                            }
                        }
                );
                DeviceId deviceId = event.deviceId();
                FlowTableBatchOperation batchOperation =
                        request.asBatchOperation(deviceId);
                FlowTableProvider flowTableProvider = getProvider(deviceId);
                if (flowTableProvider != null) {
                    flowTableProvider.executeBatch(batchOperation);
                }
                break;
            case BATCH_OPERATION_COMPLETED:
                FlowOperationsProcessor fops = pendingFlowOperations.remove(
                        event.subject().batchId());
                if (event.result().isSuccess()) {
                    if (fops != null) {
                        fops.satisfy(event.deviceId());
                    }
                } else {
                    fops.fail(event.deviceId(), event.result().failedItems());
                }
                break;
            default:
                break;
            }
        }
@Override
        public void notify(FlowTableBatchEvent event) {
            final FlowTableBatchRequest request = event.subject();
            switch (event.type()) {
            case BATCH_OPERATION_REQUESTED:
               
                request.ops().stream().forEach(
                        op -> {
                            switch (op.operator()) {
                                case ADD:
                                    post(new FlowTableEvent(FlowTableEvent.Type.TABLE_ADD_REQUESTED,
                                                           op.target()));
                                    break;
                                case REMOVE:
                                    post(new FlowTableEvent(FlowTableEvent.Type.TABLE_REMOVE_REQUESTED,
                                                           op.target()));
                                    break;
                                case MODIFY:
                                   
                                    break;
                                default:
                                    log.warn("Unknown flow operation operator: {}", op.operator());
                            }
                        }
                );
                DeviceId deviceId = event.deviceId();
                FlowTableBatchOperation batchOperation =
                        request.asBatchOperation(deviceId);
                FlowTableProvider flowTableProvider = getProvider(deviceId);
                if (flowTableProvider != null) {
                    flowTableProvider.executeBatch(batchOperation);
                }
                break;
            case BATCH_OPERATION_COMPLETED:
                FlowOperationsProcessor fops = pendingFlowOperations.remove(
                        event.subject().batchId());
                if (event.result().isSuccess()) {
                    if (fops != null) {
                        fops.satisfy(event.deviceId());
                    }
                } else {
                    fops.fail(event.deviceId(), event.result().failedItems());
                }
                break;
            default:
                break;
            }
        }
@override public void notify(flowtablebatchevent event) { final flowtablebatchrequest request = event.subject(); switch (event.type()) { case batch_operation_requested: request.ops().stream().foreach( op -> { switch (op.operator()) { case add: post(new flowtableevent(flowtableevent.type.table_add_requested, op.target())); break; case remove: post(new flowtableevent(flowtableevent.type.table_remove_requested, op.target())); break; case modify: break; default: log.warn("unknown flow operation operator: {}", op.operator()); } } ); deviceid deviceid = event.deviceid(); flowtablebatchoperation batchoperation = request.asbatchoperation(deviceid); flowtableprovider flowtableprovider = getprovider(deviceid); if (flowtableprovider != null) { flowtableprovider.executebatch(batchoperation); } break; case batch_operation_completed: flowoperationsprocessor fops = pendingflowoperations.remove( event.subject().batchid()); if (event.result().issuccess()) { if (fops != null) { fops.satisfy(event.deviceid()); } } else { fops.fail(event.deviceid(), event.result().faileditems()); } break; default: break; } }