use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput in project netvirt by opendaylight.
the class DhcpPktHandler method getInterfaceNameFromTag.
private String getInterfaceNameFromTag(long portTag) {
String interfaceName = null;
GetInterfaceFromIfIndexInput input = new GetInterfaceFromIfIndexInputBuilder().setIfIndex((int) portTag).build();
Future<RpcResult<GetInterfaceFromIfIndexOutput>> futureOutput = interfaceManagerRpc.getInterfaceFromIfIndex(input);
try {
GetInterfaceFromIfIndexOutput output = futureOutput.get().getResult();
interfaceName = output.getInterfaceName();
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error while retrieving the interfaceName from tag using getInterfaceFromIfIndex RPC");
}
LOG.trace("Returning interfaceName {} for tag {} form getInterfaceNameFromTag", interfaceName, portTag);
return interfaceName;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput in project netvirt by opendaylight.
the class IfMgr method getInterfaceNameFromTag.
public String getInterfaceNameFromTag(long portTag) {
String interfaceName = null;
GetInterfaceFromIfIndexInput input = new GetInterfaceFromIfIndexInputBuilder().setIfIndex((int) portTag).build();
Future<RpcResult<GetInterfaceFromIfIndexOutput>> futureOutput = interfaceManagerRpc.getInterfaceFromIfIndex(input);
try {
GetInterfaceFromIfIndexOutput output = futureOutput.get().getResult();
interfaceName = output.getInterfaceName();
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error while retrieving the interfaceName from tag using getInterfaceFromIfIndex RPC");
}
LOG.trace("Returning interfaceName {} for tag {} form getInterfaceNameFromTag", interfaceName, portTag);
return interfaceName;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput in project genius by opendaylight.
the class ArpUtilImpl method getInterfaceName.
private String getInterfaceName(Metadata metadata) throws InterruptedException, ExecutionException {
LOG.debug("metadata received is {} ", metadata);
GetInterfaceFromIfIndexInputBuilder ifIndexInputBuilder = new GetInterfaceFromIfIndexInputBuilder();
BigInteger lportTag = MetaDataUtil.getLportFromMetadata(metadata.getMetadata());
ifIndexInputBuilder.setIfIndex(lportTag.intValue());
GetInterfaceFromIfIndexInput input = ifIndexInputBuilder.build();
Future<RpcResult<GetInterfaceFromIfIndexOutput>> interfaceFromIfIndex = odlInterfaceRpcService.getInterfaceFromIfIndex(input);
GetInterfaceFromIfIndexOutput interfaceFromIfIndexOutput = interfaceFromIfIndex.get().getResult();
return interfaceFromIfIndexOutput.getInterfaceName();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput in project genius by opendaylight.
the class AlivenessProtocolHandlerARP method handlePacketIn.
@Override
public String handlePacketIn(ARP packet, PacketReceived packetReceived) {
short tableId = packetReceived.getTableId().getValue();
int arpType = packet.getOpCode();
if (LOG.isTraceEnabled()) {
LOG.trace("packet: {}, tableId {}, arpType {}", packetReceived, tableId, arpType);
}
if (arpType == ARP.REPLY) {
if (LOG.isTraceEnabled()) {
LOG.trace("packet: {}", packetReceived);
}
BigInteger metadata = packetReceived.getMatch().getMetadata().getMetadata();
int portTag = MetaDataUtil.getLportFromMetadata(metadata).intValue();
String interfaceName = null;
try {
GetInterfaceFromIfIndexInput input = new GetInterfaceFromIfIndexInputBuilder().setIfIndex(portTag).build();
Future<RpcResult<GetInterfaceFromIfIndexOutput>> output = interfaceManager.getInterfaceFromIfIndex(input);
RpcResult<GetInterfaceFromIfIndexOutput> result = output.get();
if (result.isSuccessful()) {
GetInterfaceFromIfIndexOutput ifIndexOutput = result.getResult();
interfaceName = 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 sourceIp = NWUtil.toStringIpAddress(packet.getSenderProtocolAddress());
String targetIp = NWUtil.toStringIpAddress(packet.getTargetProtocolAddress());
return getMonitoringKey(interfaceName, targetIp, sourceIp);
} else {
LOG.debug("No interface associated with tag {} to interpret the received ARP Reply", portTag);
}
}
return null;
}
Aggregations