2 * Copyright (c) 2014, 2016 Cisco Systems, Inc. and others. All rights reserved.
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
10 import org.junit.Test;
11 import org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManager;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import test.mock.util.StatisticsManagerTest;
18 import java.util.concurrent.ExecutionException;
20 import static org.junit.Assert.assertFalse;
21 import static org.junit.Assert.assertTrue;
23 public class NodeRegistrationTest extends StatisticsManagerTest {
26 public void nodeRegistrationTest() throws ExecutionException, InterruptedException {
27 StatisticsManager statisticsManager = setupStatisticsManager();
29 addFlowCapableNode(s1Key);
31 final InstanceIdentifier<Node> nodeII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key);
33 assertTrue(statisticsManager.isProvidedFlowNodeActive(nodeII));
37 public void nodeUnregistrationTest() throws ExecutionException, InterruptedException {
38 StatisticsManager statisticsManager = setupStatisticsManager();
40 addFlowCapableNode(s1Key);
42 final InstanceIdentifier<Node> nodeII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key);
44 assertTrue(statisticsManager.isProvidedFlowNodeActive(nodeII));
48 assertFalse(statisticsManager.isProvidedFlowNodeActive(nodeII));