Remove netconf-monitoring 74/79274/6
authorJakub Morvay <jmorvay@frinx.io>
Fri, 4 Jan 2019 15:48:49 +0000 (16:48 +0100)
committerTomas Cere <tomas.cere@pantheon.tech>
Thu, 10 Jan 2019 10:11:57 +0000 (11:11 +0100)
netconf-monitoring is a forgotten remark of CSS times. It used to be
netconf monitoring implementation for CSS netconf endpoint. CSS is gone
so we do not need to support netconf monitoring for it.

Move GetSchema class to mdsal-netconf-monitoring (only used class
here) and move the parts needed by testtool into testtool monitoring
while we decide what we want to do with them.

JIRA: NETCONF-589
Change-Id: Ic734ddab4e9a94547a8547f61b173f8eed1111ea
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
31 files changed:
features/netconf/features-netconf/pom.xml
features/netconf/odl-netconf-all/pom.xml
features/netconf/odl-netconf-impl/pom.xml
features/netconf/odl-netconf-monitoring/pom.xml [deleted file]
features/netconf/pom.xml
netconf/mdsal-netconf-monitoring/pom.xml
netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/GetSchema.java [moved from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/GetSchema.java with 87% similarity]
netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MdsalMonitoringMapperFactory.java
netconf/netconf-artifacts/pom.xml
netconf/netconf-monitoring/pom.xml [deleted file]
netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/Get.java
netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivator.java [deleted file]
netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringServiceTracker.java [deleted file]
netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/package-info.java [deleted file]
netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/GetSchemaTest.java
netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/GetTest.java [deleted file]
netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivatorTest.java [deleted file]
netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringOperationServiceTest.java [deleted file]
netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringServiceTrackerTest.java [deleted file]
netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/xml/JaxBSerializerTest.java [deleted file]
netconf/pom.xml
netconf/tools/netconf-testtool/pom.xml
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/NetconfDeviceSimulator.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/Get.java [new file with mode: 0644]
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/JaxBSerializer.java [moved from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/JaxBSerializer.java with 89% similarity]
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/MonitoringConstants.java [moved from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/MonitoringConstants.java with 94% similarity]
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/MonitoringSchema.java [moved from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/MonitoringSchema.java with 96% similarity]
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/MonitoringSession.java [moved from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/MonitoringSession.java with 90% similarity]
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/NetconfMonitoringOperationService.java [moved from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringOperationService.java with 66% similarity]
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/NetconfMonitoringOperationServiceFactory.java [new file with mode: 0644]
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/NetconfState.java [moved from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/NetconfState.java with 93% similarity]

index 96c68f47b1605d477cdeddd28fd7f5e3230c932d..10608a2ddc87f8295a42636b758a40c2e48c90b8 100644 (file)
       <type>xml</type>
       <classifier>features</classifier>
     </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>odl-netconf-monitoring</artifactId>
-      <type>xml</type>
-      <classifier>features</classifier>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>odl-netconf-netty-util</artifactId>
index b62eb53c2ff1003c06c606f08555b78ba1adf232..348e60eb1b4e965b1679c1d2f5897e8fd4ae0af5 100644 (file)
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>odl-netconf-monitoring</artifactId>
-            <version>${project.version}</version>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
     </dependencies>
 </project>
index e8134228df4119361ed96f986ed8cf7026efd1ef..d8665da514179cc4ad52b67355f907e942441d45 100644 (file)
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>odl-netconf-monitoring</artifactId>
-            <version>${project.version}</version>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>odl-netconf-notifications-impl</artifactId>
diff --git a/features/netconf/odl-netconf-monitoring/pom.xml b/features/netconf/odl-netconf-monitoring/pom.xml
deleted file mode 100644 (file)
index 16d5a3d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017 Red Hat, Inc. and others.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>single-feature-parent</artifactId>
-        <version>4.0.7</version>
-        <relativePath/>
-    </parent>
-
-    <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>odl-netconf-monitoring</artifactId>
-    <version>1.6.0-SNAPSHOT</version>
-    <packaging>feature</packaging>
-
-    <name>OpenDaylight :: Netconf :: Monitoring</name>
-
-    <dependencies>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>odl-netconf-util</artifactId>
-            <version>${project.version}</version>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>netconf-monitoring</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-</project>
index aadfdf3eea2c717771f4edf2b3da75715d12410e..4c6d7c2d01bb764344b88199ab8fa472a257ce8b 100644 (file)
@@ -35,7 +35,6 @@
     <module>odl-netconf-impl</module>
     <module>odl-netconf-mapping-api</module>
     <module>odl-netconf-mdsal</module>
-    <module>odl-netconf-monitoring</module>
     <module>odl-netconf-netty-util</module>
     <module>odl-netconf-notifications-api</module>
     <module>odl-netconf-notifications-impl</module>
index 3ffe00f6166dd4a5ae314f660a5ccef17adbda8a..574a8eeb8f6bade55eef668490e69225ca49a4be 100644 (file)
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-mapping-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>netconf-monitoring</artifactId>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-util</artifactId>
similarity index 87%
rename from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/GetSchema.java
rename to netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/GetSchema.java
index 4a041d46a43c7a0fba419f6c4ed287c8cc4e9a79..6f71559ede86e2565800566c08ce29b0b7d1a5e6 100644 (file)
@@ -5,7 +5,8 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.netconf.monitoring;
+
+package org.opendaylight.controller.config.yang.netconf.mdsal.monitoring;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -21,16 +22,16 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-public class GetSchema extends AbstractSingletonNetconfOperation {
-    public static final String GET_SCHEMA = "get-schema";
-    public static final String IDENTIFIER = "identifier";
-    public static final String VERSION = "version";
+public final class GetSchema extends AbstractSingletonNetconfOperation {
+    private static final String GET_SCHEMA = "get-schema";
+    private static final String IDENTIFIER = "identifier";
+    private static final String VERSION = "version";
 
     private static final Logger LOG = LoggerFactory.getLogger(GetSchema.class);
     private final NetconfMonitoringService cap;
 
-    public GetSchema(final NetconfMonitoringService cap) {
-        super(MonitoringConstants.MODULE_NAME);
+    public GetSchema(final String netconfSessionIdForReporting, final NetconfMonitoringService cap) {
+        super(netconfSessionIdForReporting);
         this.cap = cap;
     }
 
@@ -79,7 +80,7 @@ public class GetSchema extends AbstractSingletonNetconfOperation {
             getSchemaElement.checkName(GET_SCHEMA);
             getSchemaElement.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING);
 
-            XmlElement identifierElement = null;
+            final XmlElement identifierElement;
             try {
                 identifierElement = getSchemaElement.getOnlyChildElementWithSameNamespace(IDENTIFIER);
             } catch (final DocumentedException e) {
index cb98d40892207887c2801d54d2fa6fca91e510e8..da0eaf92f518e181f8302a7760ac4656b58a9c85 100644 (file)
@@ -17,13 +17,12 @@ import org.opendaylight.netconf.mapping.api.NetconfOperation;
 import org.opendaylight.netconf.mapping.api.NetconfOperationService;
 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
-import org.opendaylight.netconf.monitoring.GetSchema;
 
 public class MdsalMonitoringMapperFactory implements NetconfOperationServiceFactory, AutoCloseable {
 
-    private final NetconfOperationService operationService;
     private final MonitoringToMdsalWriter monitoringToMdsalWriter;
     private final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener;
+    private final NetconfMonitoringService netconfMonitoringService;
 
     private static final Set<Capability> CAPABILITIES = Collections.emptySet();
 
@@ -33,12 +32,17 @@ public class MdsalMonitoringMapperFactory implements NetconfOperationServiceFact
             final MonitoringToMdsalWriter monitoringToMdsalWriter) {
 
         this.netconfOperationServiceFactoryListener = netconfOperationServiceFactoryListener;
+        this.netconfMonitoringService = netconfMonitoringService;
         this.monitoringToMdsalWriter = monitoringToMdsalWriter;
+        this.netconfOperationServiceFactoryListener.onAddNetconfOperationServiceFactory(this);
+    }
 
-        this.operationService = new NetconfOperationService() {
+    @Override
+    public NetconfOperationService createService(final String netconfSessionIdForReporting) {
+        return new NetconfOperationService() {
             @Override
             public Set<NetconfOperation> getNetconfOperations() {
-                return Collections.singleton(new GetSchema(netconfMonitoringService));
+                return Collections.singleton(new GetSchema(netconfSessionIdForReporting, netconfMonitoringService));
             }
 
             @Override
@@ -46,20 +50,13 @@ public class MdsalMonitoringMapperFactory implements NetconfOperationServiceFact
                 // NOOP
             }
         };
-
-        this.netconfOperationServiceFactoryListener.onAddNetconfOperationServiceFactory(this);
-    }
-
-    @Override
-    public NetconfOperationService createService(final String netconfSessionIdForReporting) {
-        return operationService;
     }
 
     @Override
     public Set<Capability> getCapabilities() {
-        // TODO No capabilities exposed to prevent clashes with schemas from mdsal-netconf-connector (it exposes
-        // all the schemas). If the schemas exposed by mdsal-netconf-connector are filtered, this class would expose
-        // monitoring related models.
+        // TODO No capabilities exposed to prevent clashes with schemas from mdsal-netconf-connector (it exposes all the
+        // schemas). If the schemas exposed by mdsal-netconf-connector are filtered, this class would expose monitoring
+        // related models.
         return CAPABILITIES;
     }
 
index 2e558438f505d6b9deb545a3697721afc5ebdb77..c29a53255c034bdf003ae16b400685c262588a60 100644 (file)
                 <artifactId>netconf-mapping-api</artifactId>
                 <version>${project.version}</version>
             </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>netconf-monitoring</artifactId>
-                <version>${project.version}</version>
-            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>mdsal-netconf-monitoring</artifactId>
diff --git a/netconf/netconf-monitoring/pom.xml b/netconf/netconf-monitoring/pom.xml
deleted file mode 100644 (file)
index f0330df..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>netconf-parent</artifactId>
-    <version>1.6.0-SNAPSHOT</version>
-    <relativePath>../netconf-parent</relativePath>
-  </parent>
-
-  <groupId>org.opendaylight.netconf</groupId>
-  <artifactId>netconf-monitoring</artifactId>
-  <version>1.6.0-SNAPSHOT</version>
-  <name>${project.artifactId}</name>
-  <packaging>bundle</packaging>
-
-  <dependencies>
-    <!-- compile dependencies -->
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>netconf-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>netconf-mapping-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>netconf-util</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.opendaylight.yangtools</groupId>
-      <artifactId>mockito-configuration</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
-      <artifactId>rfc6991-ietf-inet-types</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.sun.xml.bind</groupId>
-      <artifactId>jaxb-core</artifactId>
-      <!-- FIXME: remove version once odlparent declares it -->
-      <version>2.2.11</version>
-    </dependency>
-    <dependency>
-      <groupId>com.sun.xml.bind</groupId>
-      <artifactId>jaxb-impl</artifactId>
-      <!-- FIXME: remove version once odlparent declares it -->
-      <version>2.2.11</version>
-    </dependency>
-    <dependency>
-      <groupId>javax.activation</groupId>
-      <artifactId>activation</artifactId>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <configuration>
-          <instructions>
-            <Bundle-Activator>org.opendaylight.netconf.monitoring.osgi.NetconfMonitoringActivator</Bundle-Activator>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
index 6b80a135489acef199c1970405c0f6e03debbf27..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netconf.monitoring;
-
-import java.util.Collections;
-import org.opendaylight.netconf.api.DocumentedException;
-import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-import org.opendaylight.netconf.api.xml.XmlElement;
-import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.mapping.api.HandlingPriority;
-import org.opendaylight.netconf.mapping.api.NetconfOperationChainedExecution;
-import org.opendaylight.netconf.monitoring.xml.JaxBSerializer;
-import org.opendaylight.netconf.monitoring.xml.model.NetconfState;
-import org.opendaylight.netconf.util.mapping.AbstractNetconfOperation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class Get extends AbstractNetconfOperation {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Get.class);
-    private final NetconfMonitoringService netconfMonitor;
-
-    public Get(final NetconfMonitoringService netconfMonitor) {
-        super(MonitoringConstants.MODULE_NAME);
-        this.netconfMonitor = netconfMonitor;
-    }
-
-    private static Element getPlaceholder(final Document innerResult) throws DocumentedException {
-        final XmlElement rootElement = XmlElement.fromDomElementWithExpected(
-                innerResult.getDocumentElement(), XmlNetconfConstants.RPC_REPLY_KEY,
-                XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
-        return rootElement.getOnlyChildElement(XmlNetconfConstants.DATA_KEY).getDomElement();
-    }
-
-    @Override
-    protected String getOperationName() {
-        return XmlNetconfConstants.GET;
-    }
-
-    @Override
-    protected HandlingPriority getHandlingPriority() {
-        return HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.increasePriority(1);
-    }
-
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    @Override
-    public Document handle(final Document requestMessage, final NetconfOperationChainedExecution subsequentOperation)
-            throws DocumentedException {
-        if (subsequentOperation.isExecutionTermination()) {
-            throw new DocumentedException(String.format("Subsequent netconf operation expected by %s", this),
-                    DocumentedException.ErrorType.APPLICATION,
-                    DocumentedException.ErrorTag.OPERATION_FAILED,
-                    DocumentedException.ErrorSeverity.ERROR);
-        }
-
-        try {
-            final Document innerResult = subsequentOperation.execute(requestMessage);
-
-            final NetconfState netconfMonitoring = new NetconfState(netconfMonitor);
-            Element monitoringXmlElement = new JaxBSerializer().toXml(netconfMonitoring);
-
-            monitoringXmlElement = (Element) innerResult.importNode(monitoringXmlElement, true);
-            final Element monitoringXmlElementPlaceholder = getPlaceholder(innerResult);
-            monitoringXmlElementPlaceholder.appendChild(monitoringXmlElement);
-
-            return innerResult;
-        } catch (final RuntimeException e) {
-            final String errorMessage = "Get operation for netconf-state subtree failed";
-            LOG.warn(errorMessage, e);
-
-            throw new DocumentedException(errorMessage, e, DocumentedException.ErrorType.APPLICATION,
-                    DocumentedException.ErrorTag.OPERATION_FAILED,
-                    DocumentedException.ErrorSeverity.ERROR,
-                    Collections.singletonMap(DocumentedException.ErrorSeverity.ERROR.toString(), e.getMessage()));
-        }
-    }
-
-    @Override
-    protected Element handle(final Document document, final XmlElement message,
-                             final NetconfOperationChainedExecution subsequentOperation) {
-        throw new UnsupportedOperationException("Never gets called");
-    }
-}
diff --git a/netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivator.java b/netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivator.java
deleted file mode 100644 (file)
index 3db158a..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.netconf.monitoring.osgi;
-
-import java.util.Collections;
-import java.util.Set;
-import org.opendaylight.netconf.api.capability.Capability;
-import org.opendaylight.netconf.api.monitoring.CapabilityListener;
-import org.opendaylight.netconf.mapping.api.NetconfOperationService;
-import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NetconfMonitoringActivator implements BundleActivator {
-
-    private static final Logger LOG = LoggerFactory.getLogger(NetconfMonitoringActivator.class);
-
-    private NetconfMonitoringServiceTracker monitor;
-
-    @Override
-    public void start(final BundleContext context) {
-        monitor = new NetconfMonitoringServiceTracker(context);
-        monitor.open();
-    }
-
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    @Override
-    public void stop(final BundleContext context) {
-        if (monitor != null) {
-            try {
-                monitor.close();
-            } catch (final Exception e) {
-                LOG.warn("Ignoring exception while closing {}", monitor, e);
-            }
-        }
-    }
-
-    public static class NetconfMonitoringOperationServiceFactory implements NetconfOperationServiceFactory,
-            AutoCloseable {
-
-        private final NetconfMonitoringOperationService operationService;
-
-        private static final AutoCloseable AUTO_CLOSEABLE = () -> {
-            // NOOP
-        };
-
-        public NetconfMonitoringOperationServiceFactory(final NetconfMonitoringOperationService operationService) {
-            this.operationService = operationService;
-        }
-
-        @Override
-        public NetconfOperationService createService(final String netconfSessionIdForReporting) {
-            return operationService;
-        }
-
-        @Override
-        public Set<Capability> getCapabilities() {
-            return Collections.emptySet();
-        }
-
-        @Override
-        public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
-            return AUTO_CLOSEABLE;
-        }
-
-        @Override
-        public void close() {}
-    }
-}
diff --git a/netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringServiceTracker.java b/netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringServiceTracker.java
deleted file mode 100644 (file)
index 6a0a3cf..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netconf.monitoring.osgi;
-
-import com.google.common.base.Preconditions;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-import org.opendaylight.netconf.api.util.NetconfConstants;
-import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NetconfMonitoringServiceTracker extends ServiceTracker<NetconfMonitoringService,
-        NetconfMonitoringService> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(NetconfMonitoringServiceTracker.class);
-
-    private ServiceRegistration<NetconfOperationServiceFactory> reg;
-    private NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory factory;
-
-    NetconfMonitoringServiceTracker(final BundleContext context) {
-        super(context, NetconfMonitoringService.class, null);
-    }
-
-    @Override
-    public NetconfMonitoringService addingService(final ServiceReference<NetconfMonitoringService> reference) {
-        Preconditions.checkState(reg == null, "Monitoring service was already added");
-
-        final NetconfMonitoringService netconfMonitoringService = super.addingService(reference);
-
-        final NetconfMonitoringOperationService operationService = new NetconfMonitoringOperationService(
-                netconfMonitoringService);
-        factory = new NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory(
-                operationService);
-
-        Dictionary<String, String> properties = new Hashtable<>();
-        properties.put(NetconfConstants.SERVICE_NAME, NetconfConstants.NETCONF_MONITORING);
-        reg = context.registerService(NetconfOperationServiceFactory.class, factory, properties);
-
-        return netconfMonitoringService;
-    }
-
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    @Override
-    public void removedService(final ServiceReference<NetconfMonitoringService> reference,
-                               final NetconfMonitoringService netconfMonitoringService) {
-        if (reg != null) {
-            try {
-                reg.unregister();
-            } catch (final Exception e) {
-                LOG.warn("Ignoring exception while unregistering {}", reg, e);
-            }
-        }
-        if (factory != null) {
-            factory.close();
-        }
-    }
-
-}
diff --git a/netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/package-info.java b/netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/package-info.java
deleted file mode 100644 (file)
index d42c789..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-@XmlSchema(
-        elementFormDefault = XmlNsForm.QUALIFIED,
-        xmlns = {
-                @XmlNs(namespaceURI = MonitoringConstants.EXTENSION_NAMESPACE, prefix =
-                        MonitoringConstants.EXTENSION_NAMESPACE_PREFIX),
-                @XmlNs(namespaceURI = MonitoringConstants.NAMESPACE, prefix = "")
-        },
-        namespace = MonitoringConstants.NAMESPACE
-)
-package org.opendaylight.netconf.monitoring.xml.model;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlSchema;
-import org.opendaylight.netconf.monitoring.MonitoringConstants;
\ No newline at end of file
index ab1081ae8b483517e2d78cc761a18912c2b3055f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netconf.monitoring;
-
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-
-import java.util.Optional;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.netconf.api.DocumentedException;
-import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-import org.opendaylight.netconf.api.xml.XmlElement;
-import org.opendaylight.netconf.api.xml.XmlUtil;
-import org.w3c.dom.Document;
-
-public class GetSchemaTest {
-
-
-    private NetconfMonitoringService cap;
-    private Document doc;
-    private String getSchema;
-
-    @Before
-    public void setUp() throws Exception {
-        cap = mock(NetconfMonitoringService.class);
-        doc = XmlUtil.newDocument();
-        getSchema = "<get-schema xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
-                + "        <identifier>threadpool-api</identifier>\n"
-                + "        <version>2010-09-24</version>\n"
-                + "        <format\n"
-                + "                xmlns:ncm=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">ncm:yang\n"
-                + "        </format>\n"
-                + "    </get-schema>";
-    }
-
-    @Test(expected = DocumentedException.class)
-    public void testDefaultGetSchema() throws Exception {
-        GetSchema schema = new GetSchema(cap);
-        doThrow(IllegalStateException.class).when(cap).getSchemaForCapability(anyString(), any(Optional.class));
-        schema.handleWithNoSubsequentOperations(doc, XmlElement.fromDomElement(XmlUtil.readXmlToElement(getSchema)));
-    }
-
-    @Test
-    public void handleWithNoSubsequentOperations() throws Exception {
-        GetSchema schema = new GetSchema(cap);
-        doReturn("").when(cap).getSchemaForCapability(anyString(), any(Optional.class));
-        assertNotNull(schema.handleWithNoSubsequentOperations(doc,
-                XmlElement.fromDomElement(XmlUtil.readXmlToElement(getSchema))));
-    }
-
-}
diff --git a/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/GetTest.java b/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/GetTest.java
deleted file mode 100644 (file)
index f295353..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.netconf.monitoring;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-
-import java.util.Collections;
-import org.hamcrest.CoreMatchers;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.netconf.api.DocumentedException;
-import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-import org.opendaylight.netconf.api.xml.XmlUtil;
-import org.opendaylight.netconf.mapping.api.HandlingPriority;
-import org.opendaylight.netconf.mapping.api.NetconfOperationChainedExecution;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.SchemasBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.SessionsBuilder;
-import org.w3c.dom.Document;
-
-public class GetTest {
-
-    @Mock
-    private NetconfMonitoringService monitor;
-    @Mock
-    private Document request;
-    @Mock
-    private NetconfOperationChainedExecution subsequentOperation;
-    private Document incorrectSubsequentResult;
-    private Document correctSubsequentResult;
-
-    private Get get;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-
-        incorrectSubsequentResult = XmlUtil.readXmlToDocument("<rpc-reply "
-                + "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>");
-        correctSubsequentResult = XmlUtil.readXmlToDocument("<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:"
-                + "1.0\"><data></data></rpc-reply>");
-
-        doReturn(new SessionsBuilder().setSession(Collections.emptyList()).build()).when(monitor)
-                .getSessions();
-        doReturn(new SchemasBuilder().setSchema(Collections.emptyList()).build()).when(monitor).getSchemas();
-        doReturn(false).when(subsequentOperation).isExecutionTermination();
-
-        get = new Get(monitor);
-    }
-
-    @Test
-    public void testHandleNoSubsequent() throws Exception {
-        try {
-            get.handle(null, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT);
-        } catch (final DocumentedException e) {
-            assertNetconfDocumentedEx(e, DocumentedException.ErrorSeverity.ERROR,
-                    DocumentedException.ErrorTag.OPERATION_FAILED, DocumentedException.ErrorType.APPLICATION);
-            return;
-        }
-
-        fail("Get should fail without subsequent operation");
-    }
-
-    @Test
-    public void testHandleWrongPlaceholder() throws Exception {
-        doReturn(incorrectSubsequentResult).when(subsequentOperation).execute(request);
-        try {
-            get.handle(request, subsequentOperation);
-        } catch (final DocumentedException e) {
-            assertNetconfDocumentedEx(e, DocumentedException.ErrorSeverity.ERROR,
-                    DocumentedException.ErrorTag.INVALID_VALUE, DocumentedException.ErrorType.APPLICATION);
-            return;
-        }
-
-        fail("Get should fail with wrong xml");
-    }
-
-    @Test
-    public void testHandleRuntimeEx() throws Exception {
-        doThrow(RuntimeException.class).when(subsequentOperation).execute(request);
-        try {
-            get.handle(request, subsequentOperation);
-        } catch (final DocumentedException e) {
-            assertNetconfDocumentedEx(e, DocumentedException.ErrorSeverity.ERROR,
-                    DocumentedException.ErrorTag.OPERATION_FAILED, DocumentedException.ErrorType.APPLICATION);
-            assertEquals(1, e.getErrorInfo().size());
-            return;
-        }
-
-        fail("Get should fail with wrong xml");
-    }
-
-    @Test
-    public void testSuccessHandle() throws Exception {
-        doReturn(correctSubsequentResult).when(subsequentOperation).execute(request);
-        assertTrue(get.getHandlingPriority().getPriority().get()
-                > HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.getPriority().get());
-        final Document result = get.handle(request, subsequentOperation);
-        assertThat(XmlUtil.toString(result), CoreMatchers.containsString("sessions"));
-        assertThat(XmlUtil.toString(result), CoreMatchers.containsString("schemas"));
-
-    }
-
-    @Test(expected = UnsupportedOperationException.class)
-    public void testHandle() throws Exception {
-        get.handle(null, null, null);
-
-    }
-
-    private void assertNetconfDocumentedEx(final DocumentedException exception, final DocumentedException.ErrorSeverity
-            severity, final DocumentedException.ErrorTag errorTag, final DocumentedException.ErrorType type) {
-        assertEquals(severity, exception.getErrorSeverity());
-        assertEquals(errorTag, exception.getErrorTag());
-        assertEquals(type, exception.getErrorType());
-    }
-}
diff --git a/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivatorTest.java b/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringActivatorTest.java
deleted file mode 100644 (file)
index c80937b..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.netconf.monitoring.osgi;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.Arrays;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-
-public class NetconfMonitoringActivatorTest {
-
-    @Mock
-    BundleContext context;
-    @Mock
-    Filter filter;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        doReturn(filter).when(context).createFilter(anyString());
-        doNothing().when(context).addServiceListener(any(ServiceListener.class), anyString());
-        ServiceReference<?>[] refs = new ServiceReference[2];
-        doReturn(Arrays.asList(refs)).when(context).getServiceReferences(any(Class.class), anyString());
-        doReturn(refs).when(context).getServiceReferences(anyString(), any());
-        doNothing().when(context).removeServiceListener(any(ServiceListener.class));
-    }
-
-    @Test
-    public void testNetconfMonitoringActivator() throws Exception {
-        NetconfMonitoringActivator activator = new NetconfMonitoringActivator();
-        activator.start(context);
-        verify(context, times(1)).addServiceListener(any(ServiceListener.class), anyString());
-
-        activator.stop(context);
-        verify(context, times(1)).removeServiceListener(any(ServiceListener.class));
-    }
-}
diff --git a/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringOperationServiceTest.java b/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringOperationServiceTest.java
deleted file mode 100644 (file)
index aab9066..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.netconf.monitoring.osgi;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-
-import org.junit.Test;
-import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-
-public class NetconfMonitoringOperationServiceTest {
-    @Test
-    public void testGetters() throws Exception {
-        NetconfMonitoringService monitor = mock(NetconfMonitoringService.class);
-        NetconfMonitoringOperationService service = new NetconfMonitoringOperationService(monitor);
-        NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory serviceFactory =
-                new NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory(service);
-
-        assertEquals(2, service.getNetconfOperations().size());
-
-    }
-}
diff --git a/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringServiceTrackerTest.java b/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/osgi/NetconfMonitoringServiceTrackerTest.java
deleted file mode 100644 (file)
index c08d16c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.netconf.monitoring.osgi;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import java.util.Hashtable;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-
-public class NetconfMonitoringServiceTrackerTest {
-
-    @Mock
-    private ServiceReference<NetconfMonitoringService> reference;
-    @Mock
-    private BundleContext context;
-    @Mock
-    private ServiceRegistration<?> serviceRegistration;
-    @Mock
-    private Filter filter;
-    @Mock
-    private NetconfMonitoringService monitoringService;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        doReturn(serviceRegistration).when(context).registerService(any(Class.class),
-                any(NetconfOperationServiceFactory.class), any(Hashtable.class));
-        doNothing().when(serviceRegistration).unregister();
-        doReturn(filter).when(context).createFilter(anyString());
-        doReturn("").when(reference).toString();
-        doReturn(monitoringService).when(context).getService(any(ServiceReference.class));
-    }
-
-    @Test
-    public void testAddingService() throws Exception {
-        NetconfMonitoringServiceTracker tracker = new NetconfMonitoringServiceTracker(context);
-        tracker.addingService(reference);
-        verify(context, times(1)).registerService(any(Class.class), any(NetconfOperationServiceFactory.class),
-                any(Hashtable.class));
-        tracker.removedService(reference, null);
-        verify(serviceRegistration, times(1)).unregister();
-    }
-}
diff --git a/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/xml/JaxBSerializerTest.java b/netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/xml/JaxBSerializerTest.java
deleted file mode 100644 (file)
index b7b460f..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.netconf.monitoring.xml;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
-import com.google.common.collect.Lists;
-import org.hamcrest.CoreMatchers;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-import org.opendaylight.netconf.api.xml.XmlUtil;
-import org.opendaylight.netconf.monitoring.xml.model.NetconfState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.extension.rev131210.NetconfTcp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.extension.rev131210.Session1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfSsh;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.Transport;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.Yang;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.SchemasBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.SessionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.schemas.Schema;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.schemas.SchemaKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.sessions.Session;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.ZeroBasedCounter32;
-
-public class JaxBSerializerTest {
-
-    private static final String IPV4 = "192.168.1.1";
-    private static final String IPV6 = "FE80:0000:0000:0000:0202:B3FF:FE1E:8329";
-    private static final String SESSION_XML = "<session>"
-            + "<session-id>1</session-id>"
-            + "<in-bad-rpcs>0</in-bad-rpcs>"
-            + "<in-rpcs>0</in-rpcs>"
-            + "<login-time>2010-10-10T12:32:32Z</login-time>"
-            + "<out-notifications>0</out-notifications>"
-            + "<out-rpc-errors>0</out-rpc-errors>"
-            + "<ncme:session-identifier>client</ncme:session-identifier>"
-            + "<source-host>%s</source-host>"
-            + "<transport>ncme:netconf-tcp</transport>"
-            + "<username>username</username>"
-            + "</session>";
-
-    @Mock
-    private NetconfMonitoringService monitoringService;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        doReturn(new SessionsBuilder().setSession(Lists.newArrayList(
-                getMockIPv4Session(NetconfTcp.class),
-                getMockIPv4Session(NetconfSsh.class),
-                getMockIPv6Session(NetconfTcp.class),
-                getMockIPv6Session(NetconfSsh.class)
-        )).build())
-                .when(monitoringService).getSessions();
-        doReturn(new SchemasBuilder().setSchema(Lists.newArrayList(getMockSchema("id", "v1", Yang.class),
-                getMockSchema("id2", "", Yang.class))).build()).when(monitoringService).getSchemas();
-    }
-
-    @Test
-    public void testSerialization() throws Exception {
-
-        final NetconfState model = new NetconfState(monitoringService);
-        final String xml = XmlUtil.toString(new JaxBSerializer().toXml(model)).replaceAll("\\s", "");
-        assertThat(xml, CoreMatchers.containsString(
-                "<schema>"
-                        + "<format>yang</format>"
-                        + "<identifier>id</identifier>"
-                        + "<location>NETCONF</location>"
-                        + "<namespace>localhost</namespace>"
-                        + "<version>v1</version>"
-                        + "</schema>"));
-
-        assertThat(xml, CoreMatchers.containsString(
-                String.format(SESSION_XML, IPV4)));
-        assertThat(xml, CoreMatchers.containsString(
-                String.format(SESSION_XML, IPV6)));
-    }
-
-    private static Schema getMockSchema(final String id, final String version, final Class<Yang> format) {
-        final Schema mock = mock(Schema.class);
-
-        doReturn(format).when(mock).getFormat();
-        doReturn(id).when(mock).getIdentifier();
-        doReturn(new Uri("localhost")).when(mock).getNamespace();
-        doReturn(version).when(mock).getVersion();
-        doReturn(Lists.newArrayList(new Schema.Location(Schema.Location.Enumeration.NETCONF))).when(mock).getLocation();
-        doReturn(new SchemaKey(format, id, version)).when(mock).key();
-        return mock;
-    }
-
-    private static Session getMockIPv4Session(final Class<? extends Transport> transportType) {
-        final Session mocked = getMockSession(transportType);
-        doReturn(new Host(new IpAddress(new Ipv4Address(IPV4)))).when(mocked).getSourceHost();
-        return mocked;
-    }
-
-    private static Session getMockIPv6Session(final Class<? extends Transport> transportType) {
-        final Session mocked = getMockSession(transportType);
-        doReturn(new Host(new IpAddress(new Ipv6Address(IPV6)))).when(mocked).getSourceHost();
-        return mocked;
-    }
-
-    private static Session getMockSession(final Class<? extends Transport> transportType) {
-        final Session mocked = mock(Session.class);
-        final Session1 mockedSession1 = mock(Session1.class);
-        doReturn("client").when(mockedSession1).getSessionIdentifier();
-        doReturn(1L).when(mocked).getSessionId();
-        doReturn(new DateAndTime("2010-10-10T12:32:32Z")).when(mocked).getLoginTime();
-        doReturn(new ZeroBasedCounter32(0L)).when(mocked).getInBadRpcs();
-        doReturn(new ZeroBasedCounter32(0L)).when(mocked).getInRpcs();
-        doReturn(new ZeroBasedCounter32(0L)).when(mocked).getOutNotifications();
-        doReturn(new ZeroBasedCounter32(0L)).when(mocked).getOutRpcErrors();
-        doReturn(transportType).when(mocked).getTransport();
-        doReturn("username").when(mocked).getUsername();
-        doReturn(mockedSession1).when(mocked).augmentation(Session1.class);
-        return mocked;
-    }
-}
index 0e6ad935b040a13ef3d8a03d6f33470dc43ae055..322dbd3fe2d2c2f097a8056a63e72ba2d1a38f35 100644 (file)
@@ -46,7 +46,6 @@
     <module>netconf-client</module>
     <module>netconf-ssh</module>
     <module>netconf-tcp</module>
-    <module>netconf-monitoring</module>
     <module>netconf-auth</module>
     <module>aaa-authn-odl-plugin</module>
     <module>netconf-notifications-impl</module>
index 7872771f3e70bafe431be706e259e6eb2e0b86e9..beaed7d7dd818a0526629796442d3c3f7235988c 100644 (file)
             <artifactId>netconf-mapping-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>netconf-monitoring</artifactId>
+            <groupId>org.opendaylight.netconf</groupId>
+            <artifactId>mdsal-netconf-monitoring</artifactId>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
index 5409e242d17c1cd6b168112b48989588dd237219..893582f4332b31672e20cee503187aed0f167559 100644 (file)
@@ -49,13 +49,13 @@ import org.opendaylight.netconf.impl.NetconfServerSessionNegotiatorFactory;
 import org.opendaylight.netconf.impl.SessionIdProvider;
 import org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory;
 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
-import org.opendaylight.netconf.monitoring.osgi.NetconfMonitoringActivator;
-import org.opendaylight.netconf.monitoring.osgi.NetconfMonitoringOperationService;
 import org.opendaylight.netconf.ssh.SshProxyServer;
 import org.opendaylight.netconf.ssh.SshProxyServerConfiguration;
 import org.opendaylight.netconf.ssh.SshProxyServerConfigurationBuilder;
 import org.opendaylight.netconf.test.tool.config.Configuration;
 import org.opendaylight.netconf.test.tool.customrpc.SettableOperationProvider;
+import org.opendaylight.netconf.test.tool.monitoring.NetconfMonitoringOperationService;
+import org.opendaylight.netconf.test.tool.monitoring.NetconfMonitoringOperationServiceFactory;
 import org.opendaylight.netconf.test.tool.operations.DefaultOperationsCreator;
 import org.opendaylight.netconf.test.tool.operations.OperationsProvider;
 import org.opendaylight.netconf.test.tool.rpchandler.SettableOperationRpcProvider;
@@ -158,8 +158,8 @@ public class NetconfDeviceSimulator implements Closeable {
         }
 
 
-        final NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory monitoringService =
-                new NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory(
+        final NetconfMonitoringOperationServiceFactory monitoringService =
+                new NetconfMonitoringOperationServiceFactory(
                         new NetconfMonitoringOperationService(monitoringService1));
         aggregatedNetconfOperationServiceFactory.onAddNetconfOperationServiceFactory(operationProvider);
         aggregatedNetconfOperationServiceFactory.onAddNetconfOperationServiceFactory(monitoringService);
@@ -195,7 +195,7 @@ public class NetconfDeviceSimulator implements Closeable {
         final AsynchronousChannelGroup group;
         try {
             group = AsynchronousChannelGroup.withThreadPool(nioExecutor);
-        } catch (IOException e) {
+        } catch (final IOException e) {
             throw new IllegalStateException("Failed to create group", e);
         }
 
@@ -330,7 +330,7 @@ public class NetconfDeviceSimulator implements Closeable {
         }
 
         configuration.getDefaultYangResources().forEach(r -> {
-            SourceIdentifier sourceIdentifier = RevisionSourceIdentifier.create(r.getModuleName(),
+            final SourceIdentifier sourceIdentifier = RevisionSourceIdentifier.create(r.getModuleName(),
                 Revision.ofNullable(r.getRevision()));
             registerSource(consumer, r.getResourcePath(), sourceIdentifier);
         });
@@ -363,7 +363,7 @@ public class NetconfDeviceSimulator implements Closeable {
                 consumer.getSchemaSource(moduleSourceIdentifier, YangTextSchemaSource.class).get().read());
             capabilities.add(new YangModuleCapability(module, moduleContent));
             //IOException would be thrown in creating SchemaContext already
-        } catch (ExecutionException | InterruptedException | IOException e) {
+        } catch (final ExecutionException | InterruptedException | IOException e) {
             throw new RuntimeException("Cannot retrieve schema source for module "
                 + moduleSourceIdentifier.toString() + " from schema repository", e);
         }
@@ -398,7 +398,7 @@ public class NetconfDeviceSimulator implements Closeable {
         for (final SshProxyServer sshWrapper : sshWrappers) {
             try {
                 sshWrapper.close();
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 LOG.debug("Wrapper {} failed to close", sshWrapper, e);
             }
         }
diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/Get.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/Get.java
new file mode 100644 (file)
index 0000000..b8605d4
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netconf.test.tool.monitoring;
+
+import java.util.Collections;
+import org.opendaylight.netconf.api.DocumentedException;
+import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
+import org.opendaylight.netconf.api.xml.XmlElement;
+import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
+import org.opendaylight.netconf.mapping.api.HandlingPriority;
+import org.opendaylight.netconf.mapping.api.NetconfOperationChainedExecution;
+import org.opendaylight.netconf.util.mapping.AbstractNetconfOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class Get extends AbstractNetconfOperation {
+
+    private static final Logger LOG = LoggerFactory.getLogger(Get.class);
+    private final NetconfMonitoringService netconfMonitor;
+
+    public Get(final NetconfMonitoringService netconfMonitor) {
+        super(MonitoringConstants.MODULE_NAME);
+        this.netconfMonitor = netconfMonitor;
+    }
+
+    private Element getPlaceholder(final Document innerResult)
+            throws DocumentedException {
+        final XmlElement rootElement = XmlElement.fromDomElementWithExpected(
+                innerResult.getDocumentElement(), XmlNetconfConstants.RPC_REPLY_KEY,
+                XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
+        return rootElement.getOnlyChildElement(XmlNetconfConstants.DATA_KEY).getDomElement();
+    }
+
+    @Override
+    protected String getOperationName() {
+        return XmlNetconfConstants.GET;
+    }
+
+    @Override
+    protected HandlingPriority getHandlingPriority() {
+        return HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.increasePriority(1);
+    }
+
+    @SuppressWarnings("checkstyle:IllegalCatch")
+    @Override
+    public Document handle(final Document requestMessage, final NetconfOperationChainedExecution subsequentOperation)
+            throws DocumentedException {
+        if (subsequentOperation.isExecutionTermination()) {
+            throw new DocumentedException(String.format("Subsequent netconf operation expected by %s", this),
+                    DocumentedException.ErrorType.APPLICATION,
+                    DocumentedException.ErrorTag.OPERATION_FAILED,
+                    DocumentedException.ErrorSeverity.ERROR);
+        }
+
+        try {
+            final Document innerResult = subsequentOperation.execute(requestMessage);
+
+            final NetconfState netconfMonitoring = new NetconfState(netconfMonitor);
+            Element monitoringXmlElement = new JaxBSerializer().toXml(netconfMonitoring);
+
+            monitoringXmlElement = (Element) innerResult.importNode(monitoringXmlElement, true);
+            final Element monitoringXmlElementPlaceholder = getPlaceholder(innerResult);
+            monitoringXmlElementPlaceholder.appendChild(monitoringXmlElement);
+
+            return innerResult;
+        } catch (final RuntimeException e) {
+            final String errorMessage = "Get operation for netconf-state subtree failed";
+            LOG.warn(errorMessage, e);
+
+            throw new DocumentedException(errorMessage, e, DocumentedException.ErrorType.APPLICATION,
+                    DocumentedException.ErrorTag.OPERATION_FAILED,
+                    DocumentedException.ErrorSeverity.ERROR,
+                    Collections.singletonMap(DocumentedException.ErrorSeverity.ERROR.toString(), e.getMessage()));
+        }
+    }
+
+    @Override
+    protected Element handle(final Document document, final XmlElement message,
+                             final NetconfOperationChainedExecution subsequentOperation) {
+        throw new UnsupportedOperationException("Never gets called");
+    }
+}
similarity index 89%
rename from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/JaxBSerializer.java
rename to netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/JaxBSerializer.java
index 09deb7524d875cfaf5af69c1817a51de1f661240..736633b6b54d1e436c91b095f53a6ab99d58934d 100644 (file)
@@ -5,13 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.netconf.monitoring.xml;
+package org.opendaylight.netconf.test.tool.monitoring;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
 import javax.xml.transform.dom.DOMResult;
-import org.opendaylight.netconf.monitoring.xml.model.NetconfState;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -21,7 +20,7 @@ public class JaxBSerializer {
     static {
         try {
             JAXB_CONTEXT = JAXBContext.newInstance(NetconfState.class);
-        } catch (JAXBException e) {
+        } catch (final JAXBException e) {
             throw new ExceptionInInitializerError(e);
         }
     }
similarity index 94%
rename from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/MonitoringConstants.java
rename to netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/MonitoringConstants.java
index a6ae284ea1f745d5de3647d92ee055c8d52a117c..ba5a48a4a43e26e77ae6ad1a89382dc098c1f0ac 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.netconf.monitoring;
+package org.opendaylight.netconf.test.tool.monitoring;
 
 public final class MonitoringConstants {
 
@@ -24,4 +24,4 @@ public final class MonitoringConstants {
     public static final String URI = String.format("%s?module=%s&revision=%s", NAMESPACE, MODULE_NAME, MODULE_REVISION);
 
     public static final String NETCONF_MONITORING_XML_ROOT_ELEMENT = "netconf-state";
-}
+}
\ No newline at end of file
similarity index 96%
rename from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/MonitoringSchema.java
rename to netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/MonitoringSchema.java
index 37788249450e980f660f9d2b5df80b1f55f648cf..32ef6ae3c98f9f143a434956fa5c8558419a38be 100644 (file)
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.netconf.monitoring.xml.model;
+package org.opendaylight.netconf.test.tool.monitoring;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Collections2;
@@ -49,4 +49,4 @@ final class MonitoringSchema {
                 schema.getFormat());
         return "yang";
     }
-}
+}
\ No newline at end of file
similarity index 90%
rename from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/MonitoringSession.java
rename to netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/MonitoringSession.java
index 267950444ba04891b134564a8b4b5531ddd01c39..c10784c3ba94b35ae9115d720f1b725039abc2b1 100644 (file)
@@ -5,12 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.netconf.monitoring.xml.model;
+package org.opendaylight.netconf.test.tool.monitoring;
 
 import com.google.common.base.Joiner;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlTransient;
-import org.opendaylight.netconf.monitoring.MonitoringConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.extension.rev131210.Session1;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.sessions.Session;
@@ -75,7 +74,7 @@ final class MonitoringSession {
     @XmlElement(name = "transport")
     public String getTransport() {
         try {
-            QName qualifiedName = (QName) managementSession.getTransport().getField("QNAME").get(null);
+            final QName qualifiedName = (QName) managementSession.getTransport().getField("QNAME").get(null);
             // Add extension prefix if transport type is from extension yang module
             if (qualifiedName.getNamespace().toString().equals(MonitoringConstants.EXTENSION_NAMESPACE)) {
                 return Joiner.on(':').join(MonitoringConstants.EXTENSION_NAMESPACE_PREFIX,
@@ -83,7 +82,7 @@ final class MonitoringSession {
             } else {
                 return qualifiedName.getLocalName();
             }
-        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
+        } catch (final NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
             throw new IllegalArgumentException("Unknown transport type " + managementSession.getTransport(), e);
         }
     }
@@ -97,4 +96,4 @@ final class MonitoringSession {
     public String getUsername() {
         return managementSession.getUsername();
     }
-}
+}
\ No newline at end of file
@@ -5,27 +5,29 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.netconf.monitoring.osgi;
 
-import com.google.common.collect.ImmutableSet;
+package org.opendaylight.netconf.test.tool.monitoring;
+
+import com.google.common.collect.Sets;
 import java.util.Set;
+import org.opendaylight.controller.config.yang.netconf.mdsal.monitoring.GetSchema;
 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
 import org.opendaylight.netconf.mapping.api.NetconfOperation;
 import org.opendaylight.netconf.mapping.api.NetconfOperationService;
-import org.opendaylight.netconf.monitoring.Get;
-import org.opendaylight.netconf.monitoring.GetSchema;
 
 public class NetconfMonitoringOperationService implements NetconfOperationService {
 
-    private final ImmutableSet<NetconfOperation> netconfOperations;
+    private static final String TESTTOOL_SESSION = "testtool-session";
+
+    private final NetconfMonitoringService monitor;
 
     public NetconfMonitoringOperationService(final NetconfMonitoringService monitor) {
-        netconfOperations = ImmutableSet.of(new Get(monitor), new GetSchema(monitor));
+        this.monitor = monitor;
     }
 
     @Override
     public Set<NetconfOperation> getNetconfOperations() {
-        return netconfOperations;
+        return Sets.newHashSet(new Get(monitor), new GetSchema(TESTTOOL_SESSION, monitor));
     }
 
     @Override
diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/NetconfMonitoringOperationServiceFactory.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/NetconfMonitoringOperationServiceFactory.java
new file mode 100644 (file)
index 0000000..51820f4
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.netconf.test.tool.monitoring;
+
+import java.util.Collections;
+import java.util.Set;
+import org.opendaylight.netconf.api.capability.Capability;
+import org.opendaylight.netconf.api.monitoring.CapabilityListener;
+import org.opendaylight.netconf.mapping.api.NetconfOperationService;
+import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
+
+public class NetconfMonitoringOperationServiceFactory implements NetconfOperationServiceFactory,
+        AutoCloseable {
+
+    private final NetconfMonitoringOperationService operationService;
+
+    private static final AutoCloseable AUTO_CLOSEABLE = () -> {
+        // NOOP
+    };
+
+    public NetconfMonitoringOperationServiceFactory(final NetconfMonitoringOperationService operationService) {
+        this.operationService = operationService;
+    }
+
+    @Override
+    public NetconfOperationService createService(final String netconfSessionIdForReporting) {
+        return operationService;
+    }
+
+    @Override
+    public Set<Capability> getCapabilities() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
+        return AUTO_CLOSEABLE;
+    }
+
+    @Override
+    public void close() {
+    }
+}
+
similarity index 93%
rename from netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/NetconfState.java
rename to netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/monitoring/NetconfState.java
index 39eba4a84a79b3e309a2099af2c2e6e704387396..6825f8dca47bb717b7394d38276486d6d9867c5d 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.netconf.monitoring.xml.model;
+package org.opendaylight.netconf.test.tool.monitoring;
 
 import com.google.common.collect.Collections2;
 import java.util.Collection;
@@ -13,7 +13,6 @@ import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
-import org.opendaylight.netconf.monitoring.MonitoringConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Schemas;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Sessions;