2 * Copyright (c) 2016 Cisco and/or its affiliates.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package io.fd.honeycomb.lisp.translate.read.trait;
20 import static com.google.common.base.Preconditions.checkNotNull;
21 import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L2;
22 import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L3;
23 import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.SubtableDumpParamsBuilder;
25 import com.google.common.base.Optional;
26 import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
27 import io.fd.honeycomb.translate.ModificationCache;
28 import io.fd.honeycomb.translate.read.ReadFailedException;
29 import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
30 import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
31 import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
32 import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
33 import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
34 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
35 import javax.annotation.Nonnull;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
38 import org.opendaylight.yangtools.yang.binding.ChildOf;
39 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
42 * Provides common logic for reading Eid subtables
44 public interface SubtableReader extends JvppReplyConsumer {
46 SubtableDumpParams L2_PARAMS = new SubtableDumpParamsBuilder().setL2(L2).build();
47 SubtableDumpParams L3_PARAMS = new SubtableDumpParamsBuilder().setL2(L3).build();
49 default EntityDumpExecutor<LispEidTableMapDetailsReplyDump, SubtableDumpParams> createExecutor(
50 @Nonnull final FutureJVppCore vppApi) {
51 return (identifier, params) -> {
52 final LispEidTableMapDump request = new LispEidTableMapDump();
53 request.isL2 = checkNotNull(params, "Cannot bind null params").isL2();
54 return getReplyForRead(vppApi.lispEidTableMapDump(request).toCompletableFuture(), identifier);