Java Code Examples for org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node#getTerminationPoint()

The following examples show how to use org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node#getTerminationPoint() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SouthboundUtils.java    From ovsdb with Eclipse Public License 1.0 6 votes vote down vote up
public List<OvsdbTerminationPointAugmentation> extractTerminationPointAugmentations(Node node) {
    List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<>();
    if (node == null) {
        LOG.error("extractTerminationPointAugmentations: Node value is null");
        return Collections.emptyList();
    }
    Map<TerminationPointKey, TerminationPoint> terminationPoints = node.getTerminationPoint();
    if (terminationPoints != null && !terminationPoints.isEmpty()) {
        for (TerminationPoint tp : terminationPoints.values()) {
            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
                    tp.augmentation(OvsdbTerminationPointAugmentation.class);
            if (ovsdbTerminationPointAugmentation != null) {
                tpAugmentations.add(ovsdbTerminationPointAugmentation);
            }
        }
    }
    return tpAugmentations;
}
 
Example 2
Source File: SouthboundMapper.java    From ovsdb with Eclipse Public License 1.0 6 votes vote down vote up
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);

    Map<TerminationPointKey, TerminationPoint> terminationPoints = bridgeNode.getTerminationPoint();
    if (terminationPoints != null) {
        for (TerminationPoint tp : terminationPoints.values()) {
            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
                    tp.augmentation(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;
}
 
Example 3
Source File: OvsdbPortUpdateCommand.java    From ovsdb with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
// FIXME: non-static for implementation internals mocking
private Optional<InstanceIdentifier<Node>> getTerminationPointBridge(
        final ReadWriteTransaction transaction, Node node, String tpName) {
    OvsdbNodeAugmentation ovsdbNode = node.augmentation(OvsdbNodeAugmentation.class);
    Map<ManagedNodeEntryKey, ManagedNodeEntry> managedNodes = ovsdbNode.nonnullManagedNodeEntry();
    TpId tpId = new TpId(tpName);

    for (ManagedNodeEntry managedNodeEntry : managedNodes.values()) {
        Optional<Node> optManagedNode = SouthboundUtil.readNode(transaction,
                (InstanceIdentifier<Node>)managedNodeEntry.getBridgeRef().getValue());
        if (optManagedNode.isPresent()) {
            Node managedNode = optManagedNode.get();
            Map<TerminationPointKey, TerminationPoint> tpEntrys = managedNode.getTerminationPoint();
            if (tpEntrys != null) {
                TerminationPoint tpEntry = tpEntrys.get(new TerminationPointKey(tpId));
                if (tpEntry != null) {
                    return Optional.of((InstanceIdentifier<Node>) managedNodeEntry.getBridgeRef().getValue());
                }
            }
        }
    }

    return Optional.empty();
}
 
Example 4
Source File: SouthboundUtils.java    From ovsdb with Eclipse Public License 1.0 5 votes vote down vote up
public static TerminationPoint getTerminationPointByExternalId(final Node bridgeNode, final String interfaceName) {
    final Map<TerminationPointKey, TerminationPoint> tps = bridgeNode.getTerminationPoint();
    if (tps != null) {
        for (TerminationPoint tp : tps.values()) {
            OvsdbTerminationPointAugmentation ovsdbTp = tp.augmentation(OvsdbTerminationPointAugmentation.class);
            String externalIdValue = getExternalInterfaceIdValue(ovsdbTp);
            if (externalIdValue != null && externalIdValue.equals(interfaceName)) {
                LOG.debug("Found matching termination point with iface-id {} on bridgeNode {}, returning tp {}",
                        interfaceName, bridgeNode, tp);
                return tp;
            }
        }
    }
    return null;
}
 
Example 5
Source File: SwitchConfigOperationalChangeGetter.java    From ovsdb with Eclipse Public License 1.0 5 votes vote down vote up
static Map<TerminationPointKey, TerminationPoint> getPorts(final Node node) {
    if (node == null) {
        return Collections.emptyMap();
    }
    final Map<TerminationPointKey, TerminationPoint> tps = node.getTerminationPoint();
    if (tps == null) {
        return Collections.emptyMap();
    }

    final Map<TerminationPointKey, TerminationPoint> result = new HashMap<>();
    for (TerminationPoint tp : node.getTerminationPoint().values()) {
        TerminationPointBuilder terminationPointBuilder = new TerminationPointBuilder(tp);
        terminationPointBuilder.removeAugmentation(HwvtepPhysicalPortAugmentation.class);

        HwvtepPhysicalPortAugmentation augmentation = tp.augmentation(HwvtepPhysicalPortAugmentation.class);
        HwvtepPhysicalPortAugmentationBuilder builder = new HwvtepPhysicalPortAugmentationBuilder();
        if (augmentation != null) {
            builder = new HwvtepPhysicalPortAugmentationBuilder(augmentation);
        }

        if (augmentation != null && augmentation.getVlanBindings() != null
                && !augmentation.getVlanBindings().isEmpty()) {
            builder.setVlanBindings(augmentation.getVlanBindings());
            terminationPointBuilder.addAugmentation(HwvtepPhysicalPortAugmentation.class, builder.build());

            final TerminationPoint newTp = terminationPointBuilder.build();
            result.put(newTp.key(), newTp);
        }
    }
    return result;
}