391fa766859f8bf7180439efa24fbee66d748d17
[hc2vpp.git] /
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package io.fd.honeycomb.lisp.translate.read.dump.executor;
18
19 import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
20 import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
21 import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
22 import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException;
23 import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
24 import java.util.concurrent.TimeoutException;
25 import javax.annotation.Nonnull;
26 import io.fd.vpp.jvpp.VppBaseCallException;
27 import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs;
28 import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
29 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
30
31 public class ItrRemoteLocatorSetDumpExecutor extends AbstractJvppDumpExecutor
32         implements EntityDumpExecutor<LispGetMapRequestItrRlocsReply, Void>, JvppReplyConsumer {
33
34     public ItrRemoteLocatorSetDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
35         super(vppApi);
36     }
37
38     @Override
39     public LispGetMapRequestItrRlocsReply executeDump(final Void params) throws DumpExecutionFailedException {
40         try {
41             return getReply(vppApi.lispGetMapRequestItrRlocs(new LispGetMapRequestItrRlocs()).toCompletableFuture());
42         } catch (TimeoutException e) {
43             throw DumpTimeoutException.wrapTimeoutException("Dumping of Itr Remote Locator Sets ended in timeout", e);
44         } catch (VppBaseCallException e) {
45             throw DumpCallFailedException.wrapFailedCallException("Dumping of Itr Remote Locator Sets failed", e);
46         }
47     }
48 }