Search in sources :

Example 1 with GetDpnEndpointIpsInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsInputBuilder in project netvirt by opendaylight.

the class EvpnUtils method getEndpointIpAddressForDPN.

public String getEndpointIpAddressForDPN(BigInteger dpnId) {
    Future<RpcResult<GetDpnEndpointIpsOutput>> result = itmRpcService.getDpnEndpointIps(new GetDpnEndpointIpsInputBuilder().setSourceDpid(dpnId).build());
    RpcResult<GetDpnEndpointIpsOutput> rpcResult = null;
    try {
        rpcResult = result.get();
    } catch (InterruptedException e) {
        LOG.error("getnextHopIpFromRpcOutput : InterruptedException for dpnid {}", dpnId, e);
        return null;
    } catch (ExecutionException e) {
        LOG.error("getnextHopIpFromRpcOutput : ExecutionException for dpnid {}", dpnId, e);
        return null;
    }
    if (!rpcResult.isSuccessful()) {
        LOG.warn("RPC Call to getDpnEndpointIps returned with Errors {}", rpcResult.getErrors());
        return null;
    }
    List<IpAddress> nexthopIpList = rpcResult.getResult().getNexthopipList();
    return nexthopIpList.get(0).getIpv4Address().getValue();
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) GetDpnEndpointIpsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsInputBuilder) GetDpnEndpointIpsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsOutput) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 GetDpnEndpointIpsInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsInputBuilder)1 GetDpnEndpointIpsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsOutput)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1