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
8 package org.opendaylight.controller.config.yang.netconf.mdsal.monitoring;
10 import java.util.Collections;
12 import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
13 import org.opendaylight.netconf.api.capability.Capability;
14 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
15 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
16 import org.opendaylight.netconf.mapping.api.NetconfOperation;
17 import org.opendaylight.netconf.mapping.api.NetconfOperationService;
18 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
19 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
21 public class MdsalMonitoringMapperFactory implements NetconfOperationServiceFactory, AutoCloseable {
23 private final MonitoringToMdsalWriter monitoringToMdsalWriter;
24 private final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener;
25 private final NetconfMonitoringService netconfMonitoringService;
27 private static final Set<Capability> CAPABILITIES = Collections.emptySet();
29 public MdsalMonitoringMapperFactory(
30 final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener,
31 final NetconfMonitoringService netconfMonitoringService,
32 final MonitoringToMdsalWriter monitoringToMdsalWriter) {
34 this.netconfOperationServiceFactoryListener = netconfOperationServiceFactoryListener;
35 this.netconfMonitoringService = netconfMonitoringService;
36 this.monitoringToMdsalWriter = monitoringToMdsalWriter;
37 this.netconfOperationServiceFactoryListener.onAddNetconfOperationServiceFactory(this);
41 public NetconfOperationService createService(final String netconfSessionIdForReporting) {
42 return new NetconfOperationService() {
44 public Set<NetconfOperation> getNetconfOperations() {
45 return Collections.singleton(new GetSchema(netconfSessionIdForReporting, netconfMonitoringService));
56 public Set<Capability> getCapabilities() {
57 // TODO No capabilities exposed to prevent clashes with schemas from mdsal-netconf-connector (it exposes all the
58 // schemas). If the schemas exposed by mdsal-netconf-connector are filtered, this class would expose monitoring
64 public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
65 return NoopAutoCloseable.INSTANCE;
69 * Invoked using blueprint.
73 monitoringToMdsalWriter.close();
74 netconfOperationServiceFactoryListener.onRemoveNetconfOperationServiceFactory(this);