@Override public boolean apply(@Nullable DataObjectModification<T> input) { return input != null && input.getModificationType() == DataObjectModification .ModificationType.DELETE; } };
@Override public boolean apply(@Nullable DataObjectModification<T> input) { return input != null && input.getModificationType() == DataObjectModification .ModificationType.DELETE; } };
@Override public boolean apply(@Nullable DataObjectModification<T> input) { return input != null && input.getModificationType() == DataObjectModification .ModificationType.DELETE && input.getDataBefore() != null; } };
@Override public boolean apply(@Nullable DataObjectModification<T> input) { return input != null && input.getModificationType() == DataObjectModification .ModificationType.DELETE && input.getDataBefore() != null; } };
@Override public void onDataTreeChanged(Collection<DataTreeModification<T>> changes) { changes.forEach(modif -> { DataObjectModification<T> rootNode = modif.getRootNode(); ModificationType modificationType = rootNode.getModificationType(); if (modificationType == modificationForFutureSet) { LOG.debug("{} in OPER DS: {}", modificationType.name(), iid.getRootIdentifier()); unregisterOnTrue(future.set(null)); } }); }
@Override public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) { logger.info("onDataTreeChanged called"); for (final DataTreeModification<Node> change : changes) { final DataObjectModification<Node> changeDiff = change.getRootNode(); if (changeDiff.getModificationType().equals( org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType.SUBTREE_MODIFIED)) { logger.info("There is a sub-tree modified operation performed"); extractOpenFlowStatistics(changeDiff.getDataAfter()); } } }
/** * Invoked when the specified data tree has been modified. * * @param changes A collection of data tree modifications. */ @Override public void onDataTreeChanged( @Nonnull Collection<DataTreeModification<T>> changes) { for (DataTreeModification<T> change: changes) { DataObjectModification<T> mod = change.getRootNode(); ModificationType modType = mod.getModificationType(); T data = (modType == ModificationType.DELETE) ? null : mod.getDataAfter(); setValue(data); } } }
private void onGlobalChanged(final DataObjectModification<Global> dataObjectModification, final InstanceIdentifier<Bgp> rootIdentifier) { switch (dataObjectModification.getModificationType()) { case DELETE: onGlobalRemoved(rootIdentifier); break; case SUBTREE_MODIFIED: case WRITE: onGlobalModified(rootIdentifier, dataObjectModification.getDataAfter(), null); break; default: break; } }
@Override protected void handleOperational(DataObjectModification<SxpDomain> c, InstanceIdentifier<SxpNodeIdentity> identifier, SxpNode sxpNode) { LOG.trace("Operational Modification {} {}", getClass(), c.getModificationType()); switch (c.getModificationType()) { case WRITE: if (c.getDataBefore() == null) sxpNode.addDomain(c.getDataAfter()); case SUBTREE_MODIFIED: if (c.getDataAfter() != null) break; case DELETE: sxpNode.removeDomain(Preconditions.checkNotNull(c.getDataBefore()).getDomainName()).close(); break; } }
private void onAppConfigChanged(Collection<DataTreeModification<DataObject>> changes) { for(DataTreeModification<DataObject> change: changes) { DataObjectModification<DataObject> changeRoot = change.getRootNode(); ModificationType type = changeRoot.getModificationType(); LOG.debug("{}: onAppConfigChanged: {}, {}", logName(), type, change.getRootPath()); if(type == ModificationType.SUBTREE_MODIFIED || type == ModificationType.WRITE) { DataObject newAppConfig = changeRoot.getDataAfter(); LOG.debug("New app config instance: {}, previous: {}", newAppConfig, currentAppConfig); if(!setInitialAppConfig(Optional.of(newAppConfig)) && !Objects.equals(currentAppConfig, newAppConfig)) { LOG.debug("App config was updated - scheduling container for restart"); restartContainer(); } } else if(type == ModificationType.DELETE) { LOG.debug("App config was deleted - scheduling container for restart"); restartContainer(); } } }
@Override public void onDataTreeChanged(Collection<DataTreeModification<ElanInterface>> changes) { for (DataTreeModification<ElanInterface> change : changes) { DataObjectModification<ElanInterface> mod = change.getRootNode(); switch (mod.getModificationType()) { case DELETE: ElanUtils.removeElanInterfaceFromCache(mod.getDataBefore().getName()); break; case SUBTREE_MODIFIED: case WRITE: ElanInterface elanInterface = mod.getDataAfter(); ElanUtils.addElanInterfaceIntoCache(elanInterface.getName(), elanInterface); break; default: throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType()); } } }
@Override public void onDataTreeChanged(Collection<DataTreeModification<ElanInstance>> changes) { for (DataTreeModification<ElanInstance> change : changes) { DataObjectModification<ElanInstance> mod = change.getRootNode(); switch (mod.getModificationType()) { case DELETE: ElanUtils.removeElanInstanceFromCache(mod.getDataBefore().getElanInstanceName()); break; case SUBTREE_MODIFIED: case WRITE: ElanInstance elanInstance = mod.getDataAfter(); ElanUtils.addElanInstanceIntoCache(elanInstance.getElanInstanceName(), elanInstance); break; default: throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType()); } } }
@Override public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<EndpointPolicyTemplateBySgt>> collection) { for (DataTreeModification<EndpointPolicyTemplateBySgt> change : collection) { LOG.trace("received modification: {} -> {}", change.getRootPath(), change.getRootNode().getModificationType()); // update cached dao final InstanceIdentifier<EndpointPolicyTemplateBySgt> changePath = change.getRootPath().getRootIdentifier(); final Sgt changeKey = changePath.firstKeyOf(EndpointPolicyTemplateBySgt.class).getSgt(); SxpListenerUtil.updateCachedDao(templateCachedDao, changeKey, change); final EndpointPolicyTemplateBySgt epPolicyTemplate = change.getRootNode().getDataAfter(); processWithEPTemplates(epPolicyTemplate); } }
@Override public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<EndpointForwardingTemplateBySubnet>> collection) { for (DataTreeModification<EndpointForwardingTemplateBySubnet> change : collection) { LOG.trace("received modification: {} -> {}", change.getRootPath(), change.getRootNode().getModificationType()); // update cached dao final InstanceIdentifier<EndpointForwardingTemplateBySubnet> changePath = change.getRootPath().getRootIdentifier(); final IpPrefix changeKey = changePath.firstKeyOf(EndpointForwardingTemplateBySubnet.class).getIpPrefix(); SxpListenerUtil.updateCachedDao(templateCachedDao, changeKey, change); final EndpointForwardingTemplateBySubnet epForwardingTemplate = change.getRootNode().getDataAfter(); processWithEPTemplates(epForwardingTemplate); } }
@Override public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<MasterDatabaseBinding>> collection) { for (DataTreeModification<MasterDatabaseBinding> change : collection) { LOG.trace("received modification: {} -> {}", change.getRootPath(), change.getRootNode().getModificationType()); // update cached dao final MasterDatabaseBinding sxpMasterDBItem = change.getRootNode().getDataAfter(); if (sxpMasterDBItem == null) { //TODO: cover sgt-ip mapping removal LOG.debug("ip-sgt mapping was removed - NOOP: {}", change.getRootPath().getRootIdentifier().firstKeyOf(MasterDatabaseBinding.class)); } else { final IpPrefix ipPrefixKey = sxpMasterDBItem.getIpPrefix(); SxpListenerUtil.updateCachedDao(masterDBBindingDaoCached, ipPrefixKey, change); processWithEPTemplates(sxpMasterDBItem); } } }
private void onNeighborsChanged(final DataObjectModification<Neighbors> dataObjectModification, final InstanceIdentifier<Bgp> rootIdentifier) { for (final DataObjectModification<? extends DataObject> neighborModification : dataObjectModification.getModifiedChildren()) { switch (neighborModification.getModificationType()) { case DELETE: onNeighborRemoved(rootIdentifier, (Neighbor) neighborModification.getDataBefore()); break; case SUBTREE_MODIFIED: case WRITE: onNeighborModified(rootIdentifier, (Neighbor) neighborModification.getDataAfter(), null); break; default: break; } } }
private void disconnect(@Nonnull Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change : changes) { if (change.getRootNode().getModificationType() == DataObjectModification.ModificationType.DELETE) { DataObjectModification<OvsdbNodeAugmentation> ovsdbNodeModification = change.getRootNode().getModifiedAugmentation(OvsdbNodeAugmentation.class); if (ovsdbNodeModification != null && ovsdbNodeModification.getDataBefore() != null) { OvsdbNodeAugmentation ovsdbNode = ovsdbNodeModification.getDataBefore(); ConnectionInfo key = ovsdbNode.getConnectionInfo(); InstanceIdentifier<Node> iid = cm.getInstanceIdentifier(key); try { cm.disconnect(ovsdbNode); LOG.info("OVSDB node has been disconnected:{}", ovsdbNode); cm.stopConnectionReconciliationIfActive(iid.firstIdentifierOf(Node.class), ovsdbNode); } catch (UnknownHostException e) { LOG.warn("Failed to disconnect ovsdbNode", e); } } } } }
@VisibleForTesting protected void routeChanged(final DataTreeModification<T> change, final ReadWriteTransaction trans) { final DataObjectModification<T> root = change.getRootNode(); switch (root.getModificationType()) { case DELETE: removeObject(trans, change.getRootPath().getRootIdentifier(), root.getDataBefore()); break; case SUBTREE_MODIFIED: case WRITE: if (root.getDataBefore() != null) { removeObject(trans, change.getRootPath().getRootIdentifier(), root.getDataBefore()); } createObject(trans, change.getRootPath().getRootIdentifier(), root.getDataAfter()); break; default: throw new IllegalArgumentException("Unhandled modification type " + root.getModificationType()); } }
@Override public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<FlowCapableNode>> modifications) { for (DataTreeModification modification : modifications) { if (modification.getRootNode().getModificationType() == ModificationType.WRITE) { AddFlowInputBuilder addFlowInput = new AddFlowInputBuilder(createFlow()); addFlowInput.setNode(new NodeRef(modification.getRootPath().getRootIdentifier().firstIdentifierOf(Node.class))); this.flowService.addFlow(addFlowInput.build()); } } }
@Override public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<FlowCapableNode>> modifications) { for (DataTreeModification modification : modifications) { if (modification.getRootNode().getModificationType() == ModificationType.WRITE) { SetConfigInputBuilder setConfigInputBuilder = new SetConfigInputBuilder(); setConfigInputBuilder.setFlag(SwitchConfigFlag.FRAGNORMAL.toString()); setConfigInputBuilder.setMissSearchLength(OFConstants.OFPCML_NO_BUFFER); setConfigInputBuilder.setNode(new NodeRef(modification.getRootPath().getRootIdentifier().firstIdentifierOf(Node.class))); nodeConfigService.setConfig(setConfigInputBuilder.build()); } } }