HONEYCOMB-154: update revison of models that changed since 16.09
[honeycomb.git] / v3po / v3po2vpp / src / main / java / io / fd / honeycomb / translate / v3po / interfacesstate / ip / dump / AddressDumpExecutor.java
1 package io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump;
2
3
4 import static com.google.common.base.Preconditions.checkNotNull;
5
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;
16
17 public class AddressDumpExecutor
18         implements EntityDumpExecutor<IpAddressDetailsReplyDump, AddressDumpParams>, ByteDataTranslator,
19         JvppReplyConsumer {
20
21     private FutureJVppCore vppApi;
22
23     public AddressDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
24         this.vppApi = checkNotNull(vppApi, "Vpp api refference cannot be null");
25     }
26
27     @Override
28     @Nonnull
29     public IpAddressDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final AddressDumpParams params)
30             throws ReadFailedException {
31         checkNotNull(params, "Address dump params cannot be null");
32
33         IpAddressDump dumpRequest = new IpAddressDump();
34         dumpRequest.isIpv6 = booleanToByte(params.isIpv6());
35         dumpRequest.swIfIndex = params.getInterfaceIndex();
36
37         return getReplyForRead(vppApi.ipAddressDump(dumpRequest).toCompletableFuture(), identifier);
38     }
39 }