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


Java TopologyKey类代码示例

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


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

示例1: findGWLink

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
private Link findGWLink(ReadWriteTransaction trans, FabricId fabricid, TpId tpid, NodeId routerid) {

        InstanceIdentifier<Link> linkIId = InstanceIdentifier.create(NetworkTopology.class)
                .child(Topology.class, new TopologyKey(new TopologyId(fabricid)))
                .child(Link.class, new LinkKey(this.createGatewayLink(routerid, tpid)));

        CheckedFuture<Optional<Link>,ReadFailedException> readFuture =  trans.read(LogicalDatastoreType.OPERATIONAL,
                linkIId);

        try {
            Optional<Link> optional = readFuture.get();
            Link link = optional.get();

            return link;

        } catch (InterruptedException | ExecutionException e) {
            LOG.error("", e);
        }
        return null;
    }
 
开发者ID:opendaylight,项目名称:faas,代码行数:21,代码来源:FabricServiceAPIProvider.java

示例2: createVcTopologyInstance

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
private InstanceIdentifier<Topology> createVcTopologyInstance(String topoIdStr) {
    TopologyId topoId = new TopologyId(topoIdStr);
    TopologyKey topoKey = new TopologyKey(topoId);

    InstanceIdentifier<Topology> topoPath = FabMgrYangDataUtil.buildTopologyPath(topoIdStr);
    TopologyBuilder topoBuilder = new TopologyBuilder();
    topoBuilder.setKey(topoKey);
    topoBuilder.setTopologyId(topoId);

    Topology topo = topoBuilder.build();
    fabMgrDatastoreUtil.putData(OPERATIONAL, topoPath, topo);

    InstanceIdentifier<TopologyTypes1> topoTypePath =
            topoPath.child(TopologyTypes.class).augmentation(TopologyTypes1.class);

    VcontainerTopology vcTopoType = new VcontainerTopologyBuilder().build();
    TopologyTypes1 topologyTypeAugment = new TopologyTypes1Builder().setVcontainerTopology(vcTopoType).build();
    fabMgrDatastoreUtil.putData(OPERATIONAL, topoTypePath, topologyTypeAugment);

    return topoPath;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:22,代码来源:VContainerMgr.java

示例3: testPutCreateParentsSuccess

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
@Test
public void testPutCreateParentsSuccess() throws Exception {
    InstanceIdentifier<Node> iid = InstanceIdentifier.builder(NetworkTopology.class)
        .child(Topology.class, new TopologyKey(new TopologyId("topology-netconf")))
        .child(Node.class, new NodeKey(new NodeId(NODE_ID)))
        .build();
    Node node1 =
        createNetconfNode(NODE_ID, V3PO_1704_CAPABILITY, V3PO_1701_CAPABILITY, INTERFACES);
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.OPERATIONAL, iid, node1, true);
    writeTx.submit().get();
    Assert.assertEquals(sf.get(), Integer.valueOf(1));
    sf = SettableFuture.create();
    writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.delete(LogicalDatastoreType.OPERATIONAL, iid);
    writeTx.submit().get();
    Assert.assertEquals(sf.get(), Integer.valueOf(2));
}
 
开发者ID:opendaylight,项目名称:neutron,代码行数:19,代码来源:NeutronHostconfigVppListenerTest.java

示例4: configFileTest

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
@Test
public void configFileTest() throws ReadFailedException, InterruptedException {
    final KeyedInstanceIdentifier<Topology, TopologyKey> topologyIIdKeyed =
            InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
                    new TopologyKey(new TopologyId("topology-test")));
    checkNotPresentConfiguration(getDataBroker(), topologyIIdKeyed);

    assertNotNull(ClassLoader.getSystemClassLoader().getResource("initial/network-topology-config.xml"));
    final NetworkTopologyConfigFileProcessor processor = new NetworkTopologyConfigFileProcessor(this.configLoader,
            getDataBroker());
    processor.init();
    checkPresentConfiguration(getDataBroker(), topologyIIdKeyed);

    assertEquals(SchemaPath.create(true, NetworkTopology.QNAME), processor.getSchemaPath());
    processor.close();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:NetworkTopologyConfigFileProcessorTest.java

示例5: createTunnelTopologyProvider

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
private synchronized void createTunnelTopologyProvider(final Topology topology) {
    if (!filterPcepTopologies(topology.getTopologyTypes())) {
        return;
    }
    final TopologyId topologyId = topology.getTopologyId();
    if (this.pcepTunnelServices.containsKey(topology.getTopologyId())) {
        LOG.warn("Tunnel Topology {} already exist. New instance won't be created", topologyId);
        return;
    }
    LOG.debug("Create Tunnel Topology {}", topologyId);

    final PcepTunnelTopologyConfig config = topology.getAugmentation(PcepTunnelTopologyConfig.class);
    final String pcepTopoID = StringUtils
            .substringBetween(config.getPcepTopologyReference().getValue(), "=\"", "\"");
    final InstanceIdentifier<Topology> pcepTopoRef = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(new TopologyId(pcepTopoID))).build();


    final PCEPTunnelClusterSingletonService tunnelTopoCss =
            new PCEPTunnelClusterSingletonService(this.dependencies, pcepTopoRef, topologyId);
    this.pcepTunnelServices.put(topology.getTopologyId(), tunnelTopoCss);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:23,代码来源:TunnelProviderDeployer.java

示例6: instantiateServiceInstance

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
/**
 * Create Base Topology.
 */
synchronized void instantiateServiceInstance() {
    final TopologyKey key = InstanceIdentifier.keyOf(this.topology);
    final TopologyId topologyId = key.getTopologyId();
    final WriteTransaction tx = this.dependenciesProvider.getDataBroker().newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, this.topology, new TopologyBuilder().setKey(key)
            .setTopologyId(topologyId).setTopologyTypes(new TopologyTypesBuilder()
                    .addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyPcep(
                            new TopologyPcepBuilder().build()).build()).build())
            .setNode(new ArrayList<>()).build(), true);
    try {
        tx.submit().get();
        LOG.info("PCEP Topology {} created successfully.", topologyId.getValue());
        ServerSessionManager.this.isClosed.set(false);
    } catch (final ExecutionException | InterruptedException throwable) {
        LOG.error("Failed to create PCEP Topology {}.", topologyId.getValue(), throwable);
        ServerSessionManager.this.isClosed.set(true);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:22,代码来源:ServerSessionManager.java

示例7: getInstanceIdentifier

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
public static InstanceIdentifier<Node> getInstanceIdentifier(InstanceIdentifierCodec instanceIdentifierCodec,
        OpenVSwitch ovs) {
    if (ovs.getExternalIdsColumn() != null
            && ovs.getExternalIdsColumn().getData() != null
            && ovs.getExternalIdsColumn().getData().containsKey(SouthboundConstants.IID_EXTERNAL_ID_KEY)) {
        String iidString = ovs.getExternalIdsColumn().getData().get(SouthboundConstants.IID_EXTERNAL_ID_KEY);
        return (InstanceIdentifier<Node>) instanceIdentifierCodec.bindingDeserializerOrNull(iidString);
    } else {
        String nodeString = SouthboundConstants.OVSDB_URI_PREFIX + "://" + SouthboundConstants.UUID + "/"
                + ovs.getUuid().toString();
        NodeId nodeId = new NodeId(new Uri(nodeString));
        NodeKey nodeKey = new NodeKey(nodeId);
        return InstanceIdentifier.builder(NetworkTopology.class)
                .child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
                .child(Node.class,nodeKey)
                .build();
    }
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:19,代码来源:SouthboundMapper.java

示例8: initializeOvsdbTopology

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

示例9: getBridge

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
private OvsdbBridgeAugmentation getBridge(InstanceIdentifier<OvsdbNodeAugmentation> key,
        Uri bridgeUri) {
    final InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
            .child(Node.class, new NodeKey(new NodeId(bridgeUri)))
            .augmentation(OvsdbBridgeAugmentation.class);

    OvsdbBridgeAugmentation bridge = null;
    try (ReadOnlyTransaction transaction = SouthboundProvider.getDb().newReadOnlyTransaction()) {
        final Optional<OvsdbBridgeAugmentation> bridgeOptional =
                transaction.read(LogicalDatastoreType.OPERATIONAL, bridgeIid).get();
        if (bridgeOptional.isPresent()) {
            bridge = bridgeOptional.get();
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("Error reading from datastore", e);
    }
    return bridge;
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:21,代码来源:AutoAttachUpdateCommand.java

示例10: getControllerEntryIid

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
/**
 * Create the {@link InstanceIdentifier} for the {@link ControllerEntry}.
 *
 * @param controllerEntry the {@link ControllerEntry}
 * @param bridgeName the name of the bridge
 * @return the {@link InstanceIdentifier}
 */
private InstanceIdentifier<ControllerEntry> getControllerEntryIid(
        ControllerEntry controllerEntry, String bridgeName) {

    OvsdbConnectionInstance client = getOvsdbConnectionInstance();
    String nodeString = client.getNodeKey().getNodeId().getValue()
            + "/bridge/" + bridgeName;
    NodeId nodeId = new NodeId(new Uri(nodeString));
    NodeKey nodeKey = new NodeKey(nodeId);
    InstanceIdentifier<Node> bridgeIid = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
            .child(Node.class,nodeKey)
            .build();

    return bridgeIid
            .augmentation(OvsdbBridgeAugmentation.class)
            .child(ControllerEntry.class, controllerEntry.getKey());
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:25,代码来源:OvsdbControllerUpdateCommand.java

示例11: getManagerEntryIid

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
/**
 * Create the {@link InstanceIdentifier} for the {@link ManagerEntry}.
 *
 * @param managerEntry the {@link ManagerEntry}
 * @return the {@link InstanceIdentifier}
 */
private InstanceIdentifier<ManagerEntry> getManagerEntryIid(ManagerEntry managerEntry) {

    OvsdbConnectionInstance client = getOvsdbConnectionInstance();
    String nodeString = client.getNodeKey().getNodeId().getValue();
    NodeId nodeId = new NodeId(new Uri(nodeString));
    NodeKey nodeKey = new NodeKey(nodeId);
    InstanceIdentifier<Node> ovsdbNodeIid = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
            .child(Node.class,nodeKey)
            .build();

    return ovsdbNodeIid
            .augmentation(OvsdbNodeAugmentation.class)
            .child(ManagerEntry.class, managerEntry.getKey());
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:22,代码来源:OvsdbManagersUpdateCommand.java

示例12: testGetControllerEntryIid

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
@Test
public void testGetControllerEntryIid() throws Exception {
    ControllerEntry controllerEntry = mock(ControllerEntry.class);
    OvsdbConnectionInstance client = mock(OvsdbConnectionInstance.class);
    when(ovsdbControllerUpdateCommand.getOvsdbConnectionInstance()).thenReturn(client);
    NodeKey nodeKey = mock(NodeKey.class);
    when(client.getNodeKey()).thenReturn(nodeKey);
    NodeId nodeId = mock(NodeId.class);
    when(nodeKey.getNodeId()).thenReturn(nodeId);
    when(nodeId.getValue()).thenReturn(NODE_ID);
    PowerMockito.whenNew(Uri.class).withAnyArguments().thenReturn(mock(Uri.class));
    PowerMockito.whenNew(NodeId.class).withAnyArguments().thenReturn(nodeId);
    PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(nodeKey);
    PowerMockito.whenNew(TopologyKey.class).withAnyArguments().thenReturn(mock(TopologyKey.class));
    //PowerMockito.suppress(MemberMatcher.methodsDeclaredIn(InstanceIdentifier.class));
    when(controllerEntry.getKey()).thenReturn(mock(ControllerEntryKey.class));
    assertEquals(KeyedInstanceIdentifier.class, (Whitebox
            .invokeMethod(ovsdbControllerUpdateCommand, "getControllerEntryIid", controllerEntry, BRIDGE_NAME)
            .getClass()));
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:21,代码来源:OvsdbControllerUpdateCommandTest.java

示例13: getOvsdbTopology

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
private Boolean getOvsdbTopology() {
    LOG.info("getOvsdbTopology: looking for {}...", SouthboundUtils.OVSDB_TOPOLOGY_ID.getValue());
    Boolean found = false;
    final TopologyId topologyId = SouthboundUtils.OVSDB_TOPOLOGY_ID;
    InstanceIdentifier<Topology> path =
            InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(topologyId));
    for (int i = 0; i < 60; i++) {
        Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path);
        if (topology != null) {
            LOG.info("getOvsdbTopology: found {}...", SouthboundUtils.OVSDB_TOPOLOGY_ID.getValue());
            found = true;
            break;
        } else {
            LOG.info("getOvsdbTopology: still looking ({})...", i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                LOG.warn("Interrupted while waiting for {}", SouthboundUtils.OVSDB_TOPOLOGY_ID.getValue(), e);
            }
        }
    }
    return found;
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:24,代码来源:SouthboundIT.java

示例14: testGetOvsdbNodes

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; //导入依赖的package包/类
@Test
public void testGetOvsdbNodes() throws InterruptedException {
    ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber);
    InstanceIdentifier<Topology> topologyPath = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));

    Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, topologyPath);
    InstanceIdentifier<Node> expectedNodeIid = SouthboundUtils.createInstanceIdentifier(connectionInfo);
    NodeId expectedNodeId = expectedNodeIid.firstKeyOf(Node.class).getNodeId();
    Node foundNode = null;
    Assert.assertNotNull("Expected to find topology: " + topologyPath, topology);
    Assert.assertNotNull("Expected to find some nodes" + topology.getNode());
    LOG.info("expectedNodeId: {}, getNode: {}", expectedNodeId, topology.getNode());
    for (Node node : topology.getNode()) {
        if (node.getNodeId().getValue().equals(expectedNodeId.getValue())) {
            foundNode = node;
            break;
        }
    }
    Assert.assertNotNull("Expected to find Node: " + expectedNodeId, foundNode);
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:23,代码来源:SouthboundIT.java

示例15: initializeHwvtepTopology

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


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