9b92e748f097f119e9432b0d3cf101b345e83c64
[genius.git] / interfacemanager / interfacemanager-api / src / main / java / org / opendaylight / genius / interfacemanager / interfaces / IInterfaceManager.java
1 /*
2  * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.genius.interfacemanager.interfaces;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.List;
12 import java.util.Map;
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;
32
33 public interface IInterfaceManager {
34
35     Long getPortForInterface(String ifName);
36
37     Long getPortForInterface(Interface intf);
38
39     Uint64 getDpnForInterface(String ifName);
40
41     Uint64 getDpnForInterface(Interface intrf);
42
43     String getEndpointIpForDpn(Uint64 dpnId);
44
45     List<ActionInfo> getInterfaceEgressActions(String ifName);
46
47     InterfaceInfo getInterfaceInfo(String intInfo);
48
49     InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName,
50             InterfaceInfo.InterfaceType interfaceType);
51
52     InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName);
53
54     /**
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.
57      */
58     InterfaceInfo getInterfaceInfoFromOperationalDSCache(String interfaceName);
59
60     /**
61      * Retrieve the interface information from the configuration datastore.
62      *
63      * @param interfaceName The interface name.
64      * @return The interface information.
65      * @deprecated Use {@link #getInterfaceInfoFromConfigDataStore(ReadTransaction, String)}.
66      */
67     @Deprecated
68     Interface getInterfaceInfoFromConfigDataStore(String interfaceName);
69
70     /**
71      * Retrieve the interface information from the configuration datastore.
72      *
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.
77      */
78     Interface getInterfaceInfoFromConfigDataStore(ReadTransaction tx, String interfaceName)
79             throws ReadFailedException, ExecutionException, InterruptedException;
80
81     /**
82      * Create a VLAN interface.
83      *
84      * @deprecated Use {@link #createVLANInterface(String, String, Integer, String, IfL2vlan.L2vlanMode)}.
85      */
86     @Deprecated
87     void createVLANInterface(String interfaceName, String portName, Uint64 dpId, Integer vlanId, String description,
88             IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException;
89
90     ListenableFuture<? extends Object> createVLANInterface(String interfaceName, String portName, Integer vlanId,
91             String description, IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException;
92
93     /**
94      * Create a VLAN interface.
95      *
96      * @deprecated Use {@link #createVLANInterface(String, String, Integer, String, IfL2vlan.L2vlanMode, boolean)}.
97      */
98     @Deprecated
99     void createVLANInterface(String interfaceName, String portName, Uint64 dpId, Integer vlanId, String description,
100             IfL2vlan.L2vlanMode l2vlanMode, boolean isExternal) throws InterfaceAlreadyExistsException;
101
102     ListenableFuture<? extends Object> createVLANInterface(String interfaceName, String portName, Integer vlanId,
103             String description, IfL2vlan.L2vlanMode l2vlanMode, boolean isExternal)
104                     throws InterfaceAlreadyExistsException;
105
106     boolean isServiceBoundOnInterfaceForIngress(short servicePriority, String interfaceName);
107
108     boolean isServiceBoundOnInterfaceForEgress(short servicePriority, String interfaceName);
109
110     void bindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo);
111
112     void bindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo,
113                      TypedWriteTransaction<Configuration> tx);
114
115     void unbindService(String interfaceName, Class<? extends ServiceModeBase> serviceMode, BoundServices serviceInfo);
116
117     List<Interface> getVlanInterfaces();
118
119     List<Interface> getVxlanInterfaces();
120
121     /**
122      * Retrieve an interface's children.
123      *
124      * @param parentInterface The parent interface.
125      * @return The child interfaces.
126      * @deprecated Use {@link #getChildInterfaces(ReadTransaction, String)} instead.
127      */
128     @Deprecated
129     List<Interface> getChildInterfaces(String parentInterface);
130
131     /**
132      * Retrieve an interface's children.
133      *
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.
138      */
139     List<Interface> getChildInterfaces(ReadTransaction tx, String parentInterface)
140             throws ReadFailedException, ExecutionException, InterruptedException;
141
142     /**
143      * Determine whether an interface is external.
144      *
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.
148      */
149     @Deprecated
150     boolean isExternalInterface(String interfaceName);
151
152     /**
153      * Determine whether an interface is external.
154      *
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.
159      */
160     boolean isExternalInterface(ReadTransaction tx, String interfaceName)
161             throws ReadFailedException, ExecutionException, InterruptedException;
162
163     String getPortNameForInterface(NodeConnectorId nodeConnectorId, String interfaceName);
164
165     String getPortNameForInterface(String dpnId, String interfaceName);
166
167     String getParentRefNameForInterface(String interfaceName);
168
169     Map<String, OvsdbTerminationPointAugmentation> getTerminationPointCache();
170
171     Map<String, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state
172             .Interface.OperStatus> getBfdStateCache();
173
174     OvsdbTerminationPointAugmentation getTerminationPointForInterface(String interfaceName);
175
176     OvsdbBridgeAugmentation getOvsdbBridgeForInterface(String interfaceName);
177
178     OvsdbBridgeAugmentation getOvsdbBridgeForNodeIid(InstanceIdentifier<Node> nodeIid);
179
180     List<OvsdbTerminationPointAugmentation> getPortsOnBridge(Uint64 dpnId);
181
182     List<OvsdbTerminationPointAugmentation> getTunnelPortsOnBridge(Uint64 dpnId);
183
184     Map<Class<? extends InterfaceTypeBase>, List<OvsdbTerminationPointAugmentation>>
185         getPortsOnBridgeByType(Uint64 dpnId);
186
187     void updateInterfaceParentRef(String interfaceName, String parentInterface);
188
189     void updateInterfaceParentRef(String interfaceName, String parentInterface, boolean readInterfaceBeforeWrite);
190
191     long getLogicalTunnelSelectGroupId(int lportTag);
192
193     boolean isItmDirectTunnelsEnabled();
194
195     Map getBridgeRefEntryMap();
196
197     boolean isItmOfTunnelsEnabled();
198 }