本文整理汇总了Java中org.opendaylight.controller.md.sal.binding.api.DataTreeModification.getRootNode方法的典型用法代码示例。如果您正苦于以下问题:Java DataTreeModification.getRootNode方法的具体用法?Java DataTreeModification.getRootNode怎么用?Java DataTreeModification.getRootNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.controller.md.sal.binding.api.DataTreeModification
的用法示例。
在下文中一共展示了DataTreeModification.getRootNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logDataTreeChangeEvent
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
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());
}
}
}
示例2: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
@Override
public void onDataTreeChanged(Collection<DataTreeModification<Node>> changes) {
for (DataTreeModification<Node> change: changes) {
final DataObjectModification<Node> rootNode = change.getRootNode();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final Node node = rootNode.getDataAfter();
if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) {
notifyNode(change.getRootPath().getRootIdentifier());
}
break;
default:
break;
}
}
}
示例3: ouputChanges
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
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;
}
}
}
示例4: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
/**
* Implemented from the DataTreeChangeListener interface.
*/
@Override
public void onDataTreeChanged(Collection<DataTreeModification<Toaster>> changes) {
for (DataTreeModification<Toaster> change: changes) {
DataObjectModification<Toaster> rootNode = change.getRootNode();
if (rootNode.getModificationType() == WRITE) {
Toaster oldToaster = rootNode.getDataBefore();
Toaster newToaster = rootNode.getDataAfter();
LOG.info("onDataTreeChanged - Toaster config with path {} was added or replaced: "
+ "old Toaster: {}, new Toaster: {}", change.getRootPath().getRootIdentifier(),
oldToaster, newToaster);
Long darkness = newToaster.getDarknessFactor();
if (darkness != null) {
darknessFactor.set(darkness);
}
} else if (rootNode.getModificationType() == DELETE) {
LOG.info("onDataTreeChanged - Toaster config with path {} was deleted: old Toaster: {}",
change.getRootPath().getRootIdentifier(), rootNode.getDataBefore());
}
}
}
示例5: processChanges
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
private void processChanges(Collection<DataTreeModification<T>> changes) {
LOG.info("onDataTreeChanged: Received Data Tree Changed {}", changes);
for (DataTreeModification<T> change : changes) {
final InstanceIdentifier<T> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<T> mod = change.getRootNode();
LOG.info("onDataTreeChanged: Received Data Tree Changed Update of Type={} for Key={}",
mod.getModificationType(), key);
switch (mod.getModificationType()) {
case DELETE:
dataProcessor.remove(key, mod.getDataBefore());
break;
case SUBTREE_MODIFIED:
dataProcessor.update(key, mod.getDataBefore(), mod.getDataAfter());
break;
case WRITE:
if (mod.getDataBefore() == null) {
dataProcessor.add(key, mod.getDataAfter());
} else {
dataProcessor.update(key, mod.getDataBefore(), mod.getDataAfter());
}
break;
default:
throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
}
}
}
示例6: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
@Override
public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Services>> changes) {
for (DataTreeModification<Services> change : changes) {
final DataObjectModification<Services> mod = change.getRootNode();
switch (mod.getModificationType()) {
case DELETE:
LOG.info("Service deleted {}", mod.getDataBefore());
break;
case SUBTREE_MODIFIED:
LOG.info("Service updated old : {}, new : {}", mod.getDataBefore(), mod.getDataAfter());
break;
case WRITE:
if (mod.getDataBefore() == null) {
LOG.info("Service added {}", mod.getDataAfter());
} else {
LOG.info("Service updated old : {}, new : {}", mod.getDataBefore(), mod.getDataAfter());
}
break;
default:
// FIXME: May be not a good idea to throw.
throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
}
}
}
示例7: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
@Override
public void onDataTreeChanged(Collection<DataTreeModification<VrfEntry>> changes) {
for (DataTreeModification<VrfEntry> change : changes) {
final InstanceIdentifier<VrfEntry> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<VrfEntry> mod = change.getRootNode();
switch (mod.getModificationType()) {
case DELETE:
numFibEntries -= 1;
break;
case WRITE:
if (mod.getDataBefore() == null) {
numFibEntries += 1;
} else {
// UPDATE COUNT UNCHANGED
}
break;
default:
throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
}
}
}
示例8: processUpdatedNodes
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
private void processUpdatedNodes(Collection<DataTreeModification<Node>> changes,
ReadWriteTransaction tx)
throws ReadFailedException, ExecutionException, InterruptedException {
for (DataTreeModification<Node> change : changes) {
final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<Node> mod = change.getRootNode();
String nodeId = key.firstKeyOf(Node.class).getNodeId().getValue();
Node updated = HwvtepHAUtil.getUpdated(mod);
Node original = HwvtepHAUtil.getOriginal(mod);
if (updated != null && original != null) {
if (!nodeId.contains(HwvtepHAUtil.PHYSICALSWITCH)) {
onGlobalNodeUpdate(key, updated, original, tx);
} else {
onPsNodeUpdate(key, updated, original, tx);
}
}
}
}
示例9: processDisconnectedNodes
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
private void processDisconnectedNodes(Collection<DataTreeModification<Node>> changes,
ReadWriteTransaction tx)
throws InterruptedException, ExecutionException, ReadFailedException {
for (DataTreeModification<Node> change : changes) {
final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<Node> mod = change.getRootNode();
Node deleted = HwvtepHAUtil.getRemoved(mod);
String nodeId = key.firstKeyOf(Node.class).getNodeId().getValue();
if (deleted != null) {
if (!nodeId.contains(HwvtepHAUtil.PHYSICALSWITCH)) {
LOG.trace("Handle global node delete {}", deleted.getNodeId().getValue());
onGlobalNodeDelete(key, deleted, tx);
} else {
LOG.trace("Handle ps node node delete {}", deleted.getNodeId().getValue());
onPsNodeDelete(key, deleted, tx);
}
}
}
}
示例10: processConnectedNodes
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
void processConnectedNodes(Collection<DataTreeModification<Node>> changes,
ReadWriteTransaction tx)
throws ReadFailedException, ExecutionException,
InterruptedException {
for (DataTreeModification<Node> change : changes) {
InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
DataObjectModification<Node> mod = change.getRootNode();
Node node = HwvtepHAUtil.getCreated(mod);
String nodeId = key.firstKeyOf(Node.class).getNodeId().getValue();
if (node != null) {
if (!nodeId.contains(HwvtepHAUtil.PHYSICALSWITCH)) {
LOG.trace("Handle global node add {}", node.getNodeId().getValue());
onGlobalNodeAdd(key, node, tx);
} else {
LOG.trace("Handle ps node add {}", node.getNodeId().getValue());
onPsNodeAdd(key, node, tx);
}
}
}
}
示例11: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
@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());
ElanUtils.removeElanInterfaceToElanInstanceCache(mod.getDataBefore().getElanInstanceName(),
mod.getDataBefore().getName());
break;
case SUBTREE_MODIFIED:
case WRITE:
ElanInterface elanInterface = mod.getDataAfter();
ElanUtils.addElanInterfaceIntoCache(elanInterface.getName(), elanInterface);
ElanUtils.addElanInterfaceToElanInstanceCache(elanInterface.getElanInstanceName(),
elanInterface.getName());
break;
default:
throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
}
}
}
示例12: onDataTreeChanged
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
@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());
}
}
}
示例13: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<LogicalRouter>> changes) {
for (DataTreeModification<LogicalRouter> change: changes) {
DataObjectModification<LogicalRouter> rootNode = change.getRootNode();
final LogicalRouter originalRouter = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final LogicalRouter updatedRouter = rootNode.getDataAfter();
if (originalRouter == null) {
LOG.debug("FABMGR: Create Logical Router event: {}", updatedRouter.getUuid().getValue());
ulnMappingEngine.handleLrCreateEvent(updatedRouter);
} else {
LOG.debug("FABMGR: Logical Router Switch event: {}", updatedRouter.getUuid().getValue());
ulnMappingEngine.handleLrUpdateEvent(updatedRouter);
}
break;
case DELETE:
LOG.debug("FABMGR: Remove Logical Router event: {}", originalRouter.getUuid().getValue());
ulnMappingEngine.handleLrRemoveEvent(originalRouter);
break;
default:
break;
}
}
}
示例14: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<LogicalSwitch>> changes) {
for (DataTreeModification<LogicalSwitch> change: changes) {
DataObjectModification<LogicalSwitch> rootNode = change.getRootNode();
final LogicalSwitch originalSwitch = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final LogicalSwitch updatedSwitch = rootNode.getDataAfter();
if (originalSwitch == null) {
LOG.debug("FABMGR: Create Switch event: {}", updatedSwitch.getUuid().getValue());
ulnMappingEngine.handleLswCreateEvent(updatedSwitch);
} else {
LOG.debug("FABMGR: Update Switch event: {}", updatedSwitch.getUuid().getValue());
ulnMappingEngine.handleLswUpdateEvent(updatedSwitch);
}
break;
case DELETE:
final LogicalSwitch deletedSwitch = rootNode.getDataBefore();
LOG.debug("FABMGR: Remove Switch event: {}", deletedSwitch.getUuid().getValue());
ulnMappingEngine.handleLswRemoveEvent(deletedSwitch);
break;
default:
break;
}
}
}
示例15: executeEvent
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; //导入方法依赖的package包/类
public void executeEvent(Collection<DataTreeModification<Subnet>> changes) {
for (DataTreeModification<Subnet> change: changes) {
DataObjectModification<Subnet> rootNode = change.getRootNode();
final Subnet originalSubnet = rootNode.getDataBefore();
switch (rootNode.getModificationType()) {
case WRITE:
case SUBTREE_MODIFIED:
final Subnet updatedSubnet = rootNode.getDataAfter();
if (originalSubnet == null) {
LOG.debug("FABMGR: Create Subnet event: {}", updatedSubnet.getUuid().getValue());
ulnMappingEngine.handleSubnetCreateEvent(updatedSubnet);
} else {
LOG.debug("FABMGR: Update Subnet event: {}", updatedSubnet.getUuid().getValue());
ulnMappingEngine.handleSubnetUpdateEvent(updatedSubnet);
}
break;
case DELETE:
LOG.debug("FABMGR: Remove Subnet event: {}", originalSubnet.getUuid().getValue());
ulnMappingEngine.handleSubnetRemoveEvent(originalSubnet);
break;
default:
break;
}
}
}