本文整理汇总了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;
}
示例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());
}
示例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);
}
示例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();
}
示例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;
}
示例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);
}
示例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());
}
}
示例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();
}
示例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());
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}