2 * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.interfacemanager.interfaces;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.List;
13 import java.util.concurrent.ExecutionException;
14 import org.opendaylight.genius.interfacemanager.exceptions.InterfaceAlreadyExistsException;
15 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
16 import org.opendaylight.genius.mdsalutil.ActionInfo;
17 import org.opendaylight.mdsal.binding.api.ReadTransaction;
18 import org.opendaylight.mdsal.binding.util.Datastore.Configuration;
19 import org.opendaylight.mdsal.binding.util.TypedWriteTransaction;
20 import org.opendaylight.mdsal.common.api.ReadFailedException;
21 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeBase;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
30 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
31 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
32 import org.opendaylight.yangtools.yang.common.Uint64;
34 public interface IInterfaceManager {
36 Long getPortForInterface(String ifName);
38 Long getPortForInterface(Interface intf);
40 Uint64 getDpnForInterface(String ifName);
42 Uint64 getDpnForInterface(Interface intrf);
44 String getEndpointIpForDpn(Uint64 dpnId);
46 List<ActionInfo> getInterfaceEgressActions(String ifName);
48 InterfaceInfo getInterfaceInfo(String intInfo);
50 InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName,
51 InterfaceInfo.InterfaceType interfaceType);
53 InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName);
56 * This API is currently used only for CLI usage. Please be careful that this API
57 * can return stale entries since it is just a cache read.
59 InterfaceInfo getInterfaceInfoFromOperationalDSCache(String interfaceName);
62 * Retrieve the interface information from the configuration datastore.
64 * @param interfaceName The interface name.
65 * @return The interface information.
66 * @deprecated Use {@link #getInterfaceInfoFromConfigDataStore(ReadTransaction, String)}.
69 Interface getInterfaceInfoFromConfigDataStore(String interfaceName);
72 * Retrieve the interface information from the configuration datastore.
74 * @param tx The transaction to use.
75 * @param interfaceName The interface name.
76 * @return The interface information.
77 * @throws ReadFailedException if an exception occurs while reading from the datastore.
79 Interface getInterfaceInfoFromConfigDataStore(ReadTransaction tx, String interfaceName)
80 throws ReadFailedException, ExecutionException, InterruptedException;
83 * Create a VLAN interface.
85 * @deprecated Use {@link #createVLANInterface(String, String, Integer, String, IfL2vlan.L2vlanMode)}.
88 void createVLANInterface(String interfaceName, String portName, Uint64 dpId, Integer vlanId, String description,
89 IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException;
91 ListenableFuture<? extends Object> createVLANInterface(String interfaceName, String portName, Integer vlanId,
92 String description, IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException;
95 * Create a VLAN interface.
97 * @deprecated Use {@link #createVLANInterface(String, String, Integer, String, IfL2vlan.L2vlanMode, boolean)}.
100 void createVLANInterface(String interfaceName, String portName, Uint64 dpId, Integer vlanId, String description,
101 IfL2vlan.L2vlanMode l2vlanMode, boolean isExternal) throws InterfaceAlreadyExistsException;
103 ListenableFuture<? extends Object> createVLANInterface(String interfaceName, String portName, Integer vlanId,
104 String description, IfL2vlan.L2vlanMode l2vlanMode, boolean isExternal)
105 throws InterfaceAlreadyExistsException;
107 boolean isServiceBoundOnInterfaceForIngress(short servicePriority, String interfaceName);
109 boolean isServiceBoundOnInterfaceForEgress(short servicePriority, String interfaceName);
111 void bindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo);
113 void bindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo,
114 TypedWriteTransaction<Configuration> tx);
116 void unbindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo);
118 List<Interface> getVlanInterfaces();
120 List<Interface> getVxlanInterfaces();
123 * Retrieve an interface's children.
125 * @param parentInterface The parent interface.
126 * @return The child interfaces.
127 * @deprecated Use {@link #getChildInterfaces(ReadTransaction, String)} instead.
130 List<Interface> getChildInterfaces(String parentInterface);
133 * Retrieve an interface's children.
135 * @param tx The transaction to use.
136 * @param parentInterface The parent interface.
137 * @return The child interfaces.
138 * @throws ReadFailedException if an exception occurs while reading from the datastore.
140 List<Interface> getChildInterfaces(ReadTransaction tx, String parentInterface)
141 throws ReadFailedException, ExecutionException, InterruptedException;
144 * Determine whether an interface is external.
146 * @param interfaceName The interface name.
147 * @return {@code true} if the interface is external, {@code false} if it isn't.
148 * @deprecated Use {@link #isExternalInterface(ReadTransaction, String)} instead.
151 boolean isExternalInterface(String interfaceName);
154 * Determine whether an interface is external.
156 * @param tx The transaction to use.
157 * @param interfaceName The interface name.
158 * @return {@code true} if the interface is external, {@code false} if it isn't.
159 * @throws ReadFailedException if an exception occurs while reading from the datastore.
161 boolean isExternalInterface(ReadTransaction tx, String interfaceName)
162 throws ReadFailedException, ExecutionException, InterruptedException;
164 String getPortNameForInterface(NodeConnectorId nodeConnectorId, String interfaceName);
166 String getPortNameForInterface(String dpnId, String interfaceName);
168 String getParentRefNameForInterface(String interfaceName);
170 Map<String, OvsdbTerminationPointAugmentation> getTerminationPointCache();
172 Map<String, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state
173 .Interface.OperStatus> getBfdStateCache();
175 OvsdbTerminationPointAugmentation getTerminationPointForInterface(String interfaceName);
177 OvsdbBridgeAugmentation getOvsdbBridgeForInterface(String interfaceName);
179 OvsdbBridgeAugmentation getOvsdbBridgeForNodeIid(InstanceIdentifier<Node> nodeIid);
181 List<OvsdbTerminationPointAugmentation> getPortsOnBridge(Uint64 dpnId);
183 List<OvsdbTerminationPointAugmentation> getTunnelPortsOnBridge(Uint64 dpnId);
185 Map<Class<? extends InterfaceTypeBase>, List<OvsdbTerminationPointAugmentation>>
186 getPortsOnBridgeByType(Uint64 dpnId);
188 void updateInterfaceParentRef(String interfaceName, String parentInterface);
190 void updateInterfaceParentRef(String interfaceName, String parentInterface, boolean readInterfaceBeforeWrite);
192 long getLogicalTunnelSelectGroupId(int lportTag);
194 boolean isItmDirectTunnelsEnabled();
196 Map<Uint64, BridgeRefEntry> getBridgeRefEntryMap();
198 boolean isItmOfTunnelsEnabled();
200 void addInternalTunnelToCache(String tunnelName, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
201 .ietf.interfaces.rev140508.interfaces.state.Interface iface);
203 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface
204 getInternalTunnelCacheInfo(String tunnelName);
206 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface
207 removeInternalTunnelFromCache(String tunnelName);