当前位置: 首页>>代码示例>>Java>>正文


Java Node类代码示例

本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node的典型用法代码示例。如果您正苦于以下问题:Java Node类的具体用法?Java Node怎么用?Java Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Node类属于org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology包,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerEventSourceTest

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
@Test
public void registerEventSourceTest() throws Exception {
    topicTestHelper();
    Node nodeMock = mock(Node.class);
    EventSource eventSourceMock = mock(EventSource.class);
    NodeId nodeId = new NodeId("nodeIdValue1");
    nodeKey = new NodeKey(nodeId);
    doReturn(nodeKey).when(nodeMock).getKey();
    doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey();
    BindingAwareBroker.RoutedRpcRegistration routedRpcRegistrationMock = mock(BindingAwareBroker.RoutedRpcRegistration.class);
    doReturn(routedRpcRegistrationMock).when(rpcProviderRegistryMock).addRoutedRpcImplementation(EventSourceService.class, eventSourceMock);
    doNothing().when(routedRpcRegistrationMock).registerPath(eq(NodeContext.class), any(KeyedInstanceIdentifier.class));
    assertNotNull("Return value has not been created correctly.", eventSourceTopology.registerEventSource(eventSourceMock));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:EventSourceTopologyTest.java

示例2: onDataTreeChanged

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的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;
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:EventSourceTopic.java

示例3: onDataTreeChangedTest

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void onDataTreeChangedTest() {
    InstanceIdentifier<Node> instanceIdentifierMock = mock(InstanceIdentifier.class);
    DataTreeModification<Node> mockDataTreeModification = mock(DataTreeModification.class);
    DataObjectModification<Node> mockModification = mock(DataObjectModification.class);
    doReturn(mockModification).when(mockDataTreeModification).getRootNode();
    doReturn(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, instanceIdentifierMock))
            .when(mockDataTreeModification).getRootPath();
    doReturn(DataObjectModification.ModificationType.WRITE).when(mockModification).getModificationType();

    Node dataObjectNodeMock = mock(Node.class);
    doReturn(getNodeKey("testNodeId01")).when(dataObjectNodeMock).getKey();
    NodeId nodeIdMock = mock(NodeId.class);
    doReturn(nodeIdMock).when(dataObjectNodeMock).getNodeId();
    doReturn("nodeIdPattern1").when(nodeIdMock).getValue();

    doReturn(dataObjectNodeMock).when(mockModification).getDataAfter();

    eventSourceTopic.onDataTreeChanged(Collections.singletonList(mockDataTreeModification));
    verify(dataObjectNodeMock).getNodeId();
    verify(nodeIdMock).getValue();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:EventSourceTopicTest.java

示例4: setupForHANode

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
@Before
public void setupForHANode() {
    dataBroker = getDataBroker();
    d1UUID = java.util.UUID.nameUUIDFromBytes("d1uuid".getBytes()).toString();
    d2UUID = java.util.UUID.nameUUIDFromBytes("d2uuid".getBytes()).toString();
    d1NodePath = getInstanceIdentifier(d1UUID);
    d2NodePath = getInstanceIdentifier(d2UUID);
    haNodePath = getInstanceIdentifier(managerHAId);

    haNodeId = getNodeId(managerHAId);

    NodeId d1NodeId = d1NodePath.firstKeyOf(Node.class).getNodeId();
    String d1PsNodeIdVal = d1NodeId.getValue() + "/physicalswitch/" + switchName;
    d1PsNodePath = createInstanceIdentifier(d1PsNodeIdVal);

    NodeId d2NodeId = d2NodePath.firstKeyOf(Node.class).getNodeId();
    String d2PsNodeIdVal = d2NodeId.getValue() + "/physicalswitch/" + switchName;
    d2PsNodePath = createInstanceIdentifier(d2PsNodeIdVal);

    haPsNodePath = createInstanceIdentifier(haNodeId.getValue() + "/physicalswitch/" + switchName);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:NodeConnectedHandlerTest.java

示例5: compareLogicalSwitches

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
public static void compareLogicalSwitches(Node d1, Node d2, Node ha, InstanceIdentifier<Node> nodePath) {
    LogicalSwitchesCmd cmd = new LogicalSwitchesCmd();
    HwvtepGlobalAugmentation d1Aug = d1.getAugmentation(HwvtepGlobalAugmentation.class);
    HwvtepGlobalAugmentation d2Aug = d2.getAugmentation(HwvtepGlobalAugmentation.class);
    HwvtepGlobalAugmentation haAug = ha.getAugmentation(HwvtepGlobalAugmentation.class);

    List<LogicalSwitches> d1Values =
            d1Aug.getLogicalSwitches() != null ? d1Aug.getLogicalSwitches() : new ArrayList<>();
    List<LogicalSwitches> result1 = cmd.transform(nodePath, d1Values);
    List<LogicalSwitches> d2Values =
            d2Aug.getLogicalSwitches() != null ? d2Aug.getLogicalSwitches() : new ArrayList<>();
    List<LogicalSwitches> result2 = cmd.transform(nodePath, d2Values);
    //Merge data of both d1 and d2 logical switch info should be same as ha
    Set<LogicalSwitches> set1 = new HashSet<>();
    set1.addAll(result1);
    set1.addAll(result2);
    List<LogicalSwitches> result = cmd.transform(nodePath, haAug.getLogicalSwitches());
    Set<LogicalSwitches> set2 = Sets.newHashSet(result);
    assertEquals("should have equal logical switches", 0, Sets.symmetricDifference(set1, set2).size());

}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:TestComparators.java

示例6: getOpenvswitchOtherConfig

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
private String getOpenvswitchOtherConfig(Node node, String key) {
    OvsdbNodeAugmentation ovsdbNode = node.getAugmentation(OvsdbNodeAugmentation.class);
    if (ovsdbNode == null) {
        Optional<Node> nodeFromReadOvsdbNode = readOvsdbNode(node);
        if (nodeFromReadOvsdbNode.isPresent()) {
            ovsdbNode = nodeFromReadOvsdbNode.get().getAugmentation(OvsdbNodeAugmentation.class);
        }
    }

    if (ovsdbNode != null && ovsdbNode.getOpenvswitchOtherConfigs() != null) {
        for (OpenvswitchOtherConfigs openvswitchOtherConfigs : ovsdbNode.getOpenvswitchOtherConfigs()) {
            if (openvswitchOtherConfigs.getOtherConfigKey().equals(key)) {
                return openvswitchOtherConfigs.getOtherConfigValue();
            }
        }
    }

    return null;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:20,代码来源:DisplayNaptSwithcesCli.java

示例7: onDataTreeChanged

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
@Override
public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) {
    HAJobScheduler.getInstance().submitJob(() -> {
        ReadWriteTransaction tx = getTx();
        try {
            processConnectedNodes(changes, tx);
            processUpdatedNodes(changes, tx);
            processDisconnectedNodes(changes, tx);
            tx.submit().get();
        } catch (InterruptedException e1) {
            LOG.error("InterruptedException " + e1.getMessage());
        } catch (ExecutionException e2) {
            LOG.error("ExecutionException" + e2.getMessage());
        } catch (ReadFailedException e3) {
            LOG.error("ReadFailedException" + e3.getMessage());
        }
    });
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:19,代码来源:HwvtepNodeBaseListener.java

示例8: buildManagersForHANode

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
/**
 * Transform child managers (Source) to HA managers using HA node path.
 *
 * @param childNode Child Node
 * @param haGlobalCfg HA global config node
 * @return Transformed managers
 */
public static List<Managers> buildManagersForHANode(Node childNode, Optional<Node> haGlobalCfg) {

    Set<NodeId> nodeIds = new HashSet<>();
    nodeIds.add(childNode.getNodeId());
    List<NodeId> childNodeIds = getChildNodeIdsFromManagerOtherConfig(haGlobalCfg);
    nodeIds.addAll(childNodeIds);

    ManagersBuilder builder1 = new ManagersBuilder();

    builder1.setKey(new ManagersKey(new Uri(MANAGER_KEY)));
    List<ManagerOtherConfigs> otherConfigses = new ArrayList<>();
    StringBuffer stringBuffer = new StringBuffer();
    for (NodeId nodeId : nodeIds) {
        stringBuffer.append(nodeId.getValue());
        stringBuffer.append(",");
    }

    String children = stringBuffer.substring(0, stringBuffer.toString().length() - 1);

    otherConfigses.add(getOtherConfigBuilder(HA_CHILDREN, children).build());
    builder1.setManagerOtherConfigs(otherConfigses);
    List<Managers> managers = new ArrayList<>();
    managers.add(builder1.build());
    return managers;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:33,代码来源:HwvtepHAUtil.java

示例9: remove

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
@Override
protected void remove(InstanceIdentifier<LocalUcastMacs> identifier,
        LocalUcastMacs del) {
    // Flow removal for table 18 is handled in Neutron Port delete.
    //remove the new CR-DHCP
    NodeId torNodeId = identifier.firstKeyOf(Node.class).getNodeId();
    LogicalSwitches logicalSwitch = getLogicalSwitches(del);
    if (null == logicalSwitch) {
        LOG.error("DhcpUCastMacListener remove :Logical Switch ref doesn't have data");
        return;
    }
    String elanInstanceName = logicalSwitch.getHwvtepNodeName().getValue();
    L2GatewayDevice device = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanInstanceName, torNodeId.getValue());
    if (device == null) {
        LOG.error("Logical Switch Device with name {} is not present in L2GWCONN cache", elanInstanceName);
        return;
    }
    IpAddress tunnelIp = device.getTunnelIp();
    Pair<IpAddress, String> tunnelIpElanName = new ImmutablePair<>(tunnelIp, elanInstanceName);
    dhcpExternalTunnelManager.removeFromAvailableCache(tunnelIpElanName);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:DhcpUCastMacListener.java

示例10: removed

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
@Override
protected void removed(InstanceIdentifier<RemoteMcastMacs> identifier,
                       RemoteMcastMacs del) {
    String elanInstanceName = getElanName(del);
    IpAddress tunnelIp = dhcpL2GwUtil.getHwvtepNodeTunnelIp(identifier.firstIdentifierOf(Node.class));
    if (tunnelIp == null) {
        LOG.error("Could not find tunnelIp for {}", identifier);
        return;
    }
    BigInteger designatedDpnId = externalTunnelManager.readDesignatedSwitchesForExternalTunnel(
            tunnelIp, elanInstanceName);
    if (designatedDpnId == null) {
        LOG.error("Could not find designated DPN ID elanInstanceName {}, tunnelIp {}", elanInstanceName, tunnelIp);
        return;
    }
    externalTunnelManager.removeDesignatedSwitchForExternalTunnel(designatedDpnId, tunnelIp, elanInstanceName);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:18,代码来源:DhcpMcastMacListener.java

示例11: addPortToBridge

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
/**
 * Add a port to a bridge.
 * @param node the bridge node
 * @param bridgeName name of the bridge
 * @param portName name of port to add
 * @return true if successful in writing to mdsal
 */
public boolean addPortToBridge(Node node, String bridgeName, String portName) {
    boolean rv = true;

    if (southboundUtils.extractTerminationPointAugmentation(node, portName) == null) {
        rv = southboundUtils.addTerminationPoint(node, bridgeName, portName, null);

        if (rv) {
            LOG.debug("addPortToBridge: node: {}, bridge: {}, portname: {} status: success",
                    node.getNodeId().getValue(), bridgeName, portName);
        } else {
            LOG.error("addPortToBridge: node: {}, bridge: {}, portname: {} status: FAILED",
                    node.getNodeId().getValue(), bridgeName, portName);
        }
    } else {
        LOG.trace("addPortToBridge: node: {}, bridge: {}, portname: {} status: not_needed",
                node.getNodeId().getValue(), bridgeName, portName);
    }

    return rv;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:28,代码来源:ElanBridgeManager.java

示例12: verifyHAOpNode

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
public static void verifyHAOpNode(Node d1GlobalOpNode, Node d2GlobalOpNode, Node haGlobalOpNode,
                                  Node d1PsOpNode, Node d2PsOpNode, Node haPsOpNode,
                                  InstanceIdentifier<Node> haId, InstanceIdentifier<Node> d1PsId,
                                  InstanceIdentifier<Node> d2PsId, InstanceIdentifier<Node> haPsId,
                                  NodeId haNodeId, DataBroker dataBroker) throws ReadFailedException {
    ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction();
    TestComparators.compareLogicalSwitches(d1GlobalOpNode, d2GlobalOpNode, haGlobalOpNode, haId);
    TestComparators.compareRemoteUcastMacs(d1GlobalOpNode, d2GlobalOpNode, haGlobalOpNode, haId);
    TestComparators.compareRemoteMcastMacs(d1GlobalOpNode, d2GlobalOpNode, haGlobalOpNode, haId);
    TestComparators.compareLocalUcastMacs(d1GlobalOpNode, d2GlobalOpNode, haGlobalOpNode, haId);
    TestComparators.compareLocalMcastMacs(d1GlobalOpNode, d2GlobalOpNode, haGlobalOpNode, haId);
    TestComparators.verifySwitches(haGlobalOpNode, haPsOpNode);
    TestComparators.verifySwitches(d1GlobalOpNode, d1PsOpNode);
    TestComparators.verifySwitches(d2GlobalOpNode, d2PsOpNode);
    TestComparators.comparePhysicalSwitches(d1PsOpNode, d2PsOpNode, haPsOpNode, d1PsId, d2PsId, haPsId,
            transaction, "s3", d1GlobalOpNode, d2GlobalOpNode, haGlobalOpNode);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:18,代码来源:TestUtil.java

示例13: addPsNode

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
CheckedFuture<Void, TransactionCommitFailedException> addPsNode(InstanceIdentifier<Node> path,
        InstanceIdentifier<Node> parentPath, List<String> portNameList, WriteTransaction transaction)
        throws Exception {
    NodeBuilder nodeBuilder = null;

    nodeBuilder = prepareOperationalNode(path);
    PhysicalSwitchAugmentationBuilder physicalSwitchAugmentationBuilder = new PhysicalSwitchAugmentationBuilder();
    physicalSwitchAugmentationBuilder.setManagedBy(new HwvtepGlobalRef(parentPath));
    physicalSwitchAugmentationBuilder.setPhysicalSwitchUuid(getUUid("d1s3"));
    physicalSwitchAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName("s3"));
    physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("description");

    List<TunnelIps> tunnelIps = new ArrayList<>();
    IpAddress ip = new IpAddress("192.168.122.30".toCharArray());
    tunnelIps.add(new TunnelIpsBuilder().setKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
    physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);

    nodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, physicalSwitchAugmentationBuilder.build());
    PhysicalSwitchHelper.dId = parentPath;
    nodeBuilder.setTerminationPoint(PhysicalSwitchHelper
            .addPhysicalSwitchTerminationPoints(path, transaction, portNameList));

    return TestUtil.submitNode(OPERATIONAL, path, nodeBuilder.build(), transaction);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:NodeConnectedHandlerUtils.java

示例14: extractHostConfig

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
private Map<String, String> extractHostConfig(Node node) {
    Map<String, String> config = new HashMap<>();
    OvsdbNodeAugmentation ovsdbNode = getOvsdbNodeAugmentation(node);
    if (ovsdbNode != null && ovsdbNode.getOpenvswitchExternalIds() != null) {
        for (OpenvswitchExternalIds openvswitchExternalIds : ovsdbNode.getOpenvswitchExternalIds()) {
            if (openvswitchExternalIds.getExternalIdKey() != null && openvswitchExternalIds.getExternalIdKey()
                    .startsWith(OS_HOST_CONFIG_CONFIG_KEY_PREFIX)) {
                // Extract the host type. Max 8 characters after
                // suffix OS_HOST_CONFIG_CONFIG_KEY_PREFIX.length()
                String hostType = openvswitchExternalIds.getExternalIdKey().substring(
                        OS_HOST_CONFIG_CONFIG_KEY_PREFIX.length());
                if (hostType.length() > 0) {
                    if (hostType.length() > HOST_TYPE_STR_LEN) {
                        hostType = hostType.substring(0, HOST_TYPE_STR_LEN);
                    }
                    hostType = "ODL " + hostType.toUpperCase(Locale.getDefault());
                    if (null != openvswitchExternalIds.getExternalIdValue()) {
                        config.put(hostType, openvswitchExternalIds.getExternalIdValue());
                    }
                }
            }
        }
    }
    return config;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:26,代码来源:NeutronHostConfigChangeListener.java

示例15: buildTerminationPoint

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; //导入依赖的package包/类
public static TerminationPoint buildTerminationPoint(InstanceIdentifier<Node> nodeIid, String ip) {
    TerminationPointKey tpKey = new TerminationPointKey(new TpId("vxlan_over_ipv4:" + ip));
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    if (nodeIid != null && tpKey != null) {
        tpBuilder.setKey(tpKey);
        tpBuilder.setTpId(tpKey.getTpId());
        InstanceIdentifier<TerminationPoint> tpPath =
                buildTpId(nodeIid, ip);
        HwvtepPhysicalLocatorAugmentationBuilder tpAugmentationBuilder =
                new HwvtepPhysicalLocatorAugmentationBuilder();
        tpAugmentationBuilder.setPhysicalLocatorUuid(getUUid(ip));
        tpAugmentationBuilder.setEncapsulationType(createEncapsulationType("vxlan_over_ipv4"));
        tpAugmentationBuilder.setDstIp(new IpAddress(ip.toCharArray()));
        tpBuilder.addAugmentation(HwvtepPhysicalLocatorAugmentation.class, tpAugmentationBuilder.build());
    }
    return tpBuilder.build();
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:18,代码来源:TestBuilders.java


注:本文中的org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。