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.params.xml.ns.yang.openflowplugin.app.arbitrator.reconcile.service.rev180227.ArbitratorReconcileService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
20 import org.opendaylight.yangtools.concepts.ListenerRegistration;
21 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
22 import org.opendaylight.yangtools.yang.binding.RpcService;
24 public class RpcProviderRegistryMock implements RpcProviderRegistry {
26 public <T extends RpcService> BindingAwareBroker.RpcRegistration<T> addRpcImplementation(Class<T> serviceInterface,
27 T implementation) throws IllegalStateException {
32 public <T extends RpcService> BindingAwareBroker.RoutedRpcRegistration<T> addRoutedRpcImplementation(
33 Class<T> serviceInterface, T implementation) throws IllegalStateException {
38 public <L extends RouteChangeListener<RpcContextIdentifier,
39 InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
45 public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
46 if (serviceInterface.equals(SalFlowService.class)) {
47 return (T) new SalFlowServiceMock();
48 } else if (serviceInterface.equals(SalGroupService.class)) {
49 return (T) new SalGroupServiceMock();
50 } else if (serviceInterface.equals(SalMeterService.class)) {
51 return (T) new SalMeterServiceMock();
52 } else if (serviceInterface.equals(SalTableService.class)) {
53 return (T) new SalTableServiceMock();
54 } else if (serviceInterface.equals(SalBundleService.class)) {
55 return (T) new SalBundleServiceMock();
56 } else if (serviceInterface.equals(ArbitratorReconcileService.class)) {
57 return (T) new ArbitratorReconcileServiceMock();