Search in sources :

Example 6 with GetInterfaceFromIfIndexOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput 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;
}
Also used : GetInterfaceFromIfIndexInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput) GetInterfaceFromIfIndexInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException) GetInterfaceFromIfIndexOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput)

Example 7 with GetInterfaceFromIfIndexOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput 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;
}
Also used : GetInterfaceFromIfIndexInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput) GetInterfaceFromIfIndexInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException) GetInterfaceFromIfIndexOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput)

Example 8 with GetInterfaceFromIfIndexOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput 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();
}
Also used : GetInterfaceFromIfIndexInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput) GetInterfaceFromIfIndexInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) BigInteger(java.math.BigInteger) GetInterfaceFromIfIndexOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput)

Example 9 with GetInterfaceFromIfIndexOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput 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;
}
Also used : GetInterfaceFromIfIndexInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput) GetInterfaceFromIfIndexInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) BigInteger(java.math.BigInteger) ExecutionException(java.util.concurrent.ExecutionException) GetInterfaceFromIfIndexOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput)

Aggregations

GetInterfaceFromIfIndexOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput)7 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)7 GetInterfaceFromIfIndexInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput)6 GetInterfaceFromIfIndexInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder)6 BigInteger (java.math.BigInteger)4 ExecutionException (java.util.concurrent.ExecutionException)4 GetInterfaceFromIfIndexOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutputBuilder)2 IfIndexInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface)1 IfIndexInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterfaceKey)1 GetDpidFromInterfaceInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceInput)1 GetDpidFromInterfaceInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceInputBuilder)1 GetEgressActionsForInterfaceInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInput)1 GetEgressActionsForInterfaceInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInputBuilder)1 GetEgressInstructionsForInterfaceInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressInstructionsForInterfaceInput)1 GetEgressInstructionsForInterfaceInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressInstructionsForInterfaceInputBuilder)1 GetInterfaceTypeInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceTypeInput)1 GetInterfaceTypeInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceTypeInputBuilder)1 GetNodeconnectorIdFromInterfaceInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceInput)1 GetNodeconnectorIdFromInterfaceInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceInputBuilder)1 GetPortFromInterfaceInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInput)1