2 * Copyright (c) 2015 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 io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L2;
21 import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L3;
22 import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.SubtableDumpParamsBuilder;
24 import com.google.common.base.Optional;
25 import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
26 import io.fd.honeycomb.translate.ModificationCache;
27 import io.fd.honeycomb.translate.read.ReadFailedException;
28 import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
29 import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
30 import javax.annotation.Nonnull;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
32 import org.opendaylight.yangtools.yang.binding.ChildOf;
33 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
36 * Provides common logic for reading Eid subtables
38 public interface SubtableReader {
40 SubtableDumpParams L2_PARAMS = new SubtableDumpParamsBuilder().setL2(L2).build();
41 SubtableDumpParams L3_PARAMS = new SubtableDumpParamsBuilder().setL2(L3).build();
43 default Optional<LispEidTableMapDetailsReplyDump> readSubtable(
44 @Nonnull final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager,
45 @Nonnull final String cacheKey,
46 @Nonnull final ModificationCache cache,
47 @Nonnull final InstanceIdentifier<? extends ChildOf<VniTable>> id,
48 @Nonnull final SubtableDumpParams params) throws ReadFailedException {
49 return dumpManager.getDump(id, cacheKey, cache, params);