use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsInput in project genius by opendaylight.
the class ItmManagerRpcService method getDpnEndpointIps.
@Override
public Future<RpcResult<GetDpnEndpointIpsOutput>> getDpnEndpointIps(GetDpnEndpointIpsInput input) {
BigInteger srcDpn = input.getSourceDpid();
RpcResultBuilder<GetDpnEndpointIpsOutput> resultBld = RpcResultBuilder.failed();
InstanceIdentifier<DPNTEPsInfo> tunnelInfoId = InstanceIdentifier.builder(DpnEndpoints.class).child(DPNTEPsInfo.class, new DPNTEPsInfoKey(srcDpn)).build();
Optional<DPNTEPsInfo> tunnelInfo = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, tunnelInfoId, dataBroker);
if (!tunnelInfo.isPresent()) {
LOG.error("tunnelInfo is not present");
return Futures.immediateFuture(resultBld.build());
}
List<TunnelEndPoints> tunnelEndPointList = tunnelInfo.get().getTunnelEndPoints();
if (tunnelEndPointList == null || tunnelEndPointList.isEmpty()) {
LOG.error("tunnelEndPointList is null or empty");
return Futures.immediateFuture(resultBld.build());
}
List<IpAddress> nexthopIpList = new ArrayList<>();
tunnelEndPointList.forEach(tunnelEndPoint -> nexthopIpList.add(tunnelEndPoint.getIpAddress()));
GetDpnEndpointIpsOutputBuilder output = new GetDpnEndpointIpsOutputBuilder().setNexthopipList(nexthopIpList);
resultBld = RpcResultBuilder.success();
resultBld.withResult(output.build());
return Futures.immediateFuture(resultBld.build());
}
Aggregations