2 * Copyright (c) 2014, 2017 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
8 package test.mock.util;
10 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
12 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
13 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
19 import org.opendaylight.yangtools.concepts.ListenerRegistration;
20 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
21 import org.opendaylight.yangtools.yang.binding.RpcService;
23 public class RpcProviderRegistryMock implements RpcProviderRegistry {
25 public <T extends RpcService> BindingAwareBroker.RpcRegistration<T> addRpcImplementation(Class<T> serviceInterface,
26 T implementation) throws IllegalStateException {
31 public <T extends RpcService> BindingAwareBroker.RoutedRpcRegistration<T> addRoutedRpcImplementation(
32 Class<T> serviceInterface, T implementation) throws IllegalStateException {
37 public <L extends RouteChangeListener<RpcContextIdentifier,
38 InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
44 public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
45 if (serviceInterface.equals(SalFlowService.class)) {
46 return (T) new SalFlowServiceMock();
47 } else if (serviceInterface.equals(SalGroupService.class)) {
48 return (T) new SalGroupServiceMock();
49 } else if (serviceInterface.equals(SalMeterService.class)) {
50 return (T) new SalMeterServiceMock();
51 } else if (serviceInterface.equals(SalTableService.class)) {
52 return (T) new SalTableServiceMock();
53 } else if (serviceInterface.equals(SalBundleService.class)) {
54 return (T) new SalBundleServiceMock();