Bug 2187: Bootstrap EOS shard when no local shards configured
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / entityownership / DistributedEntityOwnershipIntegrationTest.java
1 /*
2  * Copyright (c) 2015 Brocade Communications Systems, Inc. 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.controller.cluster.datastore.entityownership;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13 import static org.mockito.AdditionalMatchers.or;
14 import static org.mockito.Mockito.atMost;
15 import static org.mockito.Mockito.doNothing;
16 import static org.mockito.Mockito.reset;
17 import static org.mockito.Mockito.timeout;
18 import static org.mockito.Mockito.verify;
19 import static org.opendaylight.controller.cluster.datastore.entityownership.AbstractEntityOwnershipTest.ownershipChange;
20 import static org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipService.ENTITY_OWNERSHIP_SHARD_NAME;
21 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.CANDIDATE_NAME_NODE_ID;
22 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
23 import akka.actor.ActorSystem;
24 import akka.actor.Address;
25 import akka.actor.AddressFromURIString;
26 import akka.actor.Status.Failure;
27 import akka.actor.Status.Success;
28 import akka.cluster.Cluster;
29 import akka.testkit.JavaTestKit;
30 import com.google.common.base.Function;
31 import com.google.common.base.Optional;
32 import com.google.common.base.Stopwatch;
33 import com.google.common.util.concurrent.Uninterruptibles;
34 import com.typesafe.config.ConfigFactory;
35 import java.util.ArrayList;
36 import java.util.Arrays;
37 import java.util.Collection;
38 import java.util.concurrent.TimeUnit;
39 import org.junit.After;
40 import org.junit.Before;
41 import org.junit.Test;
42 import org.mockito.ArgumentCaptor;
43 import org.mockito.Mock;
44 import org.mockito.Mockito;
45 import org.mockito.MockitoAnnotations;
46 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
47 import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
48 import org.opendaylight.controller.cluster.datastore.IntegrationTestKit;
49 import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
50 import org.opendaylight.controller.cluster.datastore.messages.AddShardReplica;
51 import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
52 import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException;
53 import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
54 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration;
55 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipChange;
56 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
57 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.clustering.entity.owners.rev150804.entity.owners.entity.type.entity.Candidate;
59 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
60 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
61 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
62 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
63 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
64
65 /**
66  * End-to-end integration tests for the entity ownership functionality.
67  *
68  * @author Thomas Pantelis
69  */
70 public class DistributedEntityOwnershipIntegrationTest {
71     private static final Address MEMBER_1_ADDRESS = AddressFromURIString.parse("akka.tcp://cluster-test@127.0.0.1:2558");
72     private static final String MODULE_SHARDS_CONFIG = "module-shards-default.conf";
73     private static final String MODULE_SHARDS_MEMBER_1_CONFIG = "module-shards-default-member-1.conf";
74     private static final String ENTITY_TYPE1 = "entityType1";
75     private static final String ENTITY_TYPE2 = "entityType2";
76     private static final Entity ENTITY1 = new Entity(ENTITY_TYPE1, "entity1");
77     private static final Entity ENTITY1_2 = new Entity(ENTITY_TYPE2, "entity1");
78     private static final Entity ENTITY2 = new Entity(ENTITY_TYPE1, "entity2");
79     private static final Entity ENTITY3 = new Entity(ENTITY_TYPE1, "entity3");
80     private static final Entity ENTITY4 = new Entity(ENTITY_TYPE1, "entity4");
81     private static final SchemaContext SCHEMA_CONTEXT = SchemaContextHelper.entityOwners();
82
83     private ActorSystem leaderSystem;
84     private ActorSystem follower1System;
85     private ActorSystem follower2System;
86
87     private final DatastoreContext.Builder leaderDatastoreContextBuilder =
88             DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(100).shardElectionTimeoutFactor(5);
89
90     private final DatastoreContext.Builder followerDatastoreContextBuilder =
91             DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(100).shardElectionTimeoutFactor(10000);
92
93     private DistributedDataStore leaderDistributedDataStore;
94     private DistributedDataStore follower1DistributedDataStore;
95     private DistributedDataStore follower2DistributedDataStore;
96     private DistributedEntityOwnershipService leaderEntityOwnershipService;
97     private DistributedEntityOwnershipService follower1EntityOwnershipService;
98     private DistributedEntityOwnershipService follower2EntityOwnershipService;
99     private IntegrationTestKit leaderTestKit;
100     private IntegrationTestKit follower1TestKit;
101     private IntegrationTestKit follower2TestKit;
102
103     @Mock
104     private EntityOwnershipListener leaderMockListener;
105
106     @Mock
107     private EntityOwnershipListener leaderMockListener2;
108
109     @Mock
110     private EntityOwnershipListener follower1MockListener;
111
112     @Mock
113     private EntityOwnershipListener follower2MockListener;
114
115     @Before
116     public void setUp() {
117         MockitoAnnotations.initMocks(this);
118     }
119
120     @After
121     public void tearDown() {
122         if(leaderSystem != null) {
123             JavaTestKit.shutdownActorSystem(leaderSystem);
124         }
125
126         if(follower1System != null) {
127             JavaTestKit.shutdownActorSystem(follower1System);
128         }
129
130         if(follower2System != null) {
131             JavaTestKit.shutdownActorSystem(follower2System);
132         }
133     }
134
135     private void startAllSystems() {
136         startLeaderSystem();
137         startFollower1System();
138         startFollower2System();
139     }
140
141     private void startFollower2System() {
142         follower2System = ActorSystem.create("cluster-test", ConfigFactory.load().getConfig("Member3"));
143         Cluster.get(follower2System).join(MEMBER_1_ADDRESS);
144     }
145
146     private void startFollower1System() {
147         follower1System = ActorSystem.create("cluster-test", ConfigFactory.load().getConfig("Member2"));
148         Cluster.get(follower1System).join(MEMBER_1_ADDRESS);
149     }
150
151     private void startLeaderSystem() {
152         leaderSystem = ActorSystem.create("cluster-test", ConfigFactory.load().getConfig("Member1"));
153         Cluster.get(leaderSystem).join(MEMBER_1_ADDRESS);
154     }
155
156     private void initDatastores(String type) {
157         initLeaderDatastore(type, MODULE_SHARDS_CONFIG);
158
159         initFollower1Datastore(type, MODULE_SHARDS_CONFIG);
160
161         follower2TestKit = new IntegrationTestKit(follower2System, followerDatastoreContextBuilder);
162         follower2DistributedDataStore = follower2TestKit.setupDistributedDataStore(
163                 type, MODULE_SHARDS_CONFIG, false, SCHEMA_CONTEXT);
164
165         leaderDistributedDataStore.waitTillReady();
166         follower1DistributedDataStore.waitTillReady();
167         follower2DistributedDataStore.waitTillReady();
168
169         startLeaderService();
170
171         startFollower1Service();
172
173         follower2EntityOwnershipService = new DistributedEntityOwnershipService(follower2DistributedDataStore,
174                 EntityOwnerSelectionStrategyConfig.newBuilder().build());
175         follower2EntityOwnershipService.start();
176
177         leaderTestKit.waitUntilLeader(leaderDistributedDataStore.getActorContext(), ENTITY_OWNERSHIP_SHARD_NAME);
178     }
179
180     private void startFollower1Service() {
181         follower1EntityOwnershipService = new DistributedEntityOwnershipService(follower1DistributedDataStore,
182                 EntityOwnerSelectionStrategyConfig.newBuilder().build());
183         follower1EntityOwnershipService.start();
184     }
185
186     private void startLeaderService() {
187         leaderEntityOwnershipService = new DistributedEntityOwnershipService(leaderDistributedDataStore,
188                 EntityOwnerSelectionStrategyConfig.newBuilder().build());
189         leaderEntityOwnershipService.start();
190     }
191
192     private void initFollower1Datastore(String type, String moduleConfig) {
193         follower1TestKit = new IntegrationTestKit(follower1System, followerDatastoreContextBuilder);
194         follower1DistributedDataStore = follower1TestKit.setupDistributedDataStore(
195                 type, moduleConfig, false, SCHEMA_CONTEXT);
196     }
197
198     private void initLeaderDatastore(String type, String moduleConfig) {
199         leaderTestKit = new IntegrationTestKit(leaderSystem, leaderDatastoreContextBuilder);
200         leaderDistributedDataStore = leaderTestKit.setupDistributedDataStore(
201                 type, moduleConfig, false, SCHEMA_CONTEXT);
202     }
203
204     @Test
205     public void test() throws Exception {
206         startAllSystems();
207         initDatastores("test");
208
209         leaderEntityOwnershipService.registerListener(ENTITY_TYPE1, leaderMockListener);
210         leaderEntityOwnershipService.registerListener(ENTITY_TYPE2, leaderMockListener2);
211         follower1EntityOwnershipService.registerListener(ENTITY_TYPE1, follower1MockListener);
212
213         // Register leader candidate for entity1 and verify it becomes owner
214
215         leaderEntityOwnershipService.registerCandidate(ENTITY1);
216         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY1, false, true, true));
217         verify(follower1MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY1, false, false, true));
218         reset(leaderMockListener, follower1MockListener);
219
220         verifyGetOwnershipState(leaderEntityOwnershipService, ENTITY1, true, true);
221         verifyGetOwnershipState(follower1EntityOwnershipService, ENTITY1, false, true);
222
223         // Register leader candidate for entity1_2 (same id, different type) and verify it becomes owner
224
225         leaderEntityOwnershipService.registerCandidate(ENTITY1_2);
226         verify(leaderMockListener2, timeout(5000)).ownershipChanged(ownershipChange(ENTITY1_2, false, true, true));
227         verify(leaderMockListener, timeout(300).never()).ownershipChanged(ownershipChange(ENTITY1_2));
228         reset(leaderMockListener2);
229
230         // Register follower1 candidate for entity1 and verify it gets added but doesn't become owner
231
232         follower1EntityOwnershipService.registerCandidate(ENTITY1);
233         verifyCandidates(leaderDistributedDataStore, ENTITY1, "member-1", "member-2");
234         verifyOwner(leaderDistributedDataStore, ENTITY1, "member-1");
235         verify(leaderMockListener, timeout(300).never()).ownershipChanged(ownershipChange(ENTITY1));
236         verify(follower1MockListener, timeout(300).never()).ownershipChanged(ownershipChange(ENTITY1));
237
238         // Register follower1 candidate for entity2 and verify it becomes owner
239
240         follower1EntityOwnershipService.registerCandidate(ENTITY2);
241         verify(follower1MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, false, true, true));
242         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, false, false, true));
243         reset(leaderMockListener, follower1MockListener);
244
245         // Register follower2 candidate for entity2 and verify it gets added but doesn't become owner
246
247         follower2EntityOwnershipService.registerListener(ENTITY_TYPE1, follower2MockListener);
248         follower2EntityOwnershipService.registerCandidate(ENTITY2);
249         verifyCandidates(leaderDistributedDataStore, ENTITY2, "member-2", "member-3");
250         verifyOwner(leaderDistributedDataStore, ENTITY2, "member-2");
251
252         // Unregister follower1 candidate for entity2 and verify follower2 becomes owner
253
254         follower1EntityOwnershipService.unregisterCandidate(ENTITY2);
255         verifyCandidates(leaderDistributedDataStore, ENTITY2, "member-3");
256         verifyOwner(leaderDistributedDataStore, ENTITY2, "member-3");
257         verify(follower1MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, true, false, true));
258         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, false, false, true));
259
260         // Depending on timing, follower2MockListener could get ownershipChanged with "false, false, true" if
261         // if the original ownership change with "member-2 is replicated to follower2 after the listener is
262         // registered.
263         Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
264         verify(follower2MockListener, atMost(1)).ownershipChanged(ownershipChange(ENTITY2, false, false, true));
265         verify(follower2MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, false, true, true));
266
267         // Register follower1 candidate for entity3 and verify it becomes owner
268
269         follower1EntityOwnershipService.registerCandidate(ENTITY3);
270         verifyOwner(leaderDistributedDataStore, ENTITY3, "member-2");
271         verify(follower1MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY3, false, true, true));
272         verify(follower2MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY3, false, false, true));
273         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY3, false, false, true));
274
275         // Register follower2 candidate for entity4 and verify it becomes owner
276
277         follower2EntityOwnershipService.registerCandidate(ENTITY4);
278         verifyOwner(leaderDistributedDataStore, ENTITY4, "member-3");
279         verify(follower2MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY4, false, true, true));
280         verify(follower1MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY4, false, false, true));
281         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY4, false, false, true));
282         reset(follower1MockListener, follower2MockListener);
283
284         // Register follower1 candidate for entity4 and verify it gets added but doesn't become owner
285
286         follower1EntityOwnershipService.registerCandidate(ENTITY4);
287         verifyCandidates(leaderDistributedDataStore, ENTITY4, "member-3", "member-2");
288         verifyOwner(leaderDistributedDataStore, ENTITY4, "member-3");
289
290         // Shutdown follower2 and verify it's owned entities (entity 2 & 4) get re-assigned
291
292         reset(leaderMockListener, follower1MockListener);
293         JavaTestKit.shutdownActorSystem(follower2System);
294
295         verify(follower1MockListener, timeout(15000).times(2)).ownershipChanged(or(ownershipChange(ENTITY4, false, true, true),
296                 ownershipChange(ENTITY2, false, false, false)));
297         verify(leaderMockListener, timeout(15000).times(2)).ownershipChanged(or(ownershipChange(ENTITY4, false, false, true),
298                 ownershipChange(ENTITY2, false, false, false)));
299         verifyOwner(leaderDistributedDataStore, ENTITY2, ""); // no other candidate
300
301         // Register leader candidate for entity2 and verify it becomes owner
302
303         leaderEntityOwnershipService.registerCandidate(ENTITY2);
304         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, false, true, true));
305         verifyOwner(leaderDistributedDataStore, ENTITY2, "member-1");
306
307         // Unregister leader candidate for entity2 and verify the owner is cleared
308
309         leaderEntityOwnershipService.unregisterCandidate(ENTITY2);
310         verifyOwner(leaderDistributedDataStore, ENTITY2, "");
311         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, true, false, false));
312         verify(follower1MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, false, false, false));
313     }
314
315     /**
316      * Reproduces bug <a href="https://bugs.opendaylight.org/show_bug.cgi?id=4554">4554</a>
317      *
318      * @throws CandidateAlreadyRegisteredException
319      */
320     @Test
321     public void testCloseCandidateRegistrationInQuickSuccession() throws CandidateAlreadyRegisteredException {
322         startAllSystems();
323         initDatastores("testCloseCandidateRegistrationInQuickSuccession");
324
325         leaderEntityOwnershipService.registerListener(ENTITY_TYPE1, leaderMockListener);
326         follower1EntityOwnershipService.registerListener(ENTITY_TYPE1, follower1MockListener);
327         follower2EntityOwnershipService.registerListener(ENTITY_TYPE1, follower2MockListener);
328
329         final EntityOwnershipCandidateRegistration candidate1 = leaderEntityOwnershipService.registerCandidate(ENTITY1);
330         final EntityOwnershipCandidateRegistration candidate2 = follower1EntityOwnershipService.registerCandidate(ENTITY1);
331         final EntityOwnershipCandidateRegistration candidate3 = follower2EntityOwnershipService.registerCandidate(ENTITY1);
332
333         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY1, false, true, true));
334
335         Mockito.reset(leaderMockListener);
336
337         candidate1.close();
338         candidate2.close();
339         candidate3.close();
340
341         ArgumentCaptor<EntityOwnershipChange> leaderChangeCaptor = ArgumentCaptor.forClass(EntityOwnershipChange.class);
342         ArgumentCaptor<EntityOwnershipChange> follower1ChangeCaptor = ArgumentCaptor.forClass(EntityOwnershipChange.class);
343         ArgumentCaptor<EntityOwnershipChange> follower2ChangeCaptor = ArgumentCaptor.forClass(EntityOwnershipChange.class);
344         doNothing().when(leaderMockListener).ownershipChanged(leaderChangeCaptor.capture());
345         doNothing().when(follower1MockListener).ownershipChanged(follower1ChangeCaptor.capture());
346         doNothing().when(follower2MockListener).ownershipChanged(follower2ChangeCaptor.capture());
347
348         boolean passed = false;
349         for(int i=0;i<100;i++) {
350             Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
351             if(!leaderEntityOwnershipService.getOwnershipState(ENTITY1).get().hasOwner() &&
352                     !follower1EntityOwnershipService.getOwnershipState(ENTITY1).get().hasOwner() &&
353                     !follower2EntityOwnershipService.getOwnershipState(ENTITY1).get().hasOwner()) {
354                 passed = true;
355                 break;
356             }
357         }
358
359         assertTrue("No ownership change message was sent with hasOwner=false", passed);
360
361         assertFalse(leaderChangeCaptor.getAllValues().get(leaderChangeCaptor.getAllValues().size()-1).hasOwner());
362         assertFalse(follower1ChangeCaptor.getAllValues().get(follower1ChangeCaptor.getAllValues().size()-1).hasOwner());
363         assertFalse(follower2ChangeCaptor.getAllValues().get(follower2ChangeCaptor.getAllValues().size()-1).hasOwner());
364     }
365
366     /**
367      * Tests bootstrapping the entity-ownership shard when there's no shards initially configured for local
368      * member. The entity-ownership shard is initially created as inactive (ie remains a follower), requiring
369      * an AddShardReplica request to join it to an existing leader.
370      */
371     @Test
372     public void testEntityOwnershipShardBootstrapping() throws Throwable {
373         startLeaderSystem();
374         startFollower1System();
375         String type = "testEntityOwnershipShardBootstrapping";
376         initLeaderDatastore(type, MODULE_SHARDS_MEMBER_1_CONFIG);
377         initFollower1Datastore(type, MODULE_SHARDS_MEMBER_1_CONFIG);
378
379         leaderDistributedDataStore.waitTillReady();
380         follower1DistributedDataStore.waitTillReady();
381
382         startLeaderService();
383         startFollower1Service();
384
385         leaderTestKit.waitUntilLeader(leaderDistributedDataStore.getActorContext(), ENTITY_OWNERSHIP_SHARD_NAME);
386
387         leaderEntityOwnershipService.registerListener(ENTITY_TYPE1, leaderMockListener);
388
389         // Register a candidate for follower1 - should get queued since follower1 has no leader
390         follower1EntityOwnershipService.registerCandidate(ENTITY1);
391         verify(leaderMockListener, timeout(300).never()).ownershipChanged(ownershipChange(ENTITY1));
392
393         // Add replica in follower1
394         AddShardReplica addReplica = new AddShardReplica(ENTITY_OWNERSHIP_SHARD_NAME);
395         follower1DistributedDataStore.getActorContext().getShardManager().tell(addReplica , follower1TestKit.getRef());
396         Object reply = follower1TestKit.expectMsgAnyClassOf(JavaTestKit.duration("5 sec"), Success.class, Failure.class);
397         if(reply instanceof Failure) {
398             throw ((Failure)reply).cause();
399         }
400
401         // The queued candidate registration should proceed
402         verify(leaderMockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY1));
403
404     }
405
406     private static void verifyGetOwnershipState(DistributedEntityOwnershipService service, Entity entity,
407             boolean isOwner, boolean hasOwner) {
408         Optional<EntityOwnershipState> state = service.getOwnershipState(entity);
409         assertEquals("getOwnershipState present", true, state.isPresent());
410         assertEquals("isOwner", isOwner, state.get().isOwner());
411         assertEquals("hasOwner", hasOwner, state.get().hasOwner());
412     }
413
414     private static void verifyCandidates(DistributedDataStore dataStore, Entity entity, String... expCandidates) throws Exception {
415         AssertionError lastError = null;
416         Stopwatch sw = Stopwatch.createStarted();
417         while(sw.elapsed(TimeUnit.MILLISECONDS) <= 5000) {
418             Optional<NormalizedNode<?, ?>> possible = dataStore.newReadOnlyTransaction().read(
419                     entityPath(entity.getType(), entity.getId()).node(Candidate.QNAME)).get(5, TimeUnit.SECONDS);
420             try {
421                 assertEquals("Candidates not found for " + entity, true, possible.isPresent());
422                 Collection<String> actual = new ArrayList<>();
423                 for(MapEntryNode candidate: ((MapNode)possible.get()).getValue()) {
424                     actual.add(candidate.getChild(CANDIDATE_NAME_NODE_ID).get().getValue().toString());
425                 }
426
427                 assertEquals("Candidates for " + entity, Arrays.asList(expCandidates), actual);
428                 return;
429             } catch (AssertionError e) {
430                 lastError = e;
431                 Uninterruptibles.sleepUninterruptibly(300, TimeUnit.MILLISECONDS);
432             }
433         }
434
435         throw lastError;
436     }
437
438     private static void verifyOwner(final DistributedDataStore dataStore, Entity entity, String expOwner) {
439         AbstractEntityOwnershipTest.verifyOwner(expOwner, entity.getType(), entity.getId(),
440                 new Function<YangInstanceIdentifier, NormalizedNode<?,?>>() {
441                     @Override
442                     public NormalizedNode<?, ?> apply(YangInstanceIdentifier path) {
443                         try {
444                             return dataStore.newReadOnlyTransaction().read(path).get(5, TimeUnit.SECONDS).get();
445                         } catch (Exception e) {
446                             return null;
447                         }
448                     }
449                 });
450     }
451 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.