Search in sources :

Example 71 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.

the class InterfacemgrProvider method getChildInterfaces.

@Override
public List<Interface> getChildInterfaces(ReadTransaction tx, String parentInterface) throws ReadFailedException {
    InterfaceParentEntry parentEntry = interfaceMetaUtils.getInterfaceParentEntryFromConfigDS(tx, parentInterface);
    if (parentEntry == null) {
        LOG.debug("No parent entry found for {}", parentInterface);
        return Collections.emptyList();
    }
    List<InterfaceChildEntry> childEntries = parentEntry.getInterfaceChildEntry();
    if (childEntries == null || childEntries.isEmpty()) {
        LOG.debug("No child entries found for parent {}", parentInterface);
        return Collections.emptyList();
    }
    List<Interface> childInterfaces = new ArrayList<>();
    for (InterfaceChildEntry childEntry : childEntries) {
        String interfaceName = childEntry.getChildInterface();
        Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(tx, interfaceName);
        if (iface != null) {
            childInterfaces.add(iface);
        } else {
            LOG.debug("Child interface {} not found in config DS for parent interface {}", interfaceName, parentInterface);
        }
    }
    LOG.trace("Found child interfaces {} for parent {}", childInterfaces, parentInterface);
    return childInterfaces;
}
Also used : InterfaceChildEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry) ArrayList(java.util.ArrayList) InterfaceParentEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 72 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.

the class SouthboundUtils method addAllPortsToBridge.

/*
     * Add all tunnels ports corresponding to the bridge to the topology config DS.
     */
public void addAllPortsToBridge(BridgeEntry bridgeEntry, InterfaceManagerCommonUtils interfaceManagerCommonUtils, InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid, OvsdbBridgeAugmentation bridgeNew) {
    String bridgeName = bridgeNew.getBridgeName().getValue();
    LOG.debug("adding all ports to bridge: {}", bridgeName);
    List<BridgeInterfaceEntry> bridgeInterfaceEntries = bridgeEntry.getBridgeInterfaceEntry();
    if (bridgeInterfaceEntries != null) {
        for (BridgeInterfaceEntry bridgeInterfaceEntry : bridgeInterfaceEntries) {
            String portName = bridgeInterfaceEntry.getInterfaceName();
            InterfaceKey interfaceKey = new InterfaceKey(portName);
            Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
            if (iface != null) {
                IfTunnel ifTunnel = iface.getAugmentation(IfTunnel.class);
                if (ifTunnel != null) {
                    if (!(interfacemgrProvider.isItmDirectTunnelsEnabled() && ifTunnel.isInternal())) {
                        addTunnelPortToBridge(ifTunnel, bridgeIid, iface, portName);
                    }
                    if (isOfTunnel(ifTunnel)) {
                        LOG.debug("Using OFTunnel. Only one tunnel port will be added");
                        return;
                    }
                }
            } else {
                LOG.debug("Interface {} not found in config DS", portName);
            }
        }
    }
}
Also used : IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) BridgeInterfaceEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.bridge.entry.BridgeInterfaceEntry) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 73 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.

the class InterfaceManagerServiceImpl method getDpidFromInterface.

@Override
public ListenableFuture<GetDpidFromInterfaceOutput> getDpidFromInterface(GetDpidFromInterfaceInput input) {
    String interfaceName = input.getIntfName();
    BigInteger dpId;
    InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
    Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
    if (interfaceInfo == null) {
        throw new IllegalArgumentException(getDpidFromInterfaceErrorMessage(interfaceName, "missing Interface in Config DataStore"));
    }
    if (Tunnel.class.equals(interfaceInfo.getType())) {
        ParentRefs parentRefs = interfaceInfo.getAugmentation(ParentRefs.class);
        dpId = parentRefs.getDatapathNodeIdentifier();
    } else {
        org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
        if (ifState != null) {
            String lowerLayerIf = ifState.getLowerLayerIf().get(0);
            NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
            dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
        } else {
            throw new IllegalArgumentException(getDpidFromInterfaceErrorMessage(interfaceName, "missing Interface-state"));
        }
    }
    return Futures.immediateFuture(new GetDpidFromInterfaceOutputBuilder().setDpid(dpId).build());
}
Also used : Collections(java.util.Collections) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) GetDpidFromInterfaceOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceOutputBuilder) ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) BigInteger(java.math.BigInteger) DpnToInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterfaceKey) IfIndexInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterfaceKey) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) IfIndexInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface)

Example 74 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.

the class InterfaceManagerServiceImpl method getTunnelType.

@Override
public ListenableFuture<GetTunnelTypeOutput> getTunnelType(GetTunnelTypeInput input) {
    String interfaceName = input.getIntfName();
    InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
    Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
    if (interfaceInfo == null) {
        throw new IllegalArgumentException(String.format("Retrieval of Tunnel Type for the key {%s} failed due to missing Interface in Config DataStore", interfaceName));
    }
    if (Tunnel.class.equals(interfaceInfo.getType())) {
        IfTunnel tnl = interfaceInfo.getAugmentation(IfTunnel.class);
        Class<? extends TunnelTypeBase> tunType = tnl.getTunnelInterfaceType();
        return Futures.immediateFuture(new GetTunnelTypeOutputBuilder().setTunnelType(tunType).build());
    } else {
        throw new IllegalArgumentException("Retrieval of interface type failed for key: " + interfaceName);
    }
}
Also used : GetTunnelTypeOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetTunnelTypeOutputBuilder) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) DpnToInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterfaceKey) IfIndexInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterfaceKey) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) IfIndexInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface)

Example 75 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.

the class InterfaceManagerServiceImpl method getInterfaceType.

@Override
public ListenableFuture<GetInterfaceTypeOutput> getInterfaceType(GetInterfaceTypeInput input) {
    String interfaceName = input.getIntfName();
    InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
    Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
    if (interfaceInfo == null) {
        throw new IllegalStateException(String.format("getInterfaceType() Retrieval of Interface Type for " + "the key {%s} failed due to missing Interface in Config DataStore", interfaceName));
    }
    return Futures.immediateFuture(new GetInterfaceTypeOutputBuilder().setInterfaceType(interfaceInfo.getType()).build());
}
Also used : GetInterfaceTypeOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceTypeOutputBuilder) DpnToInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterfaceKey) IfIndexInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterfaceKey) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) IfIndexInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface)

Aggregations

ArrayList (java.util.ArrayList)47 Test (org.junit.Test)45 BigInteger (java.math.BigInteger)29 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)23 ByteBuf (io.netty.buffer.ByteBuf)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)21 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)20 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)19 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)16 ExecutionException (java.util.concurrent.ExecutionException)16 Optional (com.google.common.base.Optional)15 List (java.util.List)15 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)14 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)14 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)14 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)12 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)12