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.rev100924.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.inventory.rev130819.NodeConnectorId;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.*;
59 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
60 import org.opendaylight.yangtools.yang.common.RpcResult;
61 import org.slf4j.Logger;
62 import org.slf4j.LoggerFactory;
64 import java.math.BigInteger;
65 import java.util.ArrayList;
66 import java.util.List;
67 import java.util.concurrent.ExecutionException;
68 import java.util.concurrent.Future;
71 public class InterfacemgrProvider implements BindingAwareProvider, AutoCloseable, IInterfaceManager {
73 private static final Logger LOG = LoggerFactory.getLogger(InterfacemgrProvider.class);
74 private static final InterfaceStatusMonitor interfaceStatusMonitor = InterfaceStatusMonitor.getInstance();
76 private RpcProviderRegistry rpcProviderRegistry;
77 private IdManagerService idManager;
78 private NotificationService notificationService;
79 private AlivenessMonitorService alivenessManager;
80 private IMdsalApiManager mdsalManager;
81 private InterfaceConfigListener interfaceConfigListener;
82 private InterfaceTopologyStateListener topologyStateListener;
83 private TerminationPointStateListener terminationPointStateListener;
84 private HwVTEPTunnelsStateListener hwVTEPTunnelsStateListener;
85 private InterfaceInventoryStateListener interfaceInventoryStateListener;
86 private FlowBasedServicesInterfaceStateListener flowBasedServicesInterfaceStateListener;
87 private FlowBasedServicesConfigListener flowBasedServicesConfigListener;
88 private VlanMemberConfigListener vlanMemberConfigListener;
89 private HwVTEPConfigListener hwVTEPConfigListener;
90 private AlivenessMonitorListener alivenessMonitorListener;
91 private DataBroker dataBroker;
92 private InterfaceManagerRpcService interfaceManagerRpcService;
93 private BindingAwareBroker.RpcRegistration<OdlInterfaceRpcService> rpcRegistration;
94 private NodeConnectorStatsImpl nodeConnectorStatsManager;
96 public void setRpcProviderRegistry(RpcProviderRegistry rpcProviderRegistry) {
97 this.rpcProviderRegistry = rpcProviderRegistry;
98 interfaceStatusMonitor.registerMbean();
101 public void setMdsalManager(IMdsalApiManager mdsalManager) {
102 this.mdsalManager = mdsalManager;
105 public void setNotificationService(NotificationService notificationService) {
106 this.notificationService = notificationService;
110 public void onSessionInitiated(ProviderContext session) {
111 LOG.info("InterfacemgrProvider Session Initiated");
112 interfaceStatusMonitor.reportStatus("STARTING");
114 dataBroker = session.getSALService(DataBroker.class);
115 idManager = rpcProviderRegistry.getRpcService(IdManagerService.class);
118 alivenessManager = rpcProviderRegistry.getRpcService(AlivenessMonitorService.class);
119 interfaceManagerRpcService = new InterfaceManagerRpcService(dataBroker, mdsalManager);
120 rpcRegistration = getRpcProviderRegistry().addRpcImplementation(
121 OdlInterfaceRpcService.class, interfaceManagerRpcService);
123 interfaceConfigListener = new InterfaceConfigListener(dataBroker, idManager,alivenessManager, mdsalManager);
124 interfaceConfigListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
126 interfaceInventoryStateListener = new InterfaceInventoryStateListener(dataBroker, idManager, mdsalManager, alivenessManager);
127 interfaceInventoryStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
129 topologyStateListener = new InterfaceTopologyStateListener(dataBroker);
130 topologyStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
132 hwVTEPTunnelsStateListener = new HwVTEPTunnelsStateListener(dataBroker);
133 hwVTEPTunnelsStateListener.registerListener(LogicalDatastoreType.OPERATIONAL,dataBroker);
135 terminationPointStateListener = new TerminationPointStateListener(dataBroker);
136 terminationPointStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
138 flowBasedServicesConfigListener = new FlowBasedServicesConfigListener(dataBroker);
139 flowBasedServicesConfigListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
141 flowBasedServicesInterfaceStateListener =
142 new FlowBasedServicesInterfaceStateListener(dataBroker);
143 flowBasedServicesInterfaceStateListener.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
145 vlanMemberConfigListener =
146 new VlanMemberConfigListener(dataBroker, idManager, alivenessManager,mdsalManager);
147 vlanMemberConfigListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
149 hwVTEPConfigListener = new HwVTEPConfigListener(dataBroker);
150 hwVTEPConfigListener.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
152 alivenessMonitorListener = new org.opendaylight.genius.interfacemanager.listeners.AlivenessMonitorListener(dataBroker);
153 notificationService.registerNotificationListener(alivenessMonitorListener);
155 //Initialize nodeconnectorstatsimpl
156 nodeConnectorStatsManager = new NodeConnectorStatsImpl(dataBroker, notificationService,
157 session.getRpcService(OpendaylightPortStatisticsService.class), session.getRpcService(OpendaylightFlowTableStatisticsService.class));
160 interfaceStatusMonitor.reportStatus("OPERATIONAL");
161 } catch (Exception e) {
162 LOG.error("Error initializing services", e);
163 interfaceStatusMonitor.reportStatus("ERROR");
167 private void createIdPool() {
168 CreateIdPoolInput createPool = new CreateIdPoolInputBuilder()
169 .setPoolName(IfmConstants.IFM_IDPOOL_NAME)
170 .setLow(IfmConstants.IFM_ID_POOL_START)
171 .setHigh(IfmConstants.IFM_ID_POOL_END)
173 //TODO: Error handling
174 Future<RpcResult<Void>> result = idManager.createIdPool(createPool);
176 if ((result != null) && (result.get().isSuccessful())) {
177 LOG.debug("Created IdPool for InterfaceMgr");
179 } catch (InterruptedException | ExecutionException e) {
180 LOG.error("Failed to create idPool for InterfaceMgr",e);
185 public void close() throws Exception {
186 LOG.info("InterfacemgrProvider Closed");
187 interfaceConfigListener.close();
188 rpcRegistration.close();
191 public RpcProviderRegistry getRpcProviderRegistry() {
192 return rpcProviderRegistry;
196 public Long getPortForInterface(String ifName) {
197 GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(ifName).build();
198 Future<RpcResult<GetPortFromInterfaceOutput>> output = interfaceManagerRpcService.getPortFromInterface(input);
200 RpcResult<GetPortFromInterfaceOutput> port = output.get();
201 if(port.isSuccessful()){
202 return port.getResult().getPortno();
204 }catch(NullPointerException | InterruptedException | ExecutionException e){
205 LOG.warn("Exception when getting port for interface",e);
211 public Long getPortForInterface(Interface intf) {
212 GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(intf.getName()).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 InterfaceInfo getInterfaceInfo(String interfaceName) {
227 //FIXME [ELANBE] This is not working yet, fix this
229 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface
230 ifState = InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(interfaceName,dataBroker);
232 if(ifState == null) {
233 LOG.error("Interface {} is not present", interfaceName);
237 Integer lportTag = ifState.getIfIndex();
238 Interface intf = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName), dataBroker);
240 LOG.error("Interface {} doesn't exist in config datastore", interfaceName);
244 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(intf, dataBroker);
245 InterfaceInfo.InterfaceType interfaceType = IfmUtil.getInterfaceType(intf);
246 InterfaceInfo interfaceInfo = null;
247 BigInteger dpId = org.opendaylight.genius.interfacemanager.globals.IfmConstants.INVALID_DPID;
248 Integer portNo = org.opendaylight.genius.interfacemanager.globals.IfmConstants.INVALID_PORT_NO;
250 dpId = new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId));
251 portNo = Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId));
254 if(interfaceType == InterfaceInfo.InterfaceType.VLAN_INTERFACE){
255 interfaceInfo = IfmUtil.getVlanInterfaceInfo(interfaceName, intf, dpId);
256 } else if (interfaceType == InterfaceInfo.InterfaceType.VXLAN_TRUNK_INTERFACE || interfaceType == InterfaceInfo.InterfaceType.GRE_TRUNK_INTERFACE) {/*
257 trunkInterfaceInfo trunkInterfaceInfo = (TrunkInterfaceInfo) ConfigIfmUtil.getTrunkInterfaceInfo(ifName, ConfigIfmUtil.getInterfaceByIfName(dataBroker, ifName));
258 String higherLayerIf = inf.getHigherLayerIf().get(0);
259 Interface vlanInterface = ConfigIfmUtil.getInterfaceByIfName(dataBroker, higherLayerIf);
260 trunkInterfaceInfo.setPortName(vlanInterface.getAugmentation(BaseConfig.class).getParentInterface());
261 trunkInterfaceManager.updateTargetMacAddressInInterfaceInfo(trunkInterfaceInfo, trunkInterface);
262 if (trunkInterface.getPhysAddress() != null) {
263 trunkInterfaceInfo.setLocalMacAddress(trunkInterface.getPhysAddress().getValue());
265 interfaceInfo = trunkInterfaceInfo;
266 interfaceInfo.setL2domainGroupId(IfmUtil.getGroupId(OperationalIfmUtil.getInterfaceStateByIfName(dataBroker, higherLayerIf).getIfIndex(), InterfaceType.VLAN_INTERFACE));
268 LOG.error("Type of Interface {} is unknown", interfaceName);
271 interfaceInfo.setDpId(dpId);
272 interfaceInfo.setPortNo(portNo);
273 interfaceInfo.setAdminState((intf.isEnabled() == true) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
274 interfaceInfo.setInterfaceName(interfaceName);
275 interfaceInfo.setInterfaceTag(lportTag);
276 interfaceInfo.setInterfaceType(interfaceType);
277 interfaceInfo.setGroupId(IfmUtil.getGroupId(lportTag, interfaceType));
278 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Up) ? InterfaceInfo.InterfaceOpState.UP : InterfaceInfo.InterfaceOpState.DOWN);
281 return interfaceInfo;
286 public InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName, InterfaceInfo.InterfaceType interfaceType) {
287 InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
288 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = InterfaceManagerCommonUtils
289 .getInterfaceStateFromOperDS(interfaceName, dataBroker);
290 if (ifState == null) {
291 LOG.error("Interface {} is not present", interfaceName);
294 Integer lportTag = ifState.getIfIndex();
295 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(ifState);
297 interfaceInfo.setDpId(new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId)));
298 interfaceInfo.setPortNo(Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId)));
300 interfaceInfo.setAdminState((ifState.getAdminStatus() == AdminStatus.Up) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
301 interfaceInfo.setInterfaceName(interfaceName);
302 interfaceInfo.setInterfaceTag(lportTag);
303 interfaceInfo.setInterfaceType(interfaceType);
304 interfaceInfo.setGroupId(IfmUtil.getGroupId(lportTag, interfaceType));
305 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Up) ? InterfaceInfo.InterfaceOpState.UP : InterfaceInfo.InterfaceOpState.DOWN);
308 return interfaceInfo;
312 public InterfaceInfo getInterfaceInfoFromOperationalDataStore(String interfaceName) {
313 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = InterfaceManagerCommonUtils
314 .getInterfaceStateFromOperDS(interfaceName, dataBroker);
315 if (ifState == null) {
316 LOG.error("Interface {} is not present", interfaceName);
319 Integer lportTag = ifState.getIfIndex();
320 InterfaceInfo interfaceInfo = new InterfaceInfo(interfaceName);
321 NodeConnectorId ncId = IfmUtil.getNodeConnectorIdFromInterface(ifState);
323 interfaceInfo.setPortName(IfmUtil.getPortName(dataBroker, ncId));
324 interfaceInfo.setDpId(new BigInteger(IfmUtil.getDpnFromNodeConnectorId(ncId)));
325 interfaceInfo.setPortNo(Integer.parseInt(IfmUtil.getPortNoFromNodeConnectorId(ncId)));
327 interfaceInfo.setAdminState((ifState.getAdminStatus() == AdminStatus.Up) ? InterfaceAdminState.ENABLED : InterfaceAdminState.DISABLED);
328 interfaceInfo.setInterfaceName(interfaceName);
329 interfaceInfo.setInterfaceTag(lportTag);
330 interfaceInfo.setOpState((ifState.getOperStatus() == OperStatus.Up) ? InterfaceInfo.InterfaceOpState.UP : InterfaceInfo.InterfaceOpState.DOWN);
331 return interfaceInfo;
334 public void createVLANInterface(String interfaceName, String portName, BigInteger dpId, Integer vlanId,
335 String description, IfL2vlan.L2vlanMode l2vlanMode) throws InterfaceAlreadyExistsException {
337 LOG.info("Create VLAN interface : {}",interfaceName);
338 InstanceIdentifier<Interface> interfaceInstanceIdentifier = InterfaceManagerCommonUtils.getInterfaceIdentifier(new InterfaceKey(interfaceName));
339 Interface interfaceOptional = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(new InterfaceKey(interfaceName), dataBroker);
340 if (interfaceOptional != null) {
341 LOG.debug("VLAN interface is already exist",interfaceOptional.getDescription());
342 throw new InterfaceAlreadyExistsException(interfaceOptional.getName());
344 IfL2vlanBuilder l2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
346 l2vlanBuilder.setVlanId(new VlanId(vlanId));
348 ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(portName).build();
349 Interface inf = new InterfaceBuilder().setEnabled(true).setName(interfaceName).setType(L2vlan.class).
350 addAugmentation(IfL2vlan.class, l2vlanBuilder.build()).addAugmentation(ParentRefs.class, parentRefs).
351 setDescription(description).build();
352 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
353 t.put(LogicalDatastoreType.CONFIGURATION, interfaceInstanceIdentifier, inf, true);
356 public void bindService(String interfaceName, BoundServices serviceInfo){
357 LOG.info("Binding Service : {}",interfaceName);
358 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
359 InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier = InstanceIdentifier.builder(ServiceBindings.class).child(ServicesInfo.class, new ServicesInfoKey(interfaceName))
360 .child(BoundServices.class, new BoundServicesKey(serviceInfo.getServicePriority())).build();
361 // List<BoundServices> services = (List<BoundServices>)serviceInfo.getBoundServices();
362 t.put(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier, serviceInfo, true);
366 public void unbindService(String interfaceName, BoundServices serviceInfo){
367 LOG.info("Unbinding Service : {}",interfaceName);
368 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
369 InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier = InstanceIdentifier.builder(ServiceBindings.class).child(ServicesInfo.class, new ServicesInfoKey(interfaceName))
370 .child(BoundServices.class, new BoundServicesKey(serviceInfo.getServicePriority())).build();
371 t.delete(LogicalDatastoreType.CONFIGURATION, boundServicesInstanceIdentifier);
376 public BigInteger getDpnForInterface(String ifName) {
377 GetDpidFromInterfaceInput input = new GetDpidFromInterfaceInputBuilder().setIntfName(ifName).build();
378 Future<RpcResult<GetDpidFromInterfaceOutput>> output = interfaceManagerRpcService.getDpidFromInterface(input);
380 RpcResult<GetDpidFromInterfaceOutput> dpn = output.get();
381 if(dpn.isSuccessful()){
382 return dpn.getResult().getDpid();
384 }catch(NullPointerException | InterruptedException | ExecutionException e){
385 LOG.warn("Exception when getting port for interface",e);
391 public String getEndpointIpForDpn(BigInteger dpnId) {
392 GetEndpointIpForDpnInput input = new GetEndpointIpForDpnInputBuilder().setDpid(dpnId).build();
393 Future<RpcResult<GetEndpointIpForDpnOutput>> output = interfaceManagerRpcService.getEndpointIpForDpn(input);
395 RpcResult<GetEndpointIpForDpnOutput> ipForDpnOutputRpcResult = output.get();
396 if(ipForDpnOutputRpcResult.isSuccessful()){
397 List<IpAddress> localIps = ipForDpnOutputRpcResult.getResult().getLocalIps();
398 if(!localIps.isEmpty()) {
399 return localIps.get(0).getIpv4Address().getValue();
402 }catch(NullPointerException | InterruptedException | ExecutionException e){
403 LOG.warn("Exception when getting port for interface",e);
409 public List<ActionInfo> getInterfaceEgressActions(String ifName) {
410 return IfmUtil.getEgressActionInfosForInterface(ifName, 0, dataBroker);
414 public BigInteger getDpnForInterface(Interface intrf) {
415 return getDpnForInterface(intrf.getName());
419 public List<Interface> getVlanInterfaces() {
420 List<Interface> vlanList = new ArrayList<Interface>();
421 InstanceIdentifier<Interfaces> interfacesInstanceIdentifier = InstanceIdentifier.builder(Interfaces.class).build();
422 Optional<Interfaces> interfacesOptional = IfmUtil.read(LogicalDatastoreType.CONFIGURATION, interfacesInstanceIdentifier, dataBroker);
423 if (!interfacesOptional.isPresent()) {
426 Interfaces interfaces = interfacesOptional.get();
427 List<Interface> interfacesList = interfaces.getInterface();
428 for (Interface iface : interfacesList) {
429 if (IfmUtil.getInterfaceType(iface) == InterfaceInfo.InterfaceType.VLAN_INTERFACE) {
437 public List<Interface> getVxlanInterfaces() {
438 return InterfaceManagerCommonUtils.getAllTunnelInterfaces(dataBroker,
439 InterfaceInfo.InterfaceType.VXLAN_TRUNK_INTERFACE);