use of org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType in project controller by opendaylight.
the class CarDataTreeChangeListener method outputChanges.
private static void outputChanges(final DataTreeModification<Cars> change) {
final DataObjectModification<Cars> rootNode = change.getRootNode();
final ModificationType modificationType = rootNode.getModificationType();
final InstanceIdentifier<Cars> rootIdentifier = change.getRootPath().getRootIdentifier();
switch(modificationType) {
case WRITE:
case SUBTREE_MODIFIED:
{
LOG.trace("onDataTreeChanged - Cars config with path {} was added or changed from {} to {}", rootIdentifier, rootNode.getDataBefore(), rootNode.getDataAfter());
break;
}
case DELETE:
{
LOG.trace("onDataTreeChanged - Cars config with path {} was deleted", rootIdentifier);
break;
}
default:
{
LOG.trace("onDataTreeChanged called with unknown modificationType: {}", modificationType);
break;
}
}
}
use of org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType in project controller by opendaylight.
the class DsbenchmarkListener method logDataTreeChangeEvent.
private static synchronized void logDataTreeChangeEvent(final int eventNum, final Collection<DataTreeModification<TestExec>> changes) {
LOG.debug("DsbenchmarkListener-onDataTreeChanged: Event {}", eventNum);
for (DataTreeModification<TestExec> change : changes) {
final DataObjectModification<TestExec> rootNode = change.getRootNode();
final ModificationType modType = rootNode.getModificationType();
final PathArgument changeId = rootNode.getIdentifier();
final Collection<? extends DataObjectModification<? extends DataObject>> modifications = rootNode.getModifiedChildren();
LOG.debug(" changeId {}, modType {}, mods: {}", changeId, modType, modifications.size());
for (DataObjectModification<? extends DataObject> mod : modifications) {
LOG.debug(" mod-getDataAfter: {}", mod.getDataAfter());
}
}
}
use of org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType in project bgpcep by opendaylight.
the class BmpDeployerImpl method handleModification.
private synchronized void handleModification(final DataObjectModification<BmpMonitorConfig> config) {
final ModificationType modificationType = config.getModificationType();
LOG.trace("Bmp Monitor configuration has changed: {}, type modification {}", config, modificationType);
switch(modificationType) {
case DELETE:
removeBmpMonitor(config.getDataBefore().getMonitorId());
break;
case SUBTREE_MODIFIED:
case WRITE:
updateBmpMonitor(config.getDataAfter());
break;
default:
break;
}
}
use of org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType in project controller by opendaylight.
the class DataStoreAppConfigMetadata method onAppConfigChanged.
private void onAppConfigChanged(final 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");
if (appConfigUpdateStrategy == UpdateStrategy.RELOAD) {
restartContainer();
}
}
} else if (type == ModificationType.DELETE) {
LOG.debug("App config was deleted");
if (appConfigUpdateStrategy == UpdateStrategy.RELOAD) {
restartContainer();
}
}
}
}
Aggregations