2 * Copyright (c) 2016 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;
11 import com.google.common.base.Optional;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
14 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
15 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
16 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
17 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
18 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
19 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
20 import org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils;
21 import org.opendaylight.genius.interfacemanager.exceptions.InterfaceAlreadyExistsException;
22 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
23 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo.InterfaceAdminState;
24 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
25 import org.opendaylight.genius.interfacemanager.listeners.*;
26 import org.opendaylight.genius.interfacemanager.pmcounters.NodeConnectorStatsImpl;
27 import org.opendaylight.genius.interfacemanager.rpcservice.InterfaceManagerRpcService;
28 import org.opendaylight.genius.interfacemanager.servicebindings.flowbased.listeners.FlowBasedServicesConfigListener;
29 import org.opendaylight.genius.interfacemanager.servicebindings.flowbased.listeners.FlowBasedServicesInterfaceStateListener;
30 import org.opendaylight.genius.interfacemanager.statusanddiag.InterfaceStatusMonitor;
31 import org.opendaylight.genius.mdsalutil.ActionInfo;
32 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
33 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder;
38 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
39 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.AdminStatus;
40 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.*;
60 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
61 import org.opendaylight.yangtools.yang.common.RpcResult;
62 import org.slf4j.Logger;
63 import org.slf4j.LoggerFactory;
65 import java.math.BigInteger;
66 import java.util.ArrayList;
67 import java.util.List;
68 import java.util.concurrent.ExecutionException;
69 import java.util.concurrent.Future;
72 public class InterfacemgrProvider implements BindingAwareProvider, AutoCloseable, IInterfaceManager {
74 private static final Logger LOG = LoggerFactory.getLogger(InterfacemgrProvider.class);
75 private static final InterfaceStatusMonitor interfaceStatusMonitor = InterfaceStatusMonitor.getInstance();
77 private RpcProviderRegistry rpcProviderRegistry;
78 private IdManagerService idManager;
79 private NotificationService notificationService;
80 private AlivenessMonitorService alivenessManager;
81 private IMdsalApiManager mdsalManager;
82 private InterfaceConfigListener interfaceConfigListener;
83 private InterfaceTopologyStateListener topologyStateListener;
84 private TerminationPointStateListener terminationPointStateListener;
85 private HwVTEPTunnelsStateListener hwVTEPTunnelsStateListener;
86 private InterfaceInventoryStateListener interfaceInventoryStateListener;
87 private FlowBasedServicesInterfaceStateListener flowBasedServicesInterfaceStateListener;
88 private FlowBasedServicesConfigListener flowBasedServicesConfigListener;
89 private VlanMemberConfigListener vlanMemberConfigListener;
90 private HwVTEPConfigListener hwVTEPConfigListener;
91 private AlivenessMonitorListener alivenessMonitorListener;
92 private DataBroker dataBroker;
93 private InterfaceManagerRpcService interfaceManagerRpcService;
94 private BindingAwareBroker.RpcRegistration<OdlInterfaceRpcService> rpcRegistration;
95 private NodeConnectorStatsImpl nodeConnectorStatsManager;
96 private CacheInterfaceConfigListener cacheInterfaceConfigListener;
97 private CacheInterfaceStateListener cacheInterfaceStateListener;
99 public void setRpcProviderRegistry(RpcProviderRegistry rpcProviderRegistry) {
100 this.rpcProviderRegistry = rpcProviderRegistry;
101 interfaceStatusMonitor.registerMbean();
104 public void setMdsalManager(IMdsalApiManager mdsalManager) {
105 this.mdsalManager = mdsalManager;
108 public void setNotificationService(NotificationService notificationService) {
109 this.notificationService = notificationService;
112 public DataBroker getDataBroker(){
113 return this.dataBroker;
117 public void onSessionInitiated(ProviderContext session) {
118 LOG.info("InterfacemgrProvider Session Initiated");
119 interfaceStatusMonitor.reportStatus("STARTING");
121 dataBroker = session.getSALService(DataBroker.class);
122 idManager = rpcProviderRegistry.getRpcService(IdManagerService.class);
125 alivenessManager = rpcProviderRegistry.getRpcService(AlivenessMonitorService.class);
126 interfaceManagerRpcService = new InterfaceManagerRpcService(dataBroker, mdsalManager);
127 rpcRegistration = getRpcProviderRegistry().addRpcImplementation(
128 OdlInterfaceRpcService.class, interfaceManagerRpcService);
130 interfaceConfigListener = new InterfaceConfigListener(dataBroker, idManager, alivenessManager, mdsalManager);
131 interfaceConfigListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
133 interfaceInventoryStateListener = new InterfaceInventoryStateListener(dataBroker, idManager, mdsalManager, alivenessManager);
134 interfaceInventoryStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
136 topologyStateListener = new InterfaceTopologyStateListener(dataBroker);
137 topologyStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
139 hwVTEPTunnelsStateListener = new HwVTEPTunnelsStateListener(dataBroker);
140 hwVTEPTunnelsStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
142 terminationPointStateListener = new TerminationPointStateListener(dataBroker);
143 terminationPointStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
145 flowBasedServicesConfigListener = new FlowBasedServicesConfigListener(this);
146 flowBasedServicesConfigListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
148 flowBasedServicesInterfaceStateListener =
149 new FlowBasedServicesInterfaceStateListener(dataBroker);
150 flowBasedServicesInterfaceStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
152 vlanMemberConfigListener =
153 new VlanMemberConfigListener(dataBroker, idManager, alivenessManager, mdsalManager);
154 vlanMemberConfigListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
156 hwVTEPConfigListener = new HwVTEPConfigListener(dataBroker);
157 hwVTEPConfigListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
159 alivenessMonitorListener = new org.opendaylight.genius.interfacemanager.listeners.AlivenessMonitorListener(dataBroker);
160 notificationService.registerNotificationListener(alivenessMonitorListener);
162 cacheInterfaceConfigListener = new CacheInterfaceConfigListener(dataBroker);
163 cacheInterfaceConfigListener.registerListener(dataBroker);
165 cacheInterfaceStateListener = new CacheInterfaceStateListener(dataBroker);
166 cacheInterfaceStateListener.registerListener(dataBroker);
168 //Initialize nodeconnectorstatsimpl
169 nodeConnectorStatsManager = new NodeConnectorStatsImpl(dataBroker, notificationService,
170 session.getRpcService(OpendaylightPortStatisticsService.class), session.getRpcService(OpendaylightFlowTableStatisticsService.class));
173 interfaceStatusMonitor.reportStatus("OPERATIONAL");
174 } catch (Exception e) {
175 LOG.error("Error initializing services", e);
176 interfaceStatusMonitor.reportStatus("ERROR");
180 private void createIdPool() {
181 CreateIdPoolInput createPool = new CreateIdPoolInputBuilder()
182 .setPoolName(IfmConstants.IFM_IDPOOL_NAME)
183 .setLow(IfmConstants.IFM_ID_POOL_START)
184 .setHigh(IfmConstants.IFM_ID_POOL_END)
186 //TODO: Error handling
187 Future<RpcResult<Void>> result = idManager.createIdPool(createPool);
189 if ((result != null) && (result.get().isSuccessful())) {
190 LOG.debug("Created IdPool for InterfaceMgr");
192 } catch (InterruptedException | ExecutionException e) {
193 LOG.error("Failed to create idPool for InterfaceMgr", e);
198 public void close() throws Exception {
199 LOG.info("InterfacemgrProvider Closed");
200 interfaceConfigListener.close();
201 rpcRegistration.close();
202 cacheInterfaceConfigListener.close();
203 cacheInterfaceStateListener.close();
206 public RpcProviderRegistry getRpcProviderRegistry() {
207 return rpcProviderRegistry;
211 public Long getPortForInterface(String ifName) {
212 GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(ifName).build();
213 Future<RpcResult<GetPortFromInterfaceOutput>> output = interfaceManagerRpcService.getPortFromInterface(input);
215 RpcResult<GetPortFromInterfaceOutput> port = output.get();
216 if (port.isSuccessful()) {
217 return port.getResult().getPortno();
219 } catch (NullPointerException | InterruptedException | ExecutionException e) {
220 LOG.warn("Exception when getting port for interface", e);
226 public Long getPortForInterface(Interface intf) {
227 GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(intf.getName()).build();
228 Future<RpcResult<GetPortFromInterfaceOutput>> output = interfaceManagerRpcService.getPortFromInterface(input);
230 RpcResult<GetPortFromInterfaceOutput> port = output.get();
231 if (port.isSuccessful()) {
232 return port.getResult().getPortno();
234 } catch (NullPointerException | InterruptedException | ExecutionException e) {
235 LOG.warn("Exception when getting port for interface", e);
241 public InterfaceInfo getInterfaceInfo(String interfaceName) {
243 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface
244 ifState = InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(interfaceName, dataBroker);
246 if (ifState == null) {
247 LOG.error("Interface {} is not present", interfaceName);
251 Integer lportTag = ifState.getIfIndex();
252 Interface intf = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName), dataBroker);
254 LOG.error("Interface {} doesn't exist in config datastore", interfaceName);
258 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(intf.getName(), dataBroker);
259 InterfaceInfo.InterfaceType interfaceType = IfmUtil.getInterfaceType(intf);
260 InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
261 BigInteger dpId = org.opendaylight.genius.interfacemanager.globals.IfmConstants.INVALID_DPID;
262 Integer portNo = org.opendaylight.genius.interfacemanager.globals.IfmConstants.INVALID_PORT_NO;
264 dpId = new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId));
265 portNo = Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId));
267 if (interfaceType == InterfaceInfo.InterfaceType.VLAN_INTERFACE) {
268 interfaceInfo = IfmUtil.getVlanInterfaceInfo(interfaceName, intf, dpId);
269 } else if (interfaceType == InterfaceInfo.InterfaceType.VXLAN_TRUNK_INTERFACE ||
270 interfaceType == InterfaceInfo.InterfaceType.GRE_TRUNK_INTERFACE) {
271 // TODO : since there is no logical grouping for tunnel interfaces, there is no need
272 // for this code as of now. will be revisited once the support comes
275 LOG.error("Type of Interface {} is unknown", interfaceName);
278 interfaceInfo.setDpId(dpId);
279 interfaceInfo.setPortNo(portNo);
280 interfaceInfo.setAdminState((intf.isEnabled() == true) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
281 interfaceInfo.setInterfaceName(interfaceName);
282 interfaceInfo.setInterfaceTag(lportTag);
283 interfaceInfo.setInterfaceType(interfaceType);
284 interfaceInfo.setGroupId(IfmUtil.getGroupId(lportTag, interfaceType));
285 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Up) ? InterfaceInfo.InterfaceOpState.UP : InterfaceInfo.InterfaceOpState.DOWN);
288 return interfaceInfo;
293 public InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName, InterfaceInfo.InterfaceType interfaceType) {
294 InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
295 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = InterfaceManagerCommonUtils
296 .getInterfaceStateFromOperDS(interfaceName, dataBroker);
297 if (ifState == null) {
298 LOG.error("Interface {} is not present", interfaceName);
301 Integer lportTag = ifState.getIfIndex();
302 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(ifState);
304 interfaceInfo.setDpId(new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId)));
305 interfaceInfo.setPortNo(Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId)));
307 interfaceInfo.setAdminState((ifState.getAdminStatus() == AdminStatus.Up) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
308 interfaceInfo.setInterfaceName(interfaceName);
309 interfaceInfo.setInterfaceTag(lportTag);
310 interfaceInfo.setInterfaceType(interfaceType);
311 interfaceInfo.setGroupId(IfmUtil.getGroupId(lportTag, interfaceType));
312 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Up) ? InterfaceInfo.InterfaceOpState.UP : InterfaceInfo.InterfaceOpState.DOWN);
315 return interfaceInfo;
319 public InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName) {
320 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = InterfaceManagerCommonUtils
321 .getInterfaceStateFromOperDS(interfaceName, dataBroker);
322 if (ifState == null) {
323 LOG.error("Interface {} is not present", interfaceName);
326 Integer lportTag = ifState.getIfIndex();
327 InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
328 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(ifState);
330 interfaceInfo.setPortName(IfmUtil.getPortName(dataBroker, ncId));
331 interfaceInfo.setDpId(new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId)));
332 interfaceInfo.setPortNo(Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId)));
334 interfaceInfo.setAdminState((ifState.getAdminStatus() == AdminStatus.Up) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
335 interfaceInfo.setInterfaceName(interfaceName);
336 interfaceInfo.setInterfaceTag(lportTag);
337 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Down) ? InterfaceInfo.InterfaceOpState.DOWN :
338 ifState.getOperStatus() == OperStatus.Unknown ? InterfaceInfo.InterfaceOpState.UNKNOWN : InterfaceInfo.InterfaceOpState.UP);
339 return interfaceInfo;
343 public Interface getInterfaceInfoFromConfigDataStore(String interfaceName) {
344 Interface intf = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName), dataBroker);
349 public void createVLANInterface(String interfaceName, String portName, BigInteger dpId, Integer vlanId,
350 String description, IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException {
352 LOG.info("Create VLAN interface : {}", interfaceName);
353 InstanceIdentifier<Interface> interfaceInstanceIdentifier = InterfaceManagerCommonUtils.getInterfaceIdentifier(new InterfaceKey(interfaceName));
354 Interface interfaceOptional = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName), dataBroker);
355 if (interfaceOptional != null) {
356 LOG.debug("VLAN interface is already exist", interfaceOptional.getDescription());
357 throw new InterfaceAlreadyExistsException(interfaceOptional.getName());
359 IfL2vlanBuilder l2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
361 l2vlanBuilder.setVlanId(new VlanId(vlanId));
363 ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(portName).build();
364 Interface inf = new InterfaceBuilder().setEnabled(true).setName(interfaceName).setType(L2vlan.class).
365 addAugmentation(IfL2vlan.class, l2vlanBuilder.build()).addAugmentation(ParentRefs.class, parentRefs).
366 setDescription(description).build();
367 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
368 t.put(LogicalDatastoreType.CONFIGURATION, interfaceInstanceIdentifier, inf, true);
372 public void bindService(String interfaceName, BoundServices serviceInfo) {
373 LOG.info("Binding Service : {}", interfaceName);
374 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
375 InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier = InstanceIdentifier.builder(ServiceBindings.class)
376 .child(ServicesInfo.class, new ServicesInfoKey(interfaceName, ServiceModeIngress.class))
377 .child(BoundServices.class, new BoundServicesKey(serviceInfo.getServicePriority())).build();
378 t.put(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier, serviceInfo, true);
383 public void unbindService(String interfaceName, BoundServices serviceInfo) {
384 LOG.info("Unbinding Service : {}", interfaceName);
385 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
386 InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier = InstanceIdentifier.builder(ServiceBindings.class)
387 .child(ServicesInfo.class, new ServicesInfoKey(interfaceName, ServiceModeIngress.class))
388 .child(BoundServices.class, new BoundServicesKey(serviceInfo.getServicePriority())).build();
389 t.delete(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier);
394 public BigInteger getDpnForInterface(String ifName) {
395 GetDpidFromInterfaceInput input = new GetDpidFromInterfaceInputBuilder().setIntfName(ifName).build();
396 Future<RpcResult<GetDpidFromInterfaceOutput>> output = interfaceManagerRpcService.getDpidFromInterface(input);
398 RpcResult<GetDpidFromInterfaceOutput> dpn = output.get();
399 if (dpn.isSuccessful()) {
400 return dpn.getResult().getDpid();
402 } catch (NullPointerException | InterruptedException | ExecutionException e) {
403 LOG.warn("Exception when getting port for interface", e);
409 public String getEndpointIpForDpn(BigInteger dpnId) {
410 GetEndpointIpForDpnInput input = new GetEndpointIpForDpnInputBuilder().setDpid(dpnId).build();
411 Future<RpcResult<GetEndpointIpForDpnOutput>> output = interfaceManagerRpcService.getEndpointIpForDpn(input);
413 RpcResult<GetEndpointIpForDpnOutput> ipForDpnOutputRpcResult = output.get();
414 if (ipForDpnOutputRpcResult.isSuccessful()) {
415 List<IpAddress> localIps = ipForDpnOutputRpcResult.getResult().getLocalIps();
416 if (!localIps.isEmpty()) {
417 return localIps.get(0).getIpv4Address().getValue();
420 } catch (NullPointerException | InterruptedException | ExecutionException e) {
421 LOG.warn("Exception when getting port for interface", e);
427 public List<ActionInfo> getInterfaceEgressActions(String ifName) {
428 return IfmUtil.getEgressActionInfosForInterface(ifName, 0, dataBroker);
432 public BigInteger getDpnForInterface(Interface intrf) {
433 return getDpnForInterface(intrf.getName());
437 public List<Interface> getVlanInterfaces() {
438 List<Interface> vlanList = new ArrayList<Interface>();
439 InstanceIdentifier<Interfaces> interfacesInstanceIdentifier = InstanceIdentifier.builder(Interfaces.class).build();
440 Optional<Interfaces> interfacesOptional = IfmUtil.read(LogicalDatastoreType.CONFIGURATION, interfacesInstanceIdentifier, dataBroker);
441 if (!interfacesOptional.isPresent()) {
444 Interfaces interfaces = interfacesOptional.get();
445 List<Interface> interfacesList = interfaces.getInterface();
446 for (Interface iface : interfacesList) {
447 if (IfmUtil.getInterfaceType(iface) == InterfaceInfo.InterfaceType.VLAN_INTERFACE) {
455 public List<Interface> getVxlanInterfaces() {
456 return InterfaceManagerCommonUtils.getAllTunnelInterfaces(dataBroker,
457 InterfaceInfo.InterfaceType.VXLAN_TRUNK_INTERFACE);