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);
164 cacheInterfaceStateListener = new CacheInterfaceStateListener(dataBroker);
166 //Initialize nodeconnectorstatsimpl
167 nodeConnectorStatsManager = new NodeConnectorStatsImpl(dataBroker, notificationService,
168 session.getRpcService(OpendaylightPortStatisticsService.class), session.getRpcService(OpendaylightFlowTableStatisticsService.class));
171 interfaceStatusMonitor.reportStatus("OPERATIONAL");
172 } catch (Exception e) {
173 LOG.error("Error initializing services", e);
174 interfaceStatusMonitor.reportStatus("ERROR");
178 private void createIdPool() {
179 CreateIdPoolInput createPool = new CreateIdPoolInputBuilder()
180 .setPoolName(IfmConstants.IFM_IDPOOL_NAME)
181 .setLow(IfmConstants.IFM_ID_POOL_START)
182 .setHigh(IfmConstants.IFM_ID_POOL_END)
184 //TODO: Error handling
185 Future<RpcResult<Void>> result = idManager.createIdPool(createPool);
187 if ((result != null) && (result.get().isSuccessful())) {
188 LOG.debug("Created IdPool for InterfaceMgr");
190 } catch (InterruptedException | ExecutionException e) {
191 LOG.error("Failed to create idPool for InterfaceMgr", e);
196 public void close() throws Exception {
197 LOG.info("InterfacemgrProvider Closed");
198 interfaceConfigListener.close();
199 rpcRegistration.close();
200 cacheInterfaceConfigListener.close();
201 cacheInterfaceStateListener.close();
204 public RpcProviderRegistry getRpcProviderRegistry() {
205 return rpcProviderRegistry;
209 public Long getPortForInterface(String ifName) {
210 GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(ifName).build();
211 Future<RpcResult<GetPortFromInterfaceOutput>> output = interfaceManagerRpcService.getPortFromInterface(input);
213 RpcResult<GetPortFromInterfaceOutput> port = output.get();
214 if (port.isSuccessful()) {
215 return port.getResult().getPortno();
217 } catch (NullPointerException | InterruptedException | ExecutionException e) {
218 LOG.warn("Exception when getting port for interface", e);
224 public Long getPortForInterface(Interface intf) {
225 GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(intf.getName()).build();
226 Future<RpcResult<GetPortFromInterfaceOutput>> output = interfaceManagerRpcService.getPortFromInterface(input);
228 RpcResult<GetPortFromInterfaceOutput> port = output.get();
229 if (port.isSuccessful()) {
230 return port.getResult().getPortno();
232 } catch (NullPointerException | InterruptedException | ExecutionException e) {
233 LOG.warn("Exception when getting port for interface", e);
239 public InterfaceInfo getInterfaceInfo(String interfaceName) {
241 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface
242 ifState = InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(interfaceName, dataBroker);
244 if (ifState == null) {
245 LOG.error("Interface {} is not present", interfaceName);
249 Integer lportTag = ifState.getIfIndex();
250 Interface intf = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName), dataBroker);
252 LOG.error("Interface {} doesn't exist in config datastore", interfaceName);
256 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(intf.getName(), dataBroker);
257 InterfaceInfo.InterfaceType interfaceType = IfmUtil.getInterfaceType(intf);
258 InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
259 BigInteger dpId = org.opendaylight.genius.interfacemanager.globals.IfmConstants.INVALID_DPID;
260 Integer portNo = org.opendaylight.genius.interfacemanager.globals.IfmConstants.INVALID_PORT_NO;
262 dpId = new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId));
263 portNo = Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId));
265 if (interfaceType == InterfaceInfo.InterfaceType.VLAN_INTERFACE) {
266 interfaceInfo = IfmUtil.getVlanInterfaceInfo(interfaceName, intf, dpId);
267 } else if (interfaceType == InterfaceInfo.InterfaceType.VXLAN_TRUNK_INTERFACE ||
268 interfaceType == InterfaceInfo.InterfaceType.GRE_TRUNK_INTERFACE) {
269 // TODO : since there is no logical grouping for tunnel interfaces, there is no need
270 // for this code as of now. will be revisited once the support comes
273 LOG.error("Type of Interface {} is unknown", interfaceName);
276 interfaceInfo.setDpId(dpId);
277 interfaceInfo.setPortNo(portNo);
278 interfaceInfo.setAdminState((intf.isEnabled() == true) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
279 interfaceInfo.setInterfaceName(interfaceName);
280 interfaceInfo.setInterfaceTag(lportTag);
281 interfaceInfo.setInterfaceType(interfaceType);
282 interfaceInfo.setGroupId(IfmUtil.getGroupId(lportTag, interfaceType));
283 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Up) ? InterfaceInfo.InterfaceOpState.UP : InterfaceInfo.InterfaceOpState.DOWN);
286 return interfaceInfo;
291 public InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName, InterfaceInfo.InterfaceType interfaceType) {
292 InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
293 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = InterfaceManagerCommonUtils
294 .getInterfaceStateFromOperDS(interfaceName, dataBroker);
295 if (ifState == null) {
296 LOG.error("Interface {} is not present", interfaceName);
299 Integer lportTag = ifState.getIfIndex();
300 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(ifState);
302 interfaceInfo.setDpId(new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId)));
303 interfaceInfo.setPortNo(Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId)));
305 interfaceInfo.setAdminState((ifState.getAdminStatus() == AdminStatus.Up) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
306 interfaceInfo.setInterfaceName(interfaceName);
307 interfaceInfo.setInterfaceTag(lportTag);
308 interfaceInfo.setInterfaceType(interfaceType);
309 interfaceInfo.setGroupId(IfmUtil.getGroupId(lportTag, interfaceType));
310 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Up) ? InterfaceInfo.InterfaceOpState.UP : InterfaceInfo.InterfaceOpState.DOWN);
313 return interfaceInfo;
317 public InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName) {
318 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = InterfaceManagerCommonUtils
319 .getInterfaceStateFromOperDS(interfaceName, dataBroker);
320 if (ifState == null) {
321 LOG.error("Interface {} is not present", interfaceName);
324 Integer lportTag = ifState.getIfIndex();
325 InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
326 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(ifState);
328 interfaceInfo.setPortName(IfmUtil.getPortName(dataBroker, ncId));
329 interfaceInfo.setDpId(new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId)));
330 interfaceInfo.setPortNo(Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId)));
332 interfaceInfo.setAdminState((ifState.getAdminStatus() == AdminStatus.Up) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
333 interfaceInfo.setInterfaceName(interfaceName);
334 interfaceInfo.setInterfaceTag(lportTag);
335 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Down) ? InterfaceInfo.InterfaceOpState.DOWN :
336 ifState.getOperStatus() == OperStatus.Unknown ? InterfaceInfo.InterfaceOpState.UNKNOWN : InterfaceInfo.InterfaceOpState.UP);
337 return interfaceInfo;
341 public Interface getInterfaceInfoFromConfigDataStore(String interfaceName) {
342 Interface intf = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName), dataBroker);
347 public void createVLANInterface(String interfaceName, String portName, BigInteger dpId, Integer vlanId,
348 String description, IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException {
350 LOG.info("Create VLAN interface : {}", interfaceName);
351 InstanceIdentifier<Interface> interfaceInstanceIdentifier = InterfaceManagerCommonUtils.getInterfaceIdentifier(new InterfaceKey(interfaceName));
352 Interface interfaceOptional = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName), dataBroker);
353 if (interfaceOptional != null) {
354 LOG.debug("VLAN interface is already exist", interfaceOptional.getDescription());
355 throw new InterfaceAlreadyExistsException(interfaceOptional.getName());
357 IfL2vlanBuilder l2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
359 l2vlanBuilder.setVlanId(new VlanId(vlanId));
361 ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(portName).build();
362 Interface inf = new InterfaceBuilder().setEnabled(true).setName(interfaceName).setType(L2vlan.class).
363 addAugmentation(IfL2vlan.class, l2vlanBuilder.build()).addAugmentation(ParentRefs.class, parentRefs).
364 setDescription(description).build();
365 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
366 t.put(LogicalDatastoreType.CONFIGURATION, interfaceInstanceIdentifier, inf, true);
370 public void bindService(String interfaceName, BoundServices serviceInfo) {
371 LOG.info("Binding Service : {}", interfaceName);
372 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
373 InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier = InstanceIdentifier.builder(ServiceBindings.class)
374 .child(ServicesInfo.class, new ServicesInfoKey(interfaceName, ServiceModeIngress.class))
375 .child(BoundServices.class, new BoundServicesKey(serviceInfo.getServicePriority())).build();
376 t.put(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier, serviceInfo, true);
381 public void unbindService(String interfaceName, BoundServices serviceInfo) {
382 LOG.info("Unbinding Service : {}", interfaceName);
383 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
384 InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier = InstanceIdentifier.builder(ServiceBindings.class)
385 .child(ServicesInfo.class, new ServicesInfoKey(interfaceName, ServiceModeIngress.class))
386 .child(BoundServices.class, new BoundServicesKey(serviceInfo.getServicePriority())).build();
387 t.delete(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier);
392 public BigInteger getDpnForInterface(String ifName) {
393 GetDpidFromInterfaceInput input = new GetDpidFromInterfaceInputBuilder().setIntfName(ifName).build();
394 Future<RpcResult<GetDpidFromInterfaceOutput>> output = interfaceManagerRpcService.getDpidFromInterface(input);
396 RpcResult<GetDpidFromInterfaceOutput> dpn = output.get();
397 if (dpn.isSuccessful()) {
398 return dpn.getResult().getDpid();
400 } catch (NullPointerException | InterruptedException | ExecutionException e) {
401 LOG.warn("Exception when getting port for interface", e);
407 public String getEndpointIpForDpn(BigInteger dpnId) {
408 GetEndpointIpForDpnInput input = new GetEndpointIpForDpnInputBuilder().setDpid(dpnId).build();
409 Future<RpcResult<GetEndpointIpForDpnOutput>> output = interfaceManagerRpcService.getEndpointIpForDpn(input);
411 RpcResult<GetEndpointIpForDpnOutput> ipForDpnOutputRpcResult = output.get();
412 if (ipForDpnOutputRpcResult.isSuccessful()) {
413 List<IpAddress> localIps = ipForDpnOutputRpcResult.getResult().getLocalIps();
414 if (!localIps.isEmpty()) {
415 return localIps.get(0).getIpv4Address().getValue();
418 } catch (NullPointerException | InterruptedException | ExecutionException e) {
419 LOG.warn("Exception when getting port for interface", e);
425 public List<ActionInfo> getInterfaceEgressActions(String ifName) {
426 return IfmUtil.getEgressActionInfosForInterface(ifName, 0, dataBroker);
430 public BigInteger getDpnForInterface(Interface intrf) {
431 return getDpnForInterface(intrf.getName());
435 public List<Interface> getVlanInterfaces() {
436 List<Interface> vlanList = new ArrayList<Interface>();
437 InstanceIdentifier<Interfaces> interfacesInstanceIdentifier = InstanceIdentifier.builder(Interfaces.class).build();
438 Optional<Interfaces> interfacesOptional = IfmUtil.read(LogicalDatastoreType.CONFIGURATION, interfacesInstanceIdentifier, dataBroker);
439 if (!interfacesOptional.isPresent()) {
442 Interfaces interfaces = interfacesOptional.get();
443 List<Interface> interfacesList = interfaces.getInterface();
444 for (Interface iface : interfacesList) {
445 if (IfmUtil.getInterfaceType(iface) == InterfaceInfo.InterfaceType.VLAN_INTERFACE) {
453 public List<Interface> getVxlanInterfaces() {
454 return InterfaceManagerCommonUtils.getAllTunnelInterfaces(dataBroker,
455 InterfaceInfo.InterfaceType.VXLAN_TRUNK_INTERFACE);