2 * Copyright (c) 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
9 package org.opendaylight.netconf.test.tool.customrpc;
12 import java.util.Collections;
14 import org.opendaylight.controller.config.util.capability.Capability;
15 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
16 import org.opendaylight.netconf.mapping.api.NetconfOperation;
17 import org.opendaylight.netconf.mapping.api.NetconfOperationService;
18 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
20 public class SettableOperationProvider implements NetconfOperationServiceFactory {
22 private final File rpcConfig;
24 public SettableOperationProvider(final File rpcConfig) {
25 this.rpcConfig = rpcConfig;
29 public Set<Capability> getCapabilities() {
30 return Collections.emptySet();
34 public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
41 public NetconfOperationService createService(final String netconfSessionIdForReporting) {
42 return new SettableOperationService(rpcConfig);
45 private static class SettableOperationService implements NetconfOperationService {
47 private final SettableRpc rpc;
49 private SettableOperationService(final File rpcConfig) {
50 this.rpc = new SettableRpc(rpcConfig);
54 public Set<NetconfOperation> getNetconfOperations() {
55 return Collections.singleton(rpc);