public static TpId toTerminationPointId(final NodeConnectorId id) { return new TpId(id); }
public static String extractNodeId(TpId tpId) { String nodeConnectorId = tpId.getValue(); return nodeConnectorId.replaceAll(":[0-9]+$", ""); } }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TerminationPointKey other = (TerminationPointKey) obj; if (_tpId == null) { if (other._tpId != null) { return false; } } else if(!_tpId.equals(other._tpId)) { return false; } return true; }
TpId tpId = new TpId(nodeConnector); InstanceIdentifier<NetworkTopology> ntII = InstanceIdentifier.builder(NetworkTopology.class).build(); if (t.getLink() != null) { for (Link l : t.getLink()) { if ((l.getSource().getSourceTp().equals(tpId) && !l.getDestination().getDestTp().getValue().startsWith("host:")) || (l.getDestination().getDestTp().equals(tpId) && !l.getSource().getSourceTp().getValue().startsWith("host:"))) { return true;
@SuppressWarnings("unchecked") private Optional<InstanceIdentifier<Node>> getTerminationPointBridge( final ReadWriteTransaction transaction, Node node, String tpName) { OvsdbNodeAugmentation ovsdbNode = node.getAugmentation(OvsdbNodeAugmentation.class); List<ManagedNodeEntry> managedNodes = ovsdbNode.getManagedNodeEntry(); TpId tpId = new TpId(tpName); for ( ManagedNodeEntry managedNodeEntry : managedNodes ) { Node managedNode = readNode(transaction, (InstanceIdentifier<Node>)managedNodeEntry.getBridgeRef().getValue()).get(); for (TerminationPoint tpEntry : managedNode.getTerminationPoint()) { if (tpId.equals(tpEntry.getTpId())) { return Optional.of((InstanceIdentifier<Node>)managedNodeEntry.getBridgeRef().getValue()); } } } return Optional.absent(); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_tpId == null) ? 0 : _tpId.hashCode()); return result; }
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; 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;
public TpId getNodeConnectorByMac(MacAddress macAddress) { TpId tpId = null; InstanceIdentifier<HostNode> hostId = InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId("flow:1"))) .child(Node.class, new NodeKey( new NodeId("host:"+macAddress.getValue()))) .augmentation(HostNode.class) .build(); ReadOnlyTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction(); try { Optional<HostNode> dataObjectOptional = null; dataObjectOptional = readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, hostId).get(); if (dataObjectOptional.isPresent()) { HostNode hostNode = dataObjectOptional.get(); String attPoint = hostNode.getAttachmentPoints().get(0).getKey().getTpId().getValue(); tpId = new TpId(attPoint); } } catch (InterruptedException | ExecutionException e) { LOG.error("Failed to read nodes from Operation data store."); readOnlyTransaction.close(); } readOnlyTransaction.close(); return tpId; } }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_destNode == null) ? 0 : _destNode.hashCode()); result = prime * result + ((_destTp == null) ? 0 : _destTp.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
public static TpId getDefaultInstance(String defaultValue) { return new TpId(defaultValue); }
public static String toADNodeConnectorId(final TpId nodeConnectorId) { return nodeConnectorId.getValue().replaceFirst("^.*:", ""); }
TpId tpId = new TpId(nodeConnector.getKey().getId().getValue()); InstanceIdentifier<NetworkTopology> ntII = InstanceIdentifier.builder(NetworkTopology.class).build(); 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;
/** * Sets the AttachmentPointsBuilder that have the given TerminationPoint to * inactive from the list of this Host's AttachmentPoints. * * @param tp The TerminationPoint to set inactive */ public synchronized void removeTerminationPoint(TpId tp) { LOG.debug("Setting termination point {} to inactive state", tp); for (Iterator<AttachmentPointsBuilder> it = apbs.iterator(); it.hasNext();) { AttachmentPointsBuilder apbi = it.next(); if (apbi.getCorrespondingTp().equals(tp)) { apbi.setActive(Boolean.FALSE); } } }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_sourceNode == null) ? 0 : _sourceNode.hashCode()); result = prime * result + ((_sourceTp == null) ? 0 : _sourceTp.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
public static TpId getDefaultInstance(String defaultValue) { return new TpId(defaultValue); }
private String createBdPortId(TpId tpid, long segment) { return String.format("tp:%s - seg:%d", tpid.getValue(), segment); }
static void removeAffectedLinks(final TpId id, Optional<Topology> topologyOptional, ReadWriteTransaction transaction, final InstanceIdentifier<Topology> topology) { if (!topologyOptional.isPresent()) { return; } List<Link> linkList = topologyOptional.get().getLink() != null ? topologyOptional.get().getLink() : Collections.<Link> emptyList(); for (Link link : linkList) { if (id.equals(link.getSource().getSourceTp()) || id.equals(link.getDestination().getDestTp())) { transaction.delete(LogicalDatastoreType.OPERATIONAL, linkPath(link, topology)); } } }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_tpId == null) ? 0 : _tpId.hashCode()); result = prime * result + ((_tpRef == null) ? 0 : _tpRef.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
public static InstanceIdentifier<TerminationPoint> createFabricPortIId(FabricId fabricId, TpId tpid) { return Constants.DOM_FABRICS_PATH.child(Node.class, new NodeKey(fabricId)) .child(TerminationPoint.class, new TerminationPointKey(new TpId(tpid))); }