2 * Copyright (c) 2015 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
9 package org.opendaylight.openflowplugin.impl.statistics.services;
11 import org.junit.Test;
12 import org.mockito.Mock;
13 import org.mockito.Mockito;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
28 * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods
30 public class OpendaylightFlowStatisticsServiceImpl3Test extends AbstractStatsServiceTest {
33 private OpendaylightFlowStatisticsService flowStatisticsDelegate;
35 private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
38 final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
39 flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
40 flowStatisticsService.setDelegate(flowStatisticsDelegate);
44 public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
45 GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
46 .setNode(createNodeRef("unitProt:123"))
47 .setTableId(new TableId((short) 1))
50 flowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input);
51 Mockito.verify(flowStatisticsDelegate).getAggregateFlowStatisticsFromFlowTableForAllFlows(input);
55 public void testGetAllFlowStatisticsFromFlowTable() throws Exception {
56 GetAllFlowStatisticsFromFlowTableInput input = new GetAllFlowStatisticsFromFlowTableInputBuilder()
57 .setNode(createNodeRef("unitProt:123"))
58 .setTableId(new TableId((short) 1))
61 flowStatisticsService.getAllFlowStatisticsFromFlowTable(input);
62 Mockito.verify(flowStatisticsDelegate).getAllFlowStatisticsFromFlowTable(input);
66 public void testGetAllFlowsStatisticsFromAllFlowTables() throws Exception {
67 GetAllFlowsStatisticsFromAllFlowTablesInput input = new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
68 .setNode(createNodeRef("unitProt:123"))
71 flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input);
72 Mockito.verify(flowStatisticsDelegate).getAllFlowsStatisticsFromAllFlowTables(input);
76 public void testGetFlowStatisticsFromFlowTable() throws Exception {
77 GetFlowStatisticsFromFlowTableInput input = new GetFlowStatisticsFromFlowTableInputBuilder()
78 .setNode(createNodeRef("unitProt:123"))
82 flowStatisticsService.getFlowStatisticsFromFlowTable(input);
83 Mockito.verify(flowStatisticsDelegate).getFlowStatisticsFromFlowTable(input);