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


Java Link类代码示例

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


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

示例1: findGWLink

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的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: createLogicLink

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
private void createLogicLink(FabricId fabricid, NodeId routeId, NodeId swId, WriteTransaction trans, TpId tpid1,
        TpId tpid2, LinkId lid) {
    final LinkId linkid = lid == null ? new LinkId(UUID.randomUUID().toString()) : lid;
    LinkBuilder linkBuilder = new LinkBuilder();
    linkBuilder.setLinkId(linkid);
    linkBuilder.setKey(new LinkKey(linkid));

    SourceBuilder srcBuilder = new SourceBuilder();
    srcBuilder.setSourceNode(routeId);
    srcBuilder.setSourceTp(tpid1);
    linkBuilder.setSource(srcBuilder.build());

    DestinationBuilder destBuilder = new DestinationBuilder();
    destBuilder.setDestNode(swId);
    destBuilder.setDestTp(tpid2);
    linkBuilder.setDestination(destBuilder.build());

    InstanceIdentifier<Link> linkIId = MdSalUtils.createLinkIId(fabricid, linkid);
    trans.put(LogicalDatastoreType.OPERATIONAL,linkIId, linkBuilder.build());
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:21,代码来源:FabricServiceAPIProvider.java

示例3: fabricCreated

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
@Override
public void fabricCreated(FabricNode fabric) {

    List<DeviceLinks> links = fabric.getFabricAttribute().getDeviceLinks();
    if (links != null) {
        for (DeviceLinks link : links) {
            @SuppressWarnings("unchecked")
            InstanceIdentifier<Link> linkIId = (InstanceIdentifier<Link>) link.getLinkRef().getValue();
        }
    }

    List<DeviceNodes> devices = fabric.getFabricAttribute().getDeviceNodes();
    if (devices != null) {
        for (DeviceNodes deviceNode : devices) {
            @SuppressWarnings("unchecked")
            InstanceIdentifier<Node> deviceIId = (InstanceIdentifier<Node>) deviceNode.getDeviceRef().getValue();
            DeviceRole role = deviceNode.getRole();
            deviceAdded(deviceIId, role);
        }
    }

    ResourceManager.initResourceManager(fabricid);
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:24,代码来源:VlanFabricListener.java

示例4: createBasicVcLink

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
public static Link createBasicVcLink(Node ldNode, Node netNode) {
    LinkId linkId = new LinkId(VC_LINK_NAME);
    LinkKey linkKey = new LinkKey(linkId);
    LinkBuilder linkBuilder = new LinkBuilder();

    linkBuilder.setLinkId(linkId);
    linkBuilder.setKey(linkKey);

    DestinationBuilder destBuilder = new DestinationBuilder();
    NodeId ldNodeId = ldNode.getNodeId();
    destBuilder.setDestNode(ldNodeId);
    TpId sourceTpId = new TpId(VC_NODE_TP_WEST);
    destBuilder.setDestTp(sourceTpId);
    linkBuilder.setDestination(destBuilder.build());

    SourceBuilder sourceBuilder = new SourceBuilder();
    NodeId netNodeId = netNode.getNodeId();
    sourceBuilder.setSourceNode(netNodeId);
    TpId destTpId = new TpId(VC_NODE_TP_EAST);
    sourceBuilder.setSourceTp(destTpId);
    linkBuilder.setSource(sourceBuilder.build());

    return linkBuilder.build();
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:25,代码来源:FabMgrYangDataUtil.java

示例5: getBorderInfo

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
/**
 * To get the border Fabric and its port connects to the External network
 * for now we only only return the first one.
 * @return
 */
private Entry<FabricId, TpId> getBorderInfo()
{
    Topology fabricTopo = this.getFabricTopology();
    if (fabricTopo == null) {
        LOG.error("Fabric Topology is NULL!");
        return null;
    }
    for (Link l : fabricTopo.getLink()) {
        if ("external".equalsIgnoreCase(l.getSource().getSourceNode().getValue())) {
            return new AbstractMap.SimpleEntry(l.getDestination().getDestNode(), l.getDestination().getDestTp());
        }
        if ("external".equalsIgnoreCase(l.getDestination().getDestNode().getValue())) {
            return new AbstractMap.SimpleEntry(l.getSource().getSourceNode(), l.getSource().getSourceTp());
        }
    }

    LOG.error("No Fabric Topology found!");
    return null;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:25,代码来源:FabricMgrProvider.java

示例6: calcShortestPathOnFabricTopo

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
private List<Link> calcShortestPathOnFabricTopo(NodeId fabrics, NodeId fabricd)
{
    UndirectedSparseGraph<NodeId, Link> g = new UndirectedSparseGraph<>();
    Topology topo = this.getFabricTopology();
    if (topo == null) {
        LOG.error("Failed to get fabric topology!");
        return Collections.emptyList();
    }

    for (Node node : topo.getNode()) {
        g.addVertex(node.getNodeId());
    }

    if (topo.getLink() != null) {
        for (Link link : topo.getLink())
        {
            g.addEdge(link, link.getSource().getSourceNode(), link.getDestination().getDestNode());
        }
    }

    return calcShortestPath(fabrics, fabricd, g);
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:23,代码来源:FabricMgrProvider.java

示例7: invokeOperation

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
    final InstanceIdentifier<Topology> tii = TopologyProgrammingUtil.topologyForInput(this.updateTunnelInput);
    final InstanceIdentifier<Link> lii = TunnelProgrammingUtil.linkIdentifier(tii, this.updateTunnelInput);
    try (ReadOnlyTransaction t = this.dataProvider.newReadOnlyTransaction()) {
        final Link link;
        final Node node;
        try {
            // The link has to exist
            link = t.read(LogicalDatastoreType.OPERATIONAL, lii).checkedGet().get();
            // The source node has to exist
            node = TunelProgrammingUtil.sourceNode(t, tii, link).get();
        } catch (IllegalStateException | ReadFailedException e) {
            LOG.debug("Link or node does not exist.", e);
            return TunelProgrammingUtil.RESULT;
        }
        return Futures.transform(
                (ListenableFuture<RpcResult<UpdateLspOutput>>) this.topologyService
                        .updateLsp(buildUpdateInput(link, node)),
                RpcResult::getResult, MoreExecutors.directExecutor());
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:23,代码来源:UpdateTunnelInstructionExecutor.java

示例8: buildUpdateInput

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
private UpdateLspInput buildUpdateInput(final Link link, final Node node) {
    final UpdateLspInputBuilder ab = new UpdateLspInputBuilder();
    ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
    ab.setNode(requireNonNull(TunelProgrammingUtil.supportingNode(node)));

    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp
            .args.ArgumentsBuilder args = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
            .yang.topology.pcep.rev171025.update.lsp.args.ArgumentsBuilder();
    args.setBandwidth(new BandwidthBuilder().setBandwidth(this.updateTunnelInput.getBandwidth()).build());
    args.setClassType(new ClassTypeBuilder().setClassType(this.updateTunnelInput.getClassType()).build());
    args.setEro(TunelProgrammingUtil.buildEro(this.updateTunnelInput.getExplicitHops()));
    args.setLspa(new LspaBuilder(this.updateTunnelInput).build());

    final AdministrativeStatus adminStatus = this.updateTunnelInput.getAugmentation(PcepUpdateTunnelInput1.class)
            .getAdministrativeStatus();
    if (adminStatus != null) {
        args.addAugmentation(Arguments3.class, new Arguments3Builder().setLsp(new LspBuilder()
                .setAdministrative(adminStatus == AdministrativeStatus.Active).build()).build());
    }
    ab.setArguments(args.build());
    return ab.build();
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:23,代码来源:UpdateTunnelInstructionExecutor.java

示例9: invokeOperation

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
    final InstanceIdentifier<Topology> tii = TopologyProgrammingUtil.topologyForInput(this.pcepDestroyTunnelInput);
    final InstanceIdentifier<Link> lii = TunnelProgrammingUtil.linkIdentifier(tii, this.pcepDestroyTunnelInput);
    try (ReadOnlyTransaction t = this.dataProvider.newReadOnlyTransaction()) {
        final Node node;
        final Link link;
        try {
            // The link has to exist
            link = t.read(LogicalDatastoreType.OPERATIONAL, lii).checkedGet().get();
            // The source node has to exist
            node = TunelProgrammingUtil.sourceNode(t, tii, link).get();
        } catch (IllegalStateException | ReadFailedException e) {
            LOG.debug("Link or node does not exist.", e);
            return TunelProgrammingUtil.RESULT;
        }
        final RemoveLspInputBuilder ab = new RemoveLspInputBuilder();
        ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
        ab.setNode(node.getSupportingNode().get(0).getKey().getNodeRef());
        return Futures.transform(
            (ListenableFuture<RpcResult<RemoveLspOutput>>) this.topologyService.removeLsp(ab.build()),
            RpcResult::getResult, MoreExecutors.directExecutor());
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:25,代码来源:DestroyTunnelInstructionExecutor.java

示例10: createInstance

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
@Override
public java.lang.AutoCloseable createInstance() {
    DataBroker dataBrokerService = getDataBrokerDependency();
    RpcProviderRegistry rpcProviderRegistry = getRpcRegistryDependency();
    NotificationProviderService notificationService = getNotificationServiceDependency();
    MonitoringProvider provider = new MonitoringProvider(dataBrokerService, rpcProviderRegistry, notificationService);

    InstanceIdentifier<Link> linkInstance = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(new TopologyId("flow:1"))).child(Link.class).build();
    dataBrokerService.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, linkInstance,
            new TopologyListener(dataBrokerService, notificationService),
            AsyncDataBroker.DataChangeScope.BASE);

    return provider;
}
 
开发者ID:geopet85,项目名称:virtuwind-example,代码行数:16,代码来源:MonitoringModule.java

示例11: init

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
public void init () {
    LOG.info("Initializing network graph!");
    clearGraph();
    List<Link> links = getLinksFromTopology();
    if(links == null || links.isEmpty()) {
        return;
    }
    addLinks(links);
}
 
开发者ID:geopet85,项目名称:odlexample,代码行数:10,代码来源:NetworkGraphImpl.java

示例12: getLinksFromTopology

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
private List<Link> getLinksFromTopology() {
    InstanceIdentifier<Topology> topologyInstanceIdentifier = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(new TopologyId("flow:1")))
            .build();
    Topology topology = null;
    ReadOnlyTransaction readOnlyTransaction = db.newReadOnlyTransaction();
    try {
        Optional<Topology> topologyOptional = readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, topologyInstanceIdentifier).get();
        if(topologyOptional.isPresent()) {
            topology = topologyOptional.get();
        }
    } catch(Exception e) {
        LOG.error("Error reading topology {}", topologyInstanceIdentifier);
        readOnlyTransaction.close();
        throw new RuntimeException("Error reading from operational store, topology : " + topologyInstanceIdentifier, e);
    }
    readOnlyTransaction.close();
    if(topology == null) {
        return null;
    }
    List<Link> links = topology.getLink();
    if(links == null || links.isEmpty()) {
        return null;
    }
    List<Link> internalLinks = new ArrayList<>();
    for(Link link : links) {
        if(!(link.getLinkId().getValue().contains("host"))) {
            internalLinks.add(link);
        }
    }

    return internalLinks;
}
 
开发者ID:geopet85,项目名称:odlexample,代码行数:34,代码来源:NetworkGraphImpl.java

示例13: addLinks

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
public synchronized void addLinks(List<Link> links) {
    if(links == null || links.isEmpty()) {
        LOG.debug("In addLinks: No link added as links is null or empty.");
        return;
    }

    if(networkGraph == null) {
        networkGraph = new SparseMultigraph<>();
    }

    for(Link link : links) {
        if(linkAlreadyAdded(link)) {
            continue;
        }
        NodeId sourceNodeId = link.getSource().getSourceNode();
        NodeId destinationNodeId = link.getDestination().getDestNode();
        networkGraph.addVertex(sourceNodeId);
        networkGraph.addVertex(destinationNodeId);
        networkGraph.addEdge(link, sourceNodeId, destinationNodeId, EdgeType.UNDIRECTED);
    }

    LOG.info("Created topology graph {} ", networkGraph);

    if(shortestPath == null) {
        shortestPath = new DijkstraShortestPath<>(networkGraph);
    } else {
        shortestPath.reset();
    }
    LOG.info("Shortest paths {} ", shortestPath);
}
 
开发者ID:geopet85,项目名称:odlexample,代码行数:31,代码来源:NetworkGraphImpl.java

示例14: linkAlreadyAdded

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
private boolean linkAlreadyAdded(Link link) {
    String linkAddedKey = null;
    if(link.getDestination().getDestTp().hashCode() > link.getSource().getSourceTp().hashCode()) {
        linkAddedKey = link.getSource().getSourceTp().getValue() + link.getDestination().getDestTp().getValue();
    } else {
        linkAddedKey = link.getDestination().getDestTp().getValue() + link.getSource().getSourceTp().getValue();
    }
    if(linkAdded.contains(linkAddedKey)) {
        return true;
    } else {
        linkAdded.add(linkAddedKey);
        return false;
    }
}
 
开发者ID:geopet85,项目名称:odlexample,代码行数:15,代码来源:NetworkGraphImpl.java

示例15: isNodeConnectorInternal

import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link; //导入依赖的package包/类
private boolean isNodeConnectorInternal(NodeConnector nodeConnector) {
	TpId tpId = new TpId(nodeConnector.getKey().getId().getValue());
	InstanceIdentifier<NetworkTopology> ntII = InstanceIdentifier.builder(NetworkTopology.class).build();
	ListenableFuture<Optional<NetworkTopology>> lfONT;
	try (ReadOnlyTransaction rot = dataService.newReadOnlyTransaction()) {
		lfONT = rot.read(LogicalDatastoreType.OPERATIONAL, ntII);
		rot.close();
	}
	Optional<NetworkTopology> oNT;
	try {
		oNT = lfONT.get();
	} catch (InterruptedException | ExecutionException ex) {
		LOG.warn(ex.getLocalizedMessage());
		return false;
	}
	if (oNT != null && oNT.isPresent()) {
		NetworkTopology networkTopo = oNT.get();
		for (Topology t : networkTopo.getTopology()) {
			if (t.getLink() != null) {
				for (Link l : t.getLink()) {
					if ((l.getSource().getSourceTp().equals(tpId)
							&& !l.getDestination().getDestTp().getValue().startsWith(Host.NODE_PREFIX))
							|| (l.getDestination().getDestTp().equals(tpId)
									&& !l.getSource().getSourceTp().getValue().startsWith(Host.NODE_PREFIX))) {
						return true;
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:33,代码来源:HostMonitor.java


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