Search in sources :

Example 1 with ModificationType

use of org.opendaylight.controller.md.sal.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<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());
        }
    }
}
Also used : DataObject(org.opendaylight.yangtools.yang.binding.DataObject) ModificationType(org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType) DataObjectModification(org.opendaylight.controller.md.sal.binding.api.DataObjectModification) TestExec(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec) PathArgument(org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument)

Example 2 with ModificationType

use of org.opendaylight.controller.md.sal.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;
    }
}
Also used : ModificationType(org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType)

Example 3 with ModificationType

use of org.opendaylight.controller.md.sal.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();
            }
        }
    }
}
Also used : DataObject(org.opendaylight.yangtools.yang.binding.DataObject) ModificationType(org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType)

Example 4 with ModificationType

use of org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType in project controller by opendaylight.

the class CarDataTreeChangeListener method ouputChanges.

private static void ouputChanges(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:
            {
                final Cars dataBefore = rootNode.getDataBefore();
                final Cars dataAfter = rootNode.getDataAfter();
                LOG.trace("onDataTreeChanged - Cars config with path {} was added or changed from {} to {}", rootIdentifier, dataBefore, dataAfter);
                break;
            }
        case DELETE:
            {
                LOG.trace("onDataTreeChanged - Cars config with path {} was deleted", rootIdentifier);
                break;
            }
        default:
            {
                LOG.trace("onDataTreeChanged called with unknown modificationType: {}", modificationType);
                break;
            }
    }
}
Also used : Cars(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.Cars) ModificationType(org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType)

Aggregations

ModificationType (org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType)4 DataObject (org.opendaylight.yangtools.yang.binding.DataObject)2 DataObjectModification (org.opendaylight.controller.md.sal.binding.api.DataObjectModification)1 Cars (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.Cars)1 TestExec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec)1 PathArgument (org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument)1