X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=alivenessmonitor%2Falivenessmonitor-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fvpnservice%2Falivenessmonitor%2Finternal%2FAlivenessProtocolHandlerLLDP.java;h=9ff6a5a18f9bcfd4402283981a784e3865326727;hb=4761b3905af795fd2f6c801f5122d3d82c3323e0;hp=d0d7511bb29e3f42be5f2d4cf127e64a3811fc7e;hpb=07f6cb98a8259e1d69a8fdbb9634f6ecb15362e3;p=vpnservice.git diff --git a/alivenessmonitor/alivenessmonitor-impl/src/main/java/org/opendaylight/vpnservice/alivenessmonitor/internal/AlivenessProtocolHandlerLLDP.java b/alivenessmonitor/alivenessmonitor-impl/src/main/java/org/opendaylight/vpnservice/alivenessmonitor/internal/AlivenessProtocolHandlerLLDP.java index d0d7511b..9ff6a5a1 100644 --- a/alivenessmonitor/alivenessmonitor-impl/src/main/java/org/opendaylight/vpnservice/alivenessmonitor/internal/AlivenessProtocolHandlerLLDP.java +++ b/alivenessmonitor/alivenessmonitor-impl/src/main/java/org/opendaylight/vpnservice/alivenessmonitor/internal/AlivenessProtocolHandlerLLDP.java @@ -116,35 +116,11 @@ public class AlivenessProtocolHandlerLLDP extends AbstractAlivenessProtocolHandl LOG.debug("Custom LLDP Value on received packet: " + sTmp); } - BigInteger metadata = packetReceived.getMatch().getMetadata().getMetadata(); - int portTag = MetaDataUtil.getLportFromMetadata(metadata).intValue(); - if(portTag == 0) { - LOG.trace("Ignoring Packet-in for interface tag 0"); - return null; - } - - String destInterfaceName = null; - - try { - GetInterfaceFromIfIndexInput input = new GetInterfaceFromIfIndexInputBuilder().setIfIndex(portTag).build(); - Future> output = serviceProvider.getInterfaceManager().getInterfaceFromIfIndex(input); - RpcResult result = output.get(); - if(result.isSuccessful()) { - GetInterfaceFromIfIndexOutput ifIndexOutput = result.getResult(); - destInterfaceName = ifIndexOutput.getInterfaceName(); - } else { - LOG.warn("RPC call to get interface name for if index {} failed with errors {}", portTag, result.getErrors()); - return null; - } - } catch(InterruptedException | ExecutionException e) { - LOG.warn("Error retrieving interface Name for tag {}", portTag, e); - } - if(!Strings.isNullOrEmpty(interfaceName)) { String monitorKey = new StringBuilder().append(interfaceName).append(EtherTypes.LLDP).toString(); return monitorKey; } else { - LOG.debug("No interface associated with tag {} to handle received LLDP Packet", portTag); + LOG.debug("No associated interface found to handle received LLDP Packet"); } return null; } @@ -174,26 +150,15 @@ public class AlivenessProtocolHandlerLLDP extends AbstractAlivenessProtocolHandl long nodeId = -1, portNum = -1; try { - GetDpidFromInterfaceInput dpIdInput = new GetDpidFromInterfaceInputBuilder().setIntfName(sourceInterface).build(); - Future> dpIdOutput = interfaceService.getDpidFromInterface(dpIdInput); - RpcResult dpIdResult = dpIdOutput.get(); - if(dpIdResult.isSuccessful()) { - GetDpidFromInterfaceOutput output = dpIdResult.getResult(); - nodeId = output.getDpid().longValue(); - } else { - LOG.error("Could not retrieve DPN Id for interface {}", sourceInterface); - return; - } - - GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(sourceInterface).build(); Future> portOutput = interfaceService.getPortFromInterface(input); RpcResult result = portOutput.get(); if(result.isSuccessful()) { GetPortFromInterfaceOutput output = result.getResult(); + nodeId = output.getDpid().longValue(); portNum = output.getPortno(); } else { - LOG.error("Could not retrieve port number for interface {}", sourceInterface); + LOG.error("Could not retrieve port details for interface {}", sourceInterface); return; } }catch(InterruptedException | ExecutionException e) { @@ -204,7 +169,7 @@ public class AlivenessProtocolHandlerLLDP extends AbstractAlivenessProtocolHandl Ethernet ethenetLLDPPacket = makeLLDPPacket(Long.toString(nodeId), portNum, 0, sourceMac, sourceInterface); try { - List actions = getInterfaceActions(sourceInterface); + List actions = getInterfaceActions(sourceInterface, portNum); if(actions.isEmpty()) { LOG.error("No interface actions to send packet out over interface {}", sourceInterface); return; @@ -217,23 +182,8 @@ public class AlivenessProtocolHandlerLLDP extends AbstractAlivenessProtocolHandl } } - private List getInterfaceActions(String interfaceName) throws InterruptedException, ExecutionException { - - OdlInterfaceRpcService interfaceService = serviceProvider.getInterfaceManager(); - - long portNum = -1; - GetPortFromInterfaceInput input = new GetPortFromInterfaceInputBuilder().setIntfName(interfaceName).build(); - Future> portOutput = interfaceService.getPortFromInterface(input); - RpcResult result = portOutput.get(); - if(result.isSuccessful()) { - GetPortFromInterfaceOutput output = result.getResult(); - portNum = output.getPortno(); - } else { - LOG.error("Could not retrieve port number for interface {} to construct actions", interfaceName); - return Collections.emptyList(); - } - - Class intfType = null; + private List getInterfaceActions(String interfaceName, long portNum) throws InterruptedException, ExecutionException { + Class intfType; org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface interfaceInfo = getInterfaceFromConfigDS(interfaceName); if(interfaceInfo != null) { @@ -247,8 +197,7 @@ public class AlivenessProtocolHandlerLLDP extends AbstractAlivenessProtocolHandl if(Tunnel.class.equals(intfType)) { actionInfos.add(new ActionInfo(ActionType.set_field_tunnel_id, new BigInteger[] { - MetaDataUtil.getTunnelIdWithValidVniBitAndVniSet(0x08000000), - MetaDataUtil.METADA_MASK_VALID_TUNNEL_ID_BIT_AND_TUNNEL_ID})); + BigInteger.valueOf(0x08000000)})); } actionInfos.add(new ActionInfo(ActionType.output, new String[] { Long.toString(portNum) })); return actionInfos;