本文整理汇总了Java中org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction.put方法的典型用法代码示例。如果您正苦于以下问题:Java ReadWriteTransaction.put方法的具体用法?Java ReadWriteTransaction.put怎么用?Java ReadWriteTransaction.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction
的用法示例。
在下文中一共展示了ReadWriteTransaction.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private void write(final LogicalDatastoreType store) {
final ReadWriteTransaction readWriteTransaction = getDataBroker().newReadWriteTransaction();
final List<ListInRoot> listInRoots = new ArrayList<>();
for (int i = 0; i < 10; i++) {
listInRoots.add(new ListInRootBuilder()
.setLeafA("leaf a" + i)
.setLeafC("leaf c" + i)
.setLeafB("leaf b" + i)
.build()
);
}
final Root root = new RootBuilder().setListInRoot(listInRoots).build();
readWriteTransaction.put(store, ROOT_PATH, root);
assertCommit(readWriteTransaction.submit());
}
示例2: putIngressElementCounterRequestInConfig
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private void putIngressElementCounterRequestInConfig(AcquireElementCountersRequestHandlerInput input,
ElementCountersDirection direcion, ReadWriteTransaction transaction, String requestKey,
InstanceIdentifier<IngressElementCountersRequestConfig> ecrcIdentifier,
Optional<IngressElementCountersRequestConfig> iecrcOpt, String generatedUniqueId) {
IngressElementCountersRequestConfig requestConfig = iecrcOpt.get();
CounterRequestsBuilder crb = new CounterRequestsBuilder();
crb.setRequestId(requestKey);
crb.setKey(new CounterRequestsKey(requestKey));
crb.setFilters(input.getOutgoingTraffic().getFilters());
crb.setPortId(input.getPortId());
crb.setLportTag(getLportTag(input.getPortId()));
crb.setDpn(getDpn(input.getPortId()));
crb.setTrafficDirection(direcion.toString());
crb.setGeneratedUniqueId(generatedUniqueId);
List<CounterRequests> counterRequests = requestConfig.getCounterRequests();
counterRequests.add(crb.build());
IngressElementCountersRequestConfigBuilder ecrcb = new IngressElementCountersRequestConfigBuilder();
ecrcb.setCounterRequests(counterRequests);
requestConfig = ecrcb.build();
transaction.put(LogicalDatastoreType.CONFIGURATION, ecrcIdentifier, requestConfig,
WriteTransaction.CREATE_MISSING_PARENTS);
}
示例3: putEgressElementCounterRequestInConfig
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private void putEgressElementCounterRequestInConfig(AcquireElementCountersRequestHandlerInput input,
ElementCountersDirection direcion, ReadWriteTransaction transaction, String requestKey,
InstanceIdentifier<EgressElementCountersRequestConfig> ecrcIdentifier,
Optional<EgressElementCountersRequestConfig> eecrcOpt, String generatedUniqueId) {
EgressElementCountersRequestConfig requestConfig = eecrcOpt.get();
CounterRequestsBuilder crb = new CounterRequestsBuilder();
crb.setRequestId(requestKey);
crb.setKey(new CounterRequestsKey(requestKey));
crb.setFilters(input.getIncomingTraffic().getFilters());
crb.setPortId(input.getPortId());
crb.setLportTag(getLportTag(input.getPortId()));
crb.setDpn(getDpn(input.getPortId()));
crb.setTrafficDirection(direcion.toString());
crb.setGeneratedUniqueId(generatedUniqueId);
List<CounterRequests> counterRequests = requestConfig.getCounterRequests();
counterRequests.add(crb.build());
EgressElementCountersRequestConfigBuilder ecrcb = new EgressElementCountersRequestConfigBuilder();
ecrcb.setCounterRequests(counterRequests);
requestConfig = ecrcb.build();
transaction.put(LogicalDatastoreType.CONFIGURATION, ecrcIdentifier, requestConfig,
WriteTransaction.CREATE_MISSING_PARENTS);
}
示例4: copyHANodeConfigToChild
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
/**
* Copy HA global node data to Child HA node of config data tree .
*
* @param srcNode Node which to be transformed
* @param childPath Path to which source node will be transformed
* @param tx Transaction
* @throws ReadFailedException Exception thrown if read fails
* @throws ExecutionException Exception thrown if Execution fail
* @throws InterruptedException Thread interrupted Exception
*/
private void copyHANodeConfigToChild(Node srcNode,
InstanceIdentifier<Node> childPath,
ReadWriteTransaction tx)
throws ReadFailedException, ExecutionException, InterruptedException {
if (srcNode == null) {
return;
}
HwvtepGlobalAugmentation src = srcNode.getAugmentation(HwvtepGlobalAugmentation.class);
if (src == null) {
return;
}
NodeBuilder nodeBuilder = HwvtepHAUtil.getNodeBuilderForPath(childPath);
HwvtepGlobalAugmentationBuilder dstBuilder = new HwvtepGlobalAugmentationBuilder();
globalAugmentationMerger.mergeConfigData(dstBuilder, src, childPath);
globalNodeMerger.mergeConfigData(nodeBuilder, srcNode, childPath);
nodeBuilder.addAugmentation(HwvtepGlobalAugmentation.class, dstBuilder.build());
Node dstNode = nodeBuilder.build();
tx.put(CONFIGURATION, childPath, dstNode, WriteTransaction.CREATE_MISSING_PARENTS);
}
示例5: copyHAPSConfigToChildPS
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
/**
* Copy HA physical switch data to Child Physical switch node of config data tree.
*
* @param haPsNode HA physical Switch Node
* @param childPath HA Child Node path
* @param tx Transaction
* @throws ReadFailedException Exception thrown if read fails
* @throws ExecutionException Exception thrown if Execution fail
* @throws InterruptedException Thread interrupted Exception
*/
public void copyHAPSConfigToChildPS(Node haPsNode,
InstanceIdentifier<Node> childPath,
ReadWriteTransaction tx)
throws InterruptedException, ExecutionException, ReadFailedException {
InstanceIdentifier<Node> childPsPath = HwvtepHAUtil.convertPsPath(haPsNode, childPath);
NodeBuilder childPsBuilder = HwvtepHAUtil.getNodeBuilderForPath(childPsPath);
PhysicalSwitchAugmentationBuilder dstBuilder = new PhysicalSwitchAugmentationBuilder();
PhysicalSwitchAugmentation src = haPsNode.getAugmentation(PhysicalSwitchAugmentation.class);
psAugmentationMerger.mergeConfigData(dstBuilder, src, childPath);
psNodeMerger.mergeConfigData(childPsBuilder, haPsNode, childPath);
childPsBuilder.addAugmentation(PhysicalSwitchAugmentation.class, dstBuilder.build());
Node childPSNode = childPsBuilder.build();
tx.put(CONFIGURATION, childPsPath, childPSNode, WriteTransaction.CREATE_MISSING_PARENTS);
}
示例6: genNextFabricNum
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private long genNextFabricNum() {
long ret = 1;
FabricsSettingBuilder settingBuilder = new FabricsSettingBuilder();
ReadWriteTransaction trans = dataBroker.newReadWriteTransaction();
InstanceIdentifier<FabricsSetting> fabricImplPath = InstanceIdentifier.create(FabricsSetting.class);
ListenableFuture<Optional<FabricsSetting>> readFuture =
trans.read(LogicalDatastoreType.CONFIGURATION, fabricImplPath);
Optional<FabricsSetting> optional;
try {
optional = readFuture.get();
if (optional.isPresent()) {
ret = optional.get().getNextFabricNum();
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("can not read fabric setting", e);
}
settingBuilder.setNextFabricNum(ret + 1);
trans.put(LogicalDatastoreType.CONFIGURATION, fabricImplPath, settingBuilder.build());
MdSalUtils.wrapperSubmit(trans, executor);
return ret;
}
示例7: createTP
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private InstanceIdentifier<TerminationPoint> createTP(final IpAddress addr, final InstanceIdentifier<Node> sni,
final Boolean inControl, final ReadWriteTransaction trans) {
final String url = "ip://" + addr.toString();
final TerminationPointKey tpk = new TerminationPointKey(new TpId(url));
final TerminationPointBuilder tpb = new TerminationPointBuilder();
tpb.setKey(tpk).setTpId(tpk.getTpId());
tpb.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(
new IgpTerminationPointAttributesBuilder().setTerminationPointType(
new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build()).build()).build());
final NodeKey nk = new NodeKey(new NodeId(url));
final NodeBuilder nb = new NodeBuilder();
nb.setKey(nk).setNodeId(nk.getNodeId());
nb.setTerminationPoint(Lists.newArrayList(tpb.build()));
if (sni != null) {
nb.setSupportingNode(Lists.newArrayList(createSupportingNode(InstanceIdentifier.keyOf(sni).getNodeId(),
inControl)));
}
final InstanceIdentifier<Node> nid = this.target.child(Node.class, nb.getKey());
trans.put(LogicalDatastoreType.OPERATIONAL, nid, nb.build());
return nid.child(TerminationPoint.class, tpb.getKey());
}
示例8: initializeOvsdbTopology
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private void initializeOvsdbTopology(LogicalDatastoreType type) {
InstanceIdentifier<Topology> path = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));
ReadWriteTransaction transaction = db.newReadWriteTransaction();
CheckedFuture<Optional<Topology>, ReadFailedException> ovsdbTp = transaction.read(type, path);
try {
if (!ovsdbTp.get().isPresent()) {
TopologyBuilder tpb = new TopologyBuilder();
tpb.setTopologyId(SouthboundConstants.OVSDB_TOPOLOGY_ID);
transaction.put(type, path, tpb.build(), true);
transaction.submit();
} else {
transaction.cancel();
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error initializing ovsdb topology", e);
}
}
示例9: initializeHwvtepTopology
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private void initializeHwvtepTopology(LogicalDatastoreType type) {
InstanceIdentifier<Topology> path = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID));
ReadWriteTransaction transaction = db.newReadWriteTransaction();
CheckedFuture<Optional<Topology>, ReadFailedException> hwvtepTp = transaction.read(type, path);
try {
if (!hwvtepTp.get().isPresent()) {
TopologyBuilder tpb = new TopologyBuilder();
tpb.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID);
transaction.put(type, path, tpb.build(), true);
transaction.submit();
} else {
transaction.cancel();
}
} catch (Exception e) {
LOG.error("Error initializing hwvtep topology", e);
}
}
示例10: writeRoot
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private void writeRoot(final LogicalDatastoreType store) {
final ReadWriteTransaction readWriteTransaction = getDataBroker().newReadWriteTransaction();
final Barroot barRoot = new BarrootBuilder().setType(2).setValue(2).setKey(new BarrootKey(2)).build();
final ArrayList barRootList = new ArrayList();
barRootList.add(barRoot);
final Fooroot fooRoot = new FoorootBuilder().setBarroot(barRootList).build();
final ArrayList fooRootList = new ArrayList();
fooRootList.add(fooRoot);
final Root root = new RootBuilder().setFooroot(fooRootList).build();
readWriteTransaction.put(store, ROOT_PATH, root);
assertCommit(readWriteTransaction.submit());
}
示例11: putTopBarNodeSubtreeListeners
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
@Test
public void putTopBarNodeSubtreeListeners() {
TestListener topListener = createListener(CONFIGURATION, TOP, DataChangeScope.SUBTREE);
TestListener allListener = createListener(CONFIGURATION, WILDCARDED, DataChangeScope.SUBTREE, false);
TestListener fooListener = createListener(CONFIGURATION, TOP_FOO, DataChangeScope.SUBTREE);
TestListener barListener = createListener(CONFIGURATION, TOP_BAR, DataChangeScope.SUBTREE, false);
ReadWriteTransaction writeTx = getDataBroker().newReadWriteTransaction();
writeTx.put(CONFIGURATION, TOP_BAR, topLevelList(TOP_BAR_KEY));
assertCommit(writeTx.submit());
verifyBarOnlyAdded(topListener,allListener,fooListener,barListener);
}
示例12: creatIngressEelementCountersContainerInConfig
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private void creatIngressEelementCountersContainerInConfig(ReadWriteTransaction transaction,
InstanceIdentifier<IngressElementCountersRequestConfig> ecrcIdentifier) {
IngressElementCountersRequestConfigBuilder iecrcb = new IngressElementCountersRequestConfigBuilder();
List<CounterRequests> counterRequests = new ArrayList<>();
iecrcb.setCounterRequests(counterRequests);
IngressElementCountersRequestConfig iecrc = iecrcb.build();
transaction.put(LogicalDatastoreType.CONFIGURATION, ecrcIdentifier, iecrc,
WriteTransaction.CREATE_MISSING_PARENTS);
}
示例13: creatEgressEelementCountersContainerInConfig
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
private void creatEgressEelementCountersContainerInConfig(ReadWriteTransaction transaction,
InstanceIdentifier<EgressElementCountersRequestConfig> ecrcIdentifier) {
EgressElementCountersRequestConfigBuilder eecrcb = new EgressElementCountersRequestConfigBuilder();
List<CounterRequests> counterRequests = new ArrayList<>();
eecrcb.setCounterRequests(counterRequests);
EgressElementCountersRequestConfig eecrc = eecrcb.build();
transaction.put(LogicalDatastoreType.CONFIGURATION, ecrcIdentifier, eecrc,
WriteTransaction.CREATE_MISSING_PARENTS);
}
示例14: updateElanWithVpnInfo
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
public void updateElanWithVpnInfo(String elanInstanceName, VpnInstance vpnInstance, Operation operation) {
String vpnName = vpnInstance.getVpnInstanceName();
InstanceIdentifier<ElanInstance> elanIid = ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName);
ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction();
Optional<ElanInstance> elanInstanceOptional = Optional.absent();
try {
elanInstanceOptional = transaction.read(LogicalDatastoreType.CONFIGURATION, elanIid).checkedGet();
} catch (ReadFailedException e) {
LOG.error("updateElanWithVpnInfo throws ReadFailedException e {}", e);
}
if (!elanInstanceOptional.isPresent()) {
return;
}
EvpnAugmentationBuilder evpnAugmentationBuilder = new EvpnAugmentationBuilder();
ElanInstanceBuilder elanInstanceBuilder = new ElanInstanceBuilder(elanInstanceOptional.get());
if (elanInstanceBuilder.getAugmentation(EvpnAugmentation.class) != null) {
evpnAugmentationBuilder =
new EvpnAugmentationBuilder(elanInstanceBuilder.getAugmentation(EvpnAugmentation.class));
}
if (operation == Operation.ADD) {
evpnAugmentationBuilder.setEvpnName(vpnName);
LOG.debug("Writing Elan-EvpnAugmentation with key {}", elanInstanceName);
} else {
evpnAugmentationBuilder.setEvpnName(null);
LOG.debug("Deleting Elan-EvpnAugmentation with key {}", elanInstanceName);
}
elanInstanceBuilder.addAugmentation(EvpnAugmentation.class, evpnAugmentationBuilder.build());
transaction.put(LogicalDatastoreType.CONFIGURATION, elanIid, elanInstanceBuilder.build(),
WriteTransaction.CREATE_MISSING_PARENTS);
transaction.submit();
}
示例15: createObject
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入方法依赖的package包/类
@Override
protected final void createObject(final ReadWriteTransaction trans, final InstanceIdentifier<T> id, final T value) {
final NodeId ni = advertizingNode(getAttributes(value));
if (ni == null) {
return;
}
final InstanceIdentifier<IgpNodeAttributes> nii = ensureNodePresent(trans, ni);
final IpPrefix prefix = getPrefix(value);
final PrefixKey pk = new PrefixKey(prefix);
trans.put(LogicalDatastoreType.OPERATIONAL,
nii.child(Prefix.class, pk), new PrefixBuilder().setKey(pk).setPrefix(prefix).build());
}