public List<TerminationPoint> extractTerminationPoints(Node node) { List<TerminationPoint> terminationPoints = new ArrayList<>(); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = node.getAugmentation(OvsdbBridgeAugmentation.class); if (ovsdbBridgeAugmentation != null) { terminationPoints.addAll(node.getTerminationPoint()); } return terminationPoints; }
public List<TerminationPoint> extractTerminationPoints(Node node) { List<TerminationPoint> terminationPoints = new ArrayList<>(); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = node.getAugmentation(OvsdbBridgeAugmentation.class); if (ovsdbBridgeAugmentation != null) { terminationPoints.addAll(node.getTerminationPoint()); } return terminationPoints; }
public List<OvsdbTerminationPointAugmentation> extractTerminationPointAugmentations( Node node ) { List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<>(); List<TerminationPoint> terminationPoints = node.getTerminationPoint(); if(terminationPoints != null && !terminationPoints.isEmpty()){ for(TerminationPoint tp : terminationPoints){ OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation != null) { tpAugmentations.add(ovsdbTerminationPointAugmentation); } } } return tpAugmentations; }
public List<OvsdbTerminationPointAugmentation> extractTerminationPointAugmentations( Node node ) { List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<>(); if (node == null) { LOG.error("extractTerminationPointAugmentations: Node value is null"); return Collections.<OvsdbTerminationPointAugmentation>emptyList(); } List<TerminationPoint> terminationPoints = node.getTerminationPoint(); if(terminationPoints != null && !terminationPoints.isEmpty()){ for(TerminationPoint tp : terminationPoints){ OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation != null) { tpAugmentations.add(ovsdbTerminationPointAugmentation); } } } return tpAugmentations; }
public List<OvsdbTerminationPointAugmentation> extractTerminationPointAugmentations( Node node ) { List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<>(); if (node == null) { LOG.error("extractTerminationPointAugmentations: Node value is null"); return Collections.<OvsdbTerminationPointAugmentation>emptyList(); } List<TerminationPoint> terminationPoints = node.getTerminationPoint(); if(terminationPoints != null && !terminationPoints.isEmpty()){ for(TerminationPoint tp : terminationPoints){ OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation != null) { tpAugmentations.add(ovsdbTerminationPointAugmentation); } } } return tpAugmentations; }
/** * Returns all port details of the given Node. * * @param node A {@link Node} instance. * @return A list of {@link OvsdbTerminationPointAugmentation} instances. */ private List<OvsdbTerminationPointAugmentation> extractTerminationPointAugmentations(Node node) { List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<OvsdbTerminationPointAugmentation>(); List<TerminationPoint> terminationPoints = node.getTerminationPoint(); if (terminationPoints != null) { for (TerminationPoint tp : terminationPoints) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation != null) { tpAugmentations.add(ovsdbTerminationPointAugmentation); } } } return tpAugmentations; }
public Optional<TerminationPoint> getBridgeTerminationPoint(InstanceIdentifier<?> iid) { if (iid != null) { Optional<Node> nodeOptional = getBridgeNode(iid); if (nodeOptional.isPresent() && nodeOptional.get().getTerminationPoint() != null) { TerminationPointKey key = iid.firstKeyOf(TerminationPoint.class, TerminationPointKey.class); if (key != null) { for (TerminationPoint tp:nodeOptional.get().getTerminationPoint()) { if (tp.getKey().equals(key)) { return Optional.of(tp); } } } } } return Optional.absent(); }
/** * @return <code>java.util.List</code> <code>terminationPoint</code>, or an empty list if it is not present */ default @NonNull List<TerminationPoint> nonnullTerminationPoint() { return CodeHelpers.nonnull(getTerminationPoint()); }
public NodeBuilder(Node base) { this.key = base.key(); this._nodeId = base.getNodeId(); this._supportingNode = base.getSupportingNode(); this._terminationPoint = base.getTerminationPoint(); if (base instanceof NodeImpl) { NodeImpl impl = (NodeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") Map<Class<? extends Augmentation<Node>>, Augmentation<Node>> aug =((AugmentationHolder<Node>) base).augmentations(); if (!aug.isEmpty()) { this.augmentation = new HashMap<>(aug); } } }
/** * Schedule all the neutron ports associated with the given node to * configure port mapping. * * @param node The target node. */ private void setMapPorts(@Nonnull Node node) { List<TerminationPoint> tps = node.getTerminationPoint(); if (tps != null) { for (TerminationPoint tp: tps) { OvsdbTerminationPointAugmentation ovtp = tp.getAugmentation( OvsdbTerminationPointAugmentation.class); if (ovtp != null) { setMapPort(ovtp); } } } }
/** * Schedule all the neutron ports associated with the given node to * deconfigure port mapping. * * @param node The target node. */ private void setUnmapPorts(@Nonnull Node node) { List<TerminationPoint> tps = node.getTerminationPoint(); if (tps != null) { for (TerminationPoint tp: tps) { OvsdbTerminationPointAugmentation ovtp = tp.getAugmentation( OvsdbTerminationPointAugmentation.class); if (ovtp != null) { setUnmapPort(ovtp); } } } }
public NodeBuilder(Node base) { if (base.getKey() == null) { this._key = new NodeKey( base.getNodeId() ); this._nodeId = base.getNodeId(); } else { this._key = base.getKey(); this._nodeId = _key.getNodeId(); } this._supportingNode = base.getSupportingNode(); this._terminationPoint = base.getTerminationPoint(); if (base instanceof NodeImpl) { NodeImpl impl = (NodeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
@Override public boolean isLastPortinBridge(Node node, OvsdbTerminationPointAugmentation terminationPointAugmentation) { LOG.trace("isLastPortinBridge: for {}", terminationPointAugmentation.getName()); List<TerminationPoint> terminationPoints = node.getTerminationPoint(); /*Check whether the node has any port other than br-int*/ if (terminationPoints != null && !terminationPoints.isEmpty()) { for (TerminationPoint tp : terminationPoints) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (null != ovsdbTerminationPointAugmentation && !(ovsdbTerminationPointAugmentation.getName().equals(Constants.INTEGRATION_BRIDGE)) && !(terminationPointAugmentation.getInterfaceUuid() .equals(ovsdbTerminationPointAugmentation.getInterfaceUuid()))) { LOG.debug("isLastPortinBridge: it the last port in bridge {}", terminationPointAugmentation.getName()); return false; } } } return true; }
private boolean bridgeHasVmPort(Node bridgeNode) { String intBridgeName = configurationService.getIntegrationBridgeName(); String extBridgeName = configurationService.getExternalBridgeName(); List<TerminationPoint> terminationPoints = bridgeNode.getTerminationPoint(); if (terminationPoints == null) return false; for (TerminationPoint tp : terminationPoints) { String tpName = tp.getTpId().getValue(); if (tpName != null && !tpName.equals(intBridgeName) && !tpName.equals(extBridgeName)) { OvsdbTerminationPointAugmentation tpAug = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (tpAug != null && southbound.getOFPort(tpAug) != 0) { return true; } } } return false; }
@Override public boolean isLastPortinBridge(Node node, OvsdbTerminationPointAugmentation terminationPointAugmentation) { LOG.trace("isLastPortinBridge: for {}", terminationPointAugmentation.getName()); List<TerminationPoint> terminationPoints = node.getTerminationPoint(); /*Check whether the node has any port other than br-int*/ if (terminationPoints != null && !terminationPoints.isEmpty()) { for (TerminationPoint tp : terminationPoints) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (null != ovsdbTerminationPointAugmentation && !(ovsdbTerminationPointAugmentation.getName().equals(Constants.INTEGRATION_BRIDGE)) && !(terminationPointAugmentation.getInterfaceUuid() .equals(ovsdbTerminationPointAugmentation.getInterfaceUuid()))) { LOG.debug("isLastPortinBridge: it the last port in bridge {}", terminationPointAugmentation.getName()); return false; } } } return true; }
private static TerminationPoint getTerminationPoint(Node bridgeNode, String interfaceName) { for (TerminationPoint tp : bridgeNode.getTerminationPoint()) { Boolean found = false; OvsdbTerminationPointAugmentation ovsdbTp = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTp.getInterfaceExternalIds() != null && !ovsdbTp.getInterfaceExternalIds().isEmpty()) { for (InterfaceExternalIds entry : ovsdbTp.getInterfaceExternalIds()) { if (entry.getExternalIdKey().equals(EXTERNAL_ID_INTERFACE_ID) && entry.getExternalIdValue().equals(interfaceName)) { found = true; continue; } } } if (found) { return tp; } } return null; }
public static Map<InstanceIdentifier<?>, DataObject> extractTerminationPointConfigurationChanges( final Node bridgeNode) { Map<InstanceIdentifier<?>, DataObject> changes = new HashMap<>(); final InstanceIdentifier<Node> bridgeNodeIid = SouthboundMapper.createInstanceIdentifier(bridgeNode.getNodeId()); changes.put(bridgeNodeIid, bridgeNode); List<TerminationPoint> terminationPoints = bridgeNode.getTerminationPoint(); if (terminationPoints != null && !terminationPoints.isEmpty()) { for (TerminationPoint tp : terminationPoints) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (ovsdbTerminationPointAugmentation != null) { final InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid = bridgeNodeIid .child(TerminationPoint.class, new TerminationPointKey(tp.getTpId())) .builder() .augmentation(OvsdbTerminationPointAugmentation.class) .build(); changes.put(tpIid, ovsdbTerminationPointAugmentation); } } } return changes; } }
@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(); }
private InstanceIdentifier<TerminationPoint> getIpTerminationPoint(final ReadWriteTransaction trans, final IpAddress addr, final InstanceIdentifier<Node> sni, final Boolean inControl) throws ReadFailedException { final Topology topo = trans.read(LogicalDatastoreType.OPERATIONAL, this.target).checkedGet().get(); if (topo.getNode() != null) { for (final Node n : topo.getNode()) { if(n.getTerminationPoint() != null) { for (final TerminationPoint tp : n.getTerminationPoint()) { final TerminationPoint1 tpa = tp.getAugmentation(TerminationPoint1.class); if (tpa != null) { final TerminationPointType tpt = tpa.getIgpTerminationPointAttributes().getTerminationPointType(); if (tpt instanceof Ip) { for (final IpAddress a : ((Ip) tpt).getIpAddress()) { if (addr.equals(a)) { handleSni(sni, n, inControl, trans); return this.target.builder().child(Node.class, n.getKey()).child(TerminationPoint.class, tp.getKey()).build(); } } } else { LOG.debug("Ignoring termination point type {}", tpt); } } } } } } LOG.debug("Termination point for {} not found, creating a new one", addr); return createTP(addr, sni, inControl, trans); }
List<TerminationPoint> tpList = node.getTerminationPoint();