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.rev160406.IfL2vlan;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeBase;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
29 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
30 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
31 import org.opendaylight.yangtools.yang.common.Uint64;
33 public interface IInterfaceManager {
35 Long getPortForInterface(String ifName);
37 Long getPortForInterface(Interface intf);
39 Uint64 getDpnForInterface(String ifName);
41 Uint64 getDpnForInterface(Interface intrf);
43 String getEndpointIpForDpn(Uint64 dpnId);
45 List<ActionInfo> getInterfaceEgressActions(String ifName);
47 InterfaceInfo getInterfaceInfo(String intInfo);
49 InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName,
50 InterfaceInfo.InterfaceType interfaceType);
52 InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName);
55 * This API is currently used only for CLI usage. Please be careful that this API
56 * can return stale entries since it is just a cache read.
58 InterfaceInfo getInterfaceInfoFromOperationalDSCache(String interfaceName);
61 * Retrieve the interface information from the configuration datastore.
63 * @param interfaceName The interface name.
64 * @return The interface information.
65 * @deprecated Use {@link #getInterfaceInfoFromConfigDataStore(ReadTransaction, String)}.
68 Interface getInterfaceInfoFromConfigDataStore(String interfaceName);
71 * Retrieve the interface information from the configuration datastore.
73 * @param tx The transaction to use.
74 * @param interfaceName The interface name.
75 * @return The interface information.
76 * @throws ReadFailedException if an exception occurs while reading from the datastore.
78 Interface getInterfaceInfoFromConfigDataStore(ReadTransaction tx, String interfaceName)
79 throws ReadFailedException, ExecutionException, InterruptedException;
82 * Create a VLAN interface.
84 * @deprecated Use {@link #createVLANInterface(String, String, Integer, String, IfL2vlan.L2vlanMode)}.
87 void createVLANInterface(String interfaceName, String portName, Uint64 dpId, Integer vlanId, String description,
88 IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException;
90 ListenableFuture<? extends Object> createVLANInterface(String interfaceName, String portName, Integer vlanId,
91 String description, IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException;
94 * Create a VLAN interface.
96 * @deprecated Use {@link #createVLANInterface(String, String, Integer, String, IfL2vlan.L2vlanMode, boolean)}.
99 void createVLANInterface(String interfaceName, String portName, Uint64 dpId, Integer vlanId, String description,
100 IfL2vlan.L2vlanMode l2vlanMode, boolean isExternal) throws InterfaceAlreadyExistsException;
102 ListenableFuture<? extends Object> createVLANInterface(String interfaceName, String portName, Integer vlanId,
103 String description, IfL2vlan.L2vlanMode l2vlanMode, boolean isExternal)
104 throws InterfaceAlreadyExistsException;
106 boolean isServiceBoundOnInterfaceForIngress(short servicePriority, String interfaceName);
108 boolean isServiceBoundOnInterfaceForEgress(short servicePriority, String interfaceName);
110 void bindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo);
112 void bindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo,
113 TypedWriteTransaction<Configuration> tx);
115 void unbindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo);
117 List<Interface> getVlanInterfaces();
119 List<Interface> getVxlanInterfaces();
122 * Retrieve an interface's children.
124 * @param parentInterface The parent interface.
125 * @return The child interfaces.
126 * @deprecated Use {@link #getChildInterfaces(ReadTransaction, String)} instead.
129 List<Interface> getChildInterfaces(String parentInterface);
132 * Retrieve an interface's children.
134 * @param tx The transaction to use.
135 * @param parentInterface The parent interface.
136 * @return The child interfaces.
137 * @throws ReadFailedException if an exception occurs while reading from the datastore.
139 List<Interface> getChildInterfaces(ReadTransaction tx, String parentInterface)
140 throws ReadFailedException, ExecutionException, InterruptedException;
143 * Determine whether an interface is external.
145 * @param interfaceName The interface name.
146 * @return {@code true} if the interface is external, {@code false} if it isn't.
147 * @deprecated Use {@link #isExternalInterface(ReadTransaction, String)} instead.
150 boolean isExternalInterface(String interfaceName);
153 * Determine whether an interface is external.
155 * @param tx The transaction to use.
156 * @param interfaceName The interface name.
157 * @return {@code true} if the interface is external, {@code false} if it isn't.
158 * @throws ReadFailedException if an exception occurs while reading from the datastore.
160 boolean isExternalInterface(ReadTransaction tx, String interfaceName)
161 throws ReadFailedException, ExecutionException, InterruptedException;
163 String getPortNameForInterface(NodeConnectorId nodeConnectorId, String interfaceName);
165 String getPortNameForInterface(String dpnId, String interfaceName);
167 String getParentRefNameForInterface(String interfaceName);
169 Map<String, OvsdbTerminationPointAugmentation> getTerminationPointCache();
171 Map<String, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state
172 .Interface.OperStatus> getBfdStateCache();
174 OvsdbTerminationPointAugmentation getTerminationPointForInterface(String interfaceName);
176 OvsdbBridgeAugmentation getOvsdbBridgeForInterface(String interfaceName);
178 OvsdbBridgeAugmentation getOvsdbBridgeForNodeIid(InstanceIdentifier<Node> nodeIid);
180 List<OvsdbTerminationPointAugmentation> getPortsOnBridge(Uint64 dpnId);
182 List<OvsdbTerminationPointAugmentation> getTunnelPortsOnBridge(Uint64 dpnId);
184 Map<Class<? extends InterfaceTypeBase>, List<OvsdbTerminationPointAugmentation>>
185 getPortsOnBridgeByType(Uint64 dpnId);
187 void updateInterfaceParentRef(String interfaceName, String parentInterface);
189 void updateInterfaceParentRef(String interfaceName, String parentInterface, boolean readInterfaceBeforeWrite);
191 long getLogicalTunnelSelectGroupId(int lportTag);
193 boolean isItmDirectTunnelsEnabled();
195 Map getBridgeRefEntryMap();
197 boolean isItmOfTunnelsEnabled();