• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ReadWriteTransaction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction的典型用法代码示例。如果您正苦于以下问题:Java ReadWriteTransaction类的具体用法?Java ReadWriteTransaction怎么用?Java ReadWriteTransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReadWriteTransaction类属于org.opendaylight.controller.md.sal.binding.api包,在下文中一共展示了ReadWriteTransaction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:Bug3090MultiKeyList.java


示例2: initializeCountrsConfigDataSrore

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
private void initializeCountrsConfigDataSrore() {
    ReadWriteTransaction transaction = db.newReadWriteTransaction();
    CheckedFuture<Optional<IngressElementCountersRequestConfig>, ReadFailedException> iecrc =
            transaction.read(LogicalDatastoreType.CONFIGURATION, CountersServiceUtils.IECRC_IDENTIFIER);
    CheckedFuture<Optional<EgressElementCountersRequestConfig>, ReadFailedException> eecrc =
            transaction.read(LogicalDatastoreType.CONFIGURATION, CountersServiceUtils.EECRC_IDENTIFIER);
    try {
        Optional<IngressElementCountersRequestConfig> iecrcOpt = iecrc.get();
        if (!iecrcOpt.isPresent()) {
            creatIngressEelementCountersContainerInConfig(transaction, CountersServiceUtils.IECRC_IDENTIFIER);
        }

        Optional<EgressElementCountersRequestConfig> eecrcOpt = eecrc.get();
        if (!eecrcOpt.isPresent()) {
            creatEgressEelementCountersContainerInConfig(transaction, CountersServiceUtils.EECRC_IDENTIFIER);
        }
        transaction.submit();
    } catch (InterruptedException | ExecutionException e) {
        StatisticsPluginImplCounters.failed_creating_counters_config.inc();
        LOG.warn("failed creating counters config data structure in DB");
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:23,代码来源:StatisticsImpl.java


示例3: 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);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:24,代码来源:StatisticsImpl.java


示例4: 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);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:24,代码来源:StatisticsImpl.java


示例5: remove

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
@Override
protected void remove(final InstanceIdentifier<L2gateway> identifier, final L2gateway input) {
    LOG.info("Removing L2gateway with ID: {}", input.getUuid());
    List<L2gatewayConnection> connections = l2gwService
            .getL2GwConnectionsByL2GatewayId(input.getUuid());
    try {
        ReadWriteTransaction tx = this.dataBroker.newReadWriteTransaction();
        for (L2gatewayConnection connection : connections) {
            InstanceIdentifier<L2gatewayConnection> iid = InstanceIdentifier.create(Neutron.class)
                    .child(L2gatewayConnections.class).child(L2gatewayConnection.class, connection.getKey());
            tx.delete(LogicalDatastoreType.CONFIGURATION, iid);
        }
        tx.submit().checkedGet();
    } catch (TransactionCommitFailedException e) {
        LOG.error("Failed to delete associated l2gwconnection while deleting l2gw {} with id beacause of {}",
                input.getUuid(), e.getLocalizedMessage());
        //TODO :retry
    }
    List<Devices> l2Devices = input.getDevices();
    for (Devices l2Device : l2Devices) {
        LOG.trace("Removing L2gateway device: {}", l2Device);
        removeL2Device(l2Device, input);
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:L2GatewayListener.java


示例6: updateVpnWithElanInfo

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
public void updateVpnWithElanInfo(VpnInstance vpnInstance, String elanInstanceName, Operation operation) {
    String rd = vpnManager.getPrimaryRdFromVpnInstance(vpnInstance);

    InstanceIdentifier<EvpnRdToNetwork> rdToNetworkIdentifier = getRdToNetworkIdentifier(rd);

    jobCoordinator.enqueueJob("EVPN_ASSOCIATE-" + rd, () -> {
        ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction();
        List<ListenableFuture<Void>> futures = new ArrayList<>();
        if (operation == Operation.DELETE) {
            LOG.debug("Deleting Evpn-Network with key {}", rd);
            transaction.delete(LogicalDatastoreType.CONFIGURATION, rdToNetworkIdentifier);
        } else {
            EvpnRdToNetworkBuilder evpnRdToNetworkBuilder = new EvpnRdToNetworkBuilder().setKey(
                    new EvpnRdToNetworkKey(rd));
            evpnRdToNetworkBuilder.setRd(rd);
            evpnRdToNetworkBuilder.setNetworkId(elanInstanceName);
            LOG.info("updating Evpn {} with elaninstance {} and rd {}",
                    vpnInstance.getVpnInstanceName(), elanInstanceName, rd);
            transaction.put(LogicalDatastoreType.CONFIGURATION, rdToNetworkIdentifier,
                    evpnRdToNetworkBuilder.build(), WriteTransaction.CREATE_MISSING_PARENTS);
        }
        futures.add(transaction.submit());
        return futures;
    });
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:26,代码来源:NeutronEvpnUtils.java


示例7: copyHAPSUpdateToChild

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
/**
 * Copy HA ps node update to HA child ps node of config data tree.
 *
 * @param haUpdated HA node updated
 * @param haOriginal HA node original
 * @param haChildNodeId HA child node which needs to be updated
 * @param tx Transaction
 * @throws ReadFailedException  Exception thrown if read fails
 * @throws ExecutionException  Exception thrown if Execution fail
 * @throws InterruptedException Thread interrupted Exception
 */
public void copyHAPSUpdateToChild(Node haUpdated,
                                  Node haOriginal,
                                  InstanceIdentifier<Node> haChildNodeId,
                                  ReadWriteTransaction tx)
        throws InterruptedException, ExecutionException, ReadFailedException {

    Node existingNode = HwvtepHAUtil.readNode(tx, LogicalDatastoreType.CONFIGURATION, haChildNodeId);

    PhysicalSwitchAugmentation updated = HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(haUpdated);
    PhysicalSwitchAugmentation orig = HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(haOriginal);
    PhysicalSwitchAugmentation existingData = HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(existingNode);

    psAugmentationMerger.mergeConfigUpdate(existingData, updated, orig, haChildNodeId, tx);
    psNodeMerger.mergeConfigUpdate(existingNode, haUpdated, haOriginal, haChildNodeId, tx);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:27,代码来源:ConfigNodeUpdatedHandler.java


示例8: deleteChildPSConfigIfHAPSConfigIsMissing

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
private void deleteChildPSConfigIfHAPSConfigIsMissing(Optional<Node> haPSCfg,
                                                      Node childNode,
                                                      ReadWriteTransaction tx) throws ReadFailedException {
    if (haPSCfg.isPresent()) {
        return;
    }
    LOG.info("HA ps node not present cleanup child {}" , childNode);
    HwvtepGlobalAugmentation augmentation = childNode.getAugmentation(HwvtepGlobalAugmentation.class);
    if (augmentation != null) {
        List<Switches> switches = augmentation.getSwitches();
        if (switches != null) {
            for (Switches ps : switches) {
                HwvtepHAUtil.deleteNodeIfPresent(tx, CONFIGURATION, ps.getSwitchRef().getValue());
            }
        }
    } else {
        LOG.info("Global augumentation not present for connected ha child node {}" , childNode);
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:20,代码来源:NodeConnectedHandler.java


示例9: readAndCopyChildPSOpToHAPS

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
/**
 * Merge data of child PS node to HA ps node .
 *
 * @param childGlobalNode Ha Global Child node
 * @param haNodePath Ha node path
 * @param tx  Transaction
 * @throws ReadFailedException  Exception thrown if read fails
 * @throws ExecutionException  Exception thrown if Execution fail
 * @throws InterruptedException Thread interrupted Exception
 */
void readAndCopyChildPSOpToHAPS(Node childGlobalNode,
                                InstanceIdentifier<Node> haNodePath,
                                ReadWriteTransaction tx)
        throws ReadFailedException, ExecutionException, InterruptedException {

    if (childGlobalNode == null || childGlobalNode.getAugmentation(HwvtepGlobalAugmentation.class) == null) {
        return;
    }
    List<Switches> switches = childGlobalNode.getAugmentation(HwvtepGlobalAugmentation.class).getSwitches();
    if (switches == null) {
        return;
    }
    for (Switches ps : switches) {
        Node childPsNode = HwvtepHAUtil.readNode(tx, OPERATIONAL,
                (InstanceIdentifier<Node>) ps.getSwitchRef().getValue());
        if (childPsNode != null) {
            InstanceIdentifier<Node> haPsPath = HwvtepHAUtil.convertPsPath(childPsNode, haNodePath);
            copyChildPSOpToHAPS(childPsNode, haNodePath, haPsPath, tx);
        }
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:32,代码来源:NodeConnectedHandler.java


示例10: 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);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:31,代码来源:NodeConnectedHandler.java


示例11: 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);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:28,代码来源:NodeConnectedHandler.java


示例12: copyChildPSOpToHAPS

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
/**
 * Copy child physical switch node data to HA physical switch data of Operational data tree.
 *
 * @param childPsNode HA child PS node
 * @param haPath  HA node path
 * @param haPspath Ha Physical Switch 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 copyChildPSOpToHAPS(Node childPsNode,
                                InstanceIdentifier<Node> haPath,
                                InstanceIdentifier<Node> haPspath,
                                ReadWriteTransaction tx)
        throws InterruptedException, ExecutionException, ReadFailedException {

    NodeBuilder haPSNodeBuilder = HwvtepHAUtil.getNodeBuilderForPath(haPspath);
    PhysicalSwitchAugmentationBuilder dstBuilder = new PhysicalSwitchAugmentationBuilder();

    PhysicalSwitchAugmentation src = childPsNode.getAugmentation(PhysicalSwitchAugmentation.class);

    Node existingHAPSNode = HwvtepHAUtil.readNode(tx, OPERATIONAL, haPspath);
    PhysicalSwitchAugmentation existingHAPSAugumentation =
            HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(existingHAPSNode);

    psAugmentationMerger.mergeOperationalData(dstBuilder, existingHAPSAugumentation, src, haPath);
    psNodeMerger.mergeOperationalData(haPSNodeBuilder, existingHAPSNode, childPsNode, haPath);
    mergeOpManagedByAttributes(src, dstBuilder, haPath);

    haPSNodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, dstBuilder.build());
    Node haPsNode = haPSNodeBuilder.build();
    tx.merge(OPERATIONAL, haPspath, haPsNode, true);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:35,代码来源:NodeConnectedHandler.java


示例13: copyChildPsOpUpdateToHAParent

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
/**
 * Copy HA ps node update to HA child ps node of operational data tree.
 *
 * @param updatedSrcPSNode Updated HA child ps node
 * @param origSrcPSNode Original HA ps node
 * @param haPath HA node path
 * @param tx Transaction
 * @throws ReadFailedException  Exception thrown if read fails
 */
public void copyChildPsOpUpdateToHAParent(Node updatedSrcPSNode,
                                          Node origSrcPSNode,
                                          InstanceIdentifier<Node> haPath,
                                          ReadWriteTransaction tx) throws ReadFailedException {

    InstanceIdentifier<Node> haPSPath = HwvtepHAUtil.convertPsPath(updatedSrcPSNode, haPath);
    Node existingHAPSNode = HwvtepHAUtil.readNode(tx, LogicalDatastoreType.OPERATIONAL, haPSPath);

    PhysicalSwitchAugmentation updatedSrc   = HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(updatedSrcPSNode);
    PhysicalSwitchAugmentation origSrc      = HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(origSrcPSNode);
    PhysicalSwitchAugmentation existingData = HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(existingHAPSNode);

    psAugmentationMerger.mergeOpUpdate(existingData, updatedSrc, origSrc, haPSPath, tx);
    psNodeMerger.mergeOpUpdate(existingHAPSNode, updatedSrcPSNode, origSrcPSNode, haPSPath, tx);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:OpNodeUpdatedHandler.java


示例14: copyChildGlobalOpUpdateToHAParent

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
/**
 * Copy updated data from HA node to child node of operational data tree.
 *
 * @param updatedSrcNode Updated HA child node
 * @param origSrcNode Original HA node
 * @param haPath HA node path
 * @param tx Transaction
 * @throws ReadFailedException  Exception thrown if read fails
 */
public void copyChildGlobalOpUpdateToHAParent(Node updatedSrcNode,
                                              Node origSrcNode,
                                              InstanceIdentifier<Node> haPath,
                                              ReadWriteTransaction tx) throws ReadFailedException {

    Node existingDstNode = HwvtepHAUtil.readNode(tx, LogicalDatastoreType.OPERATIONAL, haPath);
    if (existingDstNode == null) {
        //No dst present nothing to copy
        return;
    }
    HwvtepGlobalAugmentation existingData    = HwvtepHAUtil.getGlobalAugmentationOfNode(existingDstNode);
    HwvtepGlobalAugmentation updatedSrc = HwvtepHAUtil.getGlobalAugmentationOfNode(updatedSrcNode);
    HwvtepGlobalAugmentation origSrc    = HwvtepHAUtil.getGlobalAugmentationOfNode(origSrcNode);

    globalAugmentationMerger.mergeOpUpdate(existingData, updatedSrc, origSrc, haPath, tx);
    globalNodeMerger.mergeOpUpdate(existingDstNode, updatedSrcNode, origSrcNode, haPath, tx);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:27,代码来源:OpNodeUpdatedHandler.java


示例15: buildGlobalConfigForHANode

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
/**
 * Build HA Global node from child nodes in config data tress.
 *
 * @param tx Transaction
 * @param childNode Child Node object
 * @param haNodePath Ha node path
 * @param haGlobalCfg HA global node object
 */
public static void buildGlobalConfigForHANode(ReadWriteTransaction tx,
                                              Node childNode,
                                              InstanceIdentifier<Node> haNodePath,
                                              Optional<Node> haGlobalCfg) {

    NodeBuilder nodeBuilder = new NodeBuilder();
    HwvtepGlobalAugmentationBuilder hwvtepGlobalBuilder = new HwvtepGlobalAugmentationBuilder();
    hwvtepGlobalBuilder.setSwitches(buildSwitchesForHANode(childNode, haNodePath, haGlobalCfg));
    hwvtepGlobalBuilder.setManagers(buildManagersForHANode(childNode, haGlobalCfg));

    nodeBuilder.setNodeId(haNodePath.firstKeyOf(Node.class).getNodeId());
    nodeBuilder.addAugmentation(HwvtepGlobalAugmentation.class, hwvtepGlobalBuilder.build());
    Node configHANode = nodeBuilder.build();
    tx.merge(CONFIGURATION, haNodePath, configHANode,Boolean.TRUE);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:24,代码来源:HwvtepHAUtil.java


示例16: deleteSwitchesManagedByNode

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
/**
 * Delete switches from Node in Operational Data Tree .
 *
 * @param haPath HA node path from whih switches will be deleted
 * @param tx  Transaction object
 * @throws ReadFailedException  Exception thrown if read fails
 * @throws ExecutionException  Exception thrown if Execution fail
 * @throws InterruptedException Thread interrupted Exception
 */
public static void deleteSwitchesManagedByNode(InstanceIdentifier<Node> haPath,
                                               ReadWriteTransaction tx)
        throws InterruptedException, ExecutionException, ReadFailedException {

    Optional<Node> nodeOptional = tx.read(OPERATIONAL, haPath).checkedGet();
    if (!nodeOptional.isPresent()) {
        return;
    }
    Node node = nodeOptional.get();
    HwvtepGlobalAugmentation globalAugmentation = node.getAugmentation(HwvtepGlobalAugmentation.class);
    if (globalAugmentation == null) {
        return;
    }
    List<Switches> switches = globalAugmentation.getSwitches();
    if (switches != null) {
        for (Switches switche : switches) {
            InstanceIdentifier<Node> id = (InstanceIdentifier<Node>)switche.getSwitchRef().getValue();
            deleteNodeIfPresent(tx, OPERATIONAL, id);
        }
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:31,代码来源:HwvtepHAUtil.java


示例17: onGlobalNodeAdd

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
@Override
public void onGlobalNodeAdd(InstanceIdentifier<Node> childGlobalPath,
                            Node childNode,
                            ReadWriteTransaction tx) {
    //copy child global node to ha global node
    //create ha global config node if not present
    //copy ha global config node to child global config node
    LOG.trace("Node connected {} - Checking if Ha or Non-Ha enabled ", childNode.getNodeId().getValue());
    haOpClusteredListener.onGlobalNodeAdd(childGlobalPath, childNode, tx);
    if (IS_NOT_HA_CHILD.test(childGlobalPath)) {
        return;
    }
    InstanceIdentifier<Node> haNodePath = hwvtepHACache.getParent(childGlobalPath);
    LOG.trace("Ha enabled child node connected {}", childNode.getNodeId().getValue());
    try {
        nodeCopier.copyGlobalNode(Optional.fromNullable(childNode),
                childGlobalPath, haNodePath, LogicalDatastoreType.OPERATIONAL, tx);
        nodeCopier.copyGlobalNode(Optional.fromNullable(null),
                haNodePath, childGlobalPath, LogicalDatastoreType.CONFIGURATION, tx);
    } catch (ReadFailedException e) {
        LOG.error("Failed to read nodes {} , {} ", childGlobalPath, haNodePath);
    }
    readAndCopyChildPsOpToParent(childGlobalPath, childNode, haNodePath, tx);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:HAOpNodeListener.java


示例18: onGlobalNodeUpdate

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
@Override
void onGlobalNodeUpdate(InstanceIdentifier<Node> childGlobalPath,
                        Node updatedChildNode,
                        Node originalChildNode,
                        ReadWriteTransaction tx) throws ReadFailedException {

    String oldHAId = HwvtepHAUtil.getHAIdFromManagerOtherConfig(originalChildNode);
    if (!Strings.isNullOrEmpty(oldHAId)) { //was already ha child
        InstanceIdentifier<Node> haPath = hwvtepHACache.getParent(childGlobalPath);
        LOG.debug("Copy oper update from child {} to parent {}", childGlobalPath, haPath);
        haEventHandler.copyChildGlobalOpUpdateToHAParent(updatedChildNode, originalChildNode, haPath, tx);
        return;//TODO handle unha case
    }

    HAOpClusteredListener.addToHACacheIfBecameHAChild(childGlobalPath, updatedChildNode, originalChildNode, tx);
    if (IS_NOT_HA_CHILD.test(childGlobalPath)) {
        return;
    }
    LOG.info("{} became ha child ", updatedChildNode.getNodeId().getValue());
    onGlobalNodeAdd(childGlobalPath, updatedChildNode, tx);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:HAOpNodeListener.java


示例19: onGlobalNodeDelete

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
@Override
void onGlobalNodeDelete(InstanceIdentifier<Node> childGlobalPath,
                        Node childNode,
                        ReadWriteTransaction tx) throws InterruptedException, ExecutionException,
        ReadFailedException {
    haOpClusteredListener.onGlobalNodeDelete(childGlobalPath, childNode, tx);
    if (IS_NOT_HA_CHILD.test(childGlobalPath)) {
        LOG.info("non ha child global delete {} ", getNodeId(childGlobalPath));
        return;
    }
    LOG.info("ha child global delete {} ", getNodeId(childGlobalPath));
    InstanceIdentifier<Node> haNodePath = hwvtepHACache.getParent(childGlobalPath);
    Set<InstanceIdentifier<Node>> children = hwvtepHACache.getChildrenForHANode(haNodePath);
    if (haOpClusteredListener.getConnected(children).isEmpty()) {
        LOG.info("All child deleted for ha node {} ", HwvtepHAUtil.getNodeIdVal(haNodePath));
        //ha ps delete is taken care by ps node delete
        //HwvtepHAUtil.deleteSwitchesManagedBy-Node(haNodePath, tx);
        HwvtepHAUtil.deleteNodeIfPresent(tx, OPERATIONAL, haNodePath);
    } else {
        LOG.info("not all child deleted {} connected {}", getNodeId(childGlobalPath),
                haOpClusteredListener.getConnected(children));
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:24,代码来源:HAOpNodeListener.java


示例20: onPsNodeAdd

import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; //导入依赖的package包/类
@Override
void onPsNodeAdd(InstanceIdentifier<Node> childPsPath,
                 Node childPsNode,
                 ReadWriteTransaction tx) throws ReadFailedException {
    //copy child ps oper node to ha ps oper node
    //copy ha ps config node to child ps config
    haOpClusteredListener.onPsNodeAdd(childPsPath, childPsNode, tx);
    InstanceIdentifier<Node> childGlobalPath = HwvtepHAUtil.getGlobalNodePathFromPSNode(childPsNode);
    if (!haOpClusteredListener.getConnectedNodes().contains(childGlobalPath)) {
        return;
    }
    if (IS_NOT_HA_CHILD.test(childGlobalPath)) {
        return;
    }
    LOG.info("ha ps child connected {} ", getNodeId(childPsPath));
    InstanceIdentifier<Node> haGlobalPath = hwvtepHACache.getParent(childGlobalPath);
    InstanceIdentifier<Node> haPsPath = HwvtepHAUtil.convertPsPath(childPsNode, haGlobalPath);
    try {
        nodeCopier.copyPSNode(Optional.fromNullable(childPsNode), childPsPath, haPsPath, haGlobalPath,
                LogicalDatastoreType.OPERATIONAL, tx);
        nodeCopier.copyPSNode(Optional.fromNullable(null), haPsPath, childPsPath, childGlobalPath,
                LogicalDatastoreType.CONFIGURATION, tx);
    } catch (ReadFailedException e) {
        LOG.error("Failed to read nodes {} , {} ", childPsPath, haGlobalPath);
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:27,代码来源:HAOpNodeListener.java



注:本文中的org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FieldDeclaration类代码示例发布时间:2022-05-22
下一篇:
Java EventType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap