2 * Copyright (c) 2014 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.sal.connect.netconf;
10 import org.opendaylight.controller.netconf.api.NetconfMessage;
11 import org.opendaylight.controller.netconf.client.AbstractNetconfClientNotifySessionListener;
12 import org.opendaylight.controller.netconf.client.NetconfClientSession;
13 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
14 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
16 import com.google.common.base.Preconditions;
18 class NetconfDeviceListener extends AbstractNetconfClientNotifySessionListener {
19 private final NetconfDevice device;
21 public NetconfDeviceListener(final NetconfDevice device) {
22 this.device = Preconditions.checkNotNull(device);
26 * Method intended to customize notification processing.
30 * NetconfClientSessionListener#onMessage(NetconfClientSession,
34 * NetconfClientSessionListener#onMessage(NetconfClientSession,
38 public void onNotification(final NetconfClientSession session, final NetconfMessage message) {
39 this.device.logger.debug("Received NETCONF notification.", message);
40 CompositeNode domNotification = null;
41 if (message != null) {
42 domNotification = NetconfMapping.toNotificationNode(message, device.getSchemaContext());
44 if (domNotification != null) {
45 MountProvisionInstance _mountInstance = null;
46 if (this.device != null) {
47 _mountInstance = this.device.getMountInstance();
49 if (_mountInstance != null) {
50 _mountInstance.publish(domNotification);