1 package io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump;
4 import static com.google.common.base.Preconditions.checkNotNull;
6 import io.fd.honeycomb.translate.read.ReadFailedException;
7 import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
8 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.params.AddressDumpParams;
9 import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
10 import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
11 import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
12 import io.fd.vpp.jvpp.core.dto.IpAddressDump;
13 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 public class AddressDumpExecutor
18 implements EntityDumpExecutor<IpAddressDetailsReplyDump, AddressDumpParams>, ByteDataTranslator,
21 private FutureJVppCore vppApi;
23 public AddressDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
24 this.vppApi = checkNotNull(vppApi, "Vpp api refference cannot be null");
29 public IpAddressDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final AddressDumpParams params)
30 throws ReadFailedException {
31 checkNotNull(params, "Address dump params cannot be null");
33 IpAddressDump dumpRequest = new IpAddressDump();
34 dumpRequest.isIpv6 = booleanToByte(params.isIpv6());
35 dumpRequest.swIfIndex = params.getInterfaceIndex();
37 return getReplyForRead(vppApi.ipAddressDump(dumpRequest).toCompletableFuture(), identifier);