MDSAL-API Migration
[genius.git] / itm / itm-impl / src / main / java / org / opendaylight / genius / itm / cache / OvsBridgeRefEntryCache.java
1 /*
2  * Copyright (c) 2018 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.genius.itm.cache;
9
10 import javax.inject.Inject;
11 import javax.inject.Singleton;
12 import org.opendaylight.genius.mdsalutil.cache.DataObjectCache;
13 import org.opendaylight.infrautils.caches.CacheProvider;
14 import org.opendaylight.mdsal.binding.api.DataBroker;
15 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.meta.rev171210.OvsBridgeRefInfo;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.meta.rev171210.ovs.bridge.ref.info.OvsBridgeRefEntry;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.meta.rev171210.ovs.bridge.ref.info.OvsBridgeRefEntryKey;
19 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
20 import org.opendaylight.yangtools.yang.common.Uint64;
21
22 @Singleton
23 public class OvsBridgeRefEntryCache extends DataObjectCache<Uint64, OvsBridgeRefEntry> {
24
25     @Inject
26     public OvsBridgeRefEntryCache(DataBroker dataBroker, CacheProvider cacheProvider) {
27         super(OvsBridgeRefEntry.class, dataBroker, LogicalDatastoreType.OPERATIONAL,
28             InstanceIdentifier.builder(OvsBridgeRefInfo.class).child(OvsBridgeRefEntry.class).build(), cacheProvider,
29             (iid, ovsBridgeRefEntry) -> ovsBridgeRefEntry.key().getDpid(),
30             dpId -> InstanceIdentifier.builder(OvsBridgeRefInfo.class)
31                     .child(OvsBridgeRefEntry.class, new OvsBridgeRefEntryKey(dpId)).build());
32     }
33 }