Search in sources :

Example 11 with OvsdbTerminationPointAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation in project genius by opendaylight.

the class InterfacemgrProvider method getParentRefNameForInterface.

@Override
public String getParentRefNameForInterface(String interfaceName) {
    String parentRefName = null;
    String dpnId = getDpidForInterface(interfaceName, null);
    OvsdbTerminationPointAugmentation ovsdbTp = getTerminationPoint(interfaceName);
    if (ovsdbTp != null) {
        if (dpnId == null) {
            LOG.error("Got NULL dpnId when looking for TP with external ID {}", interfaceName);
            return null;
        }
        parentRefName = getPortNameForInterface(dpnId, ovsdbTp.getName());
        LOG.debug("Building parent ref for interface {}, using parentRefName {} acquired by external ID", interfaceName, parentRefName);
    } else {
        LOG.debug("Skipping parent ref for interface {}, as there is no termination point that references " + "this interface yet.", interfaceName);
    }
    return parentRefName;
}
Also used : OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)

Example 12 with OvsdbTerminationPointAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation in project genius by opendaylight.

the class InterfacemgrProvider method getPortsOnBridge.

@Override
public /**
 * Get all termination points on a given DPN.
 * This API uses read on Operational DS. If there are perf issues in cluster
 * setup, we can consider caching later.
 *
 * @param dpnId
 *            Datapath Node Identifier
 *
 * @return If the data at the supplied path exists, returns a list of all termination point
 *         Augmentations
 */
List<OvsdbTerminationPointAugmentation> getPortsOnBridge(BigInteger dpnId) {
    List<OvsdbTerminationPointAugmentation> ports = new ArrayList<>();
    List<TerminationPoint> portList = interfaceMetaUtils.getTerminationPointsOnBridge(dpnId);
    for (TerminationPoint ovsPort : portList) {
        if (ovsPort.getAugmentation(OvsdbTerminationPointAugmentation.class) != null) {
            ports.add(ovsPort.getAugmentation(OvsdbTerminationPointAugmentation.class));
        }
    }
    LOG.debug("Found {} ports on bridge {}", ports.size(), dpnId);
    return ports;
}
Also used : ArrayList(java.util.ArrayList) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 13 with OvsdbTerminationPointAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation in project genius by opendaylight.

the class IfmCLIUtil method getPortDetails.

private static String getPortDetails(OvsdbTerminationPointAugmentation port) {
    if (SouthboundUtils.isInterfaceTypeTunnel(port.getInterfaceType())) {
        String remoteIp = UNSET;
        String localIp = UNSET;
        String key = UNSET;
        for (Options portOption : port.getOptions()) {
            switch(portOption.getOption()) {
                case "local_ip":
                    localIp = portOption.getValue();
                    break;
                case "remote_ip":
                    remoteIp = portOption.getValue();
                    break;
                case "key":
                    key = portOption.getValue();
                    break;
                default:
                    break;
            }
        }
        return String.format(TP_VXLAN_OUTPUT_FORMAT_LINE1, localIp, remoteIp, key);
    }
    return String.format(TP_OUTPUT_FORMAT_LINE2, UNSET);
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options)

Example 14 with OvsdbTerminationPointAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation in project genius by opendaylight.

the class ShowOvsPorts method doExecute.

@Override
protected Object doExecute() {
    LOG.debug("Executing show ovs-ports command");
    List<OvsdbTerminationPointAugmentation> ports = interfaceManager.getPortsOnBridge(dpnId);
    if (!ports.isEmpty()) {
        IfmCLIUtil.showBridgePortsHeader(session, dpnId);
    }
    for (OvsdbTerminationPointAugmentation port : ports) {
        IfmCLIUtil.showBridgePortsOutput(session, port);
    }
    return null;
}
Also used : OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)

Aggregations

OvsdbTerminationPointAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)11 ArrayList (java.util.ArrayList)6 BigInteger (java.math.BigInteger)4 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)4 List (java.util.List)3 Inject (javax.inject.Inject)3 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)3 InterfaceMetaUtils (org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils)3 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)3 OvsdbTerminationPointAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder)3 Options (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options)3 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)3 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 Collections (java.util.Collections)2 Future (java.util.concurrent.Future)2 Singleton (javax.inject.Singleton)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)2 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)2 CONFIGURATION (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION)2 SingleTransactionDataBroker (org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker)2